Just Thinking

Fourth Woods Blog

Monthly Archives: April 2012

Flickering Ubuntu 11.10 Boot Splash Screen

Posted on 24 April, 2012  in Tips and Tricks

I upgraded my file server to Ubuntu 11.10 back in February. When I ran the install CD, the boot splash screen started flickering and it didn’t seem to be loading. After messing around a bit, the install screen came up and I finally got it to install. Unfortunately, when I rebooted my server, it started doing the same thing. Here’s a video I captured that night:

After a while it will settle at the login screen and all will be fine, however it does take a while. In the mean time all the services are up and running and I can SSH into it and access the file shares so it’s not that big of a deal. I usually run it headless anyway so this has been mainly just an annoyance.

I decided to mess around with it again today and it looks like I solved it. It seems newer kernels try to load the graphics drivers early in the boot sequence to allow for things like fancy high resolution splash screens and such. Unfortunately this doesn’t always work right with some cards and you run into issues like mine. The fix is to set nomodeset in the boot options which tells the kernel to not use the drivers and fall back to the BIOS video modes.

To set this option:

  1. As root edit the file /etc/default/grub
    $ sudo vi /etc/default/grub
  2. Find the line that looks like this:
    	...
    	GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
    	...
  3. Add the nomodeset option to the end and save:
    	...
    	GRUB_CMDLINE_LINUX_DEFAULT="quiet splash nomodeset"
    	...
  4. Finally, update the grub config file:
    $ sudo update-grub
  5. Reboot:
    $ sudo shutdown -r now

Further reading

, , , , ,

[Top]

Monthly Archives: April 2012

How to Take a Screenshot of a Windows Screensaver

Posted on 23 April, 2012  in Tips and Tricks

When I posted my OpenGL Globe ScreenSaver I wanted to include a screenshot which lead to the question, “How do you take a screenshot of a running screensaver?” Well, Windows will let you capture screenshots by using the Prnt Scrn key (or Alt + Prnt Scrn to capture the active window). However, when the screensaver is running, as soon as you touch a key or move the mouse, poof! The screensaver is gone.

The trick is: open the display properties (right click the desktop and select properties in Windows XP, Personalize Desktop in Windows 7 I think), switch to the Screensaver settings and select preview. This will run the screensaver in preview mode. In this mode, you can press Prnt Scrn without deactivating the screensaver. Once you’ve captured your screenshot, move the mouse or press some other key to exit the preview, open up mspaint and paste your screenshot from the clipboard. Enjoy!

, , , , ,

[Top]

Monthly Archives: April 2012

OpenGL Globe Screensaver

Posted on 23 April, 2012  in OpenGL

I like to dabble in different things, 3D graphics being one. Here is a free screensaver I created a while back using OpenGL to display a rotating 3D globe. It’s pretty simplistic but I think it’s cool. Here’s a screenshot taken from my laptop.

OpenGL Globe Screensaver

The globe is created by mapping a flat image of the earth onto a 3D sphere. The image was obtained from NASA’s Visible Earth website out of the Blue Marble collection. This version supports multiple monitor setups and provides high and low resolution textures for the globe (though I haven’t really tested to see if the different resolution textures really make a difference). The screensaver does not change your monitor resolution and will run at whatever the current resolution is set at. Obviously an OpenGL capable graphics card is required.

I also created a msi installer for it. I just wanted an excuse to play with the WiX toolkit for creating install packages.

The screensaver can be downloaded from here.

If there is interest I have some ideas for enhancements like city lights on the night side, real-time sun tracking, perhaps cloud cover or any other suggestions. Let me know what you think.

Update 12/3/2012

Ok, after having run this screensaver on several different computers over several years without ever having any problems, I just tried to install this on my new laptop and it failed with a DLL error.

LoadLibrary failed with error 1114: A dynamic link library (DLL) initialization routine failed.

Not sure what the issue is at the moment but I’ve previously installed this screensaver on Windows XP 32-bit and Windows 7 Professional (which I also have on this laptop) without problems. It’s late now so I’ll look tomorrow to see what’s going on and post an update.

Update 2 12/5/2012

So I found a fix for the issue and posted a new article about it. Let me know if you run into the same issue or if you find any other problems.

Further reading:

, , , ,

[Top]

Monthly Archives: April 2012

Can’t call method “bodyhandle” on an undefined value

Posted on 20 April, 2012  in Perl, Programming

