I lost my streak on GitHub

I had an 18 day streak on GitHub but I lost it due to a cold. I have no energy to code in the evening at the moment, as all I’m doing it sleeping 🙁

Comments (1)

Recovering a bricked Crucial M4 SSD

I own a pair of Crucial M4 256 GB SSDs.  One of them, my boot drive, has caused me no end of trouble recently!  Sometimes, after rebooting, the SSD isn’t detected by the BIOS. This seems to be linked to the 010G firmware, which has caused a lot of complaints!

So far, I have found two ways to recover from this lockup.

Route 1: the official reset way
  1. Disconnect the SATA cable from your SSD, but leave it connected to power
  2. Power your system on and let it sit in BIOS for 20 minutes
  3. Power your system off and disconnect the power cable from the SSD
  4. Wait 30 seconds
  5. Reconnect the power cable
  6. Power your system on again, repeating steps 2, 3 and 4
  7. Reconnect both the power and SATA cables
  8. Power your system back on – it should work now

This apparently does some sort of internal reset. The timings don’t seem to need to be exact – I’ve done it with 30 minutes on power each time before and it worked.

Route 2: the other way
  1. Power your system on and go to the BIOS config screen
  2. Wait for at least 5 minutes
  3. Press the reset button on your computer
  4. Watch in awe as your SSD is detected again

Sometimes the SSD is just slow to be detected by the controller. After a few minutes, though, it’s ready. By restarting the computer without interrupting the power (which is what the reset button does) we’re able to get the SSD online and also have it available before the controller times out. Magic!

Route 3: Update the firmware

There’s new firmware out now that should solve this issue once and for all. Once I’ve finished backing up my computer I will update to 040H and see if it works. I’ll let you know!


Google’s tax avoidance means that I won’t be buying a Nexus 7

I was all geared up to buy a Nexus 7 after Christmas.  By pooling my birthday money and Christmas money, I figured that I could afford a treat.  I’m not going to do that now, though. Here’s why.

I pay tax. The government take a large cut of everything I earn. They use it to fund hospitals, universities, schools, roads, railways and the military. I don’t like everything they spend it on, but I don’t have a choice. Whether you’re a business or an individual, you pay tax. There are pays of avoiding it, of course, but only the extremely wealthy can afford to do this. That’s right, the ones who should be contributing the most are the only ones getting out of it. So much for ‘don’t be evil’ – Google think they’re above the rest of us.

“It’s called capitalism,” [Google CEO Eric Schmidt] said. “We are proudly capitalistic. I’m not confused about this.”

You operate and profit in my country but don’t pay for the public services that you use. In return, I’m not going to buy your shiny new products. You can’t complain, Eric – it’s just capitalism, isn’t it?


Changing the Tomcat heap size under Ubuntu

I always forget this, so I’m going to write it here for future reference.

Let’s assume you have an Ubuntu server.  And you want to run Tomcat on it.  So you install it via apt-get install tomcat7.  As soon as you try deploying anything beyond the most trivial of webapps to it, you’re going to have “out of heap space” exceptions in your catalina.out log file – which, incidentally, will be in /var/lib/tomcat7/logs/

To increase the heap size, edit /etc/defaults/tomcat7 – this is where the JAVA_OPTS variable is defined.


A writer in my mind

I bike to work every morning.  I bike home every evening.  As I pedal through the fog and rain, I think about happier things.  I think about writing.

I’m not sure how many half-articles I have in my mind right now.  A rough count puts the number at way over ten.  I need to start writing these down.  Typing them into the Internet.  I need to… but I don’t.  I think about them twice daily, and then forget about them when I get home.

Let’s see if I can change this (ahem) cycle of not blogging.


I’m now on Github



Installing Apache+PHP on Ubuntu

Assuming you’re running Ubuntu 11.10 or 12.04 (probably works in others) you can install Apache with PHP like this:
$ sudo su
$ apt-get install apache2 php5 libapache2-mod-php5; service apache2 restart

I’m putting this here for my own reference!


