Styling the Syntax Highlighter

I am using the Syntax Highlighter Evolved by Alex Gorbatchev and for those of you who are curious, this is how I styled the code block.

I have added a border and change the font size to 16px so that it could better fit into the post.

.syntaxhighlighter {
	background-color: white !important;
	border: 1px solid #DADAD9 !important;
	margin-bottom: 20px !important;

body .syntaxhighlighter .code {
	font-size: 16px !important;

body .syntaxhighlighter .gutter {
	font-size: 16px !important;


Checking the width of an image file

There was a plugin in WordPress that I used which allows an image to be uploaded.  This part of the code was done in Javascript and not in PHP.  When the image file is uploaded, I want it to prompt a message if the width of the image is smaller than 700px.

In Javascript, once the file is uploaded, it is put into a file object.  As with any other object, we could get other properties of this file object such as its name.  If the file object is file, we could get the name by using

Making use of file object property, this is how I get the full path of the image file and pass it to img.src to check its width.

var d = new Date();
var mth = d.getMonth() + 1;
var str1;
if (mth == 11) {
    str1 = '//localhost/wordpress/wp-content/uploads/2015/11/';
else if (mth == 12) {
    str1 = '//localhost/wordpress/wp-content/uploads/2015/12/';
var str2 = str1.concat(;

var img = new Image();
img.onload = function () {
    if (this.width < 700) {
        alert('The size of the photo is too small.');
img.src = str2;

Display a youtube link in WP post

In a WordPress post, you might have a custom field which is a Youtube link and as this youtube link is just part of the content, you might want to display it directly in the post.

This is called embedded content and in WordPress, it provides a function called wp_oembed_get:

<?php $embed_code = wp_oembed_get( $url, $args );   ?>

To display this youtube video in the post, you can save this field in wp_postmeta table with the meta_key in the table as youtube_link.

The code is as shown below and you could put it at the end of functions.php found in the WordPress theme.

iPhone Force Touch

“We believe that iPhone’s Force Touch sensor doesn’t directly detect the pressure applied by fingers,” Kuo said. “Instead, it monitors the contact area on which the finger touches the screen to decide how big the pressure is.”

Samsung could totally make use this technique to create its Force Touch technology in its Galaxy phones. By calculating the force using the number of pixels that are in touch with the fingers.

For example, for 100 pixels, it is a force level of 1 and for 1000 pixels, it is a force level of 10.

Call Of Candy

We all know that Activision is the publisher of Call Of Duty franchise and that in another 3 days, on 6th November, the world’s most popular first-person shooter Black Ops 3 will be released worldwide.

Other popular titles that are owned by Activision are Blizzard and World Of Warcraft.  Now there is a new one Candy Crush Saga that will be added to the list. In terms of popularity, Candy Crush Saga could trump them all.

However, we know that the popularity of Candy Crush Saga is declining and I wonder how Activision will revive this game.  Well, maybe call it Call Of Candy?

Apple watch is doing well after all

This could be a surprise to many who had thought Apple Watch would flop.  In fact in the first few weeks, Apple Watch was doing better than the first generation of iPad.  This is important to a lot of us as it means  we would probably have to figure out how to code in WatchOS.

Cracking it in Apple TV

The recent Apple event was mind boggling.  Last year, the iPad announcement was held in a second event held at around October but for this event, even the new iPad pro was included.

I am especially interested in the new Apple TV.  If you remember, Steve Jobs had once said that he had cracked the code for bringing Apple TV to our living room.  This was mentioned by Walter Issaacson in his biography book and for most of us who read this book, we were left wondering what was he talking about.

If Steve Jobs had cracked the code, the Apple TV that he was talking about should be the Apple TV that we are seeing now.  It combines a Siri and a motion control style controller and it would let you search and watch programs from the different network sources such as Netflix, Amazon Prime and even Youtube.  I was wrong in my earlier post thinking that we would not be able to watch Netflix programs in Apple TV.

And so if Steve Jobs had cracked the code, this would be it.  I have been puzzled by what Steve Jobs meant when he said openly to Walter Isaacson that he had cracked it.  Now all that we need to see is if Apple TV would conquer our living room.

Apple TV universal search

Apple will be announcing the iPhone 6s soon.  Along with the iPhone event, there is been rumour that Apple will announce an improved Apple TV with a universal search.  This will allow users to use Apple TV and search across the different network sources.

That is almost like saying that Apple has finally come out with its Theory of Everything and unified all the different forces into one.

If you also pay attention to another news, there was a saying that Apple is into making its own TV series or producing its own movies.  This only shows that Apple is gearing itself to compete with Amazon or Netflix and if this is the case, it is unlikely that Netflix or Amazon will allow Apple to carry their programs in Apple TV.

iPad Pro with Stylus

Steve Jobs once said that if you have a Stylus in a Tablet, it will die just like Apple Newton.

However, rumour is all over the twittersphere that the next iPad will have an iPad Pro model with a larger screen.  If you think of what Steve Jobs had said, you might discard this as just a rumour.

However, I think that the possibility that Apple will release an iPad Pro with a stylus is high.

Just earlier, it was said that Apple is working with App developers and giving them assistance to develop iOS applications for the enterprise.  Apple has always wanted to push iPad and make it widely used by its corporate customers.

If you ask me what was the single most hindrance for iPad to be widely adopted,  I would say it is that we can’t use a mouse with an iPad and so Apple would have to finally resort to using a Stylus.  We will see.


iPad In The Enterprise

Recently, rumour has it that Apple is working with 50 companies to bring iPad applications to the enterprise.  Apple is working with smaller application development firms giving them incentives and  partnership to bring applications to their enterprise clients.

I think the first thing that Apple needs to do is to tell us how iPads are used in its own Infinity Loop campus.  Steve Jobs had famously said that Apple does not understand the enterprise.  If Apple does not understand the enterprise, it certainly understands its own company.

If the different departments in Apple such as its sales and R&D could use iPad for most of its applications, I believe Apple would not have any difficulties convincing others to purchase more iPads for their staff.