Solved: Django Development Server Continues To Restart

Posted January 17th, 2012 in Django, General, Linux, Python by ryan

Hey ./manage.py runserver, Y U No Work?

Recently I was working on a Django-based project that integrates with Android and Embedded Linux devices. One day a coworker called me and asked about an error he had encountered. It seemed like he was not able to execute ./manage.py runserver to any port he had previously used. He was careful to use Control + C to stop the server, but for some reason the port was held onto by something. Looking at the output of “ps aux” was not showing any running processes using ./manage.py.

Who’s using that port?

Next instead of looking at processes, I wanted to see what was holding onto that port.  I ran the following command:

netstat -lpn | grep 8000

The output gave me the answer:

tcp    0    0 127.0.0.1:8000        0.0.0.0:*      LISTEN    15902/adb

So ADB was the culprit. A simple kill -9 to the process ID and the issue was fixed (temporarily). The issue keeps occuring, so maybe something in my code may be keeping ADB holding onto that port. I’m using the subprocess module to interact with ADB. I tried adding a call to terminate from the result of my subprocess.Popen call, but that ended very badly and had no effect on the hanging port. I’m sure when I have time to dig deeper (read “After My Looming Deadline”), I’ll try to write some tests to explore this issue more thoroughly.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

One Step Android Build & Flash

Posted April 12th, 2011 in General, Linux, Open Source by ryan

This is yet another post that’s really a reminder for me, but you’re welcome to it if it helps. I’ve been working on the Android OS for a few months now and at first I was physically touching the phone to reboot it into fastboot mode and then back to the normal boot mode. I grew tired of this manual process and so one day it dawned on me that fastboot also had a reboot command & I could make a bash alias and run all the commands to do this process at once.

m && cd out/target/product/passion/ && adb reboot-bootloader && fastboot flash system system.img && fastboot reboot && cd ../../../../

You’ll hear the phone vibrate when it’s booting back up normally and know it’s time to get back to work…

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Installing Scrapy on Ubuntu

Posted March 24th, 2011 in Django, General, Linux, Open Source, Python by ryan

I’ve been working on a Django-based project since October 2010 that includes some integration with Scrapy. Scrapy is a web scraping framework for Python and due to its design inspiration, Django developers will be quickly familiar with it. I have installed Scrapy no less than 10 times at this point and decided it was time for a script. This post is more of a reminder to me for the next time I install Scrapy, but if it works for you as well – great!.

This script works for Ubuntu 9.10, 10.04 and 10.10.  If you’re on an older release, you’ll need to install some dependencies first and then follow these instructions.

