Search This Blog

Wednesday, August 26, 2020

Why do people hate “using namespace std;” even though it makes your code cleaner? You can even still specify “std: :” when using something from the standard library, so what’s the issue?

Why do people hate "using namespace std;" even though it makes your code cleaner? You can even still specify "std: :" when using something from the standard library, so what's the issue?
The whole idea behind namespaces is to avoid name collisions, and keep related names separate.

As soon as you start pulling in an entire namespace with a using directive, you are defeating the purpose of namespaces. Doing so puts absolutely everything defined in that namespace into the global namespace.

While this is not a big deal in the trivial examples you find in books, courses, and online, in real-world code it can and does lead to serious name conflict problems. This is why it's important to understand what the implications are and to avoid getting into the habit of pulling an entire namespace into the global namespace.

Consider a C++ project that makes use of two third-party commercial C++ libraries. Each library was created independently, and the source code is out of our control. Only the header files and binaries available. Each library defines everything in it's own uniquely-named namespace. This is as it should be. Now, there are some classes and other entities that have the same names in the two libraries. If they were all defined in the global namespace, and not in their own respective namespaces, we would have no way of overcoming the resulting name conflicts. But because the two libraries use separate namespaces, we can use both libraries without running into name conflicts.

But, if we were to pull both namespaces into the global namespace with a using directive, we would run into name conflicts. Doing so effectively "turns off" the namespace feature and its benefits for all namespaces pulled into the global namespace.

Of course, doing so also means that your own source code can't use any of the names already defined in these namespaces, which means it's easy to define something that conflicts with something in those namespaces. But you have control of your own source code, and could choose different names to avoid the conflict. However, choosing different names to avoid conflicts can lead to names that are inconsistent and not the best names for entities in your own code…which can reduce the readability, maintainability, and usability of your code.

If you're not careful, and depending on the settings of your tools, you can even end up trying to do one thing, and actually doing another. This can lead to confusing compile-time errors and unexpected runtime behaviors. Both make the development process less productive and the resulting software potentially less reliable.

Finally, cluttering up the global namespace with hundreds or thousands of names can lead to compilation inefficiency. This might not be an issue for small, trivial projects, it but it can be very significant in large, real-world projects.

Bottom line: A using directive that pulls an entire namespace into the global namespace does not make your code "cleaner." In real-world projects, it can quickly lead to name conflicts, awkward naming of entities in your own code, less readable/maintainable/usable code, less productive development, less reliable behavior, and inefficient compilation.

The best approach is to pull in only those names you actually need, via a using directive, or to fully-qualify the names where they're used in the code.

Perhaps "hate" is not the right sentiment here. "Strongly discouraged" and typically "forbidden" in real-world production code are probably more in line with reality. Virtually every C++ coding standard used by my clients, employers, and colleagues, disallows the using directive for pulling in an entire namespace in production code.

Why doesn't Linux have a C drive? Does it have any benefits?

Why doesn't Linux have a C drive? Does it have any benefits?

Because it is a very old and silly way to access disks and filesystems.

Starting with Unix v1, it was realized that the only reason a reference to a physical device exists is to be able to do things with it. Thus some way for the computer to access the driver for the device is needed. Since there are multiple devices attached a generic way got used.

The older history, this was done by using a letter or combination of letters - where the combination provided the class of device: thus CON (console) TTY0,TTY1,TTY2… *(terminals), and for disks: DSKA, DSKB,DSKC….

Thus CON would look in a table for console devices (which might be redirected to a terminal), and TTY was the table for terminals, DSK was the table for disk drives.

Starting with Unix v1, it was realized that the only reason a reference to a physical device exists is to be able to do things with it. Thus some way for the computer to access the driver for the device is needed. Since there are multiple devices attached a generic way got used. Since the people writing the file system were also the ones writing the device drivers, they realized that there was no need to have two parsing operations - one for disk files, and one for device names. So instead they created "device files", something the filesystem could handle during lookup, but instead of passing the result to start reading data… it instead recognized that these were special, and thus passed them to the single table containing devices.

Now that table contained multiple entries - one for each different type of device (terminals, disks, and other things), the file metadata (specifically the bits used for file size) got broken up into two fields, one for the type of device (the major number), and one for the specific attached device (the minor number).

So instead of using the simplified "A", "B", "C" names from the 60s, Unix used a file name. And that allowed the devices to be identified in any way the administrator would want. Hence Linux, which inherited this, and has things like /dev (the collection of device names), and /dev/sda0.

Now it CAN be named anything as the name is just a convention to identify the device. In general "sd" is short for "scsi disk", and the "a" follows the older lettering style for device units, and the number following is generally used to identify the partition.

Not all devices follow that though - there are occasions when you see /dev/cdrom, or /dev/dvd0, /dev/dvd1… These are still disks - and frequently can be found with names like /dev/sr0… these are also scsi disks (simply because the conventional starting letter is "s"), but the "r" letter indicates "raw device" (which is also a convention). It is the indexing values attached to the name that are important. When the name happens to be a symbolic link, the link is followed by the file system to get to the targeted name - and THEN the special characteristics are recognized.

One of the special characteristics is that a device can generally only be used by one process at a time. So when the device is open, it is marked "busy" (or "in use"). This contributes to the ability for a filesystem to be mounted from a device.

When this is done, the mount command will examine the header of the disk, identify the filesystem to be used (looked up in another table), and the mount point (a directory), has its in-memory representation modified so that the directory gets connected to the root directory of the filesystem on the targeted device. The device is marked busy because now the file system code takes over the use of the device.

Now names of files can go through the mountpoint (the directory used when the file system is mounted), and continue processing files normally - and handing off the processing to whatever filesystem was designated for the partition.

All transparent to the user, and just making it look like the system has a REALLY big storage capacity for files.

All of this was figured out and implemented from the early 1970s.

Microsoft developers just never picked up the better organization, and remained with the methods used in the early 1960s. Then claimed "backward compatibility" just because they didn't want to do anything about the outdated use, and continues doing it to this day.

How does a company that sells a powerful software package like MS Office survive when others offer a free equivalent package? Firstly, the biggest cost is never the licence cost.


How does a company that sells a powerful software package like MS Office survive when others offer a free equivalent package?
Firstly, the biggest cost is never the licence cost.

I tried to introduce OpenOffice about 5–10 years ago to a company where I was CTO.

The economics worked out roughly as follows:

MS Office licence - £80
MS Office to OpenOffice training course - £400
Pretty much all our staff were already very, very experienced in Excel.

Secondly, for anything complex, there are not free equivalents

