It’s almost too easy with a Raspberry Pi

No Gravatar

I am part of Overskrift.dk – a local social media monitoring service built on a LAMP stack. We are the server itself, but also quite a few older laptops. They do have a couple of downsides though:

  1. Big (-ish)
  2. Clunky
  3. Noisy
  4. Power consuming
  5. Have mechanical harddisks


They each need PHP, cUrl and a MySQL client library installed in order to function – but then they are actually able to support our aggregation tasks quite nicely.

So the other day when a harddisk crashed, I came to think of the Raspberry Pi (popularly dubbed the $25 computer) – It actually set me back DKK 638,- including P&P from a danish webshop (a little more over $100), but that was only because I insisted on a cabinet, a power supply and an SD card. Still I can get three of these for the same price as 1 very low-end netbook. An our after the postman delivered the envelope, it was up and running aggregating away.

Raspberry Pi

From my laptop I downloaded the Raspian “wheezy” SD card image – it downloads a .zip file to unzip into a .img-file. On Mac and Linux the image can easily be copied to the SD card (but taking about 20 minutes). I used this process.

Once the image was downloaded I moved the SD card to theRaspberry Pi unit, plugged a keyboard into one of the USB ports, connected my TV through the HDMI connector and powered up. First boot took about 30 seconds and took me directly to a very nice configuration UI, I set the locale and timezone and asked the ssh-daemon to start on boot.

raspi-config
The Raspi Config UI

Next step was to shut down and move the box over to a LAN connection by my modem. Now only the LAN connection and the power supply was connected.

Coming from the Ubuntu world, installing PHP, cUrl and the MySQL client libraries was a question of logging on,  running

sudo apt-get update
sudo apt-get install php5 curl php5-curl php5-mysql mysql-client

Now I could simply copy my PHP code to the filesystem and set up cron jobs just as I would in Ubuntu.

UPDATE 2014-02-21: It has been almost a year since we started using Raspberry PI’s for our aggregation purposes. Since then, we’ve added a couple of pi’s for this specific purpose and retired all other aggregations machines, probably saving quite a bit on our power bill.

 

Ubuntu 10.4 – up with only one quirk so far

No Gravatar

This morning I let my Ubuntu 9.10 upgrade itself to 10.4. The upgrade itself ran fine with only a few interruptions where I had to confirm or deny changes to configuration files for PHP etc.

As I landed at the office and hooked up the laptop (Thinkpad T61P) however, my external monitor was flickering a lot. Tried booting into Windows and everything was fine. Google’d and found this post on Ubuntu Forums.

The post suggests making changes to menu.lst in /boot/grub. This is a somewhat short term solution, because the problem will probably reappear at the next kernel upgrade (which could be just around the corner). The fix may be on it’s way in an actual Ubuntu fix, but i chose a different approach which may also seem hack’ish – the fix could be more robust though.

Disclaimer: If you are not sure what you are doing, be very careful. Misspellings or deviations from the description below may lead to an unbootable system. This worked for me and doesn’t have to work for you. Make sure to back up any files you change.

OK? Let’s go..

First start a terminal (ALT-F2, enter “gnome-terminal”):

cd /etc/grub.d

Then:

sudo nano 10_linux

which will open an editor. Around line 96 inside the linux_entry-function is a line that looks like this:

linux    ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args}

and it should be changed to:

linux    ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro radeon.modeset=0 ${args}

Having done this, you should ask grub to rebuild it’s configuration files with:

sudo update-grub

Reboot and go on without the flicker..

Karmic Koala – post install notes

No Gravatar

Installed Ubuntu 9.10 a few days ago. Everything seemed OK (very very nice actually) except for a little network performance glitch that may also bother you.√Ǭ† Canonical has once again taken Linux one step further away from the status of geek-challenge to a user friendly alternative to other OS’es.

One thing bothered me though – general network responsiveness seemed seriously degraded. Digging around i found that IPv6 had taken precedence to IPv4 in a few ways – one being DNS lookup sequence. Apparently all lookups was attempted through IPv6 first. My router and network is in no way configured for IPv6 and therefore every connection-attempt to uncached hosts would have to wait for the IPv6 timeout. Two things gave me responsiveness back.

  1. Disable IPv6 at the OS level
  2. Disable IPv6 in Firefox (should give more responsiveness for any OS not running on an IPv6 network)

Maybe you would think that the first step would be enough, but Firefox seems more responsive after step 2. Follow this step to disable IPv6 in Firefox.

Ubuntu 9.10 introduces the GRUB2 bootloader on clean installations only. The upgrade process from, say version 9.04, will not upgrade GRUB and will leave you with the previous version.

To disable IPv6 OS wide, i followed this sequence and voila – responsiveness returned to my netbook (and soon to my other Ubuntu installations).

2009-11-22 update: Had to downgrade to 9.04 again – No matter what I did, which forums I visited – I could not get my Huawei 3G Modem to connect.

Javascript performance on current browsers

No Gravatar

Found this little test which gives an indicator as to Javascript performance in your browser.

