Archive by Author

Enabling mod_rewrite in Apache under Ubuntu Server

Here’s some quick instructions on enabling mod_rewrite in Apache under Ubuntu 10.04 Server.

  1. sudo a2enmod rewrite
  2. sudo vi /etc/apache2/sites-available/default
  3. Change “AllowOverride” from “None” to “all” for the /var/www directory.
  4. sudo /etc/init.d/apache2 restart

That’s it!

Arduino with Sparkfun 7-segment Serial Display

Here’s a quick example of getting an Arduino working with a Sparkfun 7-Segment Serial Display. This short example just counts up from zero to 9999.

Connections

  • Arduino 5v pin to “VCC” on LED module
  • Arduino GND pin to “GND” on LED module
  • Arduino TX pin to “RX” on LED module

Source Code


int i = 1;
char buf[12];

void setup() {
Serial.begin(9600);
Serial.print("v");
}

void loop() {

sprintf(buf, "%04d", i);
Serial.print(buf);

if(i<9999) i++;
delay(1000);
}

Installing Peerguardian Linux on Ubuntu 10.10

Here are some quick notes on how to install pgl under Ubuntu 10.10.

1. Add the gpg key to the apt keyring: -

gpg --keyserver keyserver.ubuntu.com --recv 9C0042C8
gpg --export --armor 9C0042C8 | sudo apt-key add -

2. Add the repository sources to your /etc/apt/sources.list: -

vi /etc/apt/sources.list

deb http://ppa.launchpad.net/jre-phoenix/ppa/ubuntu maverick main
deb-src http://ppa.launchpad.net/jre-phoenix/ppa/ubuntu maverick main

3. Update packages & install pgl: -

sudo apt-get update
sudo apt-get install pgld pglcmd

