Grails active page navigation menu

A Common feature found in many CMS’s or web-apps is a navigation menu with a highlighted active page, or the parent of the current page in a hierarchy. The trick is getting the proper element with an added CSS class of ‘selected’ or ‘active’. There are a number of ways to do this, but I just found a new way to do it in Grails using a Sitemesh’s pageProperty.

In my main layout gsp I have the nav menu

 
  

then in the head section of a view gsp’s where I want the appropriate element to have a ‘selected’ or ‘active’ class. I include:

    

Then in the css have something to deal with the applied class:

  #mainMenu li > a.selected { .... }

Pretty simple! I don’t know if this is very efficient in terms of performance. I can think of other ways to do this with Javascript, or params passed from the controller, but I wanted to find something that used Sitemesh as that seemed like the component that ought to handle this sort of feature. So while this is working for me, and gives a pretty good level of control, I am still wondering if it is really the ‘right’ way to do it.

For a more comprehensive explanation of Sitemesh in Grails visit this blog.

Flattr this!

layout testing – browser resizing

If you want to test a flexible or elastic site layout in Ubuntu you will be doing some window resizing. In MS Windows and Mac OSX window contents dynamically resize. It is a feature that makes it nice for seeing how CSS floats and positioning are behaving. I don’t know if it is a consequence of Compiz or what, but Ubuntu doesn’t do this be default. It only redraws the contents one you are finished resizing. Dynamic resizing is something you can enable in Ubuntu, though it is certainly not an area where Ubuntu shines.

To enable you will have to open CompizConfig Settings Manager (install it first if you don’t have it, obviously), open the “Resize Window” settings go to the “General” tab and from the “default  resize mode” drop down choose ‘normal’

You should now see window contents redrawn during the resize process, but chances are it is really laggy and crappy. To avoid the majority of this annoying crappiness on the rest of your desktop you can reset the default resize mode to rectangle or outline, and on the line that says “Normal Resize Windows” click the “+” icon. In the dialog that appears use the “grab” feature to pick the browser you want to have dynamic resizing on then click “add” to finish. That’s it! Close the settings Manager and you should be set.

UPDATE: A little more research turned up that this was in fact more an issue with Compiz. So I installed Compiz Fusion Icon , started that up and selected Metacity as the window manager. Dynamic resizing works in all the windows I tested and pretty fast/smooth. The downside is all my Compiz effects are gone, but it’s relatively easy to flip back and forth between Metacity and Compiz, so this is probably a better solution to this issue. I also noticed my javascript animations got much smoother with Compiz off.

Really if the only significant piece of compiz animation I would actually miss is the desktop switcher and zoom functionality.

Also, just tried it and this Metacity fix all goes away if you turn on Metacity’s compositioning feature as well. Compositioning is the problem, so it seems…

Flattr this!

gpick outdoes agave

Found a new colorscheme designer called gpick . In the past my fast little color helper in Ubuntu has been Agave, and if I really wanted to get serious I would head over to http://kuler.adobe.com/. Adobe’s tool is really well done, but for whatever reason I just don’t feel fond of anything associated with Adobe, so I tend to look for something else. Also there are obvious advantages of not needing a web connection and the speed of a little desktop app is nice. The Kuler concept as a HTML5 web app could have serious potential. Seeing this amazing HTML5 demo makes me think the technology is in place. Hold on… in fact… I think I just found it, or something pretty close. Wow! I love the where the web is headed! http://www.colorjack.com/sphere/.

Flattr this!

retooling desktop setup again

Thought I would write out a few thoughts on stuff as I have been tweaking my desktop work environment.

I have been trying out Kupfer (install it yourself!). I have found it to be very stable and haven’t even encountered any bugs over the past couple months using it. I talked in a previous post about it being more light-weight than Gnome-Do. Well that seems to true …sometimes and depending on how you are using Do. In Docky mode Do gets a little heavier, and it uses more system memory after being open for a while, but so does Kupfer. The difference is probably less than 5 MB realistically. Do is still the prettier of the two by far, and has significantly more features, but Kupfer is catching up on plugins.

