I brought myself a Christmas present

After being upgraded to June 2017 iMac 27″ 5k Retina at work, and using it for a week, I decided it’s about time to purchase myself an iMac. My first impression with this machine is fantastic, everything just works (fast and smooth) and the 5K Retina is amazing.

Today (after being financially stable, after some time 🙂 ) I ordered 27″ iMac 5K Retina equipped with 4.2GHz Quad-Core Intel Core i7, 16GB 2400MHz DDR4 (will be upgraded to 32 or 64 GB later), 2TB Fusion Drive and Radeon Pro 580 with 8GB VRAM.

It will arrive around 20 Jan 2018. It will be a nice time to start developing apps for iOS and bring VMSoft to the app store as well. Also a lot of my clients were asking me when will I start developing for iOS.

Fighting spammers: Removing Website URL Field from Comment Form

I’m tired of receiving massive amount of spam comments on my blog (1280 spam comments for about a month) and doing:

DELETE FROM `wp_comments` WHERE `comment_approved` = 0

Beside using SI Captcha Anti-Spam which does pretty good job in keeping some of the automated spam bots at bay, I noticed some trend in the spam comments flooding my posts, they are all full of SEO keywords and they are heavy abusing the Website field in the comment form.

Here is a small “plugin” which will remove (unset) the URL field in the comments form:

<?php
/*
Plugin Name: Remove Website field from comments.
*/
function custom_comment_fields( $fields ){
  if(isset($fields['url']))
    unset($fields['url']);
  return $fields;
}
 
add_filter( 'comment_form_default_fields', 'custom_comment_fields' );

Create a file in /wp-content/plugins/ with the code a bough. Go to the ‘Plugins’ section of the admin panel and activate the newly created plugin named “Remove Website field from comments”.

Yey, no more “Website” field in the “Leave a Reply” section 🙂

Java: Parts of the Day

Utility method that will return the part of the day, such as morning, afternoon, evening, etc.

public static String getPartOfTheDay(final int hour) {
    if(hour > 4 && hour < 12) {
        if(hour <= 8) {
            return "Early Morning";
        }
        else if(hour > 8 && hour < 11) {
            return "Morning";
        }
 
        return "Late Morning";        
    }
    else if(hour >= 12 && hour < 17) {
        if(hour >= 13 && hour <= 15) {   
            return "Early Afternoon";
        }
        else if(hour >= 16) {
            return "Late Afternoon";
        }
 
        return "Afternoon";
    }
    else if(hour >= 17 && hour <= 21) {
        if(hour <= 19) {   
            return "Early Evening";
        }
 
        return "Evening";
    }
    else {
        return "Night";
    }
}

The method is based on the following logic, that many people would agree with:

Morning: 5 to 12

  • Early morning: 5 to 8
  • Late morning: 11 to 12

Afternoon: 12 to 17

  • Early afternoon: 13 to 15
  • Late afternoon: 16 to 17

Evening: 17 to 21

  • Early evening: 17 to 21

Night: 21 to 4

Gentoo Linux

Gentoo: No image size information in Dolphin

Dolphin 16.04.3

Dolphin 16.04.3

One thing that was not working with my Gentoo installation was the information for image dimensions (and image data in general) in Dolphin. The resolution is to rebuild Dolphin with the semantic-desktop use flag turned on.

echo "kde-apps/dolphin semantic-desktop" &gt;&gt; /etc/portage/package.use/dolphin
emerge --ask kde-apps/dolphin

I thing that this flag should be on by default when building a system with KDE desktop profile or at least mentioned somewhere in the Gentoo wiki.

LCD buzzing noise and screen going completely black from time to time

27.10.2016 UPDATE: The method below fixed the monitor for a little while, it finally gave up!

Lately one of my LCD monitors was doing some strange things, like loud buzzing noises when turning on, to screen flashing and going completely black. I through it was a time for a new one, because this LCD was manufactured way back in 2007.

Being on a tight indie game developer budget it is not the right time for a replacement, so consulting google about the problem revealed some clues varying from opening the monitor and putting epoxy around the capacitors to changing the refresh rate of the monitor.

Changing the refresh rate from 75Hz to 60Hz and muting the build in speakers fixed the problem for me.

I hope that this solution will last at least until releasing my next game, which if successful will help me put aside some money for replacing my 3 monitor setup (all 3 manufactured 2007.) with 3 Dell U2415 monitors 🙂