ubuntu

Quickly starting django development server on local IP

I am frequently running ./manage.py runserver SOME_IP:8000 , so I can run django dev on my local IP address, so it can be accessed by other computers on the network for testing. Here's a shell script to automate the steps it takes to do that:


#!/bin/bash

# virtualenv
source bin/activate

# get the local IP
IP=`ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'`;

# write the IP for use in settings module
echo "IP='$IP'" > local_settings_ip.py

# launch window in firefox ( will need to refresh )
firefox http://$IP:8000

ubuntu slow lookup speeds

Comcast's DNS nameservers were really slow, so I switched to Google's DNS nameservers by changing the settings in my router.

Couldn't figure out why my lookups were still really slow.

Turns out Ubuntu's Network Manager was keeping old DNS info around, causing the issue. Replacing the nameservers and marking the file as unwritable by network manager fixed it:

sudo nano /etc/resolv.conf
sudo chattr +i /etc/resolv.conf

multiple versions of django with virtualenv for dummies

It's easy to run multiple versions of django for python development. Let's say you already have an existing django project in a directory called "chat", but it needs a different django version than the one installed globally on your machine.


# get dependency package
sudo apt-get install python-virtualenv
# set up a new virtual environment for the "chat" directory
virtualenv --no-site-packages chat
cd chat
# create a requirements.txt file that will list the python modules you need, eg
nano requirements.txt
# use pip to install the packages

Rotate iPhone video with mencoder

mencoder -vf rotate=1 -o OUTPUT.mp4 -oac pcm -ovc lavc INPUT.MOV

batch converting Nikon .NEF images to greyscale JPG

Run this in a directory of .NEF files to
* create a directory "mkdir bw-jpg-greyscale-lightness"
* convert each image to black and white with auto exposure, colors, white-balence, etc.
* save each image as a JPG to the "mkdir bw-jpg-greyscale-lightness" directory

Written by yours truly

#!/bin/sh
mkdir bw-jpg-greyscale-lightness;

for file in *.NEF;
do ufraw-batch $file --out-path=bw-jpg-greyscale-lightness --wb=auto --exposure=auto --black-point=auto --color-smoothing --grayscale=lightness --out-type=jpg;
done

lucid eclipse autocomplete doesn't appear right: solved

Go to System > Preferences > Appearance, choose the theme you want, click "customize", and change the background and text colors for tooltips. You can do it real-time and see your changes, which is great.

Seems like this is a core ubuntu bug, in my book.

adding aliases the easy way

I'm always forgetting the syntax..

echo "alias drush='~/drush/drush'" >> ~/.bash_profile
source ~/.bash_profile

Going commando with flex on ubuntu: mxmlc, fdb, fcsh

No, I did not just sneeze at you. These are the names of the commands you should get to know if you're a bleeding edge Flex developer.

In a nutshell:

mxmlc flashcard.mxml

To get more advanced, specify the path to output the compiled swf to, and mark for debug:

mxmlc -library-path+=libs/as3corelib.swc -debug=true -output=bin-debug/flashcard.swf src/flashcard.mxml

Installing PDT on Eclipse 3.5, Ubuntu lucid 10.04

I couldn't get this working for a while. I had a stock eclipse setup from the Ubuntu repository that I had put Flex Builder in. Next went to install PDT but couldn't get it working whether through a repository, through the eclipse update site, etc.

I didn't realize you need to run eclipse as root to install plugins. and it provides no error message telling you the installation was a complete failure- it just fails to write the plugin files silently. doh!

Here's how to get it working:

- start eclipse as root - sudo eclipse
- Help > Install new software

ubuntu lucid: flex builder w/ sdk 4 on eclipse 3.5 gallymead. no.

UPDATE: I gave up on this approach and moved back to Eclipse Europa 3.3

Much to my dismay, there were just too many bugs trying to get FB to support 3.5 correctly. I had it mostly working, but there are unresolved issues with the ProblemManager Class that caused consistent "internal build error" messages and generally completely unacceptable error reporting.

I don't know about you but the scope of my Flex work is such that I need top-notch error-reporting. And I really don't like having to apply multiple patches to get my IDE to a half-functional state.

Syndicate content