Keeping it Clean

I made a conscious decision to just use a laptop as my main machine back in 2004, so for more than a decade now I’ve been living without a PC “tower” as part of my essential kit. Whilst the advantages of being able to carry around your main machine with you all day every day are clear, one of the major disadvantages of a portable computer is storage space.

I have two external drives that I use to back up the machine and to keep important things like my photos backed up in duplicate between bulk uploads to my main backup server, but carrying those around with me in the same bag as the laptop is sort of defeating the point of having a backup…so I don’t. You shouldn’t either. I keep them locked away wherever I happen to be staying, and just take the aluminium slab with me. That means day-to-day I only have half a terabyte of storage space to play with, which used to be a lot…but once upon a time people said the same thing about half a megabyte; it’s a fact of digital life that data bloats.

I’ve accumulated a few tools over the years that I always come back to when keeping my MacBook tidy, here’s the rundown:

CleanMyMac 2

Screen Shot 2015-07-19 at 09.36.06If you only want to use one tool to keep your mac clean, this is the one I’d recommend. I got it in a MacHeist bundle a while back and since then have used it a couple of times a week without fail. Its ease of use is what keeps me using it, along with the reminder that you can enable that tells you when there’s a load of crap that you probably don’t need any more.

You needn’t define which files you want to keep or what you don’t upfront, it provides guidance about the common places to tidy things up; the trash can being a common and obvious one, but less obvious are unused large files that you might have forgotten about, browser and OS extensions that aren’t enabled, and even photos kept in iPhotos recycle bin!

You can also use it to cleanly remove apps that don’t support the Mac standard “drag to bin” method of uninstallation, and also makes it easy for you to reset an app to a clean install setting without having to actually reinstall it (I found this handy for resetting Eclipse after various rogue plugins ruined my setup, before I ditched it entirely for Android Studio!).

The last cool little feature, is that it keeps a running total of how much space it’s freed up since you started using it; my count is well over 3 terabytes now! Feels good.

CleanMyMac from MacPaw

 

DiskInventoryX

Screen Shot 2015-07-19 at 10.01.29This tool ventures a little into the realm of geekery in terms of its aesthetic and ease of use, it’s certainly not as pretty and straightforward as CleanMyMac. I sought out this tool following my original cleansing pilgrimage away from the poisonous gospel of Microsoft Windows, where I travelled into the remote mountains on a brain debugging retreat to cleans the last of the carcinogenic digital toxins left by years of traumatic spontaneous BSODs and the generalised corruption of my workflow by Visual Basic’s bastardised Hungarian System notation…

Too dramatic? Well I used to use a tool called WinDirStat for visualising hard disk space, and wanted the equivalent for my Mac. That tool is DiskInventoryX, and is very similar in style to WinDirStat in that it gives you colour-coded visual representations of whichever storage volumes that you have plugged into your machine, thereby making it easier to find and remove the bloaters. I cannot stress how useful it is to be able to see blocks of different sizes rather than just numbers in a list; it directly led to me moving all of my VMs (I can’t unfortunately completely escape Windows…) to external drives when I saw that the files that Windows creates when it suspends running state were bigger than my entire documents folder!

It’s somehow more meaningful when you see a big pink tumour of wasted space.

Disk Inventory X by Tjark Derlien

 

Dupe Guru

Screen Shot 2015-07-19 at 10.23.50I download a lot of stuff. Code, documents, images, screencasts of bugs, all sorts of things, all day as and when I need them. As soon as I’ve viewed them I immediately forget where they are, if I’ve seen it before and whether I’ve already deleted it. When they all end up in the same folder, then it’s easy – the little (1) gives me the clue that I already have that file, but what if like me you tend to use different folders on different drives for different projects and clients? That’s when it gets tricky. Fortunately I stumbled upon DupeGuru at some point in the past year and since then those issues have vanished for me.

It’s low-weight, fast and super easy to use. You can select individual folders or even entire disks. Hit scan, wait for it to do its stuff, and choose an action to take either individually or in bulk. As I wrote this section on dupeGuru, I set it off scanning an external drive with just under 2TB of data on it. By the time I’d finished writing, and at some point between then and me going to make a second coffee for myself, it had created me a list of stuff I could get rid of. Manually trawling the same folders would’ve taken hours (a conservative estimate) to do manually.

dupeGuru from Hardcoded Software

 

Finally, sometimes the simplest things…

