Ramblings of a Coder's Mind

Got Tech? Will Hack.

Hosting Blogs for 1¢ a Month

| Comments

If you're a dev and you self host your blog, I'd love to hear why. Why do you self host blogs? For most simple blogs in this day and age, migration to a static site like Jekyll or Octopress is pretty easy. I did this a while back. This can be followed up by asking Amazon S3 to host your website. You can even get cloudflare to front the SSL for free.

Why? S3 is free for the first year. Even post that period, my bills have been <$0.02/month which is a 99.951% reduction in cost.

Commonly Made Mistakes in Unit Testing

| Comments

What is Unit Testing?

Unit testing is all about focusing on one element of the software at a time. This unit is called the often called the 'System Under Test' (refer Mocks Aren't Stubbs). In order to test only one unit at a time, all other units need to not be test at the same time. As obvious as that sounds, it's easy to miss.

Classes do not exist independent of one another. They usually have dependencies. Such dependencies are called the 'Collaborators'. There are multiple ways to manage collaborators that have been talked about by Martin in his article.

Pre-requisites to the post before going forward

Before we go on, please ensure you've read through Mocks Aren't Stubbs by Martin Fowler. This post assumes that you've gone through the article before continuing on to commonly made mistakes in Unit Testing

Movement to Cybershark

| Comments

I had been procrastinating movement to a dev-ops style Chef deployment for my servers to ease it's management because of the age old "If it ain't broke..". Well, upgrades on Bumblebee were getting more expensive so I finally decided to take the leap. I introduce the trion cookbook that I'm using to setup my servers.

I also realized that Kimsufi came up with cheaper servers (now as low as €4.99). Without automation to setup my servers, the thought of migration and building another snowflake server scares me purely because of it's frailty. No more.

I've now officially moved to my new server, Cybershark!

I have made it a point not to have PHP on this server. It's time to stop my dependency on it. Good bye Wordpress. Welcome Octopress. Good bye Soccer Scraper. Google Now will do fine :)

This means some of the internal dependencies I had (such as PHP mailers) needs to now be moved to another technology. Hello Node.JS. I think we might be good friends :)

Modern Operating Systems Phoning Home

| Comments

It seriously irks me when general public operating systems build in default features that send data to their servers without clearly indicating so. Both Microsoft (with Windows 10) and Apple (with Yosemite) have done so. Disabling these features doesn't take long so here's what you need to do.

Windows 10

There's a well written reddit page by user hazehk which lists all the setting changes required. Takes around 10-15 minutes to run through them.

If you're a bit lazier, you could use tools to do it for you if you aren't paranoid about the tools themselves :)

OS X Yosemite

Fix my Mac OS X talks about the simple changes required to alleviate your pain. You could either follow their steps or use their python script. Your choice!

It has only 2 steps so it should take you less than a minute to do both. I actually went as far as to disable Spotlight all together (remove spotlight shortcut; disable spotlight indexing causes problems with Alfred because it needs spotlight's cache for application data) and move to Alfred (not the least of which was motivated by the privacy issues..)

Reducing Maven Package Times Due to Resource Copying

| Comments

I once worked on a web application with a 250+MB code base. This consisted of 200,000 images. For every development cycle, you had to compile and deploy the code on the server which was painful to say the least. The size wasn't the problem as much as the number of resources. The code took less than 20 seconds to compile.

We figured that compilations overwriting class files were OK but having to edit any resource just took too long. In such cases, you can use maven's process-resources plugin to ask maven to only copy the new resources to your target directory.

This is significantly faster. Package times went down from 6 minutes to 18 seconds. Of course, a SSD would have helped but looking at the difference, it's well worth the effort :)

mvn process-resources

Go try it out!

Maven Compilation in Ram Drive

| Comments

If you're working on huge maven projects and have a slow disk, compilation, packaging and install times can sore quite high. If getting faster hard disks isn't possible, why not try moving the compilation to a ram drive?

A code base which used to take 22 minutes to compile went down to 3 minutes. This just goes to show the effect that disk IO bottlenecks can have on your system.

Forced HTTPs on Your Website With CloudFlare

| Comments

I'm a supporter of the HTTPS everywhere movement by the EFF. They advocate users use (all) websites with HTTPS for extra security. This means everyone should probably fork out a few dollars to get their own certificates. Unless you're buying a domain at NameCheap (in which case they tend to throw in a SSL certificate for the first year), you'd have to shell out $8-$12 to get one.

Side note, I recommend every user have HTTPS everywhere installed on every browser.

Though it's not perfect, you can get a SSL for your website for free.

Signs of a Troubled Startup

| Comments

India has been developing the startup culture quite seriously over the past half a decade. In this time I've seen dozens of ventures pop up and quite a few of them fizzle out. If you've gone through a startup bootcamp or an equivalent program, you've probably heard the stats. Failure rate of startups is pretty high. I admit, I am concerned. Not about the high failure rate. It's about why quite a few Indian startups are failing these days.

I am concerned because they seem to not be getting their basics right. Most startup schools and accelerators tell you things that usually go wrong. Repeatedly. Yet there are other things they don't tell you. Things they'd think are common sense.

Sometimes it is hard to spot these from the outside but if you do see these signs, you better have taken your ERT training seriously because the building is on fire and you better be prepared to evacuate people.

Net Neutrality: Why Should I Care?

| Comments

Yes, that's one of the most often asked questions right after "What is that?". I don't often provide this explanation to techies because doing that is as simple as giving them a few lines of explanation and pointing them to a good website with information. The real challenge, if you ask me, is explaining this problem to the everyday Joe out there. Especially since, in a place like India you're likely to hear "we have bigger problems than ". This to me sounds like a blanket excuse for not wanting to deal with an issue at hand and here's how I tend to answer such queries.

Mac: Camera Not Available

| Comments

My Macbook Pro sometimes doesn't detect it's web camera when I'm trying to join a video call and it's painful to have to reboot the machine to fix it. A simpler way (especially if you have root access to your machine) is to kill VDCAssistant from the command line.

sudo killall VDCAssistant

Once you're done, restart the application that was attempting to use your web camera :)