DockBarX is a nice tool that I found this week. It works very similarly to the new Windows 7 dock (which is actually very nice! ) It manages to be a very nice blend between launcher and task manager. The fact that it integrates into the Gnome Panel so well is a big advantage! Docks like AWN, Cairo, or Docky have to figure out some hiding, morphing into a panel like thing in order to not occupy to much screen real-estate, or getting so much functionality that the gnome panel can be removed. It is a bit heavier on system resources than I would have hoped – around the 22MB range. The combination of Kupfer and DockBarX is a really good one.  I think I prefer it to Gnome-Do with Docky. I can’t help wonder if they could be integrated together since they seem to touch so much of the same stuff.

I know some people and Linux distros want to avoid Mono applications. I suppose this would be an appealing solution to get some of the coolness that Gnome-Do brings in that case as well.

Update: I have been running with Compiz disabled lately. An upside to the dockbar/kupfer combo is, unlike GnomeDo or Docky, they don’t require compositing to work well. In addition they both run leaner (17-18 MB each) when compositing is disabled.

Flattr this!

2010 breakout year for Linux (as in Android)?

Yeah, i know not another “year of Linux” prediction. So lame, but eh, whats the harm really 🙂

I have been thinking for a while now that Android is really the up and coming platform. This article about the android market reaching the 20,000 app milestone seems to agree, but is pretty conservative about it. Things it doesn’t consider is that the Android Market is just one place that apps are released. Apps can be made available other ways, such as a simple download available on the web that you then drop onto your device, or accessed directly through specific URL’s.

Also in contrast to native apps there are web apps. Web-apps developed for iPhone’s mobile safari browser also run on other mobile webkit browsers like the one found on Android (and Palm’s WebOS) and vice-versa. There is no count on those that I know of, but they are definitely growing in numbers and I suspect their popularity will be increasing dramatically. Less platform lock in is a big draw for developers. Additionally, existing tools make developing mobile apps relatively easy. For example, Android benefits from already existing tools like JqTouch, xUI, iUI and others

Then there is the fact that Android is starting to show up on things other than phones, like e-readerstablets, and amazing looking reader-tablet hybrids

With 2010 just around the corner some people are sure to claim (yet again) that this will be the year for Linux to break out, and they might be right as 2010 is really shaping up to be a big year for Android.

Flattr this!

Install and Benchmark Firefox 3.6 beta – Whoa Epiphany!

If you don’t already have Ubuntu Tweak I recommend it. From there you can enable the development repos for Firefox development versions. Under Applications>Third-Party Sources. Otherwise you can do it strait from launchpad.

If you run the update manager Firefox 3.5.6pre will be installed, and Under Synaptic Firefox 3.6b3 and 3.7a1 will be available to install. I only tried installing 3.6. It wont overwrite your current install of FF, and I noticed I could even run two versions at the same time. In the applications menu “Firefox” will be replaced with Shiretoko (the code name for the 3.5 release) and Namoroka (the code name for 3.6) will now show up.

There are other more complete browser benchmarks out there, but I just wanted a quick rundown of how much of a performance improvement is coming with 3.6.

 

Browser Benchmarks

Ubuntu 9.10 – Nov 12th 2009 – Sunspider:

Epiphany 2.28 [w/WebKit] (64bit) – 580.2ms
Chromium 4.0.245.0 (64bit) – 583.2ms
Chromium 4.0.245.0 (on slower 32 bit system) – 616.2ms
Epiphany 2.28 [w/WebKit] (on slower 32 bit system) –  954.8ms
Firefox 3.6b3pre (on slower 32 bit system) – 1385.4ms
FF 3.5.5 (on slower 32 bit system) – 1642.8ms
Firefox 3.5.6pre (on slower 32 bit system) – 1677.0ms
Firefox 3.6b3pre (64bit) – 2084.2ms
Firefox 3.5.6pre (64bit) – 2755.8ms
Opera 10.01 (64bit) – 3701.4ms
Opera 10.01 (on slower 32 bit system) – 6089.0ms (yikes!)

For whatever reason FF does poorly on the sunspider test on my 64 bit machine. I switched this machine to 64 bit when I did a fresh install of Karmic. I have run previous tests on in it as 32bit and FF did better then. see old post. Surprisingly Epiphany won the race overall.

