MYSQL order by regexp

written by justin on September 14th, 2009 @ 02:32 PM

So, today I found that you can use regular expressions in the order by clause in MySQL. I'm using this for a field that can be either number, alpha, or a mix.
This is what is looks like. I'm saying that if the number starts with 0 - 9 then add 0 and it sorts like a number, otherwise, just sort on the alpha.


'if(number REGEXP \'^[0-9]\',number + 0, number)'

BSU Football iPhone app

written by justin on August 3rd, 2009 @ 04:24 PM

I recently got my first iPhone app published to the app store. It is an extension of my broncodashboard.com site. It has the schedule/results, the team roster, and it displays the rss feed of the IdahoStatesman.com BSU football coverage. I'm pretty excited to finally have it out there. It was fun putting together an app that I will use and that I hope other people will use too.

HAProxy to smooth things out

written by justin on March 20th, 2009 @ 10:27 PM

For a long time I've run a rails app behind nginx with 3 mongrels in a round robin configuration. It has worked for me pretty well. Recently I've added a few longish running reports and doubled my user count, and I've seen some sluggishness on my app. The issue is not that the 3 mongrels can't handle the load, the issue is that sometimes the requests get stacked up behind the long running process when there may be a couple of free mongrels just sitting there.

This is where HAProxy comes into the picture. HAProxy is an open source tcp/http load balancer. The magic that it gives us is the ability to only allow one connection at a time to our mongrels. So, if we have one long running process going, that mongrel will be skipped and the other 2 will be used until the first frees up. I've just started using this, but I think that it is making a difference already. You can watch a nice screencast from Mark Imbriaco of 37 signals on this approach.

My setup:
nginx ----> HAProxy ----> mongrels

MyDaddyPuzzles and Extreme Makeover Home Edition update

written by justin on December 12th, 2008 @ 04:14 PM

Just posted a couple of pics from the final setup of the Extreme Makeover Home Edition puzzles. You can see them here towards the bottom of the page.

Scores on BroncoDashboard.com

written by justin on September 25th, 2008 @ 01:36 PM

I've added a new page to broncodashboard.com. I'm grabbing scores for the WAC games and other teams that I find interesting so that I can check them in one place. It is kind of a personal scoreboard, but I thought I'd put it out there for the general consumption.

MyDaddyPuzzles and Extreme Makeover Home Edition

written by justin on September 17th, 2008 @ 10:23 AM

MyDaddyPuzzles are being used in the upcoming Season Premier of Extreme Makeover Home Edition. You can read about it here.

Mini Server -- looks like bad hd

written by justin on August 19th, 2008 @ 08:58 PM

My 1.25 gz mini is failing. Not sure, but I think the HD is toast. Too bad, I'm losing a log of data... I knew I should have backed that thing up.

redirecting uploads to merb

written by justin on May 21st, 2008 @ 10:55 AM

I have a rails app for which I am using merb to handle the file uploading duties. I am using nginx as the webserver to proxy to the rails app. So here is the little bit of config from the nginx.conf that grabs the url that matches and sends it off to merb. This bit of code is in the location block.


if ($uri = /upload/acceptor) {
        proxy_pass http://applicationserver:4010;
        break;
   }


New style web content

written by justin on May 19th, 2008 @ 08:49 AM

I really like what these guys are doing with the web. They can put links into small windows that pop open and give you extra information about things on the page, but you stay on the page and you get nice control over the linked content. Very nice way to have supplementary info linked on a page.

Broncodashboard updated for 2008 --mostly

written by justin on April 19th, 2008 @ 04:54 PM

I spent the day today updating Broncodashboard.com for the 2008 season. This entailed adding support for multiple seasons, redoing the widget and the feed that supplies info to the widget and adding logos and some details on the new schools on the schedule.

I still need to add all of the schedules for the opponents, so the full schedule link is still showing the 2007 season. All in all a good day.

bash cdpath magic

written by justin on April 17th, 2008 @ 02:57 PM

While perusing the bash man page today I found something pretty interesting. There is a variable that you can set in your .bash_profile file that is a search path for the cd command. That means that you can create a path with your most used cd locations and you can always get to those locations with a simple cd <foldername>. I added my work directory for web applications:


export CDPATH=.:~:/Users/jkay/Sites

Now a simple cd essence will get me to /Users/jkay/Sites/essence from anywhere.

Xserve smb file sharing blues

written by justin on April 11th, 2008 @ 02:52 PM

I have an Xserve at work that I bought with a terabyte drive so that I could share files to Windows XP Pro sp2 users. I have had a lot of issues when trying to serve home drives to people (I also have some public shares that seem to work ok). This would be a user specific share for their work files. The permissions should be read/write for the specified user and nothing for anyone else. We get a lot of errors about not being able to find the network path and the path already being used. I'd had it, and so I decided to try something pretty extreme.

The setup that I'm now testing is publishing the share over nfs to a linux box and then using samba to share it to the windows clients. I've set the nfs server to map all uids to nobody and the nfs is only mountable on the linux server that shares it out over smb. So far so good.

Here is the samba share configuration, the nfs is mounted to /home/jkay_h


[jkay_h]
        path = /home/jkay_h
        hide dot files = yes
        writable = yes
        printable = no
        guest ok = no
        valid users = jkay
        force group = hdrives
        directory mode = 770
        create mode = 770

view http headers

written by justin on April 7th, 2008 @ 09:56 AM

If you have a need to see http headers, which I did recently, you can use


curl -I http://url.here

Sunrise

written by justin on April 2nd, 2008 @ 08:13 AM

Sunrise over the Foothills

mtn west ruby conf day 2

written by justin on March 29th, 2008 @ 08:21 PM