If you want to knock up a quick letter, sure…

… if you want a basic spreadsheet to add 100 numbers, sure…

… if you want to calculate the FVSCHEDULE, then that's a very, very, recent addition to things that aren't called Excel.

Why doesn't Mac OS have a registry?

Why doesn't Mac OS have a registry?
Because the inclusion of a monolithic "registry" might possibly be one of the worst engineering decisions of the twentieth century (hyperbole, but true).

Children who read nursery rhymes are well aware of the risks of putting all your eggs in one basket. The engineers who came up with the global registry were not.

Mac OS uses small preference-list files which are stored in containers unique to the application which requires them. This sensibly prevents damage and bad code from influencing other applications.

Monday, August 24, 2020

Powershell cmdlet

New PowerShell cmdlet functions can be written in any text editor or word processing tool. However, the latest versions of the Windows operating system include a tool called the PowerShell ISE (Integrated Scripting Environment) to make scripting even easier and more robust.



What is PowerShell Language?

PowerShell language is a high-level proprietary programming syntax developed by Microsoft for the key purpose of enabling system administrators to automate actions and configurations. The language is based on object-oriented standards but can only be used in Windows environments. It is part of the .NET framework and typically has C# code underlying its functions, although knowledge of C# is not a prerequisite for learning PowerShell. The closest comparison to the PowerShell language is Perl, which is used in similar scenarios on Linux environments.

With the PowerShell language, each unique function is referred to as a cmdlet. A cmdlet has one or more sets of defined actions and is capable of returning a .NET object. Some of the most basic cmdlets that come pre-configured with PowerShell are ones for navigating through a folder structure and moving or copying files.

What is the PowerShell ISE?

New PowerShell cmdlet functions can be written in any text editor or word processing tool. However, the latest versions of the Windows operating system include a tool called the PowerShell ISE (Integrated Scripting Environment) to make scripting even easier and more robust.

When you open the PowerShell ISE for the first time, it may look like a familiar command prompt window. However, the tool contains much more functionality and support for writing code. The PowerShell ISE contains a full list of all the common modules and cmdlets that system administrators may need to use. When you are ready to start writing your own cmdlet functions, the debugging tool within the PowerShell ISE will allow you to test your code, identify bugs or issues, and then work to fix them. Like other coding environments, the PowerShell ISE is highly customizable. Users can choose the color scheme, font, and theme they want to use while writing scripts. New scripts created in the ISE will be given the .psi file extension which can only be run in PowerShell environments.

The scripting language in PowerShell will be familiar if you've used the Windows Command Prompt. Objects and data piping work in a similar way, for instance, as does ping:

PowerShell scripting for beginners ping screenshot

However, the syntax used in PowerShell is, in most instances, much simpler and easier to read than the commands used in Command Prompt.

Windows PowerShell Uses and Features

PowerShell scripting for beginners image of what PowerShell can do

Though Windows PowerShell can be used for a wide range of different applications, for a beginner, the primary utility of PowerShell scripts will be in regard to systems automation related to:

  • Working with batches of files, whether this be to automate backups or to control access to large numbers of files at once.
  • PowerShell scripts are also very useful when adding and removing new users. With a carefully designed script, you can automate the process of adding network drives, updating security software, and granting a new user access to shared files.
  • In order to perform these tasks, you'll make use of several key features of PowerShell, such as cmdlets and aliases (which I will cover below).

Launching PowerShell

In Windows 10, the search field is one of the fastest ways to launch PowerShell. From the taskbar, in the search text field, type powershell. Then, click or tap the 'Windows PowerShell' result.

To run PowerShell as administrator, right-click (touchscreen users: tap and hold) on the Windows PowerShell search result, then click or tap 'Run as administrator'.

There are also many other ways to start a PowerShell console, but this is a good method to begin with.

Basic Features of PowerShell

If you are new to PowerShell, take a look at our PowerShell Tutorial before reading this guide to PowerShell scripting. In that guide, you'll find descriptions of all the basic tools you'll need to work with PowerShell. This includes cmdlets, aliases, help commands, and pipes.

Once you've mastered the basic commands, you can begin to write scripts. As your skills develop, you might also like to take a look at our guides on Input Options for PowerShell, and also read through the resources at the bottom of this article.

PowerShell scripting for beginners basics image including cmdlts, aliases, help commands, pipes and scripts

Before Running PowerShell Scripts

PowerShell scripts, like those we are going to create in this tutorial, are saved as .ps1 files. By default, Windows will not allow you to run these scripts by just double-clicking the file. This is because malicious (or poorly written) scripts can cause a lot of accidental damage to your system. 

Instead, to run a PowerShell script, right-click the .ps1 file, and then click 'Run with PowerShell'. 

If this is your first time working with PowerShell scripts, this might not work. That's because there is a system-wide policy that prevents execution. Run this command in PowerShell:

Get-ExecutionPolicy

You will see one of the following outputs:

  • Restricted— No scripts will be executed. This is the default setting in Windows, so you'll need to change it. 
  • AllSigned— You can only run scripts signed by a trusted developer. You will be prompted before running any script.
  • RemoteSigned— You can run your own scripts or scripts signed by a trusted developer. 
  • Unrestricted— You can run any script you want. This option should not be used, for obvious reasons.

To start working with PowerShell scripts, you'll need to change this policy setting. You should change it to 'RemoteSigned', and you can do that right from PowerShell by running the following command:

Set-ExecutionPolicy RemoteSigned

Now you are ready to get started.

How to Find PowerShell Commands

People love PowerShell because it's so, well, powerful. But that power comes from an absolutely insane amount of complexity. It's just not feasible or practical for someone to memorize all of the different commands, cmdlets, flags, filters and other ways of telling PowerShell what to do.

Thankfully, built right into the editor are multiple tools to help you deal with this fact.

Tab Completion

There's no need to memorize all of the different commands or exact spelling of a command. Type get-c into the editor and hit the TAB key – you'll cycle through all the commands beginning with what you had input so far. This works at any section of the command you're trying to invoke, the name (as shown below), but also flags and paths that you're manipulating to get your desired outcome.

PowerShell scripting for beginners get-command GIF

Get-Command

While tab completion works well, what happens if you don't know the name of the command you're looking for? In that case, you'd use a command for finding other commands

Get-Command 

In searching for commands, it's important to keep in mind that there's a syntax to them: VERB-NOUN. Typically the verbs are things like Get, Set, Add, Clear, Write and Read and the Nouns are the files, servers, or other items within your network and applications.

Get-Command is a discovery tool for exploring the commands available on your system.

