Categories
Computers Linux Mac

Version control a Rails application with SVN

I have been looking at Git for version control but so far I am using SVN. Whenever I set up a new Rails application and add it to my version control system I do the following to ignore files that should not be version controlled.

  1. Copy the entire project to a folder within my SVN working folder hierarchy
  2. Remove all superfluous files:

  3. rm tmp/*/*
    rm log/*
    rm `find . -name '.DS_Store'`
    rm `find . -name '*.sqlite3'`
    rake db:migrate VERSION=0

  4. Add all files (svn add *)
  5. Set properties on the Rails folders to ignore certain files

  6. svn propset svn:ignore "*.log" log/
    svn propset svn:ignore "*" tmp/sessions tmp/cache tmp/sockets
    svn propset svn:ignore "*.rb\n*.sqlite3" db
    svn propset svn:ignore ".DS_Store" .

  7. Make an initial commit (svn ci -m “Initial import”)
Categories
Computers Linux

Upgrade Ubuntu 6.10 (Edgy) after End-of-life

As of April 25th Ubuntu 6.10 (a.k.a Edgy Eft) is no longer supported. Any attempt to update the software from the standard repositories will therefore result in broken links.

To be able to upgrade the system the first task is to update the system to 7.04 (Feisty Fawn). This is done by replacing all instances of ‘edgy’ in the file /etc/apt/sources.list with ‘feisty’. This can be done manually using a text editor of choice or by running the following command.


sudo sed -e 's/\sedgy/ feisty/g' -i /etc/apt/sources.list

After that it should be possible to run ‘apt-get update’ followed by ‘apt-get dist-upgrade’ to upgrade the system to 7.04. Once there it is possible to use the standard method of upgrading to newer releases:


sudo apt-get install update-manager-core
sudo do-release-upgrade

During the upgrade process you will have to answer questions on what to do with files which have been edited. Run the above multiple times to upgrade to the newest version. It is possible to check the current version by running ‘cat /etc/issue’.

Categories
Computers Gadgets

Default IP addresses and credentials

Just about every network device nowadays is supposed to be configured via the network, usually through a web page. That is all fine but there is always the question of which IP address to use. And once you can contact the device they all seem to have different login credentials. Some manufacturers have done their homework and actually printed the default settings on the device itself but most of the time it is an endless search through quick start guides, user manuals or Internet forums.

I know there are lists of this kind of information but they never seem to have the devices I use, at least not all at the same place. This page is an attempt to fill this void for myself by listing the devices I actually use myself. I will be returning to this list from time to time to update it with new (or old) devices.

Device IP address User Password
Axis 209FD-R DHCP / 192.168.0.90 root (set when accessing first time)
D-Link DWL-2100AP DHCP / 192.168.0.50 admin (blank)
Lacie Ethernet Disk DHCP Administrator admin
Linksys WRT54GL * (blank) admin
Netgear DG834G v2 * admin password
Netgear WGPS606 DHCP / 192.168.0.102 admin password
Voyage Linux 0.5.0 DHCP root voyage
 

* The device has an internal DHCP server. Connect on the LAN side to acquire an IP address. The default gateway provided through DHCP is the IP address of the device.

Categories
Gadgets

Hard reset Nokia N82

Do the following to completely wipe your Nokia N82 device.

  • Type *#7370# from the standby screen
  • Enter the lock code (default 12345)

N.B. Don’t forget to backup data in the phone memory. Content on the memory card is not affected by the above.

Categories
Computers Mac Windows

Bye bye, Remote Desktop Client

Having to manage a bunch of Windows boxes made me download and install Microsoft’s Remote Desktop Client almost as soon as I switched back to using Mac last summer. First I used the current version but as soon as the beta of the Remote Desktop Client v2.0 came out I started using that. A couple of weeks ago I started getting this notification:

Remote Desktop Client - Out of date

However, there is no file to download. Apparently, the application timed out on March 31st but we have yet to learn from Microsoft when the proper version is due.

CoRD to the rescue. CoRD is a SourceForge hosted project to create a free remote desktop client for Mac – and it rocks.

Unless Microsoft comes up with some extremely useful features in their client, I won’t be switching back to RDC.

Categories
Computers Linux

Install Pure-ftpd

pure-ftpd icon

It should be very simple to set up an FTP server on a Linux server but for some reason I always seem to have an issue with it. The first question is which daemon to install when there are so many. The main three contenders seem to be pure-ftpd, proftpd and vsftpd but even choosing between them can be daunting.

Many (if not all) FTP servers seem to have been written with the intent to either providing FTP access for people with shell accounts on the FTP server or for anonymous users. I have no interest in anonymous access and the only one with local account that need file access is myself and I much prefer to use scp via Cyberduck instead. So my requirement for a pure virtual FTP server is usually not mainstream and I invariably find myself lost in all configuration descriptions.

Here is a simple step for setting up pure-ftpd on a Debian system and add an account:

  • Install the server [apt-get install pure-ftpd]
  • Create an FTP group [groupadd ftp]
  • Create an FTP user [useradd -g ftp -d /dev/null -s /etc ftp]
  • Create a folder to hold the FTP data [mkdir /var/ftp]
  • Change owner on the folder [chown ftp:ftp /var/ftp]
  • Add a pure-ftpd user [pure-pw useradd testuser -u ftp -d /var/ftp -N 300]
  • Save the changes [pure-pw mkdb]
  • Run the server [/usr/sbin/pure-ftpd -j -lpuredb:/etc/pure-ftpd/pureftpd.pdb &]

To start the server automatically, use xinetd and add the following to /etc/xinetd.d/ftp:

service ftp
{
socket_type = stream
server = /usr/sbin/pure-ftpd
server_args = -j -lpuredb:/etc/pure-ftpd/pureftpd.pdb
protocol = tcp
user = root
wait = no
disable = no
}

Then restart xinetd (/etc/init.d/xinetd restart).

Categories
Computers Mac

Riding the rails on Leopard

Mac OS X 10.5 comes with support for Ruby on Rails but the included releases were the stable releases at the time Leopard was frozen. Ruby hasn’t changed much but Rails has progressed quite a lot during that time. To make sure that your installation is up to date, do the following:

sudo gem update --system
sudo gem install rails
sudo gem update rake
sudo gem update sqlite3-ruby

This will (currently) bring your Rails version up to 2.0.2. Noteworthy changes to Rails 2.x include:

  • Sqlite3 is now the default database driver. MySQL is still available out of the box but sqlite3 makes it even quicker to set up a test project.
  • It is even more obvious that REST is preferred over SOAP for inter-machine communication under Rails.

For an extremely simple RoR solution, type this in the terminal:

$ rails TimeReport
$ cd TimeReport
$ script/generate scaffold project number:integer name:string
$ rake db:migrate
$ script/server

Then open your web browser and go to http://localhost:3000/projects. Congratulations, you have written your first Rails application.

Categories
Computers Linux

Ping utility with timestamping

Ping is no doubt one of the world’s most wide-spread applications. It is even so common that most people that use it probably don’t even know that they don’t actually “ping” the remote host. What they do is to send ICMP Echo requests and wait from replies.

Despite being great for what it does the standard GNU ping utility (or the Windows application for that matter) fails to record the time when the ping was sent and the output is in some quasi readable format that is not trivial to import into some application.

This Perl script wraps the Linux/UNIX form of the ping utility to output the sequence number and the round trip time as comma separated values. It also prepends each line with the current date and time so that the output can be imported into a spreadsheet to create a graph of the round trip time over time.

N.B. This perl script will not work on Windows since the output format differs from that on Linux/UNIX.

Attachments

Categories
Computers Linux

Installing Voyage Linux on ALIX 2c0

As I wrote earlier, I have bought myself an ALIX 2c0, a smallish embedded computer. It is designed and manufactured by PC Engines and has the following specification:

  • 433MHz AMD Geode CPU
  • 128MB RAM
  • Compact flash slot for storage
  • 2 mini-PCI slots for WiFi or other uses
  • One serial port that is uses as console but can be reconfigured (although limited in functionality

There are number of distributions that could be used on this system. I found Voyage Linux to be the most interesting since it includes the standard Debian package manager. This means that it is effortless to install additional applications.

To get Voyage Linux onto the ALIX I did this (using another computer running Linux):

  1. Download Voyage Linux 0.5.0 or later from the Voyage Linux web site
  2. Untar the archive [ tar –numeric-owner -jxvf voyage-0.5.0.tar.bz2 ]
  3. Change directory [ cd voyage-0.5.0 ]
  4. Create a directory where the compact flash disk can be mounted [ mkdir /mnt/voyage ]
  5. Insert the compact flash disk and check which device name it gets (N.B. be absolutely certain that you get this correct or you may end up wiping your hard drive) – This instruction assumes that the compact flash disk is /dev/sda
  6. Run the script [usr/local/sbin/format-cf.sh /dev/sda] within the downloaded and unzipped archive. This will initialise the compact flash disk – Again, please verify which device name corresponds to the compact flash disk on your system
  7. Run the script [usr/local/sbin/voyage.update]

The script will go through the installation and ask questions. Most of the options will be correct so it is mostly a matter of pressing enter a number of times. What you will want to change is the following:

  • The target profile should be set to “4 – ALIX” instead of “7 – WRAP” which is the default
  • The target disk should be set to whatever device is your compact flash disk (e.g. /dev/sda) – PLEASE check the correct device name on your system or risk wiping your hard drive, but on the other hand if you didn’t heed my warning earlier your disk is already toast.
  • The drive where the compact flash disk should be mounted should be set to the folder created above (e.g. /mnt/voyage)

At the end you will be faced with a summary of all the settings. Check that it is correct and then type “y” to continue. The copying will take a minute or two, after that the compact flash disk is ready. Just place it in the ALIX, connect it to your network and boot.

The system will automatically use DHCP to get an IP address. It can be reached by SSH with the default root password of “voyage”.

Categories
Computers Mac

Install wget on Mac OS X

Mac OS X comes without support for wget but this limitation is easily fixed. Start off by signing up to Apple Developer Connection and download XCode 3.0 – it’s a free but rather big download. Then open a terminal window and type:

ftp ftp://ftp.gnu.org/gnu/wget/wget-latest.tar.gz
tar -xvzf wget-latest.tar.gz
cd wget-{version}
./configure
make
sudo make install

Replace {version} with the version of wget that was downloaded (shown when unpacking the archive).

css.php