Pasteros is now on Github

I recently put Pasteros up on Github [link], the text storage service. What was once a singular file is now a collection of models, views and controllers. You can see it running here: paste.gelat.in. Feel free clone the repo and use it for your own projects.

Of course, it's not made as a turnkey solution so tables need to be created. Pastes can be forked and also compared to the parent paste (diff). It' has also been a huge stepping stone to not writing such terrible code, at least that's what I think.

Using Xdebug with NetBeans 7

There comes a time where it's unacceptable or inconvenient to stash var_dump() into your code. And then there's Xdebug. Xdebug makes it easy to debug your PHP application and with the intergration of NetBeans, it's even easier.



For the record, I'm using Debian 6.0.4 on my workstation and Debian Wheezy/Sid on my dev server.

First of all, lets install Xdebug on the server:

pecl install xdebug

Open up your xdebug.ini file, mine is located at /etc/php5/cgi/conf.d/xdebug.ini, and enable Xdebug. My xdebug.ini looks like this:

zend_extension=/usr/lib/php5/20100525+lfs/xdebug.so

xdebug.remote_enable=1

xdebug.remote_connect_back=1

xdebug.remote_handler=dbgp

xdebug.remote_mode=req

xdebug.remote_port=9000

xdebug.idekey=netbeans-xdebug

Find the largest installed packages in CentOS

I recently bought a VPS to host a Counter Strike server. WIthout having any choice, I was stuck with CentOS 5. After getting everything set up, I wasn't left with much disk space left. So, I read the man page for sort and used the following RPM command to find the largest packages installed:

rpm -qa --queryformat '%{name} %{size}\n' | sort -k2n

 

The option -k2 sorts the second column (size) and the -n option sorts it numerically. I also found out that sort -h doesn't work under CentOS 5 since it has coreutils 5.97, as it requires coreutils >= 7.5.

Tags

DeliCate

So, I have this old Pentium 166 box laying around, so I thought I'd stick Linux on it (of course). At first, I used DeLi Linux and it ran quite well. The problem is, the project changed directions, to ConnochaetOS. They took a more modern take on things, using kernel 2.6 and other modern applications. Most of the newer applications don't run quite well on an older box. So, after finding a mirror of a DeLi Linux that I cloned to a local server, I now had a working respository.

 

Tags

Google Analytics to Twitter bot

The last week, I've been tinkering with Google's Analytics API. What I wanted to do was have daily reports on my website which then  tweets the difference from yesterday to today. The ideal situation was I would have it SMS me the results. The problem is that my phone carrier (Rogers) complicates things. For most carriers, you can email a carrier-supplied address (5555555@att.com for example) which in turn would send an SMS to that address. But, what Rogers does is once you receive a text, you have to respond back with REPLY to view it. Stupid huh.

To get around this, I subscribe to my bots account via text message and for every new tweet, I get a text message.

Kobo Vox eReader

 Kobo just released their Vox eReader a couple of days ago and I've had the chance to play with it this weekend.

It's quite heavy compared to other ereaders. I found that it's even heavier than the mighty Kindle DX. See below for a comparison to a Canadian quarter.

(As you can see, there's some nice greasy fingerprints on it). Having never played around with Android before, it's quite easy to use. After firing it up the first time, it had to update the firmware, which over wifi, takes a while. After the update, I was finally able to play with it. Checking the version info in settings revealed that it's running Android 2.3.3 atop kernel version 2.6.35.3. 

 

WorkSimple 1.3.5 control panel and login fix

After playing around with WorkSimple 1.3.5 (and apparently not doing much  testing), login.php doesn't redirect on login and cp.php strips HTML.  Download the attachments below and replace cp.php and login.php with the new versions. Save the new versions as cp.php and login.php respectively and upload them to your WorkSimple install directory.

Reverse postal code lookup in PHP

 I've never played with any geolocation tools before but I thought I'd take a whack at it. After stumbling across GeoHelper, I thought I'd test things out with it. Well, after finding that the only reverse postal code lookup is Canada Post, I might as well make my own.

Download GeoHelper and script at the bottom of the page and place it in the same directory. That's pretty much it, the code explains itself. It can also do a reverse lookup on IPs.

 

Live demo here