PowerShell scripting for beginners get-command screenshot

PowerShell's Command Syntax

Someone once described the Perl scripting language as looking like "executable line noise" – an incredibly useful tool with a wildly opaque syntax and a correspondingly high learning curve. 

While not quite to that level, the traditional command prompt in Windows isn't too far off. Consider a common task like finding all the items in a directory whose names start with the string 'Foo'.

CMD: FOR /D /r %G in ("Foo*") DO @Echo %G

  • FOR and DO indicate that it's a loop.
  • The /D flag indicates this is for Directories
  • The /r flag indicates that "Files Rooted at Path"
  • The pattern that defines the set of files to be looped over is designated with "in"
  • @Echo instructs the script to write out the result of each loop and finally;
  • %G is the "implicit parameter" and is chosen because earlier developers had already used the pathname format letters a, d, f, n, p, s, t, and x. So, starting with G is traditional as it gives you the largest set of unused letters for returned variables ( G, H, I, J, K, L, M) – in other words, it's an ugly hack.

Compare that to the PowerShell equivalent:

PowerShell: Get-ChildItem -Path C:\Example -Filter 'Foo*'

The output's functionally the same, but even in this fairly trivial example, it's much, much easier to understand what's happening. It's immediately obvious what all the elements in the command do and how you could modify them. The only slightly non-obvious thing here is the * wildcard character (present in both examples) which indicates that the pattern used to match items should start with 'Foo' and end in anything else. 

It just keeps getting better from here as, say you want to know how to identify just files (not directories) in the path? You could dig up the docs, Google around and try to sort that out with the command line version, or if you're in PowerShell, type "-" and hit the tab key, rolling through the flag options until the obvious solution shows up.

PowerShell scripting for beginners get-childitem GIF

One Big String vs Object Properties

Servers are no good to anyone if they're not online. Which is why people spend an inordinate amount of time pretending they're sonar operators on a submarine and pinging them (yes, that's actually why it's called that). 

While the output from ping is useful (and you can use ping within PowerShell), at the end of the day the output is just a big string – a series of letter and number characters with no definite breaks between them). 

PowerShell has a command that's analogous to ping, but that returns data that's structured, making it easy to work with. That command is Test-Connection. 

Below you can see the output of pinging a server (named 'DC' on their local network) and the equivalent Test-Connection output.

PowerShell scripting for beginners test connection output screenshot

Putting aside that it's easier to read, what's really important is that you can now pass this information off to another command, incorporate it into a larger utility (as this full course is working towards) or just tweak it so that it makes more sense. 

How To Run A PowerShell Script

There are two main ways to make a PowerShell script:

  1. The first, which will be familiar if you've used Windows Command Line before, is to write scripts directly in notepad. For example, open a new notepad file, and write 

Write-Host "Hello World!"

Then save this file as FirstScript.ps1

You can call the script from PowerShell using the command:

& "X:\FirstScript.ps1"

And you'll see the output in PowerShell.

  1. The second, much more powerful way of making PowerShell scripts is to use the Windows PowerShell Integrated Scripting Environment (ISE). With ISE, you can run scripts and debug them in a GUI environment. 

ISE also features syntax highlighting, multiline editing, tab completion, selective execution, and a whole host of other features. It will even let you open multiple script windows at the same time, which is useful once you have scripts that call other scripts.

Though it might seem like overkill right now, it's worth working with ISE right from the beginning. That way, you can get used to it before you start writing more complex scripts. 

Basic PowerShell Script Examples

Now you can start to write PowerShell scripts. So let's go through the process step by step.

Example Script 1: Get The Date

Let's start with a simple script. In ISE or notepad, open a new file. Type:

Write-Host get-date

And then save the file as GetDate.ps1

You can call the script from PowerShell using the command:

& "C:\GetDate.ps1"

And you'll see the output in PowerShell. Simple, right?

PowerShell scripting for beginners get date screenshot

Example Script 2: Force Stop A Process

If you have a Windows service running that has frozen, you can use a PowerShell script to stop it. For instance, suppose my company uses Lync for business communications and it keeps freezing and Lync's process ID is 9212. I can stop Lync with a script.

PowerShell scripting for beginners force stop a process screenshot

To do that, make a new script file in the same way as before. This time, type:

stop-process 9212

or

stop-process -processname lync

Save the file as StopLync.ps1, and then you can invoke the script using:

& "X:\StopLync.ps1"

This script can be expanded to stop a number of processes at once, just by adding extra commands of the same type. You can also write another script if you want to automatically start a number of processes at once, using:

start-process -processname [your process here]

This is particularly useful if you want to start a bunch of networking processes at once, for instance, and don't want to enter the commands separately.

Example Script 3: Check if a File Exists

Suppose you need to delete multiple files, you might want to first check to see if the files even exist.

test-path, as the name implies, lets you verify whether elements of the path exist. It'll return TRUE, if all elements exist, and FALSE if any are missing.

You simply type:

test-Path (And then the file path)

Example Script 4: Set up a VPN on a new machine

Now you've got the basics, let's write a script that will actually do something useful. For sysadmins, one of the major advantages of PowerShell is that it allows you to automate the process of setting up new machines.

Today, individuals and businesses alike both use virtual private networks as a near mandatory security measure to protect proprietary data. All new machines should be connected to a VPN during setup. While you could handle each one manually, this is the kind of thing PowerShell is perfect for. For beginners – ie, most people reading this guide – most quality VPN services will work for your computing environment, we can write a script that will automatically set up and configure it. 

The most basic way to do this is to open a new file like before, and then type the command:

Set-VpnConnection -Name "Test1" -ServerAddress "10.1.1.2" -PassThru

You will need to set your server address to the address of your local VPN server, and by using the 'PassThru' command this script will return the configuration options of the VPN. 

Save the file as SetVPN.ps1, and then you should be able to call it in the same way as before, using 

& "X:\SetVPN.ps1"

Now. The first time you call this command, you might get some errors. But that's all part of the process of learning PowerShell scripts. Fear not: whenever you run into an error like this, just take a look at Microsoft's official guide for the 'Set-VpnConnection' command and adapt the examples there to suit your system.

PowerShell Punctuation

Here's a table to summarize some of the PowerShell punctuation we've used:

SymbolNameFunctionExample
$Dollar SignDeclares a variable$a
=EqualAssigns a value to the variable$a=get-date
""Double QuoteUse double quotes to display textIf $a = Monday

"Day of the Week: $a"
will output as:

Day of the Week: Monday

+PlusConcatenates$a = November

"Day of the Week: "
+ $a.Dayofweek

