Mysql workbench working with key based exchange mechanisms

It appears newer linux sshd configs (fedora 22) by default include a smaller set of key exchange based mechanisms that they have turned on.

This means that it gives errors saying it is unable to connect to the server. To fix this you need to enable some of the older key exchange mechanisms,

Adding this line to /etc/ssh/sshd_config and restarting the sshd server will fix it

KexAlgorithms curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1

Credits to: http://serverfault.com/questions/692060/mysql-workbench-with-debian-jessie-tcp-ip-over-ssh-does-not-work

Why are PHP’s function names a mess?

I have always wondered this, its exceptionally hit and miss and there isnt any real standards. I recently found the reason on the internet

Well, there were other factors in play there. htmlspecialchars was a very early function. Back when PHP had less than 100 functions and the function hashing mechanism was strlen(). In order to get a nice hash distribution of function names across the various function name lengths names were picked specifically to make them fit into a specific length bucket. This was circa late 1994 when PHP was a tool just for my own personal use and I wasn't too worried about not being able to remember the few function names.

-Rasmus - citation

So it turns out they were very specifically named to make sure they would fit nicely into the hashing function… Obviously today this isn’t needed, but its an exceptionally old artefact of PHP’s past that never got changed.

Add a user to a group in Linux

How to add a user to a group in Linux

usermod -a -G  

Its a simple as that. So for me adding the user “chewett” to the user “vboxusers” i run the command

usermod -a -G vboxusers chewett

The -a flag means that the new group is appended, without it you will overwrite your current groups with the specified one, In nearly all cases this is not what you want to do!

Location of GeoIP.dat for PHP

To find the location of GeoIP for PHP you can ssh into the server and use the “find” command.

find / -iname GeoIP.dat

Will return a list of file paths where the file with this name is found. In my case I found:

/usr/share/GeoIP/GeoIP.dat
/usr/local/share/GeoIP/GeoIP.dat
/opt/geoip/share/GeoIP/GeoIP.dat

In my case the bottom link was the one that PHP was searching for, To confirm this i moved the file and PHP started to complain that it couldn’t find the file.

Previously because I was updating the wrong file it didn’t update my install so PHP was returning old and wrong data.

Show trailing whitespace in Vim

A small snippet of code showing trailing whitespace being shown in vim
A small snippet of code showing trailing whitespace being shown in vim

Vim is a wonderful command line text editor with syntax highlighting and everything you could ask for provided you turn on the functionality. Recently i was shown that it was also show trailing whitespace with a quick addition to the .vimrc file.

All you need to do is add the following:

set list
set listchars=tab:→\ ,trail:☃

Thanks to Sam for showing me this, Here is his full vimrc or a directory of all of his settings files. Have a browse!

 

All computer sounds reduced when plugging in an iPhone/iDevice

Since i reinstalled my laptop a couple of weeks ago the sound of many applications randomly got reduced requiring me to go into the sound mixer to restore the levels. I noticed this most often when i plugged in my iPhone into the computer.

Since i initially thought this was related to my iPhone in some way i googled around and found a suggested solution by kleptomaniacist on the apple forums.

To stop this you need to go to:

Control Panel -> Sound -> Communication Tab -> and select Do Nothing.

Windows 7 implemented this so that when it detected communication on your computer it reduces the sound of other applications, which while useful if you are communicating i have found it irritating when it falsely triggers reducing the sound of music. This most likely only affects windows 7+ computers.

Grace Hopper – Computer Science Legend

I’m relatively surprised that I hadn’t heard of her before a couple of weeks ago. While discussing small loop optimizations with some friends someone referenced her nanoseconds video (see below). This short video explains quite simply, the concept of a nanosecond.

After seeing her talk about nanoseconds, I went to research her a bit further on trusty Wikipedia.

Spending a bit of time looking at her life, her career from getting a Ph.D. in mathematics from Yale to working on the UNIVAC and serving as the director of the Navy Programming Language Group.

Sadly no longer with us, this great woman was a pioneer of her time who i personally feel we all have a lot to thank her for.

Have a look at the video, it’s quite interesting for technical or non technical people.

Grace Hopper – Nanoseconds