On my system (Windows XP on two year old Lenovo T60p laptop) i tried to run it ten times on my browsers with all plugins disabled (lower is better):

Google Chrome: 297,7
Firefox 3.5 beta 4: 340
Firefox 3.0.10: 408,9
Internet Explorer 8: 631,3

As the score is time, lower is better. This is interesing because sites uses Javascript more and more, and as we work more and more online with more applications in the cloud, the Javascript engine has a lot to say about our perception of overall performance.

I got a bit disappointed about my Atom-based netbook – specifically Ubuntu 9.04 on that machine. It never went below 1800 (Firefox 3.0.10) and on the same hardware, the Windows-browsers gives me minimums of 1500 and 2800 for Firefox 3.0.10 and IE8 respectively. Gotta find some tweaks there.

Netbooks – the necessary new design test-tool

No Gravatar

Writing this on my Lenovo S10e netbook, I am furious. It’s before mid-day and yet I have had two experiences of software designs that did not consider netbooks a platform – or at least the new low screen resolution these computers imply. And before you call me a whiner (besides the fact that you’d be somewhat right), this is just a description of the changes I will make to include netbook users as an audience of software and website in the future.

Whine #1: Twice I’ve been cripled by software that saw the low screen resolution as a handicap – one of them on purpose. First I installed Pidgin – the cool cross-platform/cross-protocol IM and IRC client. I like it a lot, but on Windows some dialogs are too big and will not allow me to navigate to the OK/Cancel buttons at the bottomof the settings dialog. Fortunately this is Open Source stuff, so I can just participate and actively fix this myself.

Whine #2: I had to install a printer driver for my HP Photosmart 2575 printer – the install took over one hour because of some “ingenious” package system. That obviously poor user experience decision aside – the minimum requirement for the printer driver is a screen resolution of 800×600 pixels. My S10e runs at 1024 x 576. The consequence – I cannot print from my netbook in Windows because the printer driver won’t finish installing, as it has an irrelevant requirement. Fortunately I am dual-booting with Ubuntu, which has excellent support for my printer (without the requirement)

I’ve read somewhere that 20% of all computers that will be sold in 2009 will be netbooks. Some producers (including Asus) will stop production of 8.9″ -screen netbooks. The 10-inchers seems to dominate right now, and probably for the rest of the year (note: my guess only). Every company designing software will have to take this into account before they ship the next version of any product with a user interface.

I’ve worked on so many web projects with art directors saying: “Nobody runs 640×480 or 800×600 anymore”. Hey we know – but do you know how many users run with their browser maximized because a designer thought up a design that required it? Web designers don’t own the real estate of the users screen resolution – they can only hope to own the area the browser is sized to – and you have to count on users having at least one open history/bookmarks sidebar and/or plug-in and/or Google/MSN/Web developer toolbar enabled.

My point should be rather obvious: It is vital to include netbooks as testplatforms for serious UI-designers or your product will no longer be compatible with the equipment of the customers you want. The rules have changed – live with it.

You may argue that netbook users are asking for it, but if the competing website or software support the netbooks and you don’t – the users is no longer making the decision of leaving you.

Netbooks growing up

No Gravatar

ideapad s10_red

This post is written on my new netbook – a Lenovo ideapad s10e. Actually I had given up on netbooks. My first one was an Asus EEE PC 900 with SSD and that machine was a serious disappointment. I have always liked Asus hardware, mainly because it is extremly well updated with software. That was also the case with the eee 900, but in order to make it cheap enough a cut was made on the CPU and on the keyboard. Actually I think I could live with the somewhat slow Dothan CPU (Celeron’ish), but combined with the poor keyboard the experience was like:

I don’t know if the machine refuses to react on my keypress because the stroke wasn’t registered on the keyboard or because I am waiting for the CPU.

That is of course not acceptable. So the too-cheap netbook has been gathering dust for a while now.

Some colleagues also purchased netbooks. One of them a Medion Akoya (looks very much like the MSI Wind – which 95% of the hardware probably is). It had an Intel Atom processor, which seems to do A LOT for these small laptops. The price did get an extra nudge compared to the Asus eee PC 900, but that can actually mean the difference between a usable and an unusable netbook.

The Lenovo machine is Atom-based, responsive and so far a really really nice piece of machinery. I dual-boot Windows and Ubuntu Linux on it and have yet to encounter missing drivers or missing responsiveness from the keyboard.

As with anything, you get what you pay for and you actually don’t have to pay that much more for a netbook that actually behaves as you would expect.

Ubuntu two-finger scrolling

No Gravatar

My brother is now a fairly long time Mac-user. I haven’t gone down that road (yet). Last night he was here and i showed him my Asus EEE (which is currently running Ubuntu 8.10).

“Cool” – he said. “It supports two-finger-scrolling”. I didn’t know, but he is right. Googling for it found me this. Apparently the touchpad is new enough in the Asus EEE to support two finger scrolling. Nice to find hidden coolness.

Generate PDF files from PHP

