This snippet of MySQL code shows how to concatenate two fields into one column, also shows how to reverse the concatenation and order by last name then first name.
Working on a SugarCRM dashboard today, and I needed to count how many records had one value and how many records had a second value. I then wanted to know what percentage the first value was of the total. So there’s a bit of MySQL code that helps make this easy to do.
SELECT SUM(IF(field_name = 'value_one',1,0)) AS 'Value One', SUM(IF(field_name = 'value_two',1,0)) AS 'Value Two' FROM table_name
What this does is counts up how many times
value_two appear in
field_name in the table
You can then take this a step further, if you wanted to, and I did…
you can use a line like this within your query:
This gives you the percentage that
value_one is of (
Hat tip to this stackoverflow answer by eisberg.
Edit: 2014-05-26-21h53m put the final code snippet into a ‘Gist’ on GitHub.
I was needing to navigate to a file that was in a ‘hidden’ folder, but the File Open dialog box won’t show the hidden folder.
The answer was found here: Press Command, Shift, Period keys together, the hidden folders/files will appear.
Great article over at A List Apart: Can Email Be Responsive. If you do HTML email newsletters, you should go read this.
Just discovered the
srm command on *nix systems.
srm will securely delete files, dependant on the switches you give it either one overwrite with random data, 7 passes, or 35 passes.
Hat tip to practicallyefficient.com.
Just a quick post of some software that I use, that I’ve just discussed with Seth (he knows who he is).
- ClarifyIT – Create quick screenshot based documents and email them easily.
- Byword – Markdown text editor.
- OmniOutliner – Easiest outliner I’ve found.
- Nozbe – great GTD task manager.
- 1Password – simplify your password management.
- Timebar – focused working… :)
- Keyboard Maestro – macros for everything.
- BetterSnapTool – setup hot keys to move windows to where you want.
- Battery Health – keep an eye on your Mac’s battery health.
We all want to achieve. We want the truth, we want justice. But above all, we want our coffee. Coffee is the fuel that powers our quest for truth and justice. Let the world know that you are in pursuit of truth, justice and coffee by ordering your own tshirt by clicking here to order yours.
PS. I wanted a tshirt, but couldn’t find what I was looking for, so I’ve made it here. If the goal is reached (50 tshirts) at teespring, then they’ll make ’em. Go on, I know you want one, order one for yourself and your neighbour. While you’re at it, get one for your neighbours nephew too.