Tuesday, July 27, 2010

Working with Hidden Fields in ASP.NET

I need to use old school HTML hidden fields in a webpage I'm making because I need to pass it as a post parameter to an external server. I tried using the .NET server controls (ie. runat='server') but realized later that it mangles the name. So by the time the external server receives it, the names has some gibberish prefix or suffix.

Next I tried using the Visual Studio standard html hidden fields control but found out that they cannot be accessed from Code Behind. Since I need to set the hidden field values dynamically at runtime, and not at design time, that's a bit of a problem. The way I used to do it is to use the .NET Literal text control. I would put the Literal control on the page and set its value to the actual html code of "input type=hidden..." during runtime. Not a very efficient method.

After doing some more research, I found a way to dynamically insert hidden fields programmatically through the Page class:

this.Page.ClientScript.RegisterHiddenField(fieldname, fieldvalue)

That solved my problem!

Saturday, July 24, 2010

Microsoft Tags

Microsoft tag is a 2D barcode meant to be read by your mobile phone and access the corresponding information from the internet. All you need is a camera phone and the freely downloadable software from http://gettag.mobi/. Specific builds for iPhone and Android phones are available, but the more generic Java reader seem to work with most phones supporting J2ME. Microsoft Tag can read from the environments which other barcode readers cannot read such as monitors, televisions.

I tested the Tag reader on Cols' Wifi-capable Nokia phone and it was very impressive. Using 3G on my entry-level Nokia 2730 classic is another story. It takes a long time to respond after you "snap" a tag image, and it prompts too many questions before establishing the 3G connection to pull down the site content. :(

Since Microsoft Tag also uses colors to encode data, it can store more information than typical 2D barcodes. This information can be a web site address, a contact card, a text or a phone number. When you scan a tag, your phone's default browser will open a website, add a contact to your contacts, show text message or dial a number according to the tag type you scanned.

You can use the online tag manager at http://tag.microsoft.com. Its very user-friendly. It allows you to easily generate tag images in different formats (pdf, jpg, gif, png, etc.). You can modify the URL that a tag points to from the web interface anytime. You can define date ranges when that tag is considered valid for time-based applications.

Microsoft published a set of API that allows developers to create and manage the tags programmatically. This C# example is a great starting point for developers who want to get into the nitty-gritty:

Wednesday, July 21, 2010

Lasik Video

And here's a video of my corrective eye surgery. This short clip is just for my right eye. To save on size and bandwidth, I will not show the left anymore since they are just the same. This is not for the faint-of-heart. The opening of the corneal flap is particularly a bit gross.

Tuesday, July 20, 2010

E-Books Outselling Physical Books

This is simply amazing news -- e-commerce 900-pound gorilla Amazon.com is now selling more Kindle e-books than physical books. With the advent of the Apple iPad, and the expected army of iPad-clones that will inevitably come out of Taiwan, e-books will even become more accessible to a larger group of people.

Maybe this is for the best since less physical books means less paper, and less paper means less trees getting chopped down. For kids, e-books can provide a much more interactive learning experience than plain-ol' ink. I have to admit that the main reason why I would still want a physical book is it looks nice to have a den with a full book shelf. :)

Monday, July 19, 2010

Installed my first SSL Certificate

I bought an SSL certificate from GoDaddy last week for use with Dragonpay's online payment service. To validate your ownership of the domain, GoDaddy requires that you create some CNAME entries on your DNS Server. They call this "Domain Control Validation". Since I registered my dragonpay.ph with DotPH, I just used their web-based DNS management system. The interface is a bit crude, but it gets the job done.

Next, I just followed the step-by-step instruction from GoDaddy for generating a certificate with Windows 2003's IIS. You enter basic information about the company and create a 1024-bit certificate. You copy-and-paste the value onto GoDaddy web-based SSL Certificate Management page; select which OS certificate you want; and they generate 2 downloadable files for you -- an intermediate certificate (*.p7b) and the web certificate (*.crt). After installing both, my API site is now running in secure https mode.

Sunday, July 18, 2010

Hello World From My New Eyes

I finally went for my LASIK (Laser Assisted In Situ Keratomileusis) corrective eye surgery last Friday at American Eye Center. My surgery was scheduled at 2pm, but they asked me to get there by noontime for the retinal scan and other pre-op procedures.

