Category Archives: tips

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.

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.

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.

reset the net

On´n´Off - Going into standby mode

It’s on!

If you want to kick some NSA buttocks and claim your privacy then get yourself this reset the net pack and install some super-duper encryption for your PC, Mac and phone(s).

There ain’t that much on there really, but if you scroll down to the Other Resources section there’s links there like the Prism Break one I mentioned before, which contain tons of (more techy) tools and software for all your stealthy encryption needs.

Photo by Sven Seiler, cc-licensed.

what drains your battery faster? 3G or WIFI?

So what drains your smartphone’s battery more you think? Using a local WIFI network or the 3G cell network to download stuff from the internet? I Googled it but I didn’t find any solid hardcore scientifically based evidence. Time for a small home-grown scientific experiment then!

So here it is *drumroll*, the WIFI vs 3G battery drainage challenge!

I fired up the Grooveshark html5 app (which is quite nice actually) to non-stop stream music for 20 minutes and checked the battery usage when repeating this for both types of networks. In the meanwhile I was keeping anything else down to a minimum (like activating the screen which is also a juice sucker). Checking the battery usage means simply writing down the percentage displayed in the top Android menu bar before and after the test, so it’s not that precise, but it’ll do.

The results after 20 minutes of non-stop music streaming where:

  • WIFI battery usage : 2% drained
  • 3G battery usage : 5% drained

WIFI beats 3G with more than half of the battery usage in this (not so inaccurate) test. But still, it gives a pretty clear idea of the winner here. So roughly speaking, on 3G you have about 6 hours of music to go and a whopping 16 hours on WIFI before your battery is dead, if you have a Sony Xperia. Taking mobile data costs into account, WIFI certainly seems to be the preferred option to stream anything over.

Heck, I’ll even trow in some pixelarty kinda infographic, to make all the numbers just look a bit more pleasing.

wifi vs 3g battery usage duke-out infographic (sort of)

speeding up your TFS CI builds

Entering Hyperspace

If you’re using TFS as your build server for CI builds of .NET projects, you want your CI build to be bleeding fast so devs don’t sit around waiting until their build completes. This is even more the case if you use a gated check-in on that CI build.

The ideal time frame is less than 5 minutes, but as a solution grows and more projects are added it gets hard to stay below that time limit without tweaking the build. With a CI build in this case I mean a build used to check if all code compiles, is integrated with other code and all unit tests pass on it.
This build is not used for deployment. There should be a separate build for that.

So what are the time sinks here in a standard TFS build?

It helps if you know what’s it’s doing, even though it’s pretty straightforward. First your code is fetched from TFS. A local workspace is used on the build server and all files are retrieved. Then the VS solutions build with MSBuild. Code analysis is performed if requested, unit tests run, outputs are copied to your drop folder and build reports are published.

Here are a number of things you can do to speed this up:

  • Get only the latest changes, not the full code base every time by not completely cleaning up the workspace. If you only clean up the outputs, it takes a lot less time to update the workspace. The more code you have, the more this counts.
  • Code analysis is CPU intensive and slows down your build significantly. Make sure you set this to “as configured” in your build configuration, so it doesn’t run on projects that you don’t want analysed. Then configure your projects in Visual Studio that need CA, and disable it for the rest.
  • In the Source and symbol server settings, set “Index sources” to false for the CI build. This feature includes source information into your PDB files which makes things easier to debug later on, but since we’re building strictly for a CI build we don’t need this data afterwards.
  • Disable copying output files to the drop folder. The output of the CI build shouldn’t be used for any deployments, so this can all be skipped to speed up the build.
  • Look for slow tests. Often these are integration-like tests which will be causing disk I/O by manipulating files or accessing a database etc. You can disable them for the CI build only by adding a TestCategory attribute called “Integration” (or whatever you like) and exclude those from the build in the test settings. Another trick is to put all your integration tests in a separate assembly and exclude the tests from running using the test assembly file pattern.  E.g. With *.Test.dll project Foo’s Foo.Test.dll is included, but Foo.IntegrationTest.dll isn’t.
  • Avoid lots of small projects in your solution. Every project will take a few extra seconds to build, so merging them into a single larger project will build faster. Make good use of namespaces instead. For example one assembly for unit tests (or 2 if you take that integration test project in mind) is better than a test project for each regular project.

Pick and choose as needed, but these should give you a considerable boost.
Remember to analyse your build before starting to tweak it. There’s no point in optimizing what’s fast as hell already. A good tool to check out what’s taking so long is the open source TFS Build Explorer. It shows your build steps in a tree-view, including timing info and is a hell of a lot quicker than the default build output from TFS for big builds. Depending on your TFS server version you might have to use an older executable, but they are all available in the download section.

Photo by Éole Wind, cc-licensed.

sync files to your phone with bittorrent sync

Triple Sync

Syncing files with a phone is sometimes a cumbersome and tricky task. I blogged about a few solutions before like this one using FTP, but recently I found another gem.
Bittorrent Sync turns out is awesome to sync large amounts of files over WIFI to and from a mobile device without a lot of effort.

So what is it? Bittorrent Sync is, as you probably guessed, a product from the Bittorrent lads. You can use it to synchronize folders between machines in a distributed, non-centralized way. So you could think of it as Dropbox without having to use the central cloud server. There are
clients for all sorts of operating systems like Windows, Android, Mac and Linux.
The only “downside” here is that you need to have another machine online before the syncing happens as there is no central server that keeps a copy of your files in the cloud. You can also see this as an advantage if you don’t want copies to end up on third-party servers.

So to sync from your main machine to a mobile device, this works perfectly.

Basically you do the following to set up file syncing between your PC and your phone:

  • Install the BTSync application on your PC.
  • Install the BTSync app on your (android) phone.
  • Setup a sync folder on your PC.
  • Scan the QR barcode for this folder from your PC screen with your phone from the app to set up the sync folder on your phone.
  • Sit back and watch the magic happen.

Depending on your settings you can use this to sync in both directions, set up multiple sync-folders, sync with multiple machines etc.

It’s awesome, it’s free and it works like a charm.
I love it.

Addendum: if you upgrade from an older version to v2 of Sync your old sync folders might break. I ended up uninstalling and reinstalling Sync on my PC & phone + recreate the sync folders to have it all work flawlessly again.

Photo by Grant Hutchinson, cc-licensed.