disable javascript in firefox without plugins

This is one for the “it’s easy once you know” category.
In recent versions of Firefox the option to turn off JavaScript had apparently disappeared from the options. Recently I found out where those sneaky Mozilla devs have hidden this handy feature.

In the Firefox menu, go to Tools > Web Developer > Toggle Tools, or use the CTRL-I shortcut key to activate the developer tools side-panel. Once active you see one of those typical cog-wheel icons in the upper right corner showing the settings when you click it.
In those settings, scroll down to the Advanced Settings and flick the “Disable Javascript” check-box. Voila. JS is now disabled for your debugging purposes.

The “Disable Cache” option right above it is also a handy one if you are working on a page. It beats having to hit CTRL-F5 all the time anyway.

The disable JavaScript option in the developer tools settings.

If you want an easier way to control this, store settings per site and things like that, you’re better off installing the NoScript plugin. There’s a reason this option is hidden in the developer tools after all.

noisia does radio and it’s awesome

Oh yessss. The Dutch lads from Noisia are doing their own weekly Noisia Radio show of sorts and they are putting it on Soundcloud for free streaming and download. As you can expect from these guys it’s stuffed with great drum’n’bass, bass music, dubstep, electro, techno, game music… you name it (no not trance of course, who would do that anyway).

In the show they play old stuff, new stuff and basically all sorts of stuff they like. The mix of different styles makes it a sweet listen while you’re working or commuting, or whatever. It’s great to find out about some new tracks, links to free tracks from other producers on Soundcloud etc.

They are at episode 6 already by now, so get over there before you’re way behind on this like the uncool kids!

Go, go, go!

the ultimate android space clearing guide

If you’re running into that annoying problem where you can’t install yet another awesome app on your Android phone because you are running out of space, here’s the ultimate guide to freeing up app space *dramatic music*

1. Clean up app cache

Bansky street cleaner - Chalk Farm

Your phone stores apps on its internal memory card (not RAM, but the disk) including some temporary data for each app. That cached data is the first thing you can go and remove to free up space. Depending on the app, this can be quite some data. Think apps that download resources like video or images, create thumbnails etc.

You can do this manually with the internal app settings screens and go over each app individually. I bet you have better things to do though. Instead you can install ES Task Manager, which has a cache cleaner built-in and does the job for you. Sweet. There are plenty of alternative cache cleaning tools available if you don’t like the ES one.

2. Move apps to the external memory card

Still not enough space? Damn. To free up space on the internal memory card, you can also move some apps to the external card. If you have that option, you can use the application tools to move apps individually. Not all apps support this and it usually doesn’t free up all the space either. There’s always some core files that stay on the internal drive, so don’t expect any miracles. The best way to go about it, is to sort the apps by size and try to move the biggest ones first. But if that doesn’t do the trick you might want to…

3. Uninstall some apps

Yep. Makes sense doesn’t it. The bigger the better too. It sucks, but there’s probably some stuff in there you haven’t used in months. Time to say goodbye and press the delete button. Aah, instant free space.

4. When all else fails.

Still not working? I had that. My internal memory was showing 250MB of free space and I couldn’t get a 40MB app like Chrome to update anymore. Same thing with any other app around that size. They all failed to update.
It doesn’t make sense when you look at the numbers, but my guess is that it’s like with a fragmented disk drive on a PC. At some point there isn’t a large enough open space to fit the update file in one piece. Or that 250MB of free space isn’t just for apps. I’m not sure. But what I am sure is that resetting the phone wipes the internal disk space, and frees everything up again.

Photo by Dan Brady, cc-licensed.

a vim http log file syntax plugin

Log files are dull to look at. Lines and lines of text and no pretty colors to make it nicer to look at and easier to spot those weird errors you can’t simulate on your machine.