Day of the Week: Monday

( )ParenthesisGroups to create argument (get-date).day

Windows PowerShell Resources

Below are the latest tutorials, and I've culled them down to a top ten:

Getting Started with PowerShell

  1. PowerShell for Beginners – A library of links to get started, best practices, command line syntax and more! 
  2. Don Jones' bestselling PowerShell bookLearn Windows PowerShell in a Month of Lunches is also in video! After 3-4 months of lunches with the tutorial video series, you'll be automating admin tasks faster than you ever thought possible. By the way, the author answers questions at powershell.org. There are numerous PowerShell resources, events, and even free ebooks! 
  3. If you're taking the MCSA 70-410 Microsoft Exam, these flashcards will help: PowerShell commands
  4. PowerShell allows you to string multiple commands together on one line using a technique called pipelining. It makes complex things much simpler, and you can learn about it here

Configure and Manage Active Directory

Save even more time by learning how to configure and manage Active Directory using PowerShell with these resources:

  1. Use PowerShell to Search AD for High-Privileged Accounts
  2. Use AD module cmdlets to perform various administrative, configuration, and diagnostic tasks in your AD DS and AD LDS environments. 
  3. Build an AD utility from scratch in this epic 3 hour PowerShell video course (unlock for free with code: PSHL) 

Automate Exchange

With all that free time you have, why not learn how to automate Exchange with these resources:

  1. If you're an Exchange Admin, make sure you have these 5 skills down 
  2. Click here for more PowerShell tips for Exchange Admins. Then scroll down for the good stuff. 

A Final Word

We hope that this PowerShell scripting tutorial for beginners has given you everything you need to get started with PowerShell scripts. Once you've mastered the basics of the PowerShell syntax, working with scripts is pretty easy: just make sure that you keep all your scripts organized, and you name them in a way that it's obvious what they do. That way, you won't get confused.

And once you've mastered scripts, there really is no end to what you can do with PowerShell. Take a look at our guide to active directory scripting, for instance, for just a taste of the flexibility that PowerShell can provide.

I'll finish, though, with just one word of warning: don't rely on PowerShell alone to manage data security and access. Even after you become an expert in PowerShell scripting, the intricacies of GDPR and similar frameworks make data management simply too complex for such a blunt tool. Instead, you should consider consulting an expert on how to manage access to the data stored on your systems.


Friday, August 21, 2020

chia sẻ của anh Lam Binh Bao về chuyện làm Estimation Manager ở ABB

HOÀI NIỆM!
Hôm qua tự dưng hoài niệm, nhớ lại những ngày tháng làm việc ở ABB và lôi ra một đống tài liệu.
Nhân duyên đến với ABB rất thú vị. Năm 1995, đang làm trưởng bộ phận Điện ở SSY, đọc báo thấy ABB tuyển Sales Engineer, với mong muốn làm việc ở tập đoàn lớn nên mình nộp đơn ứng tuyển chứ trước đó có bao giờ làm sales đâu. Ông Trưởng VPĐD Pat Donnely béo ù, người Ireland, phỏng vấn mình một hồi nói rằng: tôi thấy cậu hợp với vị trí khác hơn. Thế là trở thành Estimation Manager chuyên lo đấu thầu. Mang danh là manager chứ chẳng có lính. Mãi sau mới có team mà sau đó nhiều người trở thành sếp ở Siemens, Avera, Schneider, Alstoms v.v
Chỉ sau 1 thời gian ngắn mình được quy hoạch vào chương trình Localization, có nghĩa là đào tạo người địa phương để thay thế sếp nước ngoài. Trong chương trình ấy thì miền Nam có chỉ có mình, Hà Nội được 3 người. Lúc ấy, những năm thập kỷ 90, chi phí cho sếp nước ngoài không thấp hơn 500.000 USD/năm/người mà 1000 USD mua được gần 3 lượng vàng . Tính ra chi phí cho một sếp nước ngoài khoảng 1500 lượng vàng/năm tương đương với hơn 80 tỷ nếu chiếu theo giá vàng hiện nay  (just kidding)!
Mình được công ty đào tạo rất nhiều và luân chuyển nhiều vị trí khác nhau: từ kỹ thuật, quản lý dự án, đến phát triển kinh doanh, quản lý để thử thách. Mình được cử đi on-the-job training ở Úc suốt 1 tháng. Lúc thì đi công trường, lúc thì ở văn phòng học hỏi cách quản lý điều hành. Cuối cùng mang về một đống kiến thức, trải nghiệm thực tế và cả những quy trình xây dựng hệ thống vận hành doanh nghiệp rất khoa học.
Rồi mình đi học 4 tuần chương trình Asia Pacific Advanced Management Training do ABB mời các giáo sư từ INSEAD Business School - một trong những trường kinh doanh hàng đầu thế giới - đến dạy. Cả khu vực có khoảng 30 người, mà toàn là cấp Tổng Giám Đốc hay tệ nhất cũng nằm trong Ban Giám Đốc, duy có mình là vị trí thấp nhất. Lúc đó học tốn tiền kinh khủng, ở toàn khách sạn 5 sao. Thời ấy mình không có credit card, nên phải mang theo séc để rút tiền. Cầm tấm séc 6.000 USD đến ngân hàng HSBC Hong Kong và Kuala Lumpur, rút tiền mặt về gởi trong két an toàn của khách sạn . Mà đi 2 đợt như thế. Đó là một chương trình đào tạo toàn diện và rất sâu mà bây giờ mình vẫn đọc đi đọc lại các tài liệu và áp dụng trong công việc.
Sau đó mình còn tham dự những chương trình đào tạo khác từ lãnh đạo, dịch vụ, đến tài chính, bán hàng, nhân sự, quản lý dự án v.v Tất cả những chương trình ấy giúp cho mình có được nền móng kiến thức quản trị vững chắc mà sau này được bồi đắp thêm bằng chương trình MBA tại Úc.
Mình cũng ấn tượng với ABB International Service, chương trình đã khai sáng tư duy của mình rất nhiều về service concept và cách vận hành.
Tất cả các công ty hàng đầu thế giới như ABB, Tetra Pak, Mettler Toledo mà mình đã làm việc đều có 1 điểm chung khiến họ thành công: họ đầu tư rất nhiều vào việc phát triển con người. Họ có những chương trình đào tạo xuyên suốt từ cấp quốc gia, khu vực, toàn cầu. Họ có chương trình mentoring và coaching mà mình cũng đã may mắn được tham gia. Trong những khoản đầu tư ấy, có cái đem lại hiệu quả ngay lập tức, có cái cần thời gian. Tuy nhiên, về lâu dài những khoản đầu tư ấy tạo nên nền móng vững chắc mà các đối thủ khó theo kịp.
Trong lúc ngồi thơ thẩn lật lại những trang tài liệu, chợt 1 câu hỏi bật ra: cách tốt nhất để chuyển giao những tri thức này đến các doanh nghiệp Việt là gì? Đặc biệt về hệ thống tổng thể từ đấu thầu đến quản lý dự án thành công và hệ thống dịch vụ kỹ thuật!


