Pages

2010-09-29

Using web2py, first impressions

I've had the opportunity to do some quick prototyping in web2py in my spare time over the last few weeks. Here are some very quick notes about what to like and what not to like:

Good:
  • Works out of the box. Just download, open, choose password, press start. Your default browser starts automatically.
  • Automatic updates (beta warning, bur works.)
  • Built in editor and version control.
  • Built in user registration and management.
  • Automagic migrations (connecting to legacy databases are supported and documented, too)
  • Built in support for multiple databases, including distributed transactions.
  • Built in sqlite database, and postgres, mysql and even mssql seems to be just one config setting away.
  • The whole official book is available online.
  • Author intends to keep the api stable. (For anybody who has had the joy of supporting an application over multiple years and multiple versions of the same framework.)
  • Bonus point 1: Nice default look and feel, and it is easily customizable. It's just html with placeholders.
  •  Bonus point 2: Applications built on top of web2py can be packed, downloaded and installed on another instance.

Needs improvement:
  • The documentation. There is lots of official documentation, but the search engine is next to useless, and google picks up old, outdated blog post before the official documentation.
  •  Routing: From the official documetation: The url http://127.0.0.1:8000/examples/default/status/x/y/z?p=1&q=2 will presented to the controller as:
    • request.args ['x', 'y', 'z']
    • request.get_vars <Storage {'p': 1, 'q': 2}>
      Why you'd like to separate between those are beyond my understanding. I always thought unifying those was one of the features of modern web frameworks.

Preliminary conclusion:


web2py is production ready and is already used a few public facing sites. To me it seems like a perfect match for small "intranet applications" but it is in no way limited to this.

Although I've not programmed apex myself, it often comes to mind because of features like online editing and redistributable applications built on top of it.

2010-05-30

Getting ipythonx to work with Mac OS X

If you're trying to get ipythonx to work under Mac OS X 10.6 Snow Leopard you might get and error message like this:
ImportError: /System/Library/Frameworks/Python.framework/
Versions/2.6/Extras/lib/python/wx-2.8-mac-unicode/wx/
_core_.so: no appropriate 64-bit architecture (see "man 
python" for running in 32-bit mode)
Here's a couple of hints:
  1. Use standard ipython instead. Unless there was something I didn't catch, ipython seems to better than ipythonx.
  2. If you want to try anyway here's the easiest way I found: In a terminal session:
    1. export VERSIONER_PYTHON_PREFER_32_BIT=yes
    2. python `which ipythonx`

2010-05-25

Copy OpenVPN settings from Tunnelblick on Mac OS X to Windows 7

I forgot the charger for my job laptop in the office today. So I spent the last few minutes of battery copying the configuration files to the pc at home.
Below is what I ended up doing:
  1. Install OpenVPN software. You can find it on the official OpenVPN site.
  2. Copy all the config files from the job laptop to C:\Program Files (x86)\OpenVPN\config. The job laptop uses tunnelblick, so the files was located under
    ~/Library/Application Support/Tunnelblick/Configurations
  3. Added .opvpn to the file name for the main configuration file (the one that is not .crt, .csr or .key)
  4. Change to Windows style line endings. I did this by opening the files in WordPad, copying the contents to a Notepad window and saving.
  5. Starting the client software.
Of course: There was a lot of trial and error. I guess I ended up using 30 minutes tinkering and 30 minutes blogging.
Gotchas:
  • Make sure all line endings are corrrect. You can see this easily by opening the files in Notepad.
  • Make sure you run the OpenVPN program as administrator.

2010-04-09

Swithing to Mac - one year after

This has been a long time coming, but here it is: My "Switching to Mac story".
I've been working on this for almost a full year. It started with three optimistic blog posts about the things I learned while unlearning Windows, and then reality struck me: I thought Mac supposed to be almost like Linux, supported. It is not.
Here is a nice summary of the differences between Mac and PC: Top Ten Things They Don’t Tell You About Switching. Below are just my additions.

The keyboard:

+
  • it is backlit
-
  • weird layout (ctrl/fn keys are switched and there is no setting anywhere to get them back)
  • missing keys (page up/down, home/end, print screen) comes to mind.
  • I can hear what some of you are thinking: It's just a matter of taste. Well, a normal (not laptop) Apple keyboard has ctrl in it's correct position, so it's obviously not a usabilty thing or a design thing but rather a "we don't care"-thing.

Software:

+
  • many small companies offer all kinds of small programs for mac
-
  • every program looks different
  • few of them is anywhere near usable without a mouse or touchpad. Placing all menus on top of the screen makes this even worse.
  • often you'll find functions hidden away behind a gear icon that may hide anything. No visual clue until you click on it. Same goes for the strange button at the top rigt of every window that will hide something.
  • Don't expect free and open source software that runs on both Windows and Linux to be available on Mac. Some programs, like Gimp, runs somehow, but looks really ugly as they are running in some kind of X11 terminal.
  • Even on programs that are available, you can expect to wait a little longer before new releases are available, and you'll also have to expect a few extra bugs. Of course this is not Apples fault, but you might like to keep it in mind anyway as you might be going to suffer from it.
Will I ever buy another Mac? Not likely. Not until they fix the keyboards and keybindings.
A few things comes to mind as for why I'd prefer a Mac over a standard pc running Linux, though:
  • iTunes (best way to buy music in Norway, where I live)
  • MagSafe power
  • Good screen
  • Less likely to break down while at a customer site

Appendix: The hopeless keyboard addicts guide to the Mac keyboard:

I was about to make a table here, detailing how to get at least home/end and pageup/down in the most used programs. But then some programs even differ inside of the program (like, "home" and "end" are mapped to different key combos depending on if you are located in the address bar of you browser or in a text area. This is especially funny when you've almost finished some writing on a blog, a company intranet etc, you want to select one line of text to move it around, and you forget that the key combo that means mark to start of line in one application means go to previous page in the browser. This particular one has hit me twice.)
Here are a few hints anyway:
  • ctrl+a go to start of line. Works in almost every program, including terminal, but doesn't work together with shift.
  • ctrl+e go to end of line. Works in almost every program, including terminal, but doesn't work together with shift.
  • cmd + arrows/fn + arrows - may or may not works for either home/end. Depends on mood of programmer, moon phase when program was written or some other, unknown parameter. If one doesn't work, try another, they rarely do anything really wrong except triggering the web browser back action.
  • cmd+shift+4 - screenshot, choose area. Press space to select a whole window.

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 : )