That inspired me to play with Epiphany just a bit and found out it can be customized to be a pretty slick browser! I found it has an inspector for web developers, automatically opens source (ctrl+U) in gedit, and in many way behaves very much like chrome. It opens fast, plays flash well, and the chrome can be stripped down so it wastes less screen space. For example if you turn off the status bar link URL’s show up in the bottom left corner just like in Chrome, a nice little touch. The unified address/search bar also serves as a progress bar like Safari used to/does(?). here’s a screenshot:

EpiphanyTweaked
Epiphany and web inspector looking good

Flattr this!

moving past Gnome-Do docky

The past year or so I have had Gnome-Do in docky mode as a staple of my desktop environment. It beat out AWN and Cario for simplicity and stability, and I love the keyboard shortcuts it provides. The more I get used to actually using the core of Gnome-Do with its keyboard shortcuts the less I find myself actually utilizing the dock. When I upgraded to Karmic I decided I would try out going without and actually stumbled upon a more lightweight, less popular alternative to Gnome-Do called Kupfer.

Kupfer

Comparing:

Gnome-Do is pretty, and it works, what’s not to like? Well, it has always stuggled to open Nautilus for me, and occasionally it has just crashed. It crashes gracefully though, just isn’t there anymore, it doesn’t freeze anything and simply starting again is all it takes to solve this rare issue. Another down side it is a little heavy, eats about 28-35 MB of Ram according to my system monitor.It has way more features/plugins than I ever use.

Gnome-Do

Kupfer is simpler, not quite so nice looking (though not bad) and I haven’t had it fail yet. Nautilus opens fast. It can act as a file browser in itself, and even moving files around and using it as an application switcher seems to work slicker than Do did. It has a fair amount of plugins, many of the same basic ones that Do does. The one I am missing is a pastebin type thing. In Do I could highlight some code, trigger Do, type ‘sel’ for selected text, tab over, and pick ‘send to pastebin’, then it would put the URL in my clipboard. Slick! However, Kupfer runs from 9-12MB according to system monitor, so about one third of Do. There are tradeoffs both ways I guess. I am going to stick with it for a while on my work machines because I like the simplistic approach it takes, and how it encourages me to use the keyboard more and mouse less. It just feels more efficient.

Flattr this!

Virtual Android Phone on Karmic Desktop

I am in the process of reading “Mobile Design and Development” by Brian Fling. It’s pretty good stuff. The first 8 chapters haven’t gone into technical details of programming at all. It’s been a lot of discussion about mobile as a platform, it’s history, its potential, its complexness, etc. All fascinating stuff.

Supporting the wide array of devices and browsers is a daunting task to say the least. For efficiencies sake I have decided to start by focusing on WebKit. From what I am reading and my perception of trends I’d say WebKit is a platform to really keep an eye on if you are a web developer at all. For those who don’t know, Webkit is the underlying technology in the browser used in the iPhone, the numerous Google/Android phones popping up, and the Palm Pre. WebKit’s approach to rendering CSS seems to be defining or redefining the standard of how to use CSS for mobile. For example two major players, Opera and Mozilla have adopted it for their mobile browsers (Mozilla’s Fennec is still in Beta). The old media=’handheld’ thing, which I never ever got around to experimenting with, seems to be losing traction.

here are a couple articles talking about web design for mobile.
optimizing for iphone and android
a list apart article

All that said I wanted to start playing around. Android is an open source platform and it’s development tools including an emulator are free.

download
install

this is what I put in my .bashrc file

### Android
### (home will be where ever you extracted the package you got off the Android website )
ANDROID_HOME=~/opt/android-sdk-linux_x86-1.6_r1
PATH=$ANDROID_HOME/bin:$PATH
export ANDROID_HOME PATH

In order to load the new path do:

source .bashrc

use eclipse to launch emulator

Android Virtual Environment on Karmic Desktop
Android Virtual Environment on Karmic Desktop

Flattr this!

Chrome Frame – dirty trick to gain market share?

Big news in the web-development world. Could Chrome Frame be the death knoll of IE6?

