Saturday, July 28, 2012

Lubuntu 12.04 slow resume from hibernate? Try updating your video drivers

I recently installed Lubuntu 12.04 on my Toshiba A305 laptop and immediately ran into the "slow resume from hibernate" problem; the laptop was going into hibernate very quickly, but resuming was taking over 3 minutes!

What seems to have fixed it in my case is updating to the proprietary video driver (ATI/AMD proprietary FGLRX driver under Preferences > Additional Drivers), which I had neglected to do. Now resume takes a more reasonable 1 minute or so from the BIOS screen to the login prompt.

Sunday, July 15, 2012

Using Grails to create static HTML sites

From time to time I've had to update static web sites, and after editing identical html over and over again in multiple pages I wished I could use Grails features like templates or taglibs.
And of course you can use Grails to generate static html sites. From an old post by Robert Fischer here on the Grails mailing list archive:
If you want to use Grails to generate a static web site, build your website, run grails run-app (locally), and then execute: "wget -m -k http://localhost:8080/yourapp" (assuming you're on a *nix with wget) 
Obviously you have to either refactor the site to use templates and taglibs or start it from scratch that way in the first place. Wget can be used on a Windows system by installing GnuWin32 or UnxUtils. The only issue I've run into is that images specified in css don't get pulled through by that wget command line above, but I just copy over all the resource folders (css, images, javascript) anyway.

http://getgnuwin32.sourceforge.net/
http://unxutils.sourceforge.net/

Monday, January 16, 2012

Gedit on Windows as a Grails/Groovy editor

I've started using gedit in order to have a common editing environment in both Windows and Linux. In order to make use of the gedit-grails-bundle when using gedit (version 2.30.1) in Windows, the files need to be installed to the following locations:
  • .lang files go in %ProgramFiles%\gedit\share\gtksourceview-2.0\language-specs\ 
  • plugins go in %UserProfile%\AppData\Roaming\gedit\plugins\ 
  • styles go in %UserProfile%\AppData\Roaming\gedit\styles\ 
  • -mime.xml files do not appear to need installation
  • Grails.tags.gz goes in  %ProgramFiles%\gedit\share\plugins\taglist\ (because TagList is one of the plugins shipped with gedit by default)
I amended the instructions on the http://grails.org/Gedit page to include the above.

Of the gedit-grails-bundle plugins only autocomplete and zen coding work unmodified, the rest have unmet dependencies; this could probably be resolved by tracking down and installing those dependencies, but that can be a very slippery slope.


Missing from gedit is built-in "find/replace in files" functionality. None of the plugins I tried worked unmodified; the only one without external dependencies is the one from the Gedit Developer Plugin (GDP) bundle (gedit-developer-plugin-2.28.0). I had to do the following to get it to install and run:

  • Rename gdpfind.gedit-plugin.desktop.in to gdpfind.gedit-plugin
  • Edit gdpfind.gedit-plugin to remove the leading underscores from Name and Description
  • Edit the method in __init__.py as below:

def on_file_lines_row_activated(treeview, path, view_column, plugin):
    """Open the file and jump to the line."""
    treestore = treeview.get_model()
    piter = treestore.get_iter(path)
    base_dir = treestore.get_value(piter, 4)
    path = treestore.get_value(piter, 0)
    if base_dir is None or path is None:
        # There is not enough information to open a document.
        return
    # windows-only hack to strip leading 'file://' which prevents file from opening        
    # uri = 'file://%s' % os.path.abspath(os.path.join(base_dir, path))
    uri = os.path.abspath(os.path.join(base_dir, path))
    line_no = treestore.get_value(piter, 2) - 1
    if line_no < 0:
        line_no = 0
    plugin.activate_open_doc(uri, jump_to=line_no)


Without this change, the URI passed to the new tab has a leading "file://" that will prevent the file from opening properly.

http://projects.gnome.org/gedit/index.html
http://grails.org/Gedit
https://launchpad.net/gdp/incubation/0.2

edit: Changed where the _init_.py fix goes, in the method where the leading 'file://' is added to the URI in the first place; also added install location for Grails.tags.gz file.