Saturday, May 01, 2010

Blog has moved

I have moved my blog from blogger over to http://KenCochrane.net.

Wednesday, April 28, 2010

Mercurial 1.5.1 on RHEL5 using python 2.5

Installing Mercurial 1.5.1 on Red Hat Enterprise Linux 5 (RHEL5) using Python 2.5

My RHEL5 setup uses python2.5 which I compiled from source, since RHEL5 only comes with python2.4.

Because I didn't use the built in python 2.4 version I couldn't do the simple "yum install mercurial". Instead I need to build mercurial from source, which isn't too bad. Just do the following.

:as Root:
> wget http://mercurial.selenic.com/release/mercurial-1.5.1.tar.gz
> tar -xvzf mercurial-1.5.1.tar.gz
> cd mercurial-1.5.1
> make PYTHON=python2.5 install

If you get the following error:
python2.5 setup.py build
Couldn't import standard bz2 (incomplete Python install).
make: *** [build] Error 1

Then when you installed python 2.5 you didn't have the bzip2 libs installed so it didn't include them in the python2.5 install. No big deal all you need to do is install those libs and then recomplile python 2.5

install bzip2 libs
> yum install bzip2 bzip2-devel bzip2-libs

Download 2.5.4 from python.org
> wget http://python.org/ftp/python/2.5.4/Python-2.5.4.tar.bz2
> tar -xvjf Python-2.5.4.tar.bz2
> cd Python-2.5.4

switch to root:
> ./configure
> make
> make altinstall

Once complete (this will take a few minutes) rerun the steps above and then you should be good.

go back to where you untar'd the mercurial bundle
> cd mercurial-1.5.1
> make PYTHON=python2.5 install

Check to make sure you are running 1.5.1

> hg --version
Mercurial Distributed SCM (version 1.5.1)

That is all, now you are running Mercurial 1.5.1 on RHEL5 with python2.5!

Monday, January 18, 2010

Introducing my new iPhone application Face Flip

I have finished with my latest iPhone application and I have submitted it to Apple. I submitted it on Sunday 01/17/2010, and hopefully it will be approved by the end of the month. Normally it takes about 10-14 days for apple to approve apps but there have been recent reports that apps have been approved in as little as 2-3 days. I'll keep my fingers crossed and post when I hear back.

Face Flip is a simple iPhone application that allows you to take your photos and mix and match them with other photos to make crazy faces. You can add photos to the app using the built in iPhone Camera or it will take photos from the iPhone photo album. Once the photos are in the app you can switch to mixer mode and the app will slice the photos into 3 separate parts, Top, middle and bottom. On the mixer mode it will allow you to swipe the different parts, left or right, until you get to a cool combo. Once you find the perfect Face Flip photo you can export the photos from the app, you can either email them to your friends, or save it to iPhone photo album, or both.

The app was built to be very simple, and easy to use, and most of all FUN.

If you get a chance, go ahead and download it, and let me know what you think.

Here are some screen shots.





























Labels: , , ,

Monday, January 11, 2010

New TV Feature Request: Ability to set the channel order

Recently I decided it was time to upgrade my aging 36" CRT television with a new HDTV. After doing a lot of research I narrowed down my requirements to the following:
  • At least 42"
  • HDTV
  • Low power consumption
  • Ability to hook up my Mac Mini so that I can watch internet TV (hulu, netflix, etc).
  • LCD Flat panel
  • Digital TV tune
  • Under $800.00
I looked around for a few months and finally ended up with a Vizio 42" Class Eco 1080p 60Hz LCD HDTV, model # VO420E , that I bought at walmart for $648.00 . I really like this TV, it has everything I wanted, and the price was decent.

