Forced HTTPs on your website with CloudFlare

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.

Continue reading Forced HTTPs on your website with CloudFlare

Mac: Camera not available

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 :)

Removing uTorrent ads

When BitTorrent bought over μTorrent, they promised users that all adverts would be optional. They have, however, made it harder and harder to hide the adverts including now a set of hidden options. Thankfully users have found how to access those hidden options.

Turn off ALL Ads/Featured Content/Bundle Crap in μtorrent/Bittorrent:

Options > Preferences > Advanced

Turn ALL settings to false:

  • bt.enable_pulse
  • distributed_share.enable
  • gui.show_notorrents_node
  • offers.left_rail_offer_enabled
  • gui.show_plus_upsell
  • offers.content_offer_autoexec
  • offers.sponsored_torrent_offer_enabled
  • offers.featured_content_badge_enabled
  • offers.featured_content_notifications_enabled
  • offers.featured_content_rss_enabled

Options > Preferences > Hold Shift+F2 while clicking Advanced (Hidden fields)

Turn ALL settings to false:

  • gui.show_gate_notify
  • gui.show_plus_av_upsell
  • gui.show_plus_conv_upsell
  • gui.show_plus_upsell_nodes

Source: Forum post from Beasley

ExpandRegion on Sublime Text

Once you get used to the JetBrains suite of IDEs pressing Cmd/Ctrl+W for expanding selection becomes second nature. This leads to closing tabs on most applications such as text editors which is of little consequence since you can train yourself to use a different short cut.

My favourite text editor (Sublime Text) does not have this feature built in but it seems I’m not the only one who misses the expand region feature. Go grab your copy of ExpandRegion by Aron Woost from GitHub with full instructions on how to install on Windows, Linux and Mac.

Project Euler #79: Passcode Derrivation (using Lambdas)

I’ve been solving Project Euler for years and I avoid posting solutions online as far as possible but this problem is old enough that it shouldn’t be a problem. Plus, the problem statement interests me enough to write a functional solution using the new Java 8 Lambdas that I’ve been experimenting over the past few months.

Before I begin, I’d like to acknowledge Alex Michael for providing the base solution with a pretty nice explanation of how to crack the problem. You should read through his post before you continue.

My solution provides a Java port of this solution using Lambdas. Here are the steps to the solution

Continue reading Project Euler #79: Passcode Derrivation (using Lambdas)

Set Java Home to a specific version on Mac

Installing Oracle’s version of Java on your machine does (for most machines I’ve encountered) add a Java Home system variable. Rarely however it doesn’t work on some machines. Such folks are recommended to add the path themselves.

On a Mac, you can do this by using the following

export JAVA_HOME=$(/usr/libexec/java_home)

This information is littered across the internet and isn’t hard to find at all. However, this specific machine, when upgraded from Java 1.7 to Java 1.8 kept insisting it’s home is Java 1.7. The Java Home script at /usr/libexec on the mac should take care of this but it hadn’t. In such situations you can explicitly tell it which version to load by passing a version parameter to it

export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)

Java 8: Generic Method Returns with Lambdas and Strategy Design Pattern implementation

With the introduction of Functional Programming in Java 8 new possibilities have opened up. One use case I recently encountered was that of processing JSONs to return data inside them. Let us, for the sake of argument, say the data in an element could be one of the following:

  • An Integer e.g. 1
  • A String e.g. The quick brown fox jumps over the lazy dog
  • A JsonObject representing a Java Object e.g. {"payload":[{"lastName\":\"AB","firstName":"Karun","email":"test[at]"}
  • A JsonArray containing Integers e.g. [1, 2, 3]
  • A JsonArray containing Strings e.g. ["String 1", "String 2"]
  • A JsonArray containing JsonObjects representing Java Objects e.g. [{"lastName":"AB","firstName":"Karun","email":"test[at]"},{"lastName":"FooBar","firstName":"Kung","email":"kung[at]"}]

If you want such a wide variety of data parsed and handled (relatively) safely (i.e. with compile time type safety where possible), here is what you do.

Continue reading Java 8: Generic Method Returns with Lambdas and Strategy Design Pattern implementation

WildFly: Server Side Variables/JNDI Custom Resources

As you probably know, Oracle stopped development of Glassfish’s commercial version and in doing so, prompted others to move. News of Glassfish being dead is greatly exaggerated according to some but myself being one who was already not happy with Glassfish’s Open Source version, steps were taken to move to WildFly. So far, the move has been well received in the team except for web based GUI administration panel which isn’t complete. Reliability of the admin panel is higher than Glassfish’s counterpart though and what WildFly’s web admin panel lacks, it’s CLI and Swing based GUI admin panel make up for allowing script writers (such as myself) to come up with automated ways to get things done.

A while back we discussed how you could use JNDI custom resources on Glassfish to set environment variables. Migration for our team meant information setup as environment variables need to be setup again.

Continue reading WildFly: Server Side Variables/JNDI Custom Resources

Atlassian Bamboo: Downloading Code from Atlassian Stash

The Atlassian suite of tools are a good way to have your organization’s workflow administered. If you’re using Atlassian Stash to manage your source code and are attempting to get Atlassian Bamboo to download code off Stash’s copy of git, the answer isn’t quite straight forward.

Having experience with Atlassian’s tools for over a year, one gets used to excellent integration wrapped up with beautiful UI but when it comes to setting up flawless CI with Bamboo, you’re let down (either that or my integration is non-standard; don’t see how). Continue reading Atlassian Bamboo: Downloading Code from Atlassian Stash