Pages

2010-04-05

The real reason why we don't use silverlight or flash

I think I speak on behalf of a lot of people if a say:

A lot of silverlight & flash fans are missing the point: We know about flash. It's not that we somehow do not "get" silverlight. We program Java, PHP, Python, -list goes on and for many of us also includes C# and actionscript. We do use a lot of different frameworks. Learning new stuff is part of our daily grind (and to be honest, we mostly love it.)

We also do struggle with fonts that might or might not be available, css rendered differently in IE etc. We just don't want to add dependencies to
  • big,
  • cpu-hogging,
  • closed source plugins
  • that might or might not be supported on our future favourite operating system
to our nicely crafted and cross browser compatible web sites. Hey, -we might not even be allowed by the customer to do that, and even if we were, I think most of us would explain the customer/boss in question why they should be careful to do that.

2010-03-25

Simple recovery of deleted files from ext3 file systems

Yesterday I finished recovery of about 8000 photos by burning them to DVD and handing them over to a friend of mine.

Recovery of files from ext 3 partitions have long been considered somewhere between hard and impossible, but thanks to free and open source PhotoRec the recovery was done automatically during the night after answering a few, relatively simple questions. Next day I just rsynced the files to my laptop, splitted them into four folders about to fit into DVDs and burned them. It even read the files directly from the dumped img file.

The burning process was actually the one that took most time.

There's one pitfall I'd like to mention, though:

PhotoRec first does a scan to find the block size of the disk in question, and then reads the disk block by block, matching the beginning of each block with a signature database.

The first time I ran the program I chose to scan the entire drive. After scanning the entire drive it had found less than 50 photos. I decided to give it one more try, this time with just one partition. I chose the partition I considered most likely to contain the images, set the paranoid setting to false and chose photos (jpg) only.

This time it found more than 40 000 jpgs. Most of them seemed to be browser cache etc so I filtered out everything smaller than 1 MB.

Because I changed two parameters I can't say why this happened but my best guess is that it happened because the block size was different between the two partitions.

2009-11-03

Spam and malware, with screenshots

Got this fake antivirus message yesterday and thought it might be worth sharing:
This one was rather well crafted, but they obviously didn't take the time to check operating system, even though they found my ip address. (See bottom left.) Here's another one. This one I got in mail a few weeks ago, from a friend who obviously got her email account stolen:

It's in norwegian, and it's readable, but it is quite obvious that she didn't write it. I guess they fed it through google translate. Translated back to english it would become something like (errors intended): "I need you help NĂ… How is you? ..." Wonder what this is going to look like in a couple of years when automated translation gets getter : )

2009-10-29

Windows 7 fail

I downloaded the Release Candidate of Windows 7 earlier this year, and today I decided to give it a try. After booting from the dvd and asking a couple of questions it asks for a cd rom driver(!). What did you say, Microsoft? You are booting from that CD rom drive. You also have a whole DVD to store whatever drivers you need. Every major linux distro I've tried manages include drivers for my cd rom on a CD! Of course, like every other Windows installation it stops more than one time. And of course it doesn't boot into live cd mode before start asking questions, but that is hardly anything new for anybody who has installed Windows more than a couple of times.
Update 2010-06-13: Finally managed to get some trial running on my laptop, and have used Windows 7 for a couple of weeks on my laptop. It behaves a lot better on my three year old laptop than Windows XP ever did, but I don|t know if this is because of Windows 7, or because it doesn|t contain hp drivers.

2009-10-18

Creating Drupal themes from scratch

If you want to create Drupal themes from scratch, i.e. you do not want to modify an existing theme but rather paste your own html and insert placeholders, MODx style, then this post is for you.

MODx has long been my favourite framework because of it's simple and powerful templating system (copy and paste your html, insert placeholders, go), but recently the lack of visible activity has convinced me to look for other alternatives. I bought "Using Drupal" and "Joomla! A User's Guide: Building a Successful Joomla! Powered Website". One of the reasons I never started to use Joomla! was that it always seemed like it would force me to organize content into two levels. After reading a few pages of the book I found out that it was in fact true. So I put the Joomla! book down and started reading "Using Drupal".

Drupal seems a lot more flexible. The thing that has always scared me away from Drupal and back to MODx is templating. Here is an example: http://drupal.org/node/11774 The templating system is very flexible, -and may seem very complicated.

In addition to this, the ultimate beginners theme, Zen, actually complicates things further if you, for instance, would like to move an existing site to Drupal, or if you want to unpack the html from the designer, insert your placeholders and test it. At least that's my conclusion so far.

Here's a simplified version of my current workflow: 
  • Use a standard theme for your admin pages:
    • Adjust settings under http://<yourservername>/admin/settings/admin
  • Download an empty theme. The best I've found so far is foundation
  • Unzip and paste into themes folder.
  • Rename page.tpl.php in the empty theme to something else.
  • Paste your html to a new file called page.tpl.php.
  • Using the old page.tpl.php as reference, insert similar placeholders into the new one.
  • Enable and test.

2009-10-15

I'm new with drupal, and I wish sobody told me this yesterday: To make an absolute link to an image in a theme, without worrying about where the theme is going to be installed, you can do the following:

<img alt="logo" src="<?php echo(base_path().drupal_get_path('theme','your_theme_name'))?>/img/some_image.png" />

If you are using phptemplate, the drupal_get_path-call might be substituted by just $directory, making it even simpler:

<img alt="logo" src="<?php echo(base_path() . $directory )?>/img/some_image.png" />

The second one was found here:  http://drupal.org/node/52520

Netbeans got a nice css preview

Was doing some spare time drupal work in Netbeans 6.8 when I suddenly found out it had working css preview. See screenshot below for details:
Logging into my other (work ) account I found it in Netbeans 6.7 too, which explains why it wasn't mentioned in NetBeans 6.8 -- New and Noteworthy