Sometimes all of these fancy GUIs can blur the real issue at hand. If you’re not scared of the odd terminal command or bash script, check this, the simplest of simple Terminal commands, out:

mv ~/Downloads/* ~/.Trash/

I set this up as a shortcut when I got my first MacBook Air, and still use it to this day. All it does is move the contents of the current user’s Downloads folder to Trash. You can even automate it on login/logout, and CleanMyMac will collect it next time it runs.

Create a shortcut to it on your tray, or if you’re brave set it up to run automatically, and you’ll start to think more carefully about whether you should leave the single copy of that important document in your Downloads folder next to the cat memes in future. Because they’ll all end up in the digital landfill together!

5 Open Source Android libraries that you should be using

Not much of a preamble here, the title says what this is. If you’re new to Android development, or if you’re just still relying on Google APIs to do everything, these might make your life a bit easier.

The titles all link to the corresponding project pages where you can download/view the source, but if that seems like too much like hard work, just copy-paste the Gradle dependencies (below the name of each library), sync your project, and start playing.

But I use Eclipse, where are the Jars?

*slap* No! Bad developer.

As you appear to have been under a rock recently, you should know that Eclipse is no longer the official IDE for Android, which means you’re making life harder for yourself for no good reason. All of the nice new stuff has moved to a lovely IntelliJ-based IDE. It still can turn a MacBook’s 9hr battery life into a 3hr one, whilst doing a pretty good impression of a hotplate, but hey, that’s Java…

So download Android Studio, then read this, no need to thank me, then read on.


Picasso

compile 'com.squareup.picasso:picasso:2.5.2'

Network image loading made really, really easy.

You probably know this one already, as it’s the easiest solution to loading up an image from a network location, and is the de-facto response to the thousands of “how do I load an image from a url” questions on StackOverflow.

There are tons of tweakable methods and callbacks to use, but if you just want to load an image, it’s as simple as this:

Picasso.with(context)
    .load(url)
    .into(imageView);

Retrofit

compile 'com.squareup.retrofit:retrofit:1.9.0'

If you have an app that connects to a RESTful API (which you do obviously because this is 2015, I think my electric razor has a RESTful API) retrofit makes it easy to turn said server-side interface into a Java interface by using annotations, so that you never have the headache of manually handling every method and call interaction yourself.

These examples are quicker to grok than it would take me to explain it, so check them out.


NexusData

compile 'com.github.dkharrat.nexusdata:nexusdata:0.1.3'

iOS, whilst almost comically flawed and restrictive as an operating system, is a whole lot easier to develop a robust app for due to the well thought out restrictions that Apple place on their developers.

I’ve often seen terror on the faces of iOS developers who try to ‘dip in’ to Android, assuming the SDK-provided libraries to be as well thought out and clean as those they play with in XCode.

It can be summed up thusly:

iOS

It just works

Android

It just works

(for API > 14, except for JellyBeanMR1, or devices that don’t support this undocumented API which we will rename next release anyway, if you’re not using proguard, which is now minify, but has these libraries that are back-ported by the manufacturer, on screen densities that are sort of big, but not landscape, except if they’re fixed aspect, and running the support libraries. On Tuesdays, when it’s not raining.)

…usually. But not on Samsung devices, or older HTCs.

So I’ll freely admit, as an Android developer I am envious of the iOS toolset; GCD, CloudKit, Multipeer Connectivity and last but most: CoreData.

Why can’t we have nice things like that? Oh, we can! (the last one anyway)

Whilst there are a lot of options available that mean you never have to meddle directly with SQLite in your app, NexusData is my personal favourite due to its high-level nature and simplicity of use.

So stop messing around with data persistence code, and get on with making your app.


ButterKnife

compile 'com.jakewharton:butterknife:6.1.0'

If you develop Android apps, you will have typed findView(R.id.something) more often than is healthy.

Stop that.

Jake Wharton’s (if you’re new to Android, you’ll see this name a lot) ButterKnife does away with the need for that extra typing by providing a simple way to generate boilerplate code for the UIs that you define, all via the magic of annotation processing.

 


GSON

compile 'com.google.code.gson:gson:1.7.2'

I use this constantly, and so should you wherever you use JSON in your Android app. I’ve found no better method for turning POJOs into JSON, and back again.

It’s hard to believe, but I’ve seen some very recent examples of code where the developer is still manually writing methods that do this, and in once case a minor mistake that somehow got through to production untested, led to the users of the app being unable to log in at all…

Don’t be that person. Use GSON.