Stuck on “reading file 901.ROM” – why EeePC 901 BIOS EZ-Flash isn’t working for you, and how to fix it

I had some fun last night flashing my EeePC 901’s BIOS up to the latest version.    I got the firmware from here and followed this guide.

My Eee sat there displaying “reading file 901.ROM” for about five minutes until I gave up and turned it off.

After a bit of Googling and a bit of thinking, I found the answer: the 4GB pen drive I was using was too big.  I’d formatted it in FAT 16 as required, and allocated a tiny 20MB partition so it wasn’t over the size limit.  Even so, EZ-Flash wasn’t able to read from it.  The limit seems to be 2GB, but I haven’t tested this – luckily I had an old 64MB pen drive lying around from 2003!  Even better, it was already formatted in FAT 16! 😀

I’m documenting this here to help anyone who has this problem in the future.  Good luck!

Comments (3)

If you’re going to write an init script, do it properly

“How do I make my Linux process auto-start?” is a fairly common question.  The answer is fairly simple, thank goodness.  Write a shell script, put it in /etc/init.d and run <code>update-rc.d myScriptName defaults</code>.  And you’re done.

Except you’re not, probably.  If you haven’t written your script correctly, you might well hang the boot process.

Init.d and all those rc.d folders are part of the Unix System V init process.  Unlike modern replacement Upstart, init starts processes in series, never in parallel.  If your startup script doesn’t exit, then init won’t either.  If you’re written a really lazy script that doesn’t detatch after starting a process, then you’re screwed 🙂

Another thing to watch our for is how your script is called.  Init will pass either “start” or “stop” to the script depending on what the process should be doing.  If you don’t handle the difference between these (in a case statement, say) and instead just execute the same code whenever the script is run, you’re going to have a really fun time when you try to shutdown or restart your server.  Especially if your script doesn’t detatch and hangs init.  Because then you’re not going to be able to shut down your server cleanly.

It’s been a fun week for my test VMs!

Here’s a little bonus for you.  If you want to start several processes in a specific sequence, you can do this by writing your startup scripts so they don’t exit until each process is ready.  Init allows you to determine the order in which you start processes within a runlevel (that’s what the numbers in the symlink filenames mean) and you know from the above that you can prevent init from processing the next script in it’s queue.  Use this knowledge wisely.


Running a program as administrator

Windows Vista and Windows 7 have a feature called UAC, which stands for User Account Control. It’s a good idea – programs can’t touch certain files or take certain actions unless you, the user, explicitly grant them administrative privileges. Sounds useful!

To get to the point of this article, as much as UAC is a good idea, it can be very annoying sometimes. Say you want to edit a config file in C:\Program Files\MyApp with Notepad++, your favourite text editor. Normally you’d right click on the file and click “Edit Notepad++” in the context menu. This won’t work in Program Files, though, as it’s a restricted folder. You need to launch Notepad++ with admin rights before you can open your file. (You might be able to read the file without admin rights, but you certainly won’t be able to save your changes!)

Or say you want to do something nifty from the command prompt. In Linux, you’d preface your command with sudo and enter your password when prompted. In Windows, you can’t do that. You need to launch your command prompt with elevated privileges, like so:

That’s: Start -> type “cmd” -> right click -> Run as administrator. Easy.

There’s an obvious downside to this, of course. In Linux you can elevate a single command and then return to being a limited user, all from the same shell. In Windows, though, your command prompt has to be elevated from start to finish. It’s the product of two different cultures. In the Linux world, the command line is king. Everything can be done from it, and it’s usually the best way of doing things. Windows expects you to work with the GUI, though, only dipping into command line mode when you absolutely have to. The GUI has almost everything you need, and you only use the command line for brief periods of time to do obscure things, generally. From that point of view, it makes sense to not have added the ability to elevate commands from within cmd, because you’re not expected to work like that. Completely understandable, but still a shame. Not to mention the source of a lot of nerdrage 😉


« Previous entries Next Page » Next Page »