Archive for the ‘Blog’ Category

Habits and Data

Wednesday, August 15th, 2012

I have been reading the Power of Habit by Charles Duhigg and have been gaining insight into our behavior and why we do the things we do. Humans are habitual creatures and apparently, we go through the majority of our day by relying on our habits – though it seems like we are making multiple conscious decisions throughout the day.

I have also found out about how much of what we do are being recorded and studied. There is actually software, Hit Song Science that predicts the popularity of a song. I wonder if that is the reason why there is so much crappy music nowadays . . . radio stations around the country are using data to see which songs are popular and then form playlists around those songs. A study shows that the majority of us will not tune out of a station if it is playing something familiar to us, regardless of whether we like it or not. Personally though, whenever a song I dislike gets played on the radio, I immediately tune to another station or plug in my iPod. However, it seems interesting to me that most people do not . . . However, all of this is moot as I have learned from other sources that a huge majority of teenagers use Youtube to discover new music. So, Youtube is now the new MTV.

More and more companies are relying on mathematicians and statisticians to make use of the enormous amounts of data they have on their customers. Patterns emerge whenever you apply the correct algorithm/formula and from there, companies are more than eager to take advantage of it. There used to be a time when I wasn’t too worried about companies mining data by monitoring my spending habits but they are now integrating their data with data they have bought or mined from somewhere else. There is a huge compilation of data on each individual through social media, online retailers and offline data records. It is no longer science fiction or paranoid to think that Google would know more about you than your co-workers or friends.

I’m also aware of the fact that the next generation would have no problem sharing this information to companies since they grew up in a time where it is the norm. Once they grow up to be our age, everything would probably be public information and perhaps it will be a better world, who knows? A whole generation will not know what a dial tone is, or a rotary dial phone for that matter, they will never see a typewriter and perhaps not know what a watermelon seed looks like. But hopefully, all the data that is gathered about them, helps them form good habits or at least, help them make good decisions.

Printer problem

Tuesday, May 29th, 2012

My trusted Canon ip1500 finally broke down after several years of being my sole printer so I had to resurrect my Brother MFC-240C multifunction printer which I was basically using as a scanner. I had to order ink cartridges from Amazon ($7) – cheap! But when they arrived, I found out that it was printing blank pages . . . I ran the print head cleaning utility a couple of times to no avail . . . so I googled it and found out that you should go into maintenance mode and run the cleaning utility from there (which basically cleans it out better than just running it from the menu – I don’t know why engineers think this is acceptable)

To go into maintenance mode, while pressing the Menu button, unplug the printer and without releasing the Menu button, plug it back in (You might need another person to help you achieve this). Wait until you see maintenance on the lcd screen and all four lights (fax,scan,copy,photo capture) should be blinking to indicate that the printer is in maintenance mode.

You should then press 7, 6, 4 (in that order) and then press the black start button – this will start a thorough cleaning process which should clear out any clogged nozzles and afterwards, your printer should be able to print normally.

Funny thing is, pressing just 7,6 at maintenance mode and then start would clean the print head but not thoroughly enough as when I tried it out, it only printed out magenta, yellow and a faint black . . . so if you really want to flush it out, do the process above and it should work.

I’m putting this in my blog for my reference as well as to help out anybody out there who might be at wit’s end and about to throw their printer out the window . . .

Intro to Javascript Objects

Thursday, May 17th, 2012

I have recently signed up for a class in Web Analytics at UBC. I think it will greatly complement my knowledge in usability design and will improve how I produce websites in the future. I haven’t really had much time to study user behavior in the past aside from the usual A/B testing so it will be a welcome change to be able to delve into the analysis of the user and how my websites are being consumed.

