Monday, November 28, 2011

Hotshots in PhilSTAR.com - New dawn for high-tech mobile ticketing from Smart

MANILA, Philippines - Who knew that the day would come when a simple swipe of the hand could yield cinema tickets and movie treats? Smart Rewards together with SM Cinema made history when they launched the revolutionary bCode technology, the country’s first cutting-edge platform that allows subscribers to redeem free blockbuster rewards conveniently through their cell phones.

Offering the latest in mobile commerce, the breakthrough bCode technology allows loyal users of Smart Gold, Smart Buddy and Smart Bro users to claim big rewards, from free tickets, popcorn and drinks, to a P100 discount on movie tickets in as easy as a single tap on the terminal screen.

Driven with the commitment to innovation, Smart Reward pioneers the use of bCode technology for mobile ticketing in the country. To develop the technology, WolfPac Mobile, Inc., Smart’s mobile service solutions provider and application developer, spearheaded the integration of the Smart Rewards loyalty program to the new redemption platform.

According to Paul Gonzaga, WolfPac’s Web and MIS development manager, a crucial part of the implementation was developing the software that would allow subscribers to use their loyalty points in redeeming reward items via bCode. With a team of MIS experts, the development of the system took only one month in time for its launch recently.

Smart Rewards’ loyalty platform linked to the bCode platform offers a hassle-free mobile-ticketing service since it doesn’t require users to download any mobile application. Subscribers need only to text the item code of the reward to 9800, and a unique bCode SMS consisting of alphanumeric characters will be sent to their mobile phone. To receive the reward coupon, subscribers must simply scan the bCode in terminals designed to securely read the encrypted codes. SMART Bro users can also redeem free items via WebConnect and print out the given code to be scanned at the bCode machines located in SM cinemas nationwide.

The new redemption network is also compatible with all mobile phones in the market, making the complete movie experience accessible to all Smart subscribers. An instant hit among movie-lovers, the new bCode platform has gained an increasing following. Today, thousands of tickets and treats are being redeemed every month using the new technology.

“Through the innovative technology of bCode, Smart Rewards and WolfPac continue to provide more dynamic ways for subscribers to enjoy their rewards. Movie tickets and treats are just the start. Subscribers can expect to delight in even more rewards as we look forward to expanding the roster of redeemable items via bCode,” says Gonzaga.

Text REWARDS to 9800 for free to start redeeming exclusive treats only from Smart Rewards. Or visit smart.com.ph/rewards for many more exciting freebies.

Reference: http://www.philstar.com/Article.aspx?publicationSubCategoryId=449&articleId=750160

Wednesday, November 23, 2011

Computing the distance between zip codes longitude / latitude

I have created a function that will compute for the distance between zip codes (longitude / latitude).

The function will actually go a series of conversion from degrees to radians, radians to degrees, degrees to miles, then miles to any unit of measurement you want.

For the benefit of this post, we will have the distance in kilometers.

Given that, we need the multipliers below.

my $pi = atan2(1,1) * 4; # pi: 3.14159265358979
my $deg2radmul = $pi / 180; # degrees to radians multiplier: 0.0174532925199433
my $rad2degmul = 180 / $pi; # radians to degrees multiplier: 57.2957795130823
my $deg2milmul = 69.09; # degrees to miles multiplier
my $mil2kilmul = 1.609344; # miles to kilometers multiplier


First, we have to get the distance between longitude1 and longitude2 by subtracting the two points.

my $dlon = $lon1 - $lon2;


Next, get the distance by getting the radians value of each points and use sin and cos function in perl.

my $dist = sin($lat1 * $deg2radmul) * sin($lat2 * $deg2radmul) + cos($lat1 * $deg2radmul) * cos($lat2 * $deg2radmul) * cos($dlon * $deg2radmul);


Then finally, convert the distance in radians, radians to degrees, degrees to miles, and miles to kilometers.

