Wednesday, November 28, 2012

Greasemonkey to rescue!

Greasemonkey is an add-on to Firefox that seems to prove to be really useful, so I wanted to give it a spin.

Basically, what it does is to modify webpages on-the-fly as you load them - using JavaScript. Many times I guess people use it to get rid of nasty ads and so forth. There are plenty of other add-ons able to do that - like removing a specific element each time, which doesn't require any coding. What fun is that?

Nonetheless, my first Greasemonkey-script does just that - removes an ad. But for the site in question - www.di.se (all in Swedish) - it isn't as easy as removing an element. The site is divided into 3 rows using a frameset that looks like this:

 
<frameset frameborder="no" framespacing="0" rows="0,210,*">
<frame class="noprint" frameborder="no" framespacing="0" name="historyFrame" noresize="" scrolling="no" src=""></frame>
<frame class="noprint" frameborder="no" framespacing="0" name="headerFrame" noresize="" scrolling="no" src=""></frame>
<frame class="" frameborder="no" framespacing="0" name="contentFrame" noresize="" scrolling="auto" src=""></frame>
</frameset>
As you maybe can tell, removing the second frame (which contains the 210px ad) doesn't cut it, because the third frame (content) will now take it's place.

This is where Greasemonkey comes to rescue! Creating the following script tells Greasemonkey to change to rows-attribute of the frameset to hide the ad frame, allowing the content frame to use all available space:

// ==UserScript==

// @name          Clean up di.se
// @namespace     http://www.technowobble.com
// @description   Removes the top add from www.di.se
// @include     http://www.di.se/
// @grant       none
// ==/UserScript==

var frameset = document.getElementsByTagName('frameset');

if (frameset[0]) {
 frameset[0].rows="0,0,*";
}
It will only be applied to http://www.di.se/ (notice the trailing slash which seems to be required) and I will never have to see the ad again. Sweet. But what more can you do with it? Anything, from removing ads, changing look & feel etc, to do automatic user interface testing or exploiting vulnerabilities, I guess?

Tuesday, August 28, 2012

Fighting Dell!

Ok - so I've been having trouble with my Dell Latitude e5410. What kind of trouble, you ask? Well, I discovered it when listening in on my favorite tunes on Spotify. Intermittent there was a "buzzing" sound for a brief moment, like if my headphones weren't properly attached, or poorly fitted into the jack.

This happened 5-10 times per song and was really annoying me, but I couldn't really figure out what it was. Tried a couple of things, like testing with different headphones, downloading new audio drivers, but it never when away. It even occurred when listening without headphones. And no matter if it was streaming media or music on from my local library.

So I gave up. Sigh! Stopped listening on music while working, that is.

Half a year later, and some hours to kill, I started searching for a solution (again). But how do you Google it? "Dell sound noise"? "Dell e5410 audio buzz"? No luck.

Turned out the magic word was "music", as this issue is most annoying when listening on favorite music, it seems. I finally found this thread, which didn't specifically mention the e5410. It eventually led me to try to upgrade the Intel Storage Controller provided by their Rapid Storage Technology anyway. Simply downloaded the driver from Intel and installed it.

Problem solved. Thanks to a dedicated community. Really - big thank you! Wish Dell was monitoring their own community and supplied hot fixes to issues like these. The driver download section isn't very helpful, even with your computer's identity tag supplied...