The following snippet is quite useful when working with unit tests in Java, where you need to mock the Calendar.getInstance() method:

 

final Calendar mockedCalendar = Calendar.getInstance();
mockedCalendar.set(2015, Calendar.JANUARY, 1, 14, 30, 00); //The date is 1/1-2015 @ 14:30:00
 
PowerMockito.mockStatic(Calendar.class);
PowerMockito.when(Calendar.getInstance()).thenAnswer(new Answer() {
public Object answer(InvocationOnMock invocation) throws Throwable {
return mockedCalendar.clone();
}
});

This is a simple yet powerful way to find the newest file in a folder (including sub folders):

dir=the-folder-in-question
newest_file="$(find $dir -type f | xargs ls -ltr | tail -n 1 | awk '{print $NF}')"

If you need to empty a log file (not delete it, but simply remove all content) this is one (simple) way of doing it:

cat /dev/null > logfile

Reminder v1.6 is currently being pushed through Google Play. The main feature is the notification the user get in the notification bar once the date for a reminder occurs. Happy reminding! :)

Reminder v1.5 was just uploaded to Google Play, it should be available with hours. It contains a new cool feature, sorting of reminders. It is possible to sort, ascending and descending, by upcoming dates, by age and by name.

The release also contains a few minor bug fixes, among others the annoying bug where the advertisement was placed in front of the list.

Version 1.4 of Reminder is out - this release only contains bug fixes.

Every web developer knows Fiddler. If not, you are missing out on some awesomeness. 

Sometimes, it would be nice to make Fiddler ignore certain ports on e.g. localhost. Currently, due to certificate issues, I would like to skip localhost:8081 and simply pass the response from this port directly rather than having Fiddler catch it.

This is simple, just Ctrl + r in Fiddler, and you get a Javascript called CustomRules.js. Look for the method called OnBeforeRequest. Here you simply add the following, and Fiddler will not process content from localhost:8081:

if (oSession.host=="localhost:8081"){
    oSession["ui-hide"] = "true";
}

 

Finally, after almost 2 months of testing and annoying debugging, Reminder v1.3 is out (currently getting push through the Google Play servers). 

New features:

  • dynamic widget size
  • shows 5 reminders in the widget
  • uses less memory

I have added a new section to the page called Linux server. I bought an old Fit-PC2, as this is going to be used as a playground/server/what-ever. The section will contain stuff on my server, e.g. tips and tricks, etc.

The next release of Reminder is currently being uploaded to Google Play. It includes minor changes to the UI as well as minor changes on tablets. The major change is a brand new icon.

Enjoy!

I have no idea as to why this happens - but from time to time some domains will throw a "413 Request Entity Too Large". The solution is simple (the same in Firefox, by the way). Simply remove the cookie/cookies from the site "infected". This is how you do it in Chrome:

 Settings > Under the Hood > Privacy > Content Settings > All cookies and site data > then search for the host in the upper right hand corner