Karachi   ->   Sweden   ->   Karachi, again   ->   Dubai   ->   Bahrain   ->   Karachi, once more   ->   London and Leeds

Wednesday, August 01, 2018

Blockchain 101 for Developers - Part 1

What problem does Blockchain address?
(In very simple terms) Blockchain primarily addresses aspects of record keeping across multiple, distributed peers such that trust between them is no longer an issue and no central authority is needed either.

In today’s world, each organization/ peer participating in a business network performs its own bookkeeping of facts of interest. For example, a car manufacturer would have its own data related to the cars manufactured and a car distributor/ reseller will have its own data---even through there are overlaps and they might be talking about the same asset (i.e., a specific car). Same goes for financial institutions---each bank will have its own data. Such silos definitely need either central authorities/ middle-man who everyone can trust as well as settlements and reconciliation processes to iron out conflicts.

Blockchain addresses all these problems by acting as a distributed ledger, which everyone can trust and have access to.

Bitcoin uses blockchain to record facts related to “coins” and their “transfers”; the interaction is from peer to peer and there is no central authority. But the technology itself is much more than what I have just stated.

How does blockchain do that?
Blockchain is, no pun intended, blocks chained together. Each block contains certain facts, and the entire chain is (usually) replicated across all peers and it is immutable.

For people with data structures (computer science) background, the chain can be thought of as a doubly linked list with an additional property of immutability.

Immutability? What? Why?
Immutability means that you cannot practically change a block, once it is added to the chain. This is achieved by using hash functions (one-way functions from cryptography). Each block contains a hash value generated from the facts in that block as well as the hash of the previous block. Therefore, modifications to a block is not possible unless all blocks from that point onwards are rewritten, which is not feasible as other peers also contain a copy of the entire blockchain.

Since blockchain is immutable, nobody needs to worry about fraud/ trust issues as long as no participant has more than 50% of the computational power in the network; more on that later.

In addition to immutability, blockchain also implicitly means decentralisation by employing a consensus protocol.

Consensus? On what and how?
Consensus on which block gets added next to the chain. In bitcoin, this is achieved by using some aspects of game theory and is termed as proof of work. All peers compete to add the next block to the chain and they have to solve a (useless) mathematical puzzle with each block they want to add to the chain. Solving this puzzle is a computationally intensive work and introduces a sort of randomness to who among all the peers gets to add the next block. Whoever creates a valid block broadcasts it to everyone else. In bitcoin, the peer who successfully creates a new block is said to be a miner and they are rewarded with some fresh bitcoins (said to be mined in the process).

Sunday, September 06, 2015

Applying for Canadian Visit Visa from the UK

Being a non-British, I do need to apply for a visa if I plan to visit Canada. Below is an account of my experience of the overall process. Please note that below is not an immigration or application advice in any way; just an account of how I applied for my visa.

Canadian visa applications can be submitted in-person, by-post or online. I would have preferred in-person if I was living close to London, but I wasn't. The next preference was to apply online as post usually takes days and I personally don't like the (albeit slim) chances of getting mail lost.

I found out that online applications are submitted via Citizenship and Immigration Canada (CIC) website. A lot of scanning is required if you don't have the documents scanned already. On the other hand, in-person applications probably need photocopies; they are submitted via VFS Global's Canadian Visa Application Centre (CVAC) in London. As far as I know, in-person applications can only be submitted in London. The CVAC website has a lot of information about the application process.

Step 0 - Getting Ready

One needs to gather all documents required. In my case, I found that the following should be sufficient to support my visa application:

  • Invitation Letter from Canada
  • Sponsorship Letter from the Current Employer
  • Old and Current Passport
  • Biometric Residence Permit
  • Recent Payslips
  • University Degree
  • A few months' Bank Statement
  • Photograph (although this is not really used in some cases, as stated later)


Step 1 - Online Application and Scanning Documents

If you are applying online, you'll need to generate something called a GCKey. This will be the id to login to the online application system.

Application forms are available for download as PDF. One of the things that I found that the application form needed details of all family members, including spouse, children, parents and siblings.

As I said earlier, a lot of scanning was required. The online application form has various categories and only one file (such as a PDF or JPG) is accepted. This means that for something like "Travel History", if I need to scan multiple old passports, all of them should be submitted as a single PDF. Moreover, there are restrictions on the file size too. One of the tools that I found very useful in merging scanned documents is PDF Joiner.

There are special requirements for submitting a photograph online. One needs to read the file size, resolution and other details carefully.

Step 2 - Pay and Submit Online

I submitted the application with supporting documents online. In my case, I need to pay the application fee as well as the biometrics collection fee via credit card.

The application processing times based on application centres are listed online.

Step 3 - Biometrics Collection (Surprise, Surprise)

