This post was published 11 years ago so it may be outdated.
When counting results from a SQL query that uses GROUP BY clause, you should take into account that it will count items of each group rather than groups themselves, even if you count fields that appear in the GROUP BY clause:
[sql]SELECT COUNT( country ) FROM users GROUP BY country[/sql]
Will return a row for each different country containing the amount of users from that country.
[sql]SELECT COUNT( COUNT ( country ) ) FROM users GROUP BY country[/sql]
Will return a single row with the amount of different countries in the table.
This post was published 11 years ago so it may be outdated.
Dear programmers who develop Java applications for OS X, please, add this line to your application:
[java]System.setProperty(“apple.laf.useScreenMenuBar”, “true”);[/java]
It will place the menu bar where it is expected to be in an OS X application.
This post was published 11 years ago so it may be outdated.
A couple of months ago I switched from Bash to ZSH. It took me a couple of minutes to know that I wouldn’t go back. These are some of the reasons that made me take that decision.
Auto-correction
Don’t you misspell commands sometimes? I do.
When ZSH can’t find the command I write it offers me suggestions, usually being the command I actually wanted to use. For instance if we write clar it will suggest us clear, and it will probably be suggesting the right command.
Auto-completion
I find auto-completion extremely useful. Bash just lists the files in the current directory. ZSH changes its suggestions depending on the command written.
Let’s image we write kill, ZSH will show the list of running processes rather than the list of files in the current directory. If we write cd and press <tab> then ZSH will show us just the list of folders in the current directory.
This capability can be improved via plugins, making ZSH capable of auto-completing more precisely other programs.
Did I say that you can actually browse the list of suggested terms? Yes, you can.
Git plugin
What is nicer than having local branches auto-completion? Having remote origins and remote branches auto-completion! And even more, you can show the current branch next to the current directory. Really nice features if you work with Git.
Other out-of-the-box useful features
Floating point math: I don’t always do math in the shell, but when I do, I need floating point numbers. To do floating point math in Bash you need external applications (bc, for instance). Floating point math works out-of-the-box in ZSH.
Expand variables: write a variable, press <tab> and see the value of that variable.
Global aliases: you can create aliases that work not just at the beginning. Pretty useful if you use to pipe outputs.
Easily enhanced
Want to show how much time took a command to finish? Piece of cake with ZSH, not so easy with Bash.