$dist = atan2(sqrt(1 - $dist**2), $dist);
$dist = $dist * $rad2degmul; # radians to degrees
$dist = $dist * $deg2milmul; # degrees to miles
$dist = $dist * $mil2kilmul; # miles to kilometers


To get the complete implementation and example that I created, please see below. Happy Coding!

#!/usr/bin/perl

my $lat1 = '14.559943';
my $lon1 = '121.015198';
my $lat2 = '14.56255';
my $lon2 = '121.017151';

my $dist = &distance($lat1, $lon1, $lat2, $lon2);
print "distance in km: $dist\n";

#!/usr/bin/perl

my $lat1 = '14.559943';
my $lon1 = '121.015198';
my $lat2 = '14.56255';
my $lon2 = '121.017151';

my $dist = &distance($lat1, $lon1, $lat2, $lon2);
print "distance in km: $dist\n";

sub distance
{
  my ($lat1, $lon1, $lat2, $lon2) = @_;
  my ($pi, $deg2radmul, $rad2degmul, $deg2milmul, $mil2kilmul, $dlon, $dist);

  $pi = atan2(1,1) * 4; # pi: 3.14159265358979
  $deg2radmul = $pi / 180; # degrees to radians multiplier: 0.0174532925199433
  $rad2degmul = 180 / $pi; # radians to degrees multiplier: 57.2957795130823
  $deg2milmul = 69.09; # degrees to miles multiplier
  $mil2kilmul = 1.609344; # miles to kilometers multiplier

  $dlon = $lon1 - $lon2;
  $dist = sin($lat1 * $deg2radmul) * sin($lat2 * $deg2radmul) + cos($lat1 * $deg2radmul) * cos($lat2 * $deg2radmul) * cos($dlon * $deg2radmul);

  $dist = atan2(sqrt(1 - $dist**2), $dist);
  $dist = $dist * $rad2degmul; # radians to degrees
  $dist = $dist * $deg2milmul; # degrees to miles
  $dist = $dist * $mil2kilmul; # miles to kilometers

  return ($dist);
}




1;


Some men succeed by what they know; some by what they do; and a few by what they are.

Friday, November 18, 2011

How to disable resize functionality on textarea

Textarea by default is resizable by dragging the bottom right corner of the element. Having that functionality will causes the layout to crash if we implemented styles in our textarea, such as having a background image instead of shadow style. That is because the background image doesn't follow the size of the textarea when resized.

We can disable the resize functionality by setting the resize to none. Please see below for the implementation.

<html>
<head>
<title>Disable Resize in Textarea</title>
</head>
<body>
<textarea style="resize:none" rows="5" cols="5"></textarea>
</body>
</html>

Thursday, November 17, 2011

How to show a running date and time clock in your website.

Using Ajax, I created a simple script that will show a running date and time clock in the website. Basically, the function will get the actual date and time of the server, then set a time out that loop in every second.

To get the date and time, you can initialize it by Date() object.

var today = new Date();


From there, you can get the date and time, please see below for the object methods that you can call.

var cmonth = today.getMonth(); // this will return the index of the month[0-11]
var cyear = today.getFullYear(); // this will return the year in 4 digits
var cday = today.getDate();
var chour = today.getHours();
var cmin = today.getMinutes();
var csec = today.getSeconds();


As for the complete implementation, please see below.

<html>
<head>
        <title>Hotel Aide</title>
        <script type="text/javascript">
        function updateTime() {
                var today = new Date();
                var month = new Array(12);
                month[0]="Jan";
                month[1]="Feb";
                month[2]="Mar";
                month[3]="Apr";
                month[4]="May";
                month[5]="Jun";
                month[6]="Jul";
                month[7]="Aug";
                month[8]="Sep";
                month[9]="Oct";
                month[10]="Nov";
                month[11]="Dec";

                var cmonth = month[today.getMonth()];
                var cyear = today.getFullYear();
                var cday = today.getDate();
                var chour=today.getHours();
                var cmin=today.getMinutes();
                var csec=today.getSeconds();

                if (chour<10) chour = "0"+chour;
                if (cmin<10) cmin = "0"+cmin;
                if (csec<10) csec = "0"+csec;

                document.getElementById('datetime').innerHTML= cmonth+' '+cday+', '+cyear+' '+chour+':'+cmin+':'+csec;
                window.setTimeout('updateTime();',1000);
        }
        </script>
