I came across a question in a forum asking how to deliver license keys to a customer as soon as a payment is made through PayPal. I know that PayPal has the facility to send a user back to a page of your choice after the payment is made. So, I did a bit more research and found that there is a facility called PDT (Payment Data Transfer). Here is how it works. As soon as a payment is made, the transaction id of that payment is returned back to the call back URL on your website where you can give a confirmation message to the user. This call back URL can be a dynamic page (cgi script) that takes the transaction id, makes a call to PayPal and gets additional information about the transaction. The response payload contains, among other things, the name of the customer which can be used to create a custom message and even embed the name into the license keys. But the main purpose of calling Paypal with the transaction id is to ensure that it’s a valid transaction (you don’t want someone faking a transaction id just to get a license). Assuming that the transaction is verified with Paypal, you can just create a license on the fly or a standard license key (depending on how sophisticated your licensing software is) and bundle it along with the rest of the software and just provide a download link. Make sure to keep track of the transaction id and the timing along with the license key id so that you don’t keep regenerating new licenses just in case the customer refreshes the browser a couple of times. Infact, just redirect the original call back page that contains the transaction id so that the user doesn’t even get to see it (I know, such things are not hacker-proof, but doesn’t harm doing it). In addition to giving the same license for a given transaction, make sure to expire a transaction id. If you want to be very cautious, you can just let only one download to happen for a given transaction, but with the internet not working sometimes and what not, it may be a safe bet to let the software downloaded any number of times (but with the same license key for a given transaction) within X minutes (where X is dependent on how big your download file is, the bigger it is, the more time you might want to give just in case the customer’s network is not working properly to download a larger file).
Monthly Archives: June 2008
Recently when I was shopping for a new laptop, I noticed that there were several 3GB Notebooks and initially I didn’t understand why there are 3GB laptops and not just 2GB or 4GB notebooks.
So, as I was shopping for the laptop and tried learning a few things, came to know that Windows Vista 32-bit edition could only support up to 3GB. That prompted me to go for a 64-bit Windows Vista Home Premium edition. But then, today I was reading the Redmond magazine that talked about Windows Vista SP1 and seems, SP1 now allows a 32-bit Vista OS to support up to 4GB as well. Here is the excerpt from the magazine
“Apparently, this is a limitation in the way the 32-bit version of Vista handles memory (the 64-bit version doesn’t have this issue). It’s no longer an issue, as SP1 fixes the problem and shows you the full amount of memory in your system.” So, no longer frustrations about the missing RAM.
Now, if you are wondering why there is a 4GB limit for a 32-bit machine, the reason is, 2^32 = 2^2 * 2^30 = 4 * (2^10*2^10*2^10) = 4GB. Yup. I already ordered a 64-bit OS since the CPU is Intel Core 2 Duo, which is a 64-bit CPU.
PIM stands for Product Information Management. There are applications built specifically to deal with product definition since it is very critical for online retailers to have accurate and comprehensive data so that their visitors can make the right decision. Similarly, it’s also in the best interest of the manufacturers to capture accurate and comprehensive data in a timely manner to provide their upstream supply-chain parters.
My notepad crashed recently so I am trying to shop for a new one. After some research I ended up at HP Pavilion DV6500T Entertainment 15.4″ Notebook PC and the funny thing was, when you go to the Technical Details, it contained the following
” Special Features
* These are the additional features. Yada yada yada. Wuba wuba wuba”
I wonder if this is a funny place-holder TODO text used by the manufacturer (HP), or by the retailer (Amazon.com). Anyway, will be doing more research for HP Laptops.
XPath 1.0 has following and preceding axes to help you get all the elements after a certain element or all the elements before a certain element. But what if you want all the elements between two elements? I didn’t find any explicit construct in xpath 1.0 specification to do this.
One way to do this is use the following axis and get all the elements after the first element and use the preceding axis and get all the elements before the second element and then find the intersection of these two. Sounds like a good idea, but how to do this using xpath only and no procedural code? So, I searched for the intersection operator and to my delight found this in XPath 2.0 specification, that also contains except and union operators.
But the tools I am working with only support XPath 1.0 and so, I was back to finding a way to do this in XPath 1.0. After a bit of experimentation, came up with the following strategy.
Take a simple XML like
The goal is to get all the b elements between c and d.
- Using //b, you get 5 <b> elements
- Using //c/following::b, you get 4 <b> elements
- Using //d/preceding::b, you get 3 <b> elements
- Using //c/following::b[following::d] you get 2 <b> elements, the end goal!
Technically, the above solution is not 100% correct as there can be multiple c and d elements, but it’s good enough for my use case. However, the general idea is
to get the desired behavior of the between axis. I would be curious to hear any other solutions. And BTW, you can verify all this by using the online xpath evaluator, a nice tool to experiment with xpaths.