Showing page 7 of 37.


 

code 400, message Bad request version

Lately I have noticed that I kept getting a 400 bad request when doing django development (i.e. using runserver) and browsing through Google Chrome. It was only Chrome that was behaving this way because Firefox would browse without generating any of these errors on the server side.

1
2
3
4
[09/Nov/2010 00:31:53] "GET /acq/ HTTP/1.1" 200 1393
[09/Nov/2010 00:31:53] code 400, message Bad request syntax ('\x16\x03\x00...')
?????????...." 400 -???8 .....?????
[09/Nov/2010 00:33:39] "GET /acq/ HTTP/1.1" 200 1393

I finally took a few minutes to debug. After clearing the cache and browsing data as suggested by many sites and having no luck I started disabling all of the extensions that I had installed. Guess what? The error disappeared.

This issue was being caused by the Secure Sites extension which lets you use secure versions of the site if one is available. In order to figure out whether a secure version is available it does an extra request, and it is this extra request that was causing the problem.

What’s the solution? I went into the options for this extension and added localhost to “Assumed no secure version exists” and the error disappeared.

Read more

Wake on LAN for webOS updated

I just published an updated version of the Wake on LAN (WoL) client for webOS (Palm Pre and Pixi). The latest version supports specifying a custom hostname and port, which means that now you can send WoL packages from to a remote network.

Main screen of the updated version, note the host name and port under the MAC address. Screenshot of the new fields. Preware screen showing the updates.

James Knowles (please see the about screen for contact info) contributed the initial UI changes for specifying a hostname. I added some more information and added the ability to specify a custom port (which required a service update).

To get these changes please update to/install the latest version of the service and UI using Preware.

Read more

Now I know!

...that the monitors at the Chicago O’Hare airport are running Adobe Flash! :)

Someone right clicked on the screen, and now I know that the monitors are running Adobe Flash A close up of the menu

Read more

Low level hotkeys in MediaMonkey

MediaMonkey Logo

MediaMonkey (MM) is my music player of choice on Windows. I have a few global hotkeys setup (for instance WIN+ALT+B for next track), but after an upgrade a few months ago (probably starting with 3.0) I noticed that my shortcuts started sending the shortcut keys to the active applications. So, for instance, while in Outlook if I press WIN+ALT+B, MM will go to the next track, but in addition Outlook will switch views because ALT+B is a shortcut in Outlook.

After a quick post online I found the solution that I was looking for. Basically, I had to edit the MediaMonkey.ini and add “PreferLLKeysHook=1” to the “[options]” section. MediaMonkey.ini will be located in different places based on the operating system, you can find the details in this knowledge base article. Add “PreferLLKeysHook=1” to the “[options]” section in there and restart MM. From there on the shortcut keys will only be interpreted by MM and will not be forwarded to the active application.

Read more

Object is not key value coding compliant

Lately I have been playing around with Objective-C development on mac. As I was working through a tutorial I kept getting the following error for a calculated read-only property.

[<NSManagedObject 0x2000c3c20> valueForUndefinedKey:]: the entity Expense is not key value coding-compliant for the key "filename".

Below is the definition of the class.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
// Expense.h
#import <Cocoa/Cocoa.h>
@interface Expense : NSManagedObject {}
@property (readonly) NSString* filename;
@end


// Expense.m
#import "Expense.h"
@implementation Expense
- (NSString *) filename {
	return @"TestingPath";
}
@end

The class definition is OK so the error didn’t make sense. After some troubleshooting I found out what was causing this. Since this was my first application I didn’t know that I had to tell the model what class it should be using, and, unfortunately, the book that I was using didn’t mention it either (or maybe I missed it).

Anyways, if you get this error then make sure that you have associated the class with the model. To do this you have to specify the class name under “Class” in the model definition (see screenshot below).

Make sure to specify the class in the model (highlighted field)

Read more

Speeding up django's development server on Windows

I am very picky about my development environment and I need it to be just right, otherwise the fun part of programming disappears. I have a dedicated Linux server in my office that is sharing and serving the development files. This is a solid server, fast enough that django’s development server refreshes as soon as I save the files, even before I have switched to my browser; and that’s how I like it! :) Lately I have been on the road quite a bit so I have had to run the development environment on my tablet (when in Windows 7; runs excellent in Linux). The tablet has OK specs: 1.4GHz Core Duo with 2GB RAM and a 7200 RPM drive (generally the bottleneck). But for some reason django’s development server seems especially slow at serving the files. The refreshes after changes are OK, not fast, but OK. It is the media that it is very slow at serving (understandably so).

I did a lot of research on my options to speed this up. I am using the standard CPython distribution on Windows. I saw a lot of references to unladden-swallow, but there weren’t a lot of benchmarks to prove the speed gain yet. I realize that this is still under very heavy development, but the one benchmark that I found really excited me so I decided to give it a try. Unfortunately, after hunting for a number of source code packages necessary for compilation and still not succeeding I concluded that it wasn’t worth the time yet :| I decided to rule out pypy because of the possibility of compatibility issues, I wanted something that I could plug into the existing system. For some of my projects I am using external libraries, which might not work with pypy.

Anyways, my solution ended up involving Apache. Based on the console output of django’s dev server I had an idea that it was slow at serving multiple files. So I decided to serve the media, which generally is the majority of the files in a given view, using Apache and let django’s server deal only with the views. Microsoft’s IIS is also an option, but I had Apache setup for another project so I decided to use that. Below is a part of my dev_settings.py that makes this change.

1
2
3
4
5
6
7
8
9
import socket
# ...

# System specific dev settings.
if socket.gethostname() == "mystic":
	MEDIA_URL = 'http://localhost:8080/projectname_media/'
	SERVE_STATIC_FILES = False
else:
	SERVE_STATIC_FILES = True

With this new combination and using 127.0.0.1 instead of localhost now my dev environment on Windows is fast enough to keep things interesting.

Read more

"Operation change the hinge" is a success, with a few hiccups

Two weeks ago when I came home after using the tablet in a car for a few hours I noticed that the screen won’t turn and that there was a lot of bend by the hinge. I have had this tablet for about three years and the warranty had recently expired. I knew getting it fixed from Lenovo would be expensive and probably more than I was willing to pay. Luckily, Lenovo publishes the hardware guide for most of their products so I downloaded X60’s hardware manual for reference and opened up the LCD to figure out what was wrong.

A very blurry picture of the broken hinge.

As you can see in the picture on the right, the left half of the hinge was broken. I didn’t blame Lenovo for it because I have used this tablet almost everyday, opening, closing and turning multiple times in a single day. The hardware manual was very helpful because it gave me the exact part number (which, as I found out, is also on almost every replaceable part in this laptop, a big plus!) and after about 20 minutes I knew that I could get a replacement part for less $50 (including shipping).

Read more

SBC?

Haha, SBC! :)

SBC, what?

As a programmer I know sometimes this is what you want to say, but what can I say, we have to live with backwards compatibility even if it means twice as much work.

Read more