I’ve recently been seeing and increase in spam emails for my fourthwoods.com accounts. I started playing with a perl script to process the spam messages to feed to SpamAssassin. When I finish it I’ll post an article on here describing what I did and why. Hopefully it will be helpful to somebody.

Anyway, this was the first I used the MIME::Parser and related perl classes so I muddled my way through following some examples and reading the perl documentation. I did run across an error that wasn’t immediately obvious what was causing it. According to the examples, I was doing everything correctly. However, I ran into the following:

Can't call method "bodyhandle" on an undefined value at foo.pl line XX.

Ok, so I’m parsing a multipart message following along with this example and every time I try to access the bodyhandle I get the error. WTF?? My code isn’t that much different from the example. If I iterate through all the parts the data is there, so why no bodyhandle?

Digging through the documentation for bodyhandle “An entity will have either a body or parts: not both.” Aha! Ok, so when will there be parts and when will there be a bodyhandle? Well, it depends on the mime-type and whether or not the parser is set up to extract nested messages. In my case I’m concerned with mime-type “message/rfc822” which according to the table, if the parser is configured to extract nested messages the nested messages are parsed and put into an array of MIME::Entity objects returned by the parts method. If the parser is not to extract nested messages, they are placed into a MIME::Body object returned by bodyhandle.

For the MIME::Parser, according to the documentation for the extract_nested_messages option it defaults to true which causes my issue. To prevent extraction of nested messages and instead get a valid bodyhandle, extract_nested_messages must be set to false or 0.

In the example that I was following they do not ever set this option to false however, they also do not seem to be particularly interested in my specific case. I did see that sal-wrapper.pl does in fact set this option so I know I’m not nuts!

, , , , , , ,

[Top]

Monthly Archives: April 2012

Add the Quick Launch Bar to the Taskbar in Windows 7

Posted on 16 April, 2012  in Tips and Tricks

I don’t have too many complaints about Windows 7. It’s actually a step up from Windows XP and a giant leap up from Vista (AKA Windows ME part deux). Anyway I don’t really care for the way applications are now “pinned” to the taskbar and when an application is active, the pinned icon is now the taskbar button with the inactive application icons hidden in between. Who thought THAT was a good idea?

The quick launch bar was a great place to access frequently used applications without taking up too much real estate. Unfortunately it’s gone missing from Windows 7. To get it back do the following:

  1. Right click the taskbar and select Toolbars | New Toolbar…
  2. In the Choose a Folder dialog that appears enter the following in the location bar:
    %appdata%\Microsoft\Internet Explorer\Quick Launch
  3. Click “Select Folder” and the Quick Launch bar will immediately appear on the taskbar.
  4. Position and customize as before

Thanks to How-To Geek for the tip.

, , , ,

[Top]

Monthly Archives: April 2012

Remove a Drop Shadow in Inkscape

Posted on 16 April, 2012  in Graphics, Tips and Tricks

Here’s an easy one that stumped me for a bit. How do you remove a drop shadow from an object in Inkscape? This guy had the answer:

Select the object, then from the filters menu (where you would normally apply a filter), select “Remove Filters” at the bottom. This will remove all the filters applied to that object, not just the drop shadow filter, but it gets the job done!

, , , , ,

[Top]

Monthly Archives: April 2012

JSP error: [method] must be used with a prefix when a default namespace is not specified

Posted on 16 April, 2012  in JSP, Programming

So, in a JSP I needed to compare two strings so I tried something like this:


...

This of course was followed by the following error:

JSP error: equalsIgnoreCase must be used with a prefix when a default namespace is not specified

Silly me… you can’t do that in a JSP like that. But you can use the function (fn) expression language tag library with some common function implementations. So, the above becomes this:

<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
...

...

, , , , ,

[Top]

Monthly Archives: April 2012

missing ] after element list parsing JSON

Posted on 13 April, 2012  in JavaScript, Programming

I was working on a little web application front end submitting a form and processing a result asynchronously using jQuery. I wrote a little JavaScript snippet that looks something like the following:

$.post(
    "submitForm.jsp",
    theForm.serialize(),
    function(data){
        var res = eval('(' + data + ')');
        // do something with the result
    }
);

Yeah, I know, eval() probably isn’t the best choice here but we need to support IE7 which doesn’t support JSON.parse natively. Anyway, after submitting I get the following error:

error: missing ] after element list parsing JSON

Turns out that jQuery will try to figure out if the result is JSON and parse it automatically. In this case data is already a JavaScript object and not a JSON string waiting to be parsed.

, , , , ,

[Top]