Khắc kỷ

Q: Làm sao một người có thể kết hợp hiệu quả chủ nghĩa Khắc kỷ và chủ nghĩa Machiavelli (Xảo quyệt) trong đời sống hằng ngày?
A:Tonka Sukic, người hâm mộ nghệ thuật thứ bảy
_________________
Để xem nào. Nếu những thuật ngữ trên được hiểu theo lối sơ xài, thiển cận thì đây sẽ biến thành bí quyết để trở thành một kẻ ái kỷ chống xã hội. Tôi thấy hai từ này thường được dùng khá nhiều để nói về một thứ không liên quan gì đến ý nghĩa ban đầu của chúng, đại loại như:
Chủ nghĩa Khắc kỷ trở nên ngầu lòi nhờ thái độ thờ ơ không chút "cảm xúc"
Chủ nghĩa Machiavelli – thao túng người khác để bản thân được hưởng lợi nhiều nhất
Tôi thật sự ước rằng hai cụm từ đẹp đẽ này không bị hiểu theo lối ấy. Chủ nghĩa Khắc kỷ hầu như không liên quan gì đến thái độ thờ ơ vô cảm cả. Những người Khắc kỷ có một hệ thống đường lối đạo đức vững chắc với nền tảng là giáo dục và nuôi dưỡng các phẩm chất: Tiết chế, Thông thái, Can đảm, Công bằng. Chúng ta không thực hiện chúng bằng cách loại bỏ hết mọi cảm xúc mà bằng cách ý thức và vượt qua được những "đam mê" mang tính bị động, vô thức, và thiếu xem xét đã luôn gắn liền với con người chúng ta, và chúng cũng không thể nào bao hàm hết được cảm xúc của con người. Người Khắc kỷ phấn đấu nuôi dưỡng những cảm xúc tốt đẹp, đồng thời chế ngự những cảm xúc thụ động, bộc phát. Có một sự khác biệt rất lớn giữa nghĩa của hai từ có nguồn gốc Hy Lạp là "pathos" (cảm động) và "apatheia" (tĩnh tâm) và hai từ "pathetic" (thảm hại) và "apathetic" (vô cảm). Trở nên "pathetic" theo cách hiểu ở Hy Lạp cổ nghĩa là trải qua một trạng thái cảm xúc mãnh liệt. Theo cách hiểu này thì không phải mọi cảm xúc đều là pathe. Chữ "pathos" dịch theo cách hợp lý hơn sẽ mang nghĩa "ham muốn không kiểm soát được". Người Khắc kỷ chủ yếu quan tâm đến việc sống một cuộc đời có khuôn khổ, có suy tính kỹ lưỡng bằng việc phát triển lý trí và tâm hồn bản thân.
Machiavelli, ngược lại, là một nhà tư tưởng chính trị nguyện dâng hiến lý tưởng của mình cho công cuộc thống nhất nước nhà, nước Ý, và rất muốn được đóng góp chút ít nào đó cho sự nghiệp ấy. Ông sinh ra và sống trong một thời kỳ biến loạn, khi mà việc những đứa con ngoài giá thú của Giáo hoàng chém giết lẫn nhau, ăn nằm cùng chị em gái của mình, và trừ khử bất kỳ kẻ nào cản trở được xem là bình thường. Bất kỳ ai cố gắng thống nhất nước Ý bằng những biện pháp chính nghĩa hơn đều cũng sẽ bị đầu độc chết và mau chóng mồ xanh cỏ dại. Liệu Machiavelli có cho rằng những biện pháp xảo trá, tàn nhẫn này là tốt? Không, nhưng ông coi chúng là cần thiết trong hoàn cảnh chính trị đương thời. Nếu bỗng chốc ông du hành thời gian đến năm trăm năm sau, liệu ông vẫn cho là thế? Rất có thể, bởi ông xem người dân như là một đám người dễ bị dắt mũi và cần phải được làm hài lòng bằng mọi giá. Tuy nhiên, phương pháp của ông lại là một cách sinh tồn trong một thời đại mà những người sống đúng với đạo đức luân lý thường dễ chết hơn. Ngày nay, việc thuật ngữ "Chủ nghĩa Machiavelli" bị xuyên tạc trong thế giới phương Tây là một điều ngu ngốc và đáng tiếc, khi ngày nay việc đảm bảo một cuộc sống thoải mái và giữ cho bản thân khỏi vạ miệng khi bàn tán về bất kỳ ai mà chúng ta cố gắng làm cho hài lòng là điều đơn giản.
Quay trở lại câu hỏi. Liệu có thể cùng phối hợp "hiệu quả" chủ nghĩa Khắc kỷ và Machiavelli trong đời sống ngày nay? Theo nghĩa ban đầu của hai từ này, hai thế giới quan và hệ thống tư tưởng có vẻ mâu thuẫn với nhau. "Mục tiêu" của người Khắc kỷ chính là đạt được niềm vui sống thông qua đức hạnh bằng cách kiểm soát những ham muốn của bản thân. Như các bạn có thể thấy, tự bản thân nó cũng đã là đích đến rồi. Còn "mục tiêu" đối với Machiavelli là một cái gì đó khác. Bạn có thể cho nó là sự sinh tồn, hay thống nhất nước Ý. Tôi xin trích dẫn Epictetus, một nô lệ được trả tự do và là một nhà triết học Khắc kỷ, từ quyển Cẩm nang (Enchiridion):
Một số thứ chúng ta kiểm soát được còn một số thì không. Những thứ ta kiểm soát được là chính kiến, mưu cầu, khát khao, ác cảm, và, tóm gọn lại, chính là những hành động do con người ta thực hiện. Những thứ ta không kiểm soát được là cơ thể, tài sản, danh tiếng, quyền lực, và tóm gọn lại, là những thứ không phải hành động của con người ta. Thứ ta điều khiển được mặc nhiên nó là tự do, nó không bị gò bó, không bị cản trở; nhưng thứ không phải do ta điều khiển nó lại mang tính yếu ớt, phụ thuộc, gò bó, thuộc về kẻ khác. Hãy nhớ, rằng nếu những thứ mặc nhiên nó bị phụ thuộc mà ta lại coi là tự do, và cái gì thuộc về người khác ta lại coi là của riêng ta, thì đó là lúc ta bị cản lối. Ta sẽ than trách, ta sẽ phiền toái, và ta sẽ bắt lỗi cả thần linh và thế nhân. Nhưng nếu những gì chỉ thuộc về ta mà ta cũng coi nó là như thế, và những gì thuộc về kẻ khác ta cũng thừa nhận nó như thế, thì sẽ chẳng có ai bắt buộc hay kiềm hãm ta. Hơn thế, ta sẽ chẳng bắt lỗi cho ai và cũng sẽ chẳng đổ lỗi cho ai. Ta sẽ không làm gì trái với ý muốn của riêng ta. Chẳng ai tổn thương ta, ta chẳng có kẻ thù, và không ai làm hại ta.
Bởi vậy, khi mưu cầu những điều lớn lao như thế, hãy nhớ rằng ta không được để bản thân bận lòng, dù là những ý định nhỏ nhất, về những điều nhỏ nhoi. Thay vào đó, ta phải hoàn toàn từ bỏ một số thứ và ngay tại hiện tại phải dời những thứ còn lại về sau. Nhưng nếu ta muốn tất cả những cái lớn lao trên, kèm theo quyền lực và giàu có, thì ta thậm chí sẽ không hề có được cái sau, vì mục tiêu của ta là cái đầu: và ta sẽ hoàn toàn đánh mất cái đầu, vì nhờ có nó mà mới có hạnh phúc và sự tự do.
Nhưng nếu bạn đang hỏi liệu bạn có thể trở thành một người thao túng nhẫn tâm, thì trên chính là cách tốt hơn để tiếp cận câu hỏi.