I have also made great improvements in my javascripting, having completed a course last year on the basics. I’m also finishing up on the Javascript component at Codecademy (http://www.codecademy.com/). I’m much more confident in my Javascript skills now and am consistently putting it into practice in whatever project I may be working on.

Here’s a snippet of what I have learned so far:

Creating Objects in Literal notation

var person = {
name: 'Ryan', // note the comma
weight: 150 // no comma after the last key-value pair
};

Below is the same but using an instance

var person = new Object();
person.name = 'Ryan';
person.weight = 150;

Now you can access the object’s properties by just stating

var weight1 = person.weight;
var weight2 = person['weight']; //this is an alternate way

You can also create a constructor to make it easier to create new objects

function person(name,weight)
{
this.name=name;
this.weight=weight;
}

And then afterwards, create new objects just by using the constructor

var myFriend=new person("John",150);

That is the basics of Javascript objects . . . I will be sharing more about Javascript and jquery on later posts.

Stop Internet Censorship!

Wednesday, January 18th, 2012

If there was any doubt that big business controls the government, there shouldn’t be any after 2 bills – SOPA and PIPA are about to pass in US Congress and the Senate. These 2 bills are so obviously drafted by big media companies in order to protect their copyrighted content in an attempt to eradicate online piracy. The huge problem is that, if they pass this bill – it will cripple the internet as sites can be taken down without any due process. And online piracy, the very thing that the media companies are trying to eliminate will probably not be affected at all. File sharing as history has it . . . has morphed and adapted to whatever hurdles may come its way . . . short of cutting all telecommunications methods, these 2 bills will NOT stop piracy. The very people who drafted these bills obviously do not understand how the Internet works – or are desperate enough to try everything they can just to protect their own interests.

Below is a video from TED explaining further how this is going to affect you as an internet user.  And further below are a few sites opposed to the bills and are participating in the blackout today!

Google

Google

Wordpress

Wikipedia

Reddit

Mozilla

Wired

Using Google Feed API to parse external RSS/XML feeds

Tuesday, November 8th, 2011

Recently, I have been tasked to parse an XML/RSS feed using only client-side code. As the website is being migrated from Apache to IIS, it is difficult to settle on which server-side code to use (asp.net or php or python) thus the reasoning behind using pure Javascript/jquery for the task. At first, I thought that this was not possible but as I later found out . . . Google has released an API that would accomplish this task.

Here is a simple implementation of this task:

<script type="text/javascript" src="https://www.google.com/jsapi?key=API_KEY"></script><script type="text/javascript">// <![CDATA[
google.load("feeds", "1");
google.setOnLoadCallback(showFeed);
function showFeed() {
var feed = new google.feeds.Feed("FEED_URL");
feed.setNumEntries(5);
feed.load(function(result) {
if (!result.error) {
var container = document.getElementById("listing");
for (var i = 0; i < result.feed.entries.length; i++) {
var entry = result.feed.entries[i];
var li = document.createElement("span");
li.innerHTML = '<h3><a href="' + entry.link + '">' + entry.title + '</a> <cite>on ' + entry.publishedDate + '</cite></h3>';
li.innerHTML += '<p>' + entry.contentSnippet + '</p>';
container.appendChild(li);
}
if(result.feed.entries.length == 0) { container.innerHTML = '<h4>Nothing in the feed.</h4> Please check back later'; }
} else {
var container = document.getElementById("listing");
container.innerHTML = '<span><h4>Error getting the feed.</h4>
<a href="http://www.benjamingaw.com/blog">Check out my Blog</a></li>';
}
});
}
// ]]></script>

In the HTML, all you need is a placeholder where you want your feed to appear:

You will need to sign up for an API key here. Google loads up the feed as a JSON object, but you can specify XML if that is what you prefer – the entire documentation is found here – http://code.google.com/apis/feed/v1/devguide.html

Look at a demo of this.
There are a couple of jquery plug-ins that take advantage of the Google API as well – go check out PaRSS and gfeed.

Using jParse to post-process an XML feed

Monday, October 24th, 2011

I have used jquery to parse XML in the past for simple tasks. But rewriting the same code every time gets tedious and cumbersome. So I have resorted to using jParse – which is a freely available plug-in especially made for this task.

The plug-in works great straight out of the box and you can even customize the output to your heart’s content.  Simple usage script below:

function start(){
jQuery('#jparse-meta').html('<img alt="Content Loading" src="ajax-loader.gif" />');
}
function finish(){
jQuery('#jparse-meta').remove();
}
$(function(){
$('#ajax-cont').jParse({
ajaxOpts: {url: 'kyle-rush-feed.xml'},
elementTag: ['title', 'link', 'description'],
output: ' <div><h4><a href="jpet01">jpet00</a></h4><p>jpet02</p></div>',
precallback: start,
callback: finish
});
});

HTML for the above script is:

<div id="jparse-meta" style="text-align: center; margin: 15px 0 0 0;">
<p><a href="//http://www.benjamingaw.com/blog">Read my Blog</a></p>
</div><!--/#jparse-meta-->
<div id="ajax-cont"></div><!--/#demo-cont-->

Simple, isn’t it? However, the project I was working on required a little bit more flexibility. As it is a feed that may at times, return nothing. So how do you display default text if the RSS/XML feed is empty? I have looked around for an answer to this and found nothing on Google, so I have to write a simple snippet to address this issue.

For my purposes, the code will lie within the finish function, as this is the callback function once jParse finishes running (see the line of code – callback: finish). And here is the code snippet I added to the finish function to display “No entries. Pls. check back later.”

function finish(){
jQuery('#jparse-meta').remove();
if ($('#ajax-cont').html() == 0) {
$('#ajax-cont').append('<h4>No entries</h4><p>Pls. check back later</p>');
}
}

And that’s it, if the XML doesn’t have any entries, it will show that line of text instead of a blank space.

HP Touchpad overclocking, tips and tricks!

Friday, October 14th, 2011

[Update]: On Oct 18th, HP released an OTA update to version 3.0.4 which renders most of the patches and the overclocking non-operational. However, the update seems to have made the Touchpad more responsive and speedier. It also included a Camera app for taking images with the camera that works better than other free 3rd-party apps. I’ve also noticed a change in video playback – definitely a good update!

I have been playing with my new HP Touchpad for 2 weeks now and would like to share tips and tricks on how to speed it up. Because let’s face it – straight off the box, it is really laggy and slow.

Remove Logging

HP logs almost everything you do on your Touchpad for diagnostic information – the disadvantage is that these background processes slows down everything you do on your Touchpad. Here are some steps to follow to eliminate background logging:

Remove Logging

  • Open up the Phone & Video Calls App
  • Type ##5647# and hit the green call button
  • In the new window that pops up, click on “Change Logging Levels . . .”
  • On the next screen hit “Set Logging To Minimal”
  • Click OK to confirm on the “Are You Sure?” popup

These steps would stop some of the logging processes but not all of them. To remove logging entirely, you have to install some patches. First off, we need turn on Developer mode so we can install third-party apps that are not in the HP App Catalog.

In the Just Type bar – type in webos20090606. Tap the Developer Mode icon. A window will appear – do not set/change password. Instead just hit the toggle from Off to On. That’s it, your Touchpad is on Dev mode.

Installing “Preware” onto your PC or Mac


Download WebOs Quick Install here. Make sure you have java runtime installed on your PC, double-click on the .jar file to install WebOs Quick Install. Let it install the Palm Novacom drivers, it will then prompt you that there is no device attached.

Use a USB cable to connect the TouchPad to your computer. Do not go into USB drive mode (just click cancel)

Once your Touchpad is detected, Click on the globe-like button on the right. A new window will pop up – Type in “Preware” in the search box in the Applications tab and Install it.

Okay. Now you have installed Preware on your TouchPad. Load it up and now you will be able to install the patches. You can do this by clicking on Available Packages > Patch or by simply typing the name of the patches into the search prompt (click on the magnifying glass icon on the right of the Preware title bar)

Here are some suggestions on what patches to install:

  • Advanced Reset Options
  • Muffle System Logging
  • Faster Card Animations HYPER Version
  • Remove Dropped Packet Logging
  • Quiet Powerd Messages
  • Remove Tap Ripple
  • Unthrottle Download Manager

There may be more to come in the coming weeks, just go through all the patches and install the ones that interests you.

Overclock

To overclock your Touchpad, load up Preware and search for Govnah. Install this application and load it up. Click on “Profile” and instead of Palm, select “OnDemandTcL 1512”. This will overclock your CPU to 1.5Ghz.

You will be able to overclock it to as high as 1.9Ghz but that is not as stable and I do not recommend it. That’s it. Enjoy your Touchpad!!

The passing of an icon . . . 

Thursday, October 6th, 2011

Steve Jobs, the co-founder of Apple passed away yesterday, Oct 5, 2011.

I have read numerous biographies about him and had concluded that while I was a huge fan of Jobs (much more than Apple, as a company) I wouldn’t necessarily want to work for him – he was extremely meticulous, argumentative and once he set his mind on something, could be really difficult to sway. Having said that, he was mostly right on most things – he had vision and he almost single-handedly made those visions reality.

He will truly be missed and Apple as we know it, will never be the same without him.

Here’s to the crazy ones. The misfits. The rebels. The troublemakers. The round pegs in the square holes. The ones who see things differently. They’re not fond of rules. And they have no respect for the status quo. You can quote them, disagree with them, glorify or vilify them. About the only thing you can’t do is ignore them. Because they change things. They push the human race forward. And while some may see them as the crazy ones, we see genius. Because the people who are crazy enough to think they can change the world, are the ones who do. – Apple Inc.

Book Review: Endgame: Bobby Fischer’s Remarkable Rise and Fall

Thursday, September 8th, 2011
ENDGAME

ENDGAME

I have just recently finished reading this book about Bobby Fischer – 1972 World Chess Champion. He is indeed a remarkable character, read his Wikipedia entry and you will get a glimpse. That is exactly what he wanted the world to get, only a glimpse since he is an intensely private person. Right after he won the World Championship in 1972, he fell off the radar and completely removed himself from chess as well as from the public eye.

He calls himself a genius and was deeply involved in the Worldwide Church of God until 1972, he was also Jewish but he denounced both the church and all Jews. Frequently making harsh remarks against all Jews (anti-Semitic) and religion as a whole. He hates journalists of all kinds and refuses to be photographed even with close friends.

Overall, I enjoyed reading the book – it is fascinating how a person can be so sensible and sharp when in front of a chessboard and yet be so anti-social and seem so neurotic apart from it. Bobby Fischer, while he was probably the best chess player who ever lived was not nearly half as good as a human being.

Mercury Drug website . . .

Wednesday, August 24th, 2011

I have recently re-discovered the Mercury Drug website (mercurydrug.com) . . . this was one of the first few websites I created way back 1998-ish – and I was surprised that the original layout down to the graphical elements is still in use today. This is just so mind-boggling to me – this is not in any sense of the word a small business, or a one-man garage operation . . . this is the Philippines’ biggest and most popular drugstore we are talking about. I think I should be flattered that they are still essentially using the same template and layout for more than a decade now but I’m actually embarrassed by it — they should really hire somebody to do the deed or I will be forced to call them and offer my services for free. I mean, they are still using tables for crying out loud!

Looking at the source code, I can definitely say that they have made very minor modifications . . . I can still see my work in there, at times – just being commented out. How could a corporation of this size be so neglectful of their website? I’m sure cost is not the problem here as I have mentioned, they are one of the biggest corporations in the Philippines and web design/development isn’t really expensive in Manila — I heard you can get a website done for less than Php2,500 there (approx. $50) so I can’t really see why this hasn’t been done apart from red tape, corporate politics and probably an owner/CEO who just doesn’t understand the technology at all to take advantage of it.