Tuesday, December 22, 2009

More gift card deals

If you like to eat at Applebee, get their $50 GC now and you will get $10 bonus card. Link: Applebee.

There are few more restaurants that are doing the same promotion:
1. Benihana: $10 bonus card for $50 GC.
2. Denny's : $5 bonus card for $25 GC.
3. IHOP : $5 bonus card for $25 GC.
4. Outback : $20 bonus card for $100 GC.
5. P.F.Chang : $10 "Be Our Guest Card" for $50 GC.
6. Souplantation & Sweet Tomato : Get a free meal pass for $100 GC.
7.TGI Friday's : $5 bonus card for $25 GC.

You have to act quickly as all these offer only valid until Christmas or End of 2009. (The bonus card usually valid until end of March, but read the fine print)

Merry Christmas Everyone! Happy Holiday!

Friday, December 18, 2009

If you eat out a lot...

If you eat out a lot, this might be a good news to you. Restaurant.com is having a promotion right now. When you buy any gift certificate from them, you will get 80% after applying this coupon code: "SANTA". I have used their gift certificate before and it was a nice experience. However, each gift certificate for different restaurants have different restriction. Some required you to spend about $35 before you can apply the $20 gift certificate and etc. So, read the fine print before you order the gift certificate. I still think this is a good way to save especially if you dine with your family or friends (where the bill will add up quickly).

Website: www.restaurant.com
After you add the gift certificate and click on "Checkout", in the checkout screen, on the top right area, you will notice a text box with label: "Enter Discount Code:". Put this coupon code: "SANTA" and click the "Apply" button. You should see the discount applied to your gift certicate.

Good luck! :)

Thursday, December 17, 2009

If you like cheesecake...

Cheesecake Factory has a promotion right now. If you buy a $25 gift card, you get a free slice of cheesecake! Check out the promotion here: Cheesecake Factory Link

Thursday, December 10, 2009

Toshiba Regza 55SV670U

I recently purchased this Toshiba TV from Amazon when it was on sale. This is a "LED Backlight with Local Dimming" TV. This is one of the best TV in term of image quality on the market right now. Because of the local dimming LED, the black is really black. Watching blu-ray movie on this TV is just absolutely awesome! I love watching BBC documentary blu-ray like Planet Earth[Blu-ray]
and Wild China[Blu-ray]
on this TV. Both SD and HD channels show up nicely on this TV as well, which is a plus.

However, I run into a problem with this TV. The CC (closed caption) on this TV is not working properly with the channels receive on the air.(public broadcasting). Sometime, the CC will not show up at all. You will have to go to setup again for the CC to show up again. On some channels, even though the CC show up, it will show up overlapping each other on the same line. This makes the CC un-readable!

I called Amazon and they are very nice and send a replacement TV for me. Unfortunately, I just received the TV today and it exhibits the same problem as the previous one!!! Right now, I don't know what to do... Should I return this or keep it?

So, this is just a warning for you if you are thinking about getting this TV. The price is great.(For the comparable quality on Samsung brand, you will have to pay close to 3K!) The image quality is stunning and beautiful. If you don't use the CC feature, I think this is a great choice. But if you need the CC feature, would you buy this TV?

BTW, the reviews of this TV on Amazon are great.

Wednesday, December 9, 2009

Customizing jqPlot stacked bar chart

Recently, because of a need of a project, I have been introduced to jQuery and jqPlot. jQuery is a popular javascript library that is very powerful. jqPlot is an extension to jQuery and it adds the graph or chart capability to the library. Both are open source library and can be freely used in any projects. You can find the link to both open source project at the end of this article. The jQuery version used for my project is v1.3.2 and for jqPlot is 0.9.6.

jqPlot provides many types of charts and features. There are many ways you can customize the charts. For example, you can customize the legends, the colors, both the y-axis and x-axis and etc. You can see the example of all the available charts on jqPlot website.

However, there is one missing feature in the stackedBarChart that I need to use in my project. There is no way you can click on a "bar" in the chart that will send some request back to the server so that the screen can be updated. For example, in a weekly chart that show each days as a "bar", if I click on the bar, I want the screen to be updated and show the chart of the day. This feature is missing and I will need to add some javascript code to make it work.

There are few challenges in order to achieve this. First, I will need to detect whether a mouse click is indeed inside of a "bar". Then, when the mouse click is inside of a "bar", I need to be able to retrieve some information (like the date of the day) to send back a request to the server.

In order to detect the mouse click on the chart, I will need to add a event listener first. Here is the code:


$(function(){
var xAllowedRange = 0.4;
$.jqplot.eventListenerHooks.push(['jqplotClick', myClickHandler]);
});


The "myClickHandler" is a callback function that will be called when users click on the chart. Inside of this function, we will determine whether the mouse click is inside of a "bar" and what to do with it.

The "xAllowedRange" is a variable used to detect the "width" of the "bar". The exact middle position between 2 bars will be "0.5". So, for normal bar's width, 0.4 will be a good value. You will need to change this value based on the width of your bar. You can set the width of the bar when you create the chart.

The function "myClickHandler" is listed below:


function myClickHandler(ev, gridpos, datapos, neighbor, plot) {
var items = plot.data;//Get the chart's data from the 'plot' object
//The data for the stackedbarchart is an array of array
var itemLength = items.length;//This should be equal to number of category you have; or the number legend.
var numberOfBars = 0;//How many bars are on the chart
if (itemLength > 0) {
numberOfBars = items[0].length;
}
if (numberOfBars == 0) //no data
return;
var timeIndex = Math.round(datapos.xaxis);

//we are trying to detech which bar the user click on
//The timeIndex will give us the indication, timeIndex=2 for bar #2 and etc...
if (isInsideBar(datapos.xaxis,datapos.yaxis,items,xAllowedRange)) {
//Send a request to the server
if (numberOfBars == 24) {//Daily chart
//Change the timePeriod type to Hourly
getChart("Hourly",timeIndex);
} else {//Weekly or Monthly Chart
//Change the timePeriod type to Daily
getChart("Daily",timeIndex);
}
}
}

The function "isInsideBar()" is a function that detect whether a mouse click is inside of a bar. It is listed here:

function isInsideBar(xPos,yPos,items,allowed) {
var roundedXPos = Math.round(xPos);
if (roundedXPos == 0) {//the click happen near the y-axis
return false;
}
var result = xPos - roundedXPos;
var xIndicator = Math.abs(result);
var idx = roundedXPos-1;//since the array is zero based, we need to minus 1
var barTopValue = 0;
for (var i in items) {
barTopValue += items[i][idx];
}

var yIndicator = Math.round(yPos);
if ((xIndicator < allowed) && (yIndicator <= itemTotal)) {
return true;
}
return false;
}


The css for formatting the code snippets is from here. Thanks.

Resources:

The best most up-to-date book about jQuery is "Learning jQuery 1.3". You can check out others review on amazon website.

My First Blog!

Finally I made it; I created my first blog! :) This will be my space where I will be sharing my creative thoughts and knowledge with everyone on Internet. I always believe the Internet is the best tool for knowledge sharing and I'm glad that I can finally contribute to this knowledge pool. If I make any mistake in my blog, don't hesitate to let me know. I would love to learn from everybody as well. :)