Tuesday, September 24, 2013

Fira Font


Mozilla's new Fira font looks great. Looking forward to use it on some future projects.

Thursday, September 19, 2013

MySQL IF Statement Affect On Speed


That's the part of my query that was increasing the execution time by 10x. 

I changed it to just `table`.`start` (without the IF statement) and the query was 10x faster.

Tuesday, September 17, 2013

Phonegap Start (for Phonegap Build)

"A Hello World application to get started with PhoneGap Build."

Twilio PHP Library Using A Proxy


I found a spot where I can add a proxy to the twilio PHP library.

Go to TinyHttp.php and add the highlighted part (using your own URL of course):
$opts[CURLOPT_PROXY] = 'http://xxx.xxx.xxx.xxx:8080/';
try {
      if ($curl = curl_init()) {

Failed to connect to socket /var/run/dbus/system_bus_socket

Error: Can't find out if NetworkManager is running: Failed to connect to socket /var/run/dbus/system_bus_socket: No such file or directory.
The following fixed the problem:
apt-get install dbus
(if you already have dbus installed: sudo service dbus start)
/etc/init.d/network-manager start

What caused the error?:
/etc/init.d/network restart

Monday, September 16, 2013

Could not initialize NMClient

** (process:17986): WARNING **: error: could not connect to NetworkManager

Fix: Try running with sudo.

For example: sudo nm-tool | grep DNS

Sunday, September 8, 2013

Check If Script Is already Running - Python


import tendo

# If is there another instance already running:
# display the message “Another instance is already running, quitting.”, and return -1 error code.
me = SingleInstance()

Tuesday, September 3, 2013

Fighting WinSCP Time-Outs


That's a guide to making WinSCP send a dummy command every 30 seconds to keep your connection alive. It's way better than constantly having to type in your password.

Crontab Mistake

I wanted to run a script every 20 minutes, so I put this into my crontab:
20 * * * * sh script.sh

That's wrong. That only runs it once every hour 20 minutes into the hour. For example, "20,40 * * * * sh bash.sh" would run it twice - 20 and 40 minutes into the hour.

To run the script every 20 minutes like I was expecting:
*/20 * * * * sh script.sh

Monday, September 2, 2013

Include yiiGridView Javascript


I ended up with the following code at the top of the page (since I'm not using a layout):

$assetsScriptUrl = Yii::app()->getAssetManager()->publish(Yii::getPathOfAlias('zii.widgets.assets'));
Yii::app()->getClientScript()->registerScriptFile($assetsScriptUrl .'/gridview/jquery.yiigridview.js');