The primary company I work for has an old style Java app that was designed specifically for IE6. It has since been opened up to Firefox as well, but other browsers are still locked out. In one sense I am excited about Chrome Frame because it might mean we get to drop official support for IE6 sooner. In another sense I feel like Google might be playing a dirty underhanded trick to force sites that support IE to also support Chrome.

The scenario I envision goes like this: A unsuspecting and not-so-tech-savvy person is prompted on some site far far away to install the Chrome Frame plugin for IE. Seems innocent enough, so they do, and it works! all is well. Then at some point not so long after that they sign in to our application with no problem. Our browser sniffer doesn’t see anything amiss, just another IE user. Then potentially things start not working like they are used to. (i don’t know if this would happen, we don’t test Chrome/webkit since we don’t support it…). they get stuck enough or frustrated enough that they call our support staff for help, and after some time spent trying to understand what is happening we have to say either, “sorry, we don’t support IE with plugins like that,” or, “sorry, that is a bug and we need to fix it.” Both options make us look bad to paying customers.

Google’s motivations supposedly include making life easy for developers, and I think for the most part Chrome Frame will achieve that. It is just one more reason that I won’t bother to test/support old IE browsers a number of sites I work on. However, I think the whole, “we want to help developers”, and, “we want to advance the web” is more marketing spin. Not to say it’s untrue that they want those things too, but Google is a company and companies usually have less altruistic motives.

Because of Google Frame companies like the one I work for are now forced to consider if we will support Chrome. That means for companies who have sites that were built specifically for IE, life just got harder. Ultimately supporting Chrome would be a good thing since it would basically mean a much more standards compliant site – something that is definitely one of the companies goals. The answer to the question, ‘should we support Chrome?’ should be yes, It already was in fact, but before it was less of a priority. The benefit that Google gets for pushing this shift of priorities is that the one more hurdle to Chrome gaining browser share is dismantled. Greater market share in their browser arena means a more prominent platform for their services, and that affects the bottom line. This perspective makes Google seem less likable to me. On the other hand, Google really is advancing web standards which opens the doors that much wider to any other standards compliant browsers, and I do like that…

Flattr this!

Giving KDE a try

I had been hearing some buzz around KDE over the past few months. People saying how much it has improved and praising the features of the advanced desktop environment. My thoughts were that eye candy is fun, and plasma widgets may be cool, but I was curious whether I could be as productive (or maybe more) in KDE, and I knew that figuring that out would require me setting down and actually trying it hands on for a little while.

Since I was in an experimental mood I went with a fresh install of Kubuntu 9.10 alpha 4, and it installed in about 30 min with no problem. My initial impression is very positive – plasma widgets are cool! Lots of cool functionality out of the box, and it looks pretty too! Things like WiFi and desktop effects were a simple matter of turning on.

Firefox isn’t included, which just feels weird to me, but Arora seems promising. It even prompted me to install the flash plugin when I started it up, but though the install appeared successful flash didn’t work.

The file manager, Dolphin, seems sweet! more features and options than Nautilus by far. This is a big plus for KDE, though you could use dolphin in Gnome . The usability of something this fundamental is hard to determine in such a short time, so I don’t want to make to strong of judgments to soon, but so far I feel confident that Dolphin would enhance my productivity. Split views, tabs, columns,previews, zoom slider – nice!

I spend a lot of time in a text-editor. I have come to love Gedit, Gnome’s default editor, for its lightweight and feature full (via plugins) nature. Kate is the corresponding application is KDE. My initial impression is that it has some features I have missed in Gedit – split view is the one that really stands out, but it also seems to be missing some pieces I would like to see.  And after the impressive GUI of Dolphin I fell let down by Kate’s lackluster interface, but it is very similar to Gedit, so no real complaint.

After messing with KDE for a couple weeks some of the sparkle that initially impressed me has started to fade. It has been dulled by a desktop environment that is different enough from Gnome to really confuse and lose me at times. It is hard for me to tell how much of this is just unintuitive and how much is me being mentally trained to do things a certain way. Various things just don’t work (of course this could be due to the fact that I am using a development build…) , and overall the desktop just feels less snappy and responsive than I am used to in Gnome.

Flattr this!