_________________
A: Gregory B. Sadler, nhà triết học | người diễn thuyết | huấn luyện viên | nhà tư vấn | nhà giáo dục
Nếu hiểu "Khắc kỷ" theo nghĩa là trường phái triết học và giáo lý thật, đơn giản mà nói, takhông thể kết hợp nó cùng chủ nghĩa Machiavelli được. Bạn hoàn toàn có thể thử, đương nhiên rồi, nhưng bạn sẽ dần thấy rằng càng tuân theo những tư tưởng của chủ nghĩa Khắc kỷ về cách đối nhân xử thế, nó sẽ càng trở nên không phù hợp với cái mà chúng ta thường hay gọi là "chủ nghĩa Machiavelli".
Nhân tiện, người theo chủ nghĩa Khắc kỷ cổ điển hiểu rằng những người muốn theo trường phái của họ có thể mang theo rất nhiều quan điểm, thói quen và quan niệm mẫu thuẫn với chính chủ nghĩa Khắc kỷ, và rằng không thể giải quyết vấn đề đó chỉ bằng cách bảo họ "bỏ hết đi". Khi chúng ta đọc tác phẩm của Epictetus chẳng hạn, ta thấy được ông hợp tác với mọi người, giảng giải cho họ hiểu rằng vì sao phương pháp động viên khích lệ tinh thần không hề tốt đối với họ, và sẽ không thật sự khiến họ thấy hạnh phúc một chút nào cả. Họ trở nên nhận thức được về những mâu thuẫn trong đời sống, các mối quan hệ, sự lựa chọn, và hành động, và quyết định xem liệu có nên giải quyết chúng hay không. . . .
Bây giờ, dĩ nhiên rồi, nếu ý người hỏi "Chủ nghĩa Khắc kỷ" chỉ là trở nên vô cảm, kiềm nén ham muốn và cả hành động đáp lại, hay "rắn rỏi" – một cách diễn đạt ngày nay của thuật ngữ này, vô cùng khác biệt so với bản chất thật sự của Khắc kỷ - thì có vẻ chúng ta có thể kết hợp nó với Chủ nghĩa Machiavelli. . .


Thursday, August 20, 2020

Bớt siêng năng, tăng hiệu quả

TÔI ĐÃ GIẢM 50% THỜI GIAN LÀM VIỆC NHƯ THẾ NÀO?

Thưa các anh chị thành viên group!

Trong suy nghĩ của phần lớn mọi người, hình ảnh của nhà quản lý doanh nghiệp luôn gắn liền với sự bận rộn. Tôi (em) từng chứng kiến nhiều người bạn, khi còn đi làm thuê trông họ thật thảnh thơi và vui vẻ, họ có những kỳ nghỉ trọn vẹn, có cơ hội chăm lo cho gia đình. Nhưng kể từ khi mở một doanh nghiệp riêng, họ trở nên vô cùng tất bật, không còn thời gian cho gia đình, bạn bè hay bất cứ sở thích cá nhân nào.

Có lẽ đó không phải là mong muốn của những người quản lý, hay các ông chủ doanh nghiệp khi mới khởi nghiệp. Nhưng theo thời gian, do áp lực của công việc, họ phải dành thời gian cho công việc ngày càng nhiều và mặc nhiên chấp nhận sự thật đó. Cá nhân tôi cũng từng rất vất vả khi phải điều hành hai doanh nghiệp cùng một lúc. Tôi làm việc 7 ngày mỗi tuần, đôi khi là cả các buổi tối. Cơ thể tôi gần như kiệt sức, tôi luôn ở trong tình trạng mệt mỏi và không thể sáng tạo được.

Cho đến khi tôi nhận ra sự thật là có những người đang giải quyết khối lượng công việc lớn hơn mình rất nhiều, nhưng họ cũng như tôi, chỉ có 24 tiếng mỗi ngày. Tôi nghĩ mình cần phải thay đổi cách làm việc. Tôi đã lập kế hoạch cắt giảm 50% thời gian làm việc, cụ thể là mỗi ngày chỉ làm việc 4 tiếng thay vì 8 – 12 tiếng như trước. Và sau đó 2 tháng, tôi vui mừng nhận ra mình đã ở trong trạng thái khỏe mạnh hơn, vui vẻ hơn và quan trọng là công việc cũng hiệu quả hơn hẳn lúc trước.

Nếu bạn là một mẫu "sếp" bận rộn và bạn cũng muốn có nhiều thời gian hơn cho bản thân, gia đình thì hãy tham khảo những kinh nghiệm mà tôi đã đúc rút và áp dụng cho công việc của mình dưới đây.

1. THAY ĐỔI TƯ DUY LÀM VIỆC