Cols and I had lunch first at Sango. Its a Japanese hamburger restaurant. I've seen it at Power Plant before but haven't gotten around to trying it. I had the beef with rice bun. The serving was very generous. They used sticky rice and compressed it into the shape of a bun. Very interesting and filling.

Anyway, going back to my eye surgery, it was a very long wait for the pre-op procedures. I went through several more eye checks before I was brought into the surgery room at around 3:30pm. American Eye averages about 12 LASIK surgeries in a day from what I heard. So its practically like an assembly line already. They say that the likelihood of something going wrong is very slim. But of course, it is never good to be that 1 in 10,000 statistic who goes blind. :P

My turn came at around 3:45pm. They made me lie down on the hard operating bed. My left eye was covered first while they put tape on my right eye lids to keep them from closing. Then they placed a forcep-like apparatus to keep my eyes wide open. That was a very uncomfortable feeling. I'm not sure exactly when they put the topical anesthesia but other than the slight discomfort, it was really not as painful as it looked.

Each eye took about 7 mins to operate on. The actual "laser" burning was only about a minute. Near-sightedness or "myopia" is caused by the eyeball not being perfectly spherical but a little bit more oval (think American football vs. basketball). Laser correction works by using "cold" argon-based laser to "flatten" the eyeball back to a spherical shape. It loosens the corneal tissue and I guess they wash away the excess.

The really weird part is they first have to make an incision to open up your cornea. They call this the "corneal flap" because they literally open a flap on your corneal surface so they can laser the tissue underneath it. I will be posting a video of my operation in the next couple of days to better explain this. Yes, the operation comes with a DVD of the whole procedure to serve as your remembrance.

I spent about another hour in the recovery area before I was discharged. Vision was very blurry and my eyes were uncomfortable. But over all, I would agree that the LASIK procedure is relatively painless. I went to sleep early since there's nothing much to do if you cannot see anything -- no computer, no tv, no books, etc. When I woke up Saturday morning, I felt back to normal already. No more discomfort.

I can imagine that for people who spend their entire lives with eyeglasses, getting a LASIK surgery is a major life-altering experience. But since I've been wearing contact lenses for a very long time, the change for me is not that dramatic. Pretty much the only thing that changed was I did not have to go through the ritual anymore of putting my lenses on in the morning and taking them off at night.

Thursday, July 15, 2010

Last Day with Eyeglasses

I've been wearing my eyeglasses for the past 7 days in preparation for my Lasik corrective eye surgery tomorrow at American Eye Center. I've been a bit anxious about it the whole week. My eye exam last week showed that my eyesight can be corrected by laser surgery.

However, since I'm hitting 40 soon, my internal lens have started to deteriorate due to "old age". So even though my near-sightedness will be corrected, I might still have to wear reading glasses soon. *groan* I have been having a hard time focusing on very near objects especially early in the morning (ex. while having breakfast).

My surgeon (aka. EyeMD) is Dr. Alnette Tan. She was the same doctor who performed Lasik on my brother-in-law, Alvin. She asked me to try out "monovision" correction first. What that essentially mean is they fully correct one eye (my right eye) and only partially correct the other one (my left eye).

The idea is the right eye will be able to see far and compensate for the weaker left eye; and the left eye will be able to see nearer objects like fine print labels. They made me wear 2 contact lenses -- 3.50 for my right and 2.50 for my left to simulate monovision. I didn't really like it, so I'm opting for the full correction.

The surgery should only take about 15 mins, but I will be uncomfortable watching TV or computer after 48 hours. So my next blog entry will be next week most likely!

Wednesday, July 14, 2010

Metrowide Brownout

Typhoon Basyang brought strong winds yesterday and knocked out power metro wide. Power at our house went off at around 10pm, and restoration is still ongoing as of this morning. I supposed Meralco's call center 16211 is getting swamped by calls because I'm just getting a fast-busy tone when I tried dialing it.

While going through Meralco's website, I noticed that there were no updates on its front page about the current outage. Then I noticed that they had a Twitter link. Surprise, surprise! They seem to actually be regularly updating their Twitter account to apprise customers of the situation. Of course, residential users cannot do much to access the site since they don't have electricity to begin with -- unless they have a still-charged-up notebook and a mobile broadband facility.

Tuesday, July 13, 2010

US Visa for Ethan

