2013
03.14

Just want to post a solution to an error I was getting when I was trying to build my Titanium app for Android.

I always got this error

[ERROR] Application Installer abnormal process termination. Process exit value was 1

Turns out I had to set the API version in the tiapp.xml like this where my API version is 17

<android xmlns:android="http://schemas.android.com/apk/res/android">
<tool-api-level>17</tool-api-level>
</android>

Hope this helps someone else.

2013
01.15

To find the string ‘foo’ inside the array $array and remove it, you can do this.

unset($array[array_search('foo', $array)]);
2013
01.03

You don’t need SSH access, just use this command:

mysql -h db.server -u user -p dbname

You’ll need mysql installed on your machine to run it. If you’re on a Mac, you can install mysql through homebrew by typing in terminal:

homebrew install mysql

This can be really handy if you don’t have phpMyAdmin access or your Navicat is acting up.

2013
01.02

Recently I had to use Media Queries to handle a responsive site so that it could be viewed in mobile. I really didn’t want to redo it all so it would work in IE, so I found this amazing time saving javascript script that will handle it all for you via JS.

You can find it here on GitHub

You just have to include the script below your CSS and it handles it all for you. Very handy.

2012
12.31

I have a table like this:

id name starttime endtime
1 Breakfast 01:00:00 11:00:00
2 Lunch 11:00:00 16:00:00
3 Dinner 16:00:00 23:00:00

This query will figure out which time range the current time fits in. In this case, it figures out if we’re in breakfast-zone or lunch-land.

SELECT 
	name,
	IF(CURTIME() BETWEEN starttime AND endtime,1,0) AS active
FROM 
	meal_times

If you’re not used to using BETWEEN, here’s a way using the > and < operators.

SELECT 
	name,
	IF(CURTIME() >= starttime AND CURTIME() <= endtime,1,0) AS active
FROM 
	meal_times

This makes a seperate field called active and sets it to 1 if the meal is within the current time, otherwise it’s 0.