Wednesday, October 7th, 2009 by Niall
Requirement
I need to do a quick prototype of a web app for a friend that has to run initially on a windows localhost and be able to hand it over to his developer for development if it floats the necessary boats. Totally coincidentally, I need to do a prototype for a web app at work too.
Tech Choice Breakdown
I haven’t spent anytime with Ruby On Rails and precious little doing web apps of any kind. Ruby I’ve scripted with a little, any web ui’ed stuff has usually ended up in hasty perl on the intranet. RoR is something I have meant to fit in for a few years.
So, I’ve dug in the library and found the Pragmatic Programmers Agile Web Development With Rails by DT, THH et al, 2005 edition. I understand Ruby and Rails have upped a version or two since then, so I’m tempted to use the book and stick with version 1.x of Rails.
InstantRails 1.7 looks like it hits the two requirements of providing quick start up for my friend, and being version 1.x of Rails so I can use the THH book to get up to speed.
Promise to self is to upgrade once prototype 0.2.x is motted on either system, probably looking at JRuby as well.
Installing InstantRails
- Snagged InstantRails 1.7 on advice from Pragmatic Programmer forum (slightly different topic, I know, but looks as though it may apply with my old book). Work is shaping network traffic, so took a bloody age to download.
- Extracted the zip contents to C:\, now have a directory C:\InstantRails.
- Opened C:\InstantRails\readme.txt and followed the instructions. One functioning server – tick
Now need to do some Use Cases and get on with it….
Posted in 1 | Leave a Comment »
Friday, August 14th, 2009 by Niall
Q: Why did the tachyon cross the road?
A: Because it was on the other side.
Posted in 1 | Leave a Comment »
Thursday, June 18th, 2009 by Niall
I hate chain letters. The underlying conceit of a chain letter is to make the sender feel guilty or afraid for not sending it on, to make the receiver feel annoyed at the sender for involving them, and to perpetuate that cycle ad nauseam. It may seem harmless at first touch, but if you forward one you are being manipulated by the original author. Even if you just send them on but don’t feel anything, some of the people you target, or indirectly target, are going to have a bad day or two because of it, because of you. So just don’t send them on: no-one’s hurt; it doesn’t cost you anything; and you’ve saved some of your bandwidth. It wasn’t that funny or clever anyway. Just full of platitudes or bad info.
I try to kill these damn things; to stop them everytime I see one (cue rousing music, maybe some kilted people thrusting swords in the air, general cheering, and exeunt all stage left (pursued by bear)).
My standard reply to chain letters:
Hi So-andSo,
Please don’t be offended, this is no reflection on you, but please don’t include me on any chain letters. I don’t like them. I find the concept underlying them offensive and divisive. If I had a religion, they’d be against it!
The wikipedia page is pretty evenhanded about them: http://en.wikipedia.org/wiki/Chain_e-mail and this is good mickey-take: http://www.perry.com/bizarre/antichn.html
Something lovely and generally ignoring the whole chain letter thing so hopefully there’s no bitter aftertaste.
If it’s a virus/worm/hoax email of any kind, I look it up on Virus Encyclopedia, Sophos, or Hoax Slayer and email the sender with the ref and an explanation.
Posted in 1 | 2 Comments »
Wednesday, March 18th, 2009 by Niall
I wanted to use this excellent command line from commandlinefu.com on the mac to create a podcasts playlist on my G1 each time I chucked some new podcast files on it. Unfortunately OSX (or BSD) aren’t exact matches to linux, so here’s my hack. It’s not elegant, too many pipes, but it works!
cd /Volumes/NIALLSG1/Music/Podcasts && find . -type f -exec stat -f "%c %N" {} \; | grep -v '\./\._' | grep -v m4v | sort -rn | sed 's/\.\//;.\//' | awk -F ';' '{print $2}' > ../podcasts.m3u
On my mounted G1 all my podcasts live in /Volumes/NIALLSG1/Music/Podcasts. I generate the podcasts.m3u to the Music folder.
The stat prints the created date as seconds from the epoch followed by the file name.
The first grep -v removes the stupid itunes symbolic links (mutter, mutter) that get copied across from the listings in iTunes, the second removes video podcasts as the Music Player doesn’t play the video.
The sort gives us the list sorted on created date descending.
The sed gives me an easy delimiter to use in the awk. A cheaty bit I know.
The awk spews out the filenames only for the write to the m3u file.
Teh usual caveats apply; your mileage may vary; be careful; etc.
Posted in makeitbetter, music | Tagged android, bash, commandlinefu, g1, mac, music, osx | Leave a Comment »
Monday, March 16th, 2009 by Niall
Using:
- OS:
$ lsb_release -a
Distributor ID: Ubuntu
Description: Ubuntu 8.10
Release: 8.10
Codename: intrepid
- php 5.2.6
- mysql server 5.0.67-0ubuntu6
Added pre-requisities php libraries:
sudo apt-get install php5-cli
sudo apt-get install php5-curl
sudo apt-get install php5-mysql
sudo apt-get install php5-gd
sudo apt-get install php-gettext
- Check mbstring is installed:
php -i | grep -i mbstring
If you get some output, you should be OK.
- Check xmlwriter is installed:
php -i | grep -i xmlwriter
If you get some output, you should be OK.
Added nice to haves:
sudo apt-get install php5-memcache
sudo apt-get install php-pear
sudo apt-get install php5-dev
sudo pecl install mailparse
- Not sure whether you need this, but did it anyway as seemed logical at the time:
sudo vim /etc/php5/conf.d/mailparse.ini
and add:
# manual configuration for php mailparse module
# yourInitials 16-mar-09
extension=mailparse.so
- Install Sphinx Server. Not sure how/when we’ll config this, but it’s as well to get it in before we’re asked for it:
sudo apt get install libmysqlclient15-dev
wget http://sphinxsearch.com/downloads/sphinx-0.9.8.1.tar.gz
tar -xvf sphinx-0.9.8.1.tar.gz
cd sphinx-0.9.8.1/
./configure
make
sudo make install
- Check it’s in OK:
search
You should see output starting with: Sphinx 0.9.8.1-release
sudo apt-get install php5-xcache
I suggest you also install phpMyAdmin for looking after the mysql databases if you haven’t already. I’m certainly not hard enough to do all the sql work from the command-line
Just in case restart Apache:
sudo /etc/init.d/apache2 restart
And now, we begin. Rather marvellously Mr Prodromou has just released a new laconia update, version 0.7.2.1, which includes a “first version of a web-based installer”. I’m following the instructions from the README file in the download. Here goes…. Just followed the instructions and I have a functioning install! Mwah-ha. Mwah-ha! Mwah-ha-ha-ha-haaaaaa! I have the power. etc.
Things not working: Fancy URLs. But I’ll get ’round to that.
UPDATE: run sudo a2enmod rewrite to enable the apache rewrite engine so you can use fancy urls and then follow the instructions in the README for .htaccess.
Posted in 1 | Tagged howto, intrepid, laconica, php, sphinx, ubuntu | 1 Comment »
Thursday, March 12th, 2009 by Niall
Whilst learning how to use git with svn I am documenting the way I’ve done it. I’m using bash and am starting from the directory above my working directory. The project is checked out already from an svn repo. The working directory is “efot”.
Now for the paranoid amongst us, cross the i’s and dot the t’s
:
cp -R ../efot.pregit/src . ; cp -R ../efot.pregit/testsrc .;cp -R ../efot.pregit/xml;cp ../efot.pregit/.classpath . ; cp ../efot.pregit/.settings .;
git add .
git commit -a
- update from svn:
git-svn fetch
- if any come in on the fetch, replay any git changes onto it (shouldn’t be any at this point):
git-svn rebase
- commit to svn:
git-svn dcommit
Job’s a good’un. I think.
Refs: Git User’s Manual, Flavio Castelli, and Git Crash Course.
Posted in 1 | Leave a Comment »
Wednesday, March 11th, 2009 by Niall
I can never get this syntax to stick in my head.
ALTER TABLE someTable
ADD CONSTRAINT DF_someTable_someColumn DEFAULT getdate() FOR someColumn
Posted in makeitbetter | Leave a Comment »
Tuesday, March 10th, 2009 by Niall
Whilst learning how to use git with svn starting from a new item in the trunk, I’ve hit a couple of snags and am documenting the way I should have done it.
- Create your new working directory and add it to svn first:
mkdir efot && svn add efot && svn commit efot -m "starting the new project"
(Note the revision number for later)
- Make sure svn will ignore git files:
svn ps svn:ignore ".git" efot
- Now we go to setup git:
cd efot
- Initialise git:
git svn init https://svnServer/repos/section/trunk/efot
- Get the right revision from svn using the revision number you got in 1:
git-svn fetch -r2424
- Make sure everything is really, really, really ready
: git-svn rebase
- Make sure git ignores .svn:
vim .git/info/exclude
- add “.svn” (without the quotes) to the bottom of the file
- save and quit.
- At this point you’re ready to go. Create your usual directory structure and add it to git:
git add .
- Do your first commit to git:
git commit
- Add a file:
touch showMe.txt
- add to git:
git add .
- commit to git:
git commit -a
- update from svn:
git-svn fetch
- if any come in on teh fetch, replay your git changes onto it:
git-svn rebase
- commit to svn:
git-svn dcommit
Job’s a good’un. Thanks to Flavio Castelli
Posted in makeitbetter | Tagged git, git-svn, subversion, svn | Leave a Comment »
Saturday, March 7th, 2009 by Niall
If you’re a developer moving to a Mac may I recommend, from my own experience, you do these three things before you try and do anything at all other than using iLife or M$ Office:
- Install XCode Tools. You’ll need your OSX install DVD, select Optional Installs/Xcode Tools, and run the XcodeTools.mpkg. Budget an hour for it to install, hope for 40 mins. Maybe better on the Intels.
- Install MacPorts. It makes life so much easier than trawling the web trying to understand the esoterica of Mac OSX standard installs of various things like mysql, sqlite, python and ruby. None of them work quite the way I expect them to, and the hacking to try and understand what’s different, and then how to fix it, is so time consuming I have bypassed them and use MacPorts. It looks like a shedload of other people do too.
- create a .bash_profile file in your home directory. Use this for aliases (.bashrc doesn’t work).
All I can think of right now.
Posted in 1, Design & Development, makeitbetter | Tagged development, mac, macports, osx, xcode | Leave a Comment »