Wednesday, March 23, 2011

100% height page in IE8

I set body and html to 100% height and then an inner container element to min-height: 100%

This worked in Chrome and Firefox but in IE8 the container element was not stretching to the bottom of the page.

Eventually I found that the GWT date picker widget and photo viewer on the page were not being included in the height of the page.  By setting a specific height on these elements (reserving the space) IE displays the page correctly.  It also makes the page load look smoother.

Tuesday, March 22, 2011

AppEngine logging level

I tried to change the logging level in my Google App Engine app to FINE to see what was happening in Sitebricks.  I edited the /WEB-INF/logging.properties file to read:

.level = INFO
com.google.sitebricks.level = FINE 
 But still only WARN messages were logged to the console.

Finally I realised that on the launcher dialogue panel for GWT I had to also set the level to DEBUG.  But when I did that the console was flooded with GWT compile messages.  This is due to a new bug in GAE's logging where it tries to use the same settings as GWT but gives you no control of the GWT part.

So I installed a simple logging handler to get around this:


Put this in app init
if (isDevelopment()) { Logger.getLogger("").addHandler(new WorkaroundHander()); }
public boolean isDevelopment() { return System.getProperty("com.google.appengine.runtime.environment").equals("Development"); }
private static class WorkaroundHander extends Handler { public WorkaroundHander() { setFormatter(new TextLogFormatter(false)); setLevel(Level.ALL); }
@Override public void publish(LogRecord record) { if (isLoggable(record)) { System.out.println(getFormatter().format(record)); } } 
@Override public void flush() { } @Override public void close() throws SecurityException { } }


Now I I happily see all the FINE messages that Sitebricks has for me.

Friday, November 26, 2010

New Mail Client for Windows

I had to switch back to a Windows PC recently and found that no email client is installed be default. Unfortunately Gmail does not deal so well with multiple accounts and is a bit clunky off-line.

I tried Windows Live Mail which showed some promise but eventually proved to be so slow and has a very annoying bug which makes writing in-line replies impossible. It sometimes won't let you hit enter and write your reply interleaved with the receivers. Sometimes it does sometimes it doesn't.... very annoying. You just cannot break through that thick black line.

So then I tried Mozilla Thunderbird which I had previously rejected just because the user interface looks a bit clunky. But I tried it again and so far have found it a real pleasure to use. It is very functional and stable. Much better than Apple Mail which would often "wedge" itself when checking for mail and leave me wondering why no emails were received for hours.


Tuesday, October 12, 2010

Lubuntu install removed Windows boot option

I bought an HP Mini 210 netbook which is a great little machine but Windows 7 Starter uses almost all of the meagre 1GB RAM for itself making everything painfully slow.  After a little research I found that the Lubuntu Linux distribution claims to have the lowest memory use of any of the Debian based desktops so I'm giving it a try.

I found I had to be online with an ethernet cable to finish the install because it could not recognise the WiFi card without installing extra drivers.  After updating the software with Synaptic and rebooting I found that the windows options had disappeared from the boot menu. 

To get them back I needed to run:

sudo apt-get install os-probe

sudo os-probe

sudo update-grub

 

Now the windows options are back in the boot menu!

Wednesday, July 21, 2010

New optimisation in Twig for merged parent queries

I have just added a really nifty corner-case optimisation to Twig for merged parent queries (relation index entities) which is needed for Target Rooms location based search.  Target Rooms searches a number of map blocks at the same time using async parallel queries and then merges the results together to get rid of the duplicates. You can see the blocks it chooses by adding the debug parameter:

http://www.targetrooms.com/place/montpellier?debug

See how tightly the blocks fit to the map?  It chooses the blocks using a lowest-cost formula to minimize the amount of overlap and the number of blocks queried. If there is a major city just off the screen Twig may need to sort through thousands of hotels to find the best available prices and then throw them away because they are not on the map. That makes a really slow worst case that was actually quite common before this best-fit approach.

It now asks each child query which entities it wants and gets rid of duplicates before sending off a single request to the datastore for all of them.  When any of the children needs more parent entities it asks this EntitySupplier for more which in turn asks all of the children again if they need any more.

It has speed up the geospatial search HUGELY!  I only recently realised that the complex part of the query (searching 6 blocks of geospatial data in parallel and sorting it by price) was completing in about 50ms!!!  The simple part (bulk get of the parent results) was taking between 200 and 1200ms to do 6 bulk gets.  What a surprise. You can actually see in the Google App Engine Status page that some days each simple get (not even bulk get) can take like 500ms.

Now Twig combines all bulk gets for each child query into a single bulk get which has made a huge improvement.

Eclipse debug running very slow

I hit a problem developing with App Engine which took me a long time to figure out.  I have been flipping between projects so didn't really notice when GAE and GWT started so run so slowly.  I have also been experimenting with JRebel and messing with JVM memory parameters.  Well "suddenly" every started running really really slowly and App Engine would take around 10 minutes to start up and run my 6 async parallel queries.  Was it the new version of App Engine Java introducing a concurrency problem?  Was it that my local datastore local_db.bin was too big - holy shit its 10MB!

After a lot of kafuffle I finally removed all break points and viola - Every thing was lightening fast again!  Even though they were not being hit they somehow slowed the dev server down to a crawl.  What a massive waste of time.

Wednesday, March 17, 2010

GWT Eclipse and testing with Parallels

I use Parallels to run IE6, 7 and 8 for testing my GWT site. I use Bonjour to easily find my local server running on the mac without fiddling with ip addresses that change often. From a windows VM I use something like http://my-computer-name.local:8888/?gwt.codesvr=my-computer-name:9997"

Suddenly after upgrading GWT to 2.0.2 this stopped working - at least the GWT part did but the page still loaded.

The trick is to add an argument to the launch config: -bindAddress 0.0.0.0

Seems that 2.0.2 added a new feature to only bind to localhost by default.