</head>
<body onLoad="updateTime();">
        <span id="datetime"></span>
</body>
</html>


Hope this is helpful! Thanks!

Tuesday, November 15, 2011

Eclipse 101: Debug Certificate expired on x/xx/xx xx:xx AM/PM

I'm new to eclipse IDE and when I tested my newly created app for android, I encountered an error "Debug Certificate expired on 6/1/11 10:51 AM".

Developers might encounter this error when using eclipse and what we need to do here is to remove the debug certificate file for eclipse to create a new one.

To do this in linux or mac os, go to your terminal then execute the command below. Make sure you have the proper access to remove the file.

rm ~/.android/debug.keystore


Hope this helps a lot of developers which are new to eclipse IDE. Thank you for reading.

Monday, November 14, 2011

Eclipse 101: ERROR: Failed to fetch URL https://dl-ssl.google.com/android/repository/repository.xml, reason: Unknown Host http://xxx.xxx.xxx.x

While doing an update on my Eclipse SDK for Android development, I came to a problem that I can't able to update SDK due to proxy problem which I didn't remember setting it up.

Problem is that I encountered this error "ERROR: Failed to fetch URL https://dl-ssl.google.com/android/repository/repository.xml, reason: Unknown Host http://192.168.101.5".

I tried disabling the proxy settings of Eclipse Network Connections in all active provider: Direct, Manual, and Native but nothing works for me and error still persist.

It took me half a day to figure out the problem is, and then I found the config file on Android for the proxy settings.

You just have to go to this path: ~/.android/androidtool.cfg.. and you will see the settings like on this below.

### Settings for Android Tool
#Tue Jun 22 09:08:34 PHT 2010
http.proxyPort=80
sdkman.monitor.density=72
http.proxyHost=http\://192.168.101.5
sdkman.show.update.only=false
sdkman.ask.adb.restart=false
sdkman.force.http=false


Then update it to remove the proxy port, proxy host, and set the force http to true. The settings should be like this.

### Settings for Android Tool
#Tue Jun 22 09:08:34 PHT 2010
http.proxyPort=
sdkman.monitor.density=72
http.proxyHost=
sdkman.show.update.only=false
sdkman.ask.adb.restart=false
sdkman.force.http=true


Thank you for reading this post. Hope it helps!

Leadership 101


  • Leadership demands sacrifices for the near-term to receive lasting benefits. the longer we wait to make sacrifices, the harder they become. Successful people make important decisions early in their life, then manage those decisions the rest of their lives.
  • Growth does not happen by chance. If you want to be sure to grow, you need a plan something strategic, specific, and scheduled. it's a discipline that would need incredible determination from us.
  • Success comes by going the extra mile, working the extra hours, and investing the extra time. The same is true for us. If we want to get to excel in any segment of life, a little extra effort can help. Our efforts can go a long way if we only work a little smarter, listen a little better, push a little harder, and persevere a little longer.
  • Making a difference in your work is not about productivity; it's about people. When you focus on others and connect with them, you can work together to accomplish great things.
  • Envision a goal you'd like to reach. Make it big enough to scare you a little. Now write down a plan for moving toward it. Create mini-goals within the big goal, to set yourself up for continual progress. And include some risks, too. Set yourself up for success.
  • Leaders build margins, not image. A leader may be forced to take unpopular stands for the good of the company. Popularity isn't bad, but decisions made solely on the basis of popular opinion can be devastating. So take courage and make the right though sometimes painful choices.