sudo apt-get install curl
curl -s http://archive.scrapy.org/ubuntu/archive.key | sudo apt-key add -
DISTRO=$(lsb_release -cs)
echo deb http://archive.scrapy.org/ubuntu $DISTRO main | sudo tee -a /etc/apt/sources.list
sudo apt-get update
sudo apt-get install scrapy-0.12
[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Dude I Got A………Mac

Posted November 2nd, 2009 in Apple, General, iPhone, Linux, Web Design by ryan

This weekend we drove up to Raleigh for the simple pleasure of giving Apple, Inc. a handful of money. I’ve wanted one for over a year, but the timing or the budget just didn’t line up until now. We purchased an iMac last year as a “Shared Family” computer. Wrong. After 3 days, my wife decided it was hers and the rest of us were never to touch it.  Ever.

First Mac

First Mac

I ended up getting the 2.53Ghz, with a 320GB HDD and 4GB of RAM.  I also purchased a wired keyboard with the number pad and a magic mouse.  The mouse is pretty good, like magic.  So far it’s been very easy to set up and use.

Now that I have the Mac I hope to take a little time to get to know the platform, try out some Obj-C, PyCocoa, and maybe try my hand at an iPhone app.  I’m very curious to see where this differs from my Linux platform.

If you want the play by play, here’s the Whrrl story to document my experience.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

CodeWeaver Cross Over Pro ~ Free Today Only

Posted October 28th, 2008 in Blogs I Read, General, Linux by ryan

I caught this scoop from Nolan’s blog this morning…

The company that makes the commercial version of WINE that allows you to install windows apps natively on mac or linux is giving their product away for free for 24 hours.  Here’s an article explaining it at length:

And here is the site to get the serial # and product.


[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Brief Update on Slicehost and Blogging Frequency

Posted May 2nd, 2008 in General, Linux by ryan

A lot of the referrers I’ve been getting are people looking for a Slicehost review.  Am I still happy – YES.  It has been great service with .001% downtime of which I was notified well in advance.  They have a great service and do a good job.  If you’re looking for a Linux VPS, I still enthusiastically recommend Slicehost.

So what else am I doing?  Well, I haven’t been blogging, that’s for sure.  I’ve been working on WPF at work and founding out there are some really cool things about it, and then there are a bunch of things it really lacks.  I hope to qualify that statement with some upcoming posts.

I also took a vacation – an actual road trip to a far away land (AZ) to see some family.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Update on RM-Install

Posted January 8th, 2008 in General, Linux, rails by ryan

Shortly after I posted my last blog entry on installing RM-Install, I received a comment from an employee at FiveRuns encouraging me to contact their support team.  We had a few brief emails back and forth and in the end I was told “You need 32-bit compatibility binaries to use our product on 64-bit linux.”  I was confident that was the issue from the start as the error was specifically nagging about “ELFCLASS32″.

I honestly didn’t take the time to go and find out how to install 32-bit compatibility binaries. And of course I expect you, Dear Reader, to understand why.  I’m a developer and therefore I’m lazy.  If I can add a few lines to a shell script that will install the software I want, that’s an easy and known quantity.  It will probably take me a few minutes to write the script and a few more to run the script.

To install the 32-bit binaries, use the following command:

sudo apt-get install ia32-libs

So what do I really think of the RM-Install product?  It’s a good idea if you’re running on a 32-bit distro and need a Rails development environment quickly.  I’m sure there are many developers not using dual core 64-bit processors these days, I just don’t know any. :)   This is really more on par to what Instant Rails is for the Windows guys for a complete environment than the BitNami product is this time.

Congrats to FiveRuns for making it easier to start coding in Rails.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

First Impressions: Five Runs RM-Install

Posted December 19th, 2007 in Linux, Open Source, rails, ruby, Web Design by ryan

Last night I tried the RM-Install product from Five Runs. It’s a multi-platform (Linux and Mac) Ruby on Rails Stack powered by BitRock. It is very similar to the Windows RubyStack offered by BitNami, but it is also supports a production install option.

I tried the development install and it was very easy to click next a few times and let it run. The very first thing I tried doing was updating the gems with “sudo gem update”. It failed giving me an error about not finding a file in require for some ELFClass. I’d never seen that before when updating gems, so I’m inclined to think that it may be something from within the RM-Install package.

So at the end of my first experience with the RM-Install stack, I think it’s a better solution to just create your own shell script for installing your Ruby/Rails environment.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

DataMapper Installation Woes

Posted December 18th, 2007 in Linux, Object Relational Mapping, ruby by ryan

I started playing more with Sinatra, and I have so many ideas for it’s usage.  At work I’m using to prototype a quick way to enable remote execution of .Net command line apps.  So I started looking into DataMapper as well to use with it.

So far I can’t get the datamapper gem to install on either XP or Ubuntu.  It gives me the same compilation errors on either platform.  I realize the problem is that I’m missing some software I need to build, but it still seems like a hassle.  Active record “just works”.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Trying out Sinatra on Windows

Posted November 9th, 2007 in General, Linux, Microsoft, Open Source, ruby, Web Design by ryan

I saw a lot of buzz about the new Sinatra web framework and decided I’d give it a try. I have a client now that has a simple site they need up now and then I can migrate them to Rails over time. When I saw how easy Sinatra looked, I thought I could give it a chance to see what it could do.

I installed Sinatra via RubyGems:
gem install sinatra -y

After that I created a simple file following the example:

require 'rubygems'
require 'sinatra'


get '/' do
"Now we're cooking with gas"
end

But much to my dismay, nothing happened when running this on my windows box. I instantly searched Google for “Sinatra on windows” and found the Google Group for Sinatra and a post explaining that Sinatra doesn’t run on Windows yet. As I read into the thread, I found someone had some suggestions for making it work.

John Bledsoe had the following suggestions:

My humble suggestion would be to remove the FileUtils#touch from
Sinatra::Server#tail and update Environment#prepare_loggers to
something like:

def prepare_loggers(logger = nil)
if logger.nil?
FileUtils.touch(Options.log_file)
logger = Logger.new(open(Options.log_file, 'w')
end
end

Making these changes allowed Sinatra to run, but it wouldn’t server the page. Instead it returned an error:

Fri Nov 09 16:26:26 -0800 2007: ERROR: undefined method `info’ for nil:NilClass

I made a post to the group and was promptly replied to! The general advice given is that it is a rapidly emerging framework undergoing a lot of changes and to check back soon.

More on testing Sinatra in Linux coming soon….

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]
FireStats icon Powered by FireStats