I have had the TV for a few weeks now, and the only thing that really annoys me is the fact that my non HD channels are separate from my HD channels. My non HD channels are 1 thru 70, and my HD channels are in this weird format, 6-0,83-1,83-2,84-11, etc. Here is what NBC,CBS,ABC, and Fox look like. (It is important to note, that I might be off with the HD channel numbers, since I can't seem to remember which channel is which.)

NBC: [non HD channel , 6] , [HD channel , 6-0].
CBS: [non HD channel , 13] , [HD channel , 83-11].
ABC: [non HD channel , 8] , [HD channel , 84-2].
FOX: [non HD channel , 7] , [HD channel , 82-4].

Now that I have an HDTV, I have become somewhat of an HD snob, why would I want to watch something that isn't HD if it was available. So I end up channel surfing thru the channels, and then if it ends up on a channel where I have HD, I then search for the HD channel. For NBC it was kind of easy to fix this because when you surf the channels it would put 6 and 6-0 right next to each other, so I ended up removing channel 6 all together, so now it goes 4,5,6-0,7,8,etc.

Feature Request:
If there are any TV manufactures out there, here is what I would like you to add to your next TV. I would like the ability to change my channel order when I am surfing. If I only watch 20 channels, why should I have to scan through all 70+ channels finding the few that I want, why not allow me to reorder them so that I can put my favorite 20 first, and then put the rest of the channels after. This way I could replace any non HD channels with their HD equivalents and I wouldn't need to worry about searching for those every time.

If you would like bonus points, it would be great if you could have a custom list for each person in the house, so that my wife can have her list of channels, and I can have mine. I envision it working like this. I pick up my remote, I hit my special button (there are 4 buttons, one for each profile), this tells the TV which channel ordering to use, and then when I start browsing, which channels to show next. My wife sits down, hits her button, and then the remote knows it is her, and when she starts browsing, she gets the channels she wants, in her order. We have favorite channel buttons, when extend that a little bit, and make it much more useful.

This feature seems very reasonable, and technology wise, not too hard. I mean come on, they just released 3D TV, that has to be much harder then this.

Well that is just my 2 cents, if you know of a TV or set top box that has this feature please let me know.

Monday, March 09, 2009

Django-Notification Creating Notice Types issues

I was setting up Django-Notification for a project, and I was trying to create notice types like it mentions on their wiki . Their wiki says that you should add the following code to your management.py file in your app.

from django.conf import settings
from django.db.models import signals
from django.utils.translation import ugettext_noop as _

if "notification" in settings.INSTALLED_APPS:
from notification import models as notification

def create_notice_types(app, created_models, verbosity, **kwargs):
notification
.create_notice_type("friends_invite", _("Invitation Received"), _("you have received an invitation"))
notification
.create_notice_type("friends_accept", _("Acceptance Received"), _("an invitation you sent has been accepted"))

signals
.post_syncdb.connect(create_notice_types, sender=notification)
else:
print "Skipping creation of NoticeTypes as notification app not found"

After trying lots of different things (dropping database and re syncing,etc) the management file wasn't getting picked up and it was quite annoying.

It turns out that if you have written custom management extensions and you have a management directory under your application it will ignore the management.py file all together. So you need to add the code to the app/management/__init__.py file instead.

Once you have added the files you need to resync (make sure you remove notification_* tables first).

This makes total sense now, and I guess I shouldn't have taken the directions to literaly.

If you still can't get it to work, the other option is to just create a fixture and load the data that way.

Labels: , , ,

Thursday, February 26, 2009

Plesk 8.6 cgi-bin trouble

I recently worked on a project to quickly create a simple cgi-bin script to capture some data from a form on a mostly static website. The script was simple, take the data from the form, and send it via email. The script was written by a co-worker of mine using python. When we went to deploy the script on the server with Plesk 8.6, it was nothing but a pain in the butt.. I have documented some of the things we did below in order to get it working.

Here are the errors that we were getting during the process in no particular order.
  • "target uid/gid (10001/2524 or 2523) mismatch with directory (10001/2524) or program (48/48)"
  • "uid: (10001/cashstarftp) gid: (2524/2524) cmd: mail_script.cgi"
  • "cannot get docroot information (/var/www/vhosts)"
  • "failed to open log file /var/log/httpd/suexec_log"
  • "Premature end of script headers: mail_script.py"

Here are the different steps that we did to resolve the different errors:

SSH in and type the following: "chown root:apache /usr/sbin/suexec"

My permissions were also wrong for the following
/var/log/httpd, should be drwx------ root root

/var/log/httpd/suexec_log, should be -rw-r--r-- root root

/home/httpd/vhosts/your-domain-name.com/statistics, should be dr-xr-x--- root psaserv

/home/httpd/vhosts/your-domain-name.com/cgi-bin should be, drwxr-x--x ftpuser psaserv

As most of you know but just in case scripts in the cgi-bin directory need to be -rwxr-xr-x ftpuser psacln

Replace "ftpuser" with the ftp user name for that domain

And don't forget to restart Apache after making these changes.
There are probably more things that we ended up trying that I didn't document here, so feel free to post how you fixed your issue, so that others can benefit.

Labels: , ,

Wednesday, February 04, 2009

Google's Ajax Libary hosting, the New Web Tracker

A little while ago, I noticed that Google started hosting the most common JavaScript libraries on their CDN. The project is called AJAX Libraries API , and it allows websites to reference these libaries instead of hosting the files themselves. Using a CDN to host your static files isn't anything new, and it provides some nice side effects.
  • Less bandwidth
  • Less space (every little bit helps)
  • Global caching
    • If everyone uses the same file it is more likely they already have the file cached from another site.
  • Faster download
    • Clients get the file from the server closer to them
    • Different servers mean more asynchronous downloads
For more info check out the YSlow page.

At first this sounded great, Google was providing a nice service for free, and everyone benefits. But then I was thinking, what does Google get out of this? With a big company there is always something, even Google.

Then it hit me. How does Google Analytics work? If you don't know, it is pretty simple. All you need to do is insert a small little JavaScript snippet at the bottom of the pages you want to track, and that is it. How is Google analytics different then the new Google Ajax API? Not much, the major difference is that Analytics has a tracking code and the AJAX API doesn't. But that isn't a big deal for Google to get around, they can easily link all views back to the originatly server. So the tracking code isn't needed unless you want to link that back to a user, so that they can view the results.

AJAX API, isn't the only project where they could easily gather information. They also have Google Chart API where they will generate charts for you on the file to display on your website. The big one that most people see everyday is the Google Maps API which allow you to embed google maps onto any website.

If you combine the information they get from all the people visiting thier website, with the information they gather from Google Analytics and all of these free tools that they give away, it is really amazing how much data they have, and how easy it would be to track people.

I'm not a paranoid person, and I could care less if Google wanted to track me, but I can see how some people might be concerned. If they could only use all of this information to track down all of the bad people out there. I don't know if Osama bin laden even has power in his cave, no less internet access, but if he did, watch out. Google's Coming!