Khi được khuyên cắt giảm thời gian làm việc, phần lớn các nhà quản lý đều cho rằng đó là điều bất khả thi. Làm sao có thể làm việc ít đi trong khi hiện tại họ đang cố hết sức mà vẫn chưa giải quyết hết "núi công việc" mỗi ngày.

Đây là một loại bẫy tư duy nhà quản lý phải vượt qua. Thử tưởng tượng bạn muốn đến một nơi rất xa, nhưng hiện tại bạn chỉ có một chú lạc đà. Lạc đà tuy chăm chỉ nhưng đi chậm hơn ngựa rất nhiều. Vậy giải pháp là bạn sẽ đi kiếm một chú ngựa hay bắt chú lạc đà đi suốt đêm?

Mỗi khi bạn bị quá tải trong công việc thì đó là dấu hiệu cho thấy bạn cần làm việc một cách "thông minh hơn" thay vì "chăm chỉ hơn". Là một nhà quản lý, bạn cần hiểu mục tiêu của doanh nghiệp là đạt được kết quả cao nhất với ít nguồn lực nhất. Thực tế đã cho thấy các doanh nghiệp thành công không bao giờ phát triển bằng cách yêu cầu mọi người làm việc nhiều hơn, vì sức lực của mỗi người đều có hạn. Thay vào đó, họ sẽ xây dựng một phương pháp làm việc khoa học, hợp lý và tạo ra môi trường thoải mái cho tất cả mọi người. 

Tôi rất thích một câu nói của Bill Gates, ông nói: "Tôi thường giao việc khó cho những người lười, vì người lười sẽ tìm ra cách đơn giản nhất để giải quyết việc khó". Ở đây, bạn cũng nên thử "lười" một cách khôn ngoan. Chăm chỉ là một đức tính tốt, nhưng nếu nhà quản lý chỉ tập trung vào sự chăm chỉ, nó sẽ là kẻ thù của hiệu suất. Vì vậy, thử lật ngược vấn đề và đặt câu hỏi "tại sao không phải là 4 tiếng thay cho 8 tiếng". Tôi tin rằng bạn sẽ thấy câu trả lời không ở quá xa.

2. NÓI KHÔNG VỚI NHỮNG NHIỆM VỤ KHÔNG QUAN TRỌNG

Bước đầu tiên trong hành trình cắt giảm thời gian làm việc là nói không với những nhiệm vụ không quan trọng. Nguyên nhân chủ yếu khiến các nhà quản lý bận rộn là vì họ ôm đồm quá nhiều thứ và đặt ra quá nhiều nhiệm vụ cho chính mình.

Thông thường, bạn nghĩ rằng đó đều là những việc quan trọng và tôi phải tự làm, nếu không công việc sẽ đổ bể. Có thể bạn đang quá tự tin vào bản thân hoặc đánh giá quá thấp nhân viên của mình đấy. Nếu nghiêm túc nhìn nhận lại, bạn sẽ thấy có đến hàng tá công việc bạn đang làm là không cần thiết. Hãy tập trung vào những nhiệm vụ quan trọng nhất, chia bớt việc còn lại cho người khác, tìm kiếm đối tác hoặc các dịch vụ thuê ngoài, thậm chí là bỏ hẳn ra khỏi kế hoạch kinh doanh nếu nó không quá quan trọng.

Hãy nhớ rằng thời gian của bạn rất quý, đừng lãng phí nó cho những việc mà người khác có thể làm thay bạn. Có câu nói "việc quan trọng nhất của cái đầu là để làm cái đầu". Nếu bạn cứ ôm hết mọi việc thì bạn chỉ là một "nhân viên cao cấp" chứ không phải là thủ lĩnh thực sự của doanh nghiệp.

Hãy hình dung doanh nghiệp của bạn là một chiếc máy bay Boeing, và bạn là cơ trưởng. Bên cạnh bạn có đội ngũ nhân viên (phi hành đoàn) và phía sau là khách hàng của doanh nghiệp (hành khách đi máy bay). Nhiệm vụ của bạn là đưa cả chiếc máy bay đến đích an toàn và nhanh chóng. Nếu bạn cứ chạy tới lui làm thay nhiệm vụ của tiếp viên, nhân viên kỹ thuật mà không tập trung vào nhiệm vụ của cơ trưởng, máy bay sẽ chẳng bao giờ đến đích được. 

3. TẬP TRUNG CAO NHẤT CHO THỜI GIAN LÀM VIỆC 

Việc chỉ còn lại 4 tiếng làm việc mỗi ngày (tương đương với một buổi sáng hoặc chiều) tự nhiên sẽ đặt bạn trước áp lực phải tập trung cao cho khoảng thời gian này nếu muốn công việc suôn sẻ.
Cá nhân tôi thấy rằng đó là một sự thay đổi tuyệt vời. Nếu như trước kia, bạn thường bắt đầu ngày mới một cách khá chậm rãi, có thể bạn tự cho nửa tiếng đầu tiên để nhấm nháp ly cà phê, hoặc nghỉ giữa giờ một lúc để nghe nhạc thì bây giờ bạn hẳn sẽ thay đổi hoàn toàn.

Kể từ khi làm việc 4 tiếng mỗi ngày, tôi mới nhận ra 8 tiếng trước kia của mình không hề được khai thác triệt để. Tôi bị xao lãng và phân tán bởi rất nhiều yếu tố, đôi khi là trì hoãn công việc và tự nhủ "mình còn cả ngày để giải quyết công việc kia mà". Nhưng với lịch làm việc mới, tôi thường bắt tay ráo riết ngay từ phút đầu tiên. 

Thông thường, tôi sẽ dành 3 phút để liệt kê tất cả những công việc cần làm trong ngày hôm đó. Ban đầu, tôi khá vất vả, nhưng sau tháng đầu tiên, mọi việc bắt đầu trôi chảy hơn, tôi thường kết thúc vào khoảng 11h sáng. Tôi có thể yên tâm rời khỏi bàn làm việc và cảm thấy mình đã có một ngày thật tuyệt vời.

4. TỪ CHỐI LÀM VIỆC THÊM GIỜ

Có một số "sếp" rất thích làm việc thêm giờ, thậm chí là nghiện làm ngoài giờ. Thông thường, họ chỉ kết thúc công việc lúc 18h hoặc 19h hàng ngày. Họ thích gửi email và nhắn tin cho nhân viên vào buổi tối, khoảng thời gian lẽ ra nên được dành cho gia đình. Tôi hoàn toàn cảm thông với suy nghĩ đó vì tôi cũng đã từng làm như vậy. Việc làm ngoài giờ cho tôi một cảm giác tự hào, giống như mình đang nỗ lực và hy sinh tất cả cho công việc vậy.