Vim rocks and writing a syntax file is supposed to be a breeze judging from the vast amount of syntax plugins out there. I didn’t quite find one I liked for syntax highlighting HTTP log files, so I thought I’d get down and dirty with some vimscript myself and see if I could hack something together.

It turned out alright I think. So to share the fun I’m hosting the logsyntax.vim plugin on Github and the vim.org scripts library for all to use. It highlights dates, HTTP verbs, URLs, IP addresses etc for IIS, W3C extended, NCSA and probably a bunch more typical log formats.

May your logs be pretty and colorful from now on.

The vim log file syntax highlighting plugin screenshot. Look at those pretty colors.

a wordpress full site spell checker tool

A while ago I noticed that some of my older posts had some silly misspellings in it, so I was looking for a way to spell check all my posts in one shot. I couldn’t really find anything that was free, so I figured I’d try to write something myself to do this for me.

I knew about the free and open source Hunspell spell checker and that you can use it from the command line. So I thought using that together with the WordPress export XML file which has all your post’s content it should be possible to spell check the whole lot.

The end result is a PowerShell script which reads out the XML export file and runs it through Hunspell, parses the spelling errors found and finally bundling it all into a simple HTML report.

It worked nicely for me, even though it’s pretty crude and simple. I only had to use this once, so I don’t see the point of fine-tuning it a lot further.

However this could be handy for others who want to do the same thing, so I cleaned it up a bit, slapped a readme file on it and posted it on Github as the WordPress full site spell checker.
Check it out if you want to spell check your WordPress blog in a single run and maybe this will be good enough to get your job done. You find more info on how to set up and use it on the Github page.

That very basic report I was talking about.

how to exclude yourself from WordPress analytics

I use a number of analytics tools to see how little hits I get a month and one of the things that annoyed me is that my own visits as I’m writing posts or looking up older posts also get counted. There’s a silly trick to avoid this and it’s so easy it’s stupid I didn’t think of it before.

WordPress has these widgets in the Appearance menu which make it easy to put all sorts of components in your sidebar and footer. I also use the Text Widget to insert snippets of custom javascript code in my pages, things like those analytics tracker code for example.

To exclude yourself from those stats all you need to do is make sure that code doesn’t get included when you are browsing your own site. Here’s how it works.

  1. Put your web analytics script code in a sidebar text widget. Leave the title empty if you don’t want anything to show up.
  2. Click the “Visibility” button at the bottom of the widget panel.
  3. In the options, choose “Hide” if: “User” is “Logged in”.
  4. Save.

You can set visibility options on WordPress sidebar widgets.

That’s all.
The cool thing is this works with any analytics tool (or any other custom javascript code you want to exclude yourself from) without having to figure out if it has any support for that itself.

find and delete duplicate files with just Powershell

... analog computer!

Consider this. You have the same files with different file names spread out over a bunch of folders. If you are on a recent Windows machine, Powershell is all you need to get out of that mess and delete the duplicates.
This also means you get to do this from the command line which makes it extra l33t.

Cool. Let’s get started.

ls *.* -recurse | get-filehash | group -property hash | where { $_.count -gt 1 } 
| % { $_.group | select -skip 1 } | del

You’re done.

Alright. Here’s what going on in detail:

ls *.* -recurse             # get all files in the current folder and all subfolders
get-filehash                # calculate the file hash for all files
group -property hash        # group them by the hash value
where { $_.count -gt 1 }    # select those groups with more than 1 item
% {                         # for all groups
    $_.group |              # output the group content, which are the files
    select -skip 1          # select all but the first file 
   }                        # (we don't want to delete all of them right?)
del                         # delete the file

If you want to experiment with this I’d recommend you to change the last del command with something safer, like echo which just prints out the file.

Oh yeah, **DISCLAIMER**. Don’t just randomly copy past Powershell code and execute it on your machine if you don’t know what you are doing. Certainly if it’s deleting files like the example above. You might end up deleting more than you bargained for.  :)

Photo by James Vaughan, cc-licensed.