I accompanied Ethan to the US Embassy this afternoon for his Visa interview. Well, it was really my interview since they can't possibly ask him directly. The interview was originally scheduled for July 4. But due to my negligence, I did not request for an NSO birth certificate. So I had to re-book the interview. Good thing everything can be done online nowadays. No need to wait long on the phone and listen to long IVR's.

Our interview was scheduled at 2pm, but we got there with plenty of time to spare at 12:30pm. We parked at Quirino Grandstand and just walked over the short distance. It was drizzling a bit so Ethan wore his yellow Pooh raincoat.

The process flow has slightly changed since the last time I was here (2 years ago). There was no longer any need to wait at the "pavilion". We went straight to fingerprinting. But since Ethan was below age, he was not required to scan his finger.

We waited a long time until we got called at around 3:30pm. It was a very short interview. The consul did not bother asking me to show any financial data, nor did he even ask for the NSO papers. I guess he knew from his data that I have a US visa already, so he just immediately approved one for Ethan.

Next stop -- Canadian visas for my family!

Thursday, July 8, 2010

Dragonpay Blog

I wanted my Turnkey Wordpress appliance to maintain 2 separate blogs under the same website. According to my tech guy, the Wordpress content management system can only maintain a blog for 1 Wordpress "page". So its not possible to have the equivalent of 2 blogs under the same installation.

Since the main purpose of my Wordpress appliance is to host the main Dragonpay website, I decided to use an external blog for the Dragonpay Official Blog. For that, I went to my trusted Blogger account. I started a second blog under my same account. It seems that a single account can have an unlimited number of blogs under it. I picked a template; customized the host/domain name to use blog.dragonpay.ph instead of the default dragonpay.blogspot.com; and I was up and blogging in a few minutes!

I just got stumped with one minor hitch. I was wondering why articles I post stay as "scheduled" even if the time has already passed. After some tinkering, I found out that all new blogs are assumed to be based on US Pacific Standard Time. Since Manila is about 16 hours ahead of Pacific Time, there was a lag in the time my scheduled posts are being published. To change the timezone, you just need to go to Settings >> Formatting.

Tuesday, July 6, 2010

Cannot Access IIS from the Internet on XP after installing SP3

Since my hard drive recently crashed and I had to reinstall my Windows XP (yes, I have not yet moved on to Vista nor Windows 7), I took the opportunity to install Service Pack 3. For some strange reason, my previous SP2 installation would get strange errors when I try to install SP3. So this time around, I went straight to SP3.

For the past week, I've been testing some applications to require a PC outside my LAN to access my XP's web server (aka. IIS). The http connection cannot seem to get through. I use Comodo Internet Security for my firewall, and as far as I can tell, my firewall rules should allow HTTP to come in. After a couple of days of tinkering, it finally occurred to me that the problem might be related to SP3.

After a little bit of Google research, I found that out that XP+SP3, by default, runs Windows Firewall that blocks incoming traffic including port 80. I assumed that when one installs a 3rd party firewall or anti-virus, it disables the built-in one from Windows. But in this case, even though I had Comodo running, the internal Windows Firewall was still active.

To fix the problem:
  1. Start >> Run "firewall.cpl"
  2. Go to Exceptions tab
  3. "Add Port" for port 80
That's it! After that, incoming HTTP is working again.

Sunday, July 4, 2010

Electronic Filing of BIR Returns

I received a notice from the Bureau of Internal Revenue (BIR) about a couple of months ago telling me that I should register my company into their electronic filing system (eFPS). I was previously hesitant in doing this as my accountant told me that the eFPS is problematic and is often down. Well, this BIR notice no longer made it optional. I am required to register for eFPS where I like it or not.

Registering was the easy part. However, it did not necessarily go without a hitch. The people at RDO 47 had to manually request their backoffice to do something before my company's TIN was recognized by the online registration platform. It seems that they are running multiple database in the back-end which are not synchronized. So while my TIN appears on one system, the eFPS enrollment system could not see it.

Anyway, as I said, registering with eFPS was the easy part. Next was to enroll in one of the eFPS-accredited banks. Our corporate bank, BDO, was naturally supported, being one of the biggest local commercial banks. I filed a request to BDO's Transactional Banking Group (TBG) through our branch. At first, the branch did not seem to know what to do with it and had the form sent back to me. I had to personally go back to the branch and argue before they accepted it and sent it to TBG. From there, it was a long wait to get the feature activated on our corporate Internet banking menu.