Dù vậy, không thể phủ nhận làm việc ngoài giờ là một thói quen thiếu khoa học và ảnh hưởng xấu đến sức khỏe và tâm lý. Tệ hơn, nó không những không giúp hiệu quả công việc tăng lên mà còn giảm đi rất nhiều.

Nếu đã chọn làm việc 4 tiếng mỗi ngày, bạn cần kiên quyết từ chối làm "thêm một chút" và sẵn sàng để công việc còn dư lại hôm sau, trừ những việc thực sự khẩn cấp. Khi công việc phát sinh, bạn hãy tự nhắc nhở bản thân "luôn có cách dễ hơn để giải quyết vụ này". Chỉ cần bạn sáng tạo một chút, và đừng thỏa hiệp với "con ong chăm chỉ" bên trong bạn, giải pháp sẽ đến rất sớm. Đôi khi chỉ với một cú điện thoại cho đúng người, bạn sẽ giải quyết xong công việc mà bạn cần cả ngày trước đó.

5. DÀNH THỜI GIAN PHÁT TRIỂN NHÂN VIÊN

Nếu đã nghiêm túc với kế hoạch cắt giảm thời gian làm việc, chắc hẳn bạn sẽ có ngay một khoảng thời gian "dư thừa" mỗi ngày (4 tiếng buổi chiều chẳng hạn). Bây giờ là lúc bạn nghĩ xem nên làm gì với khoảng thời gian này.

Tất nhiên bạn không nên lãng phí nó để ngủ hay đi chơi một cách không mục đích. Người ta thường nói thời gian là vàng bạc. Chúng ta hãy lấy chuyện tiền bạc làm ví dụ. Giả sử trước kia, bạn luôn sống trong sự nghèo khó, túng thiếu, dù làm việc cật lực vẫn không đủ chi tiêu. Bây giờ, nhờ khéo léo tiết kiệm và kiếm tiền, bạn đã có một khoản thu nhập dư dả mỗi tháng, nhất định bạn không bao giờ được phung phí nó, mà phải tích cực đầu tư số tiền này để có thêm nhiều tiền hơn nữa. 

Với thời gian cũng như vậy. Khi có thời gian rảnh, hãy nghĩ cách tái đầu tư nó vào công việc, bạn sẽ lại có nhiều thời gian hơn, và hiệu quả công việc lại tăng lên gấp bội.

Một trong những cách đầu tư khôn ngoan nhất bạn nên áp dụng là đầu tư cho nhân viên. Bạn hãy dành 1 – 2 buổi trao đổi mỗi tuần để huấn luyện kỹ năng làm việc cho họ. Hãy nhớ xem lần gần nhất bạn tổ chức một buổi huấn luyện cho nhân viên là khi nào, và sau mỗi năm, nhân viên của bạn có tiến bộ nhiều không?

Đầu tư vào nhân viên giúp cải thiện hiệu suất làm việc của tổ chức. Bạn sẽ rất ngạc nhiên khi thấy tình trạng nhân viên yếu kém, chậm tiến ngày càng giảm đi. Đồng thời, được cấp trên trực tiếp đào tạo cũng sẽ khiến nhân viên cảm thấy gắn bó và yêu mến môi trường doanh nghiệp hơn.

6. TÌM KIẾM Ý TƯỞNG CẢI TIẾN CÔNG VIỆC 

Bên cạnh đầu tư vào nhân viên thì đầu tư cho chính mình cũng là điều rất quan trọng. Có rất nhiều cách để bạn đầu tư cho bản thân như:

- Đọc sách

- Tham gia các khóa học hoặc hội thảo

- Gặp gỡ những người thành đạt hoặc có kinh nghiệm

- Giao lưu với những người bạn mới để mở rộng mối quan hệ

- Đi tham khảo thị trường và tìm kiếm ý tưởng kinh doanh

- Học hỏi đối thủ cạnh tranh trên tinh thần tôn trọng và cầu thị

- Gọi điện hoặc đến thăm khách hàng để lắng nghe ý kiến của họ
v..v..

Tất cả những cách làm trên sẽ khiến bạn luôn tràn đầy ý tưởng, năng lượng và nhiệt huyết với công việc mỗi ngày. Có nhiều nhà quản lý không hề áp dụng một ý tưởng cải tiến công việc nào trong suốt một năm, thậm chí lâu hơn. Có thể do họ lười thay đổi, nhưng phần lớn là vì họ có quá ít thời gian để nghĩ về những ý tưởng mới. 

Các cụ ta có câu "một người lo bằng kho người làm", nếu bạn có 4 tiếng để nghĩ ý tưởng mới mỗi ngày, trong khi các quản lý khác chỉ có 4 tiếng mỗi tháng thì tôi không hề nghi ngờ rằng doanh nghiệp của bạn sẽ có những bước tiến thần kỳ mà các doanh nghiệp khác không thể theo kịp.

Tất cả, chỉ cần bắt đầu với một suy nghĩ đơn giản ngay từ hôm nay: hãy cắt đi 50% thời gian, bớt siêng năng, tăng hiệu quả. 

Xin chúc các anh chị và các bạn nhiều sức khỏe và thành công trong sự nghiệp quản lý của mình.

Trân trọng. Chu Ngọc Cường.#chungoccuong

git lightweight tag vs git annotated tag


TL;DR

The difference between the commands is that one provides you with a tag message while the other doesn't. An annotated tag has a message that can be displayed with git-show(1), while a tag without annotations is just a named pointer to a commit.

More About Lightweight Tags

According to the documentation: "To create a lightweight tag, don't supply any of the -a, -s, or -m options, just provide a tag name". There are also some different options to write a message on annotated tags:

  • When you use git tag <tagname>, Git will create a tag at the current revision but will not prompt you for an annotation. It will be tagged without a message (this is a lightweight tag).
  • When you use git tag -a <tagname>, Git will prompt you for an annotation unless you have also used the -m flag to provide a message.
  • When you use git tag -a -m <msg> <tagname>, Git will tag the commit and annotate it with the provided message.
  • When you use git tag -m <msg> <tagname>, Git will behave as if you passed the -a flag for annotation and use the provided message.

Basically, it just amounts to whether you want the tag to have an annotation and some other information associated with it or not.


Phật giáo vs cúng sao

Nhiều người nói Phật giáo bây giờ biến tướng, cúng sao giải hạng mê tín dị đoan... Nhưng mất đi cái đó rồi, nhóm những con người có ít họ...