(Answer the questions during installation process.

4. To check status: -

sudo pglcmd status

Checking video codec information via the command-line

Here are a couple of commands to get he information about a video file in Linux (bitrate etc): -

 ffmpeg -i foo.avi 
 mplayer -vo null -ao null -identify -frames 0 foo.avi 

VirtualBox piix4_smbus Error

VirtualBox 3.2.10 gives me the following error message when booting Ubuntu 10.10: -

piix4_smbus 0000.00.07.0: SMBus base address uninitialized - upgrade bios or use force_addr=0xaddr

This error is caused by VM having no smbus but Ubuntu always trying to load the module. It doesn’t affect anything but is a bit annoying – to fix: -

1. Check module is being loaded: -

lsmod | grep i2c_piix4

2. If so, blacklist it in /etc/modprobe.d/blacklist.conf, by adding the following to the end of the file :-

blacklist i2c_piix4

3. Update the initramfs

update-initramfs -u -k all

Serial connection to Seagate Dockstar via FTDI USB-Serial Cable

Here’s a quick summary of how to use a FTDI data cable to connect to a Seagate Dockstar.

Requirements

Making the Connector

  1. Cut the cable of the Xbox power connector in half.
  2. You’re interested in the 3 pins at the top left (looking from behind), so seperate these and strip them.
  3. Snap a strip of male header pins so that you have 5 pins. Remove pins #2 and #3
  4. Solder the top left-most pin (GND) to header pin #1
  5. Solder the top next pin (TX) to pin #5
  6. Solder the top third pin (RX) to pin #4

Connecting

  1. Plug pin #1 of the header pins into the socket to connect to the black cable of the USB-serial cable
    (this will mean that pin #4 goes to the orange, and #5 to yellow)
  2. Open your dockstar and plug the xbox connector onto the header pins (if you orientate your dockstar so the header pins are at
    the top, the xbox top-left wire connects to the dockstar top-left pin)
  3. Plug in your USB-serial cable to your PC
  4. Open putty and use the following connection settings: -
    Serial
    Serial line: COM5 (or whatever COM port the USB-serial adapter has)
    Speed: 115200
    Data bits: 8
    Stop bits: 1
    Parity: none
    Flow control: none
  5. Click “Open” in putty
  6. Power up the Dockstar
  7. Watch the putty window – the boot-up messages should appear.

Connecting an Arduino to a Seagate Dockstar

Here’s a quick summary of how to connect your arduino to a Seagate Dockstar.

Checking connection

1. Install Plugbox Linux on the Dockstar (via http://plugapps.com/index.php5?title=PlugApps:Pogoplug_Setboot )

2. Plug in arduino to Dockstar via USB cable

3. Check arduino recognised

[root@Plugbox ~]# dmesg

The bottom lines should look something like: -

[ 126.200168] usb 1-1.3: new full speed USB device using orion-ehci and address 4
[ 126.382290] usbcore: registered new interface driver usbserial
[ 126.382974] USB Serial support registered for generic
[ 126.383709] usbcore: registered new interface driver usbserial_generic
[ 126.383722] usbserial: USB Serial Driver core
[ 126.401088] USB Serial support registered for FTDI USB Serial Device
[ 126.401283] ftdi_sio 1-1.3:1.0: FTDI USB Serial Device converter detected
[ 126.401569] usb 1-1.3: Detected FT232RL
[ 126.401582] usb 1-1.3: Number of endpoints 2
[ 126.401592] usb 1-1.3: Endpoint 1 MaxPacketSize 64
[ 126.401601] usb 1-1.3: Endpoint 2 MaxPacketSize 64
[ 126.401610] usb 1-1.3: Setting MaxPacketSize 64
[ 126.402330] usb 1-1.3: FTDI USB Serial Device converter now attached to ttyUSB0
[ 126.403067] usbcore: registered new interface driver ftdi_sio
[ 126.403080] ftdi_sio: v1.6.0:USB FTDI Serial Converters Driver

4. Check which device to use

[root@Plugbox ~]# ls -ltr /dev/ttyU*
crw-rw---- 1 root uucp 188, 0 Oct 29 13:17 /dev/ttyUSB0

Communication via Command Line

1. Configure serial port (taken from http://www.arduino.cc/playground/Interfacing/LinuxTTY)

[root@Plugbox ~]# stty -F /dev/ttyUSB0 cs8 19200 ignbrk -brkint -icrnl -imaxbel -opost -onlcr -isig -icanon -iexten -echo -echoe -echok -echoctl -echoke noflsh -ixon -crtscts

(19200 should match the baud rate set via Serial.begin(XXXX) in the arduino program)

2. Read data from arduino: -

[root@Plugbox ~]# cat /dev/ttyUSB0

3. Send data to arduino: -

[root@Plugbox ~]# echo "Hello Arduino" > /dev/ttyUSB0

Communication via Minicom

1. Install minicom

[root@Plugbox ~]# pacman -Sy minicom

2. Fire up minicom

[root@Plugbox ~]# minicom -D /dev/ttyUSB0 -b 19200

Creating EFI String for Asus 8400GS Silent

There are a number of ways of getting your graphics card working within OS X (in order of difficulty) : -

  • Adding “GraphicsEnabler=Yes” to Chameleon /Extra/com.apple.Boot.plist
  • Adding EFI string to Chameleon /Extra/com.apple.Boot.plist
  • Using an injector such as NVInject or NVEnabler
  • Patching your DSDT file

The first one didn’t work for my Asus Silent EN8400GS, so here’s how I generated and added an EFI string.

First, install “gfxutil

Next, get the location of your graphics card by entering the following: -
gfxutil -f display

You should get something back like this: -

DevicePath = PciRoot(0×1)/Pci(0×1,0×0)/Pci(0×0,0×0)

Next, create a file called “graphics.plist” which is the following (but put your settings in): -

<?xml version=”1.0″ encoding=”UTF-8″?>

<!DOCTYPE plist PUBLIC “-//Apple//DTD PLIST 1.0//EN” “http://www.apple.com/DTDs/PropertyList-1.0.dtd”>

<plist version=”1.0″>

<dict>

<key>PciRoot(0×1)/Pci(0×1,0×0)/Pci(0×0,0×0)</key>

<dict>

<key>@0,compatible</key>

<string>NVDA,NVMac</string>

<key>@0,device_type</key>

<string>display</string>

<key>@0,name</key>

<string>NVDA,Display-A</string>

<key>@1,compatible</key>

<string>NVDA,NVMac</string>

<key>@1,device_type</key>

<string>display</string>

<key>@1,name</key>

<string>NVDA,Display-B</string>

<key>NVCAP</key>

<data>BAAAAAAAAwAEAAAAAAAABwAAAAA=</data>

<key>NVPM</key>

<data>AQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA==</data>

<key>VRAM,totalsize</key>

<string>0×20000000</string>

<key>device_type</key>

<string>NVDA,Parent</string>

<key>model</key>

<string>nVidia Geforce 8400GS</string>

<key>name</key>

<string>display</string>

<key>rom-revision</key>

<string>nVidia Geforce 8400GS OpenGL Engine</string>

</dict>

</dict>

</plist>

Next you need to generate a hex string to be inserted – run the following command: -

gfxutil -i xml -o hex graphics.plist graphics.hex

This will create a “graphics.hex” file in the current directory.

Lastly, copy and paste this string into your /Extra/com.apple.Boot.plist file in the following format: -

<key>device-properties</key>
<string>640200000100000001000000580200000d00000002010c00d041030a010000000101060000010101060000007fff04001e00000072006f006d002d007200650076006900730069006f006e000000270000006e5669646961204765666f72636520383430304753204f70656e474c20456e67696e6522000000400030002c006400650076006900630065005f00740079007000650000000b000000646973706c6179100000004e00560043004100500000001800000004000000000003000400000000000007000000000e0000006e0061006d00650000000b000000646973706c617914000000400030002c006e0061006d0065000000120000004e5644412c446973706c61792d41100000006d006f00640065006c000000190000006e5669646961204765666f726365203834303047530e0000004e00560050004d000000200000000100000000000000000000000000000000000000000000000000000014000000400031002c006e0061006d0065000000120000004e5644412c446973706c61792d4220000000400031002c0063006f006d00700061007400690062006c00650000000e0000004e5644412c4e564d6163220000005600520041004d002c0074006f00740061006c00730069007a0065000000080000000000002020000000400030002c0063006f006d00700061007400690062006c00650000000e0000004e5644412c4e564d616322000000400031002c006400650076006900630065005f00740079007000650000000b000000646973706c61791c0000006400650076006900630065005f00740079007000650000000f0000004e5644412c506172656e74</string>

Reboot and voila! You should have Quartz Extreme (QI) and Core Image (CI) enabled – open up Front Row, if it works then you’re done!

Sub-£200 Hackintosh

Here are the specs of my soon-to-be-built hackintosh…

Gigabyte GA-G31M-ES2L iG31 Socket 775 mATX Motherboard
Manuf Code: GA-G31M-ES2L
£ 32.35

Intel Celeron Dual Core CPU – E1500 2.2 GHz (800 MHz) Socket 775 512kb Cache
Manuf Code: BX80557E1500
£ 34.63

Asus 8400GS Silent 512MB DDR2 DVI VGA Out PCI-E Graphics Card
Manuf Code: 8400GSILENTP512MA
£24.86

Crucial 2GB DDR2 800MHz/PC2-6400 RAM
Manuf Code: CT25664AA800
£ 34.00

Shiny Piano Black/Silver Slim MicroATX Mini Tower Case With 400W PSU
Manuf Code: 908BL
£ 31.05

Netgear GA311 PCI Network Card
Manuf Code: GA311-100PES
£ 16.49

Sony AD-5240S 24x Dual Layer SATA DVD±RW
Manuf Code: AD-5240S-0B
£ 15.30

TOTAL : £ 188.68

Ok, I’ve cheated a little bit – I already had an old 80GB SATA Hard Drive which I will use for this PC, but they can be picked up for around a tenner on ebay…

Installing Torrentflux on the Viglen MPC-L

This is a quick guide to installing Torrentflux on my Viglen MPC-L.

First, make sure that python, mysql-server and mysql-client are installed.

Then simply install the software with apt-get: -

    sudo apt-get install torrentflux

Once it is installed, point your web browser at the following location (where a.b.c.d is the IP address of your Viglen).: -

http://a.b.c.d/torrentflux

…and then start uploading .torrent files to it.

By default, files are saved in the following location: -

    /var/cache/torrentflux/

By default, the ports used are 49160- 49300, so remember to open these on your firewall/router.