2007
26 11 2007
We don’t use PHP 5.x at work so I needed to install JSON via PEAR. In your PHP script include the JSON.php file and instaniate the object. 1 2 include_once(’JSON.php’) $json = new Services_JSON(); In your javascript include a reference to json.js minus the comment marks: 1 (<)script src="json.js" type="text/javascript"(>)(<)/script(>) Now create a simple javascript [...]
8 11 2007
The database I was working on the other day is FAR from normalized. It stores shipping types as regular VARCHAR strings. We needed to orderby Overnight and International orders so they print first in the batch. Using a case statement I was able to create a temporary sane column in this query, using the integer [...]
2 11 2007
At work we interact with a MS SQL server that our shipping software runs on. We are a MySQL shop so don’t use MS SQL too much and the database in this proprietary shipping system is pretty large (about 100 tables). I needed to find a table that another table had a relation too and [...]
27 10 2007
Mod log sql is an awesome way of getting away from those old log files and is really handy for both web development and system administration. It’s been a while since I’ve posted a blog and this is something I’ve never done before so here we go. If you are ever doing any kind of [...]
25 09 2007
I found some other badly needed javascript methods today. Push (similiar to PHPs array_push function) and Join, which converts a simple array into a string. The Join method is great if you want to pass a dumb string to a server side language using an HTTP GET or POST. Push /* this can be defined [...]
25 09 2007
I’m used to using PHPs foreach function to iterate through an array. I finally found support for this in javascript the other day. Here is an example of its use. var myArr = new Array(); myArr[0] = “element 1″; myArr[1] = “element 2″; myArr[2] = “element 3″; myArr.forEach(yell); function yell(element, index, array) { alert(index+’ ‘+element); [...]
6 09 2007
Doing an HTTP POST has several advantages over an HTTP GET. For one, a GET is limited to 2000 characters, it can’t really send XML formatted data, and it’s not as secure as a POST. Though a POST isn’t too secure either unless sent over HTTPS. The first thing you will want, especially if you [...]
10 08 2007
Install rsync on the server you want to backup apt-get install rsync To backup the entire server create a cron job with the following command in it (you can choose how often you’d like it to run yourself if you know how the time syntax in a cronjob, otherwise search the blog for information on [...]
10 08 2007
How to pseudo type caste in JavaScript and deal with currency formatting.
2 08 2007
I needed to loop through a bunch of form fields in javascript, serialize them into a string, and then pass them to a PHP script for further manipulation. Here’s an easy way to loop through form fields that I found on the google: for(i=0; i