So finally, I gave it a try today. I paid for my company's Final Tax (1601-F) and Expanded Withholding Tax (1601-E) returns. You basically login to BIR's eFPS; fill-up the online form; submit; choose the bank where to debit the payment from. The eFPS basically just performs a redirect to your bank's corporate Internet banking website and passes the details like payment reference number, amount due, etc. Then its a simple matter of following the menu to choose the specific bank account where you want to debit the payment from.

The payment flow is really not that much different from online payment systems such as PayPal or Mozcom PayEasy. One thing I noticed though, there is no "postback" facility that will take you back to the eFPS site after making the payment at the bank side. It just ends at the bank side. I guess they then perform an automated reconciliation at the end of the day by batch.

Over all, I would give the system two thumbs up. Its pretty simple and it sure makes life for taxpayers simpler. This saves me the trouble of going to RCBC Legaspi Village branch twice a month just to pay my taxes. The only caveat that my accountant warns me is that I have to file my returns early as the system is often down during the deadline.

Friday, July 2, 2010

Closing The Final Chapter of Ondoy

Today marks the closing of the final chapter of Ondoy -- at least as far as my affected life is concerned. After almost 9 months of pestering our insurer, Generali Pilipinas, I finally got my insurance claim for our damaged store. Jeez!!! I have to say -- Generali Pilipinas is incredibly lousy when it comes to customer service. Granted that there were several claimants at the same time as me, that does not absolve them for their really lousy treatment of their customers.

All insurance sales agents will promise you heaven when they are trying to get your account. But when it comes to claims time, the same sales people are nowhere to be found and they will just refer you to their crappy claims department. Generali's claims department is practically made up of 2 persons -- an old guy and a girl. The girl was actually ok and a bit friendly. Unfortunately, my case was assigned to the guy, whom I shall hereafter refer to as Mr. ASs.

This Mr. ASs seriously need to go through a customer service orientation seminar. I've met several government employees who are several notches friendlier than him (and we all know how cranky government employees can be). He has absolutely no telephone answering skills and zero phone personality. And that's if you happen to catch him on the phone, as it seems that he is also never around or his local is always busy.

It seems that because of the big disaster, Generali decided to get out of the retail insurance business altogether. And in line with that decision, they had a major retrenchment. That just exacerbated the problem since they ended up with fewer staff. But luckily, some guy there with a modicum of grey matter in his head decided to reassign some of the displaced workers to the claims department to help alleviate the workload. And a friendly lady by the name of Cathy was assigned there to help coordinate and liaise between management and customers. She at least made the whole experience a little bit pleasant.

But going back to Mr. ASs, my initial confrontations with him over the phone proved fruitless. He basically just passed the buck to me to nag their adjuster directly. I really don't understand this as I personally do not have any personality when it comes to dealing with the adjuster. As an end-customer, my contract is with my insurer. And it is the insurer who has a contract with their adjuster. So what business do I have to be talking directly and following up my claims with the adjuster?! And what right do I have to demand anything from him since I'm not his client?

Anyway, for those of you not familiar with the insurance industry, insurance companies basically hire professional third-party "adjusters" who presumably know how to properly value the cost of items across a broad range of industries. I mean, when it comes to specifically knowing how much a repair of a kitchen equipment would cost, the adjuster is supposed to have "expert knowledge" to be able to give a fair valuation to both business insurer and insurer.

Since talking to Mr. ASs was going nowhere, he suggested that I file a complaint directly to his boss. This was something new -- when was the last time that a staff actually recommended that you complain to his boss about him? Logically, shouldn't the staff try to contain the situation so that it does not reach the ears of his boss in the first place? Well, I took the challenge and sent fax and email to his boss, whom I shall hereafter refer to as Mr. Jungle. Surprise, surprise! I got no replies whatsoever from Mr. Jungle -- not even an acknowledgement of receipt. No wonder Mr. ASs was so gung-ho in advising me to talk to his boss. He probably knew the guy would not do anything either!

Although my dad and uncle have very strong upper management contacts at BDO, I hesitated to use them hoping that I can still resolve this at my level. During one of my meetings with the BDO credit card group for PayEasy, I met some people who were very kind enough to throw in a word for me at Generali. It somehow reached the ears of their president, which I'm sure helped in moving things a bit.

So finally, here I am after almost 1 year with my insurance claim. I can finally remove "call Generali Pilipinas" in my to-do list.