Once I applied online, I received a message to submit biometrics collection. I found out that I did need to visit CVAC in London for this. This was a surprise for me because the whole idea behind the online application was to avoid taking time off from work just to visit the application centre. Any ways, I had to do it. The online documents that I took with me were my passport and a print-out of the biometrics collection letter. I found out that there is no need to book an appointment.

If you are planning to visit, make sure that you are not planning to visit on a public holiday/ closure date. Also, do make a note of the opening timings and the address.

At CVAC, they will take the collection letter and passport from you. They will take your fingerprints and a photograph, and return your passport after a while. This will be forwarded to the CIC authorities directly by CVAC.

Note - Security Regulations
Although there is a long list of prohibited items, I found that CVAC doesn't have an airport like security system. Coming from a different city, I did need to carry a mobile phone and keys, which didn't cause any problems at security. Previously, visiting the US embassy for a different purpose, I did find out that even taking a set of keys could be problematic, but not with CVAC.

Step 4 - Sending Your Passport

If your application is successful, you will need to send in your passport, once again via VFS Global's CVAC. I am not sure if there are multiple ways of sending the passport, but what I did was as follows: I sent my passport and additional fee (detailed next) to CVAC, who forwarded it to CIC. The additional charges cover the cost of forwarding the passport to CIC as well as the return postage. They payment this time has to be as postal order, bank draft or demand draft. Service charges for the two items can be found on CVAC's website.

Friday, August 22, 2014

Can I use John Lewis Vouchers at Waitrose online?

The answer to the question, "Can I use John Lewis vouchers at Waitrose online?" is "Yes!", and here is how you can do just that.

John Lewis vouchers are really called "John Lewis Waitrose". While the terms and conditions at the back of the voucher do not explicitly say that you can use the voucher online, they do indicate that you can use them in-store at Waitrose. But they do really work online too.


Each voucher as a 10-digit serial number written at the bottom right of the voucher. In addition to that, these vouchers have a scratch panel at the top which contains a 7-letter security code, as indicated in the picture above. Both these pieces of information are required if you want to use the voucher online. However, please be mindful of the fact that once you scratch the panel and reveal the security code, you can no longer use the voucher in-store. You must use it online only!

So, in order to use these vouchers, shop as usual on Waitrose.com and on the payment page, enter your voucher serial  numbers and the security codes before entering your credit/ debit card information. The card information is required anyhow, because Waitrose would want to know where to deduct any additional amounts from or where to refund if any refunds are claimed later on.

Enjoy shopping!

Sunday, February 09, 2014

Configuring jPOS with Maven POM

jPOS is now available on GitHub. If you want to make use of the ISO8583 Java library in your Maven project, following are the dependency settings that you need to define in your POM.xml:

In other words, the groupId is org.jpos and the artifactId is jpos. The latest released version as of today is 1.9.2.

A frequently encountered error, however, is related to missing sleepycat jar when you build your maven project having jPOS as a dependency. The exact error is something like "missing com.sleepycat:je:4.1.10 artifact".

A nice solution to that is to add Oracle's maven repository in your project's list of repositories, so that the missing dependency gets resolved automatically. For this, you just need to add reference to http://download.oracle.com/maven in your POM file, as shown below:

Saturday, December 14, 2013

Applying for International Driving Permit (IDP)

You can easily get an International Driving Permit (IDP) from the post office (over the counter), and the application fee is just £5.50. Read on to know the details.

If you are a UK driving licence holder and would like to drive abroad, you might be required to hold an International Driving Permit (IDP) along with your full driving licence. The exact requirements vary country by country; for example, you can drive in all European Union (EU) or European Economic Area (EEA) countries and Switzerland without on your UK driving licence, but the same is not true for several Asian countries. Here is a word on the requirement from the UK government.

So, if you have decided to apply for an International Driving Permit (IDP), this post is going to highlight the process as of Dec 2013. You can apply by post or by visiting the local crown post office in person. I personally prefer getting it over the counter to avoid postage costs and the associated delays.

Step 0: Get the application form

The application forms are available in the UK crown post offices. They are also available from the AA and the RAC website. Here is the Royal Mail page about International Driving Permits. Just visit one of the post offices which can issue an IDP.

Step 1: Fill in the application form and attach supporting documents

The application form is pretty simple to fill in. You'll need some personal details, driving licence number, the country you are visiting and the date you would like your IDP to become active. You can post date your application by 3 months. The IDP is valid for 1 year.

The required supporting documents are
  • Your driving licence and the counter part
  • An additional proof of identity (such as Passport or Biometric Residence Permit)
  • A photo signed at the back

Step 2: Apply at the post office

Visit one of the post offices which can issue IDP, along with a filled in application form, the supporting documents and the application fee (£5.50). Provide these over the counter and they will issue you the IDP then and there.