No Gravatar

For a web project I needed to create invoices, to be downloaded or e-mailed to clients in PDF format. The platform is PHP and the documentation for this almost exclusively describe PDFLib for this purpose. I am sure PDFLib is fine, and the tutorials that come with the package looks really good.

But..

You pay for PDFLib – I don’t mind paying for software, you should pay for usable high-quality stuff, which I am sure PDFLib is. US$ 995 is a little steep though – compared to free. The FAQ however mentions a few free alternatives. Right now I am looking into FPDF – which seem to do the trick.

Actually I found out that my previous ISP (invoicing their customers only by PDF invoices via E-mail) use FPDF. This tells me that FPDF is more than ready for production. I’ll let you know if I something disappoints me – although I would hate to bash a truly free initiative such as this one. Oh – and by the way it has another edge to PDFLib – It is written in PFP and does not need server reconfiguration to work. If you want a head start, there are quite an extensive list of code examples available.

Simple VPN setup

No Gravatar

Up until today, I have had to make important files from the shares of my home Linux server available as Windows Offline files to have them readily available on the road. I could sftp to my home server and fetch the files, but with the overhead of having to remember to actively upload the files again if they have been updated. I had a hunch that SSH tunnels could help me out, but today I finally made everything work, enabling me to map drives to the Samba shares of my home server through a secure SSH tunnel. Here’s how..

Background info

I am creating this setup using my home Linux server connected to my ADSL connection at home. I want to connect my laptop to my Linux server in order to map the Samba shares as drives on my laptop, when I am connected to the internet at the office or at a client. The Linux server is running OpenSSH which enables me to make regular SSH terminal connections using a client such as Putty, SFTP file transfers using WinSCP AND tunnels – also using Putty.

Uninstall File and Printer sharing for Microsoft NetworksA tunnel through SSH works like this: A service is listening for connection requests on some port on the server -A Samba server listens on port 139 (like any Windows machine that has “File and printer sharing” installed does). When you create a tunnel like this one, you are “rewiring” the network of your workstation telling it to forward all connection attempts to the local port 139 to port 139 of the remote server through a the secure connection supplied by SSH. As only one service can listen on one port at a time, you need to uninstall “File and printer sharing” for your network connections. Please note that when you do this, any folder or printer shared by your computer will no longer be available to other users on your network.

Do it

If you have Samba shares and OpenSSH running on your server and you can connect to it using an SSH client, you only need to change the setup of your client pc.

  1. Install Putty – which should be fairly straight forward.
  2. Uninstall “File and Printer sharing”. Note: If you merely disable the element, this will not work as the service will still listen on port 139 and block Putty from listening on the same port. A complete Uninstall is necessary.

  3. If you already have a terminal connection set up for your server in Putty, it can be reused and you can merely add a tunnel to the connection. To make your initial connection in Putty, simply supply your internet IP address (or domain name if you have one) for your home server, and make sure the standard port 22 is NAT’ed in your router to your server. You may choose to increase security by having OpenSSH run on a port other than 22 – but that is a outside the scope of this post.
  4. Open the Tunnels configuration and enter:
    • 139 in the Source port field
    • The internal IP adress of your server followed by :139 to indicate that you wish to connect to port 139 on the server. In the example below, the internal IP adress of the server is 10.0.0.150

Putty Configuration

Apply your changes and open the connection. Once you have succesfully logged on in the terminal window the tunnel will be established and you should be able to start mapping drives to \\127.0.0.1\remotesharenames.

Feisty Fawn screen resolution issues

No Gravatar

Important: Before you begin, back up your xorg.conf file – a misconfiguration may leave you without a GUI.

Apparently Ubuntu 7.04 does not know either my graphics card (Intel 810) and/or monitor (Dell FP1701). The monitor – one of Dell’s first flat panels – only supports 1280×1024 @ 60Hz, or for some reason 1024×768 @ 75Hz. Ubuntu plays it safe and sets the default resolution to the latter – and choosing 1280×1024 in the GUI is not an option.

To remedy I tried adding 1280×1024 to my /etc/X11/xorg.conf like so:

SubSection "Display"

Depth 24
Modes "1280x1024" "1024x768" "800x600" "720x400" "640x480"

EndSubSection

But booting X makes my monitor sorry – as it probably tries to display “1280×1024 @ 75Hz” which is not supported. I eventually fixed this with this modeline tool. Set resolution to 1280×1024 and the vertical frequency to 60Hz which returned:

Modeline "1280x1024" 109.62 1280 1336 1472 1720 1024 1024 1026 1062

Which i pasted into my xorg.conf like this:

Section "Monitor"

Identifier "DELL 1701FP"
Option "DPMS"
Modeline "1280x1024" 109.62 1280 1336 1472 1720 1024 1024 1026 1062

EndSection


“Boom goes the dynamite” – and I had the optimum resolution at 60Hz.

UPDATE: A few necessary additions

1) You must use the specifications of your own monitor and display adapter to ensure that everything works

2) Back up your xorg.conf file before you begin