Use EA Origin to download games you own

If you have a scratched EA game media, you can use the serial number to download the game from Origin. You’ll need to download and install Origin. When done, run the Origin client. From the Origin menu select “Redeem Product Code…”. Provide the serial number that accompanies the media, and your game should be available for download. Pretty useful!


Like for spam

I’ve temporarily disabled the like button for posts. I was getting likes from people I suspect weren’t that interested in the post itself but rather in furthering their agenda (as in spamming me). I’ll bring the like button back when gives me the capability to delete such likes. Since most of my readers arrive from Google Search, I think the typical anonymous user will find it much easier to just rate a post. I want to simplify rating the posts by adopting the Nero (up/down) rating scheme, but the dashboard has no statistics for that.

360 degrees

360 degrees has a nice feel to it. Its usage in popular culture has become so normal that we hardly even think anything of the number 360. Just as we hardly even think why a week has seven days, or a year has 12 months, and so on. These have become accepted conventions, and by adulthood most of us barely even give them second thought.

Math is the science of abstraction, although it is considered being neither science nor art. In real life there is nothing like a perfect circle, and yet Math studies such a thing as a circle and precisely defines its ideal properties. I call this perfect circle an abstraction of the real life circle, because it does not take into consideration all the imperfections that a real life circle may possess. In fact, it may be more like an ellipse than a circle, like the orbits of the planets. Then again, the orbits of planets are not a perfect ellipse, but slightly altered by the gravity of other planets.

Math can predict real phenomena only as long as it takes into consideration their nature. Understanding that is the objective of the scientific method. Historically, Math and Science have been closely entwined, with one coaxing the development of the other.

Siloed thinking with use cases

Use cases by their very nature force separation of needs into silos. Design thinking forces you to take a holistic view at things, and take into consideration unspoken needs, branding, look and feel, information flow, usability, user delight, accessibility, and so on.

Have you visited the site of a bank, retailer, phone operator and so on, and felt confused by how you’ll go about doing whatever it is you wish to do? Basing the system on use cases alone may lead to complexity and overwhelm the user.

Design it, then identify the use cases. In fact, it is extremely risky to estimate software development effort otherwise. It shows that you haven’t thought deeply enough about user needs and will face volatile requirements during software development.

If your business subcontracts software development, ensure that the contractor will iteratively design the solution, and test it with potential users based on mockups or storyboards.

Applications that communicate

You are building an application that needs to communicate over a network, maybe you have decided to build your own communication protocol. I hope you’re doing it because TCP over IP does not meet your needs. I cover some points to keep in mind when developing an application or protocol that communicates over a network.

Use an existing transport protocol

You’ll find it easier to layer your protocol on top of an existing transport protocol such as UDP or TCP over IP. It will require more work otherwise.

Protocol header

A protocol usually requires a header to transmit relevant information about the message. It can contain information such as version, sender address, receiver address, payload size, sequence number, and so on. One important consideration is the size of the header itself, make it as small as possible so that it does not become a significant overhead.

Message oriented vs stream oriented

It may be desirable to have message boundaries preserved. For instance, if the protocol has been asked to deliver a particular set of bytes, it should ideally provide the receiver those same set of bytes as a cohesive whole.

TCP is an example of a stream oriented protocol in the sense that there are no clear message boundaries. UDP is message oriented, each message or datagram can be up to approximately 65,000 bytes long.

Fragmentation and reassembly

Depending on the the size of the data, it will need to be broken into smaller fragments, these are reassembled when received. To reassemble data, data fragments need to be put in the order they are sent. The order can be indicated by adding a sequence number to each fragment. The application may also segment data as required, a protocol does not care for the contents of the data itself, it is blissfully unaware that data is segmented.

IP, and therefore TCP and UDP, transparently perform fragmentation and reassembly of data. TCP also further segments data sent by the application. The segments are reassembled at the receiver and provided to the application as a stream. The segment size needs to be such that the total length of the network packet does not exceed the maximum transmission unit (MTU) of the network.


If your communication link is unreliable, such as a noisy wireless link, you’ll need to retransmit data that does not arrive at the receiver. Retransmission may also be required if data arrives but is corrupted.

One way to implement retransmission is by requiring the receiver to send an acknowledgement when data is correctly received. The sender can use a timer to resend data when an acknowledgement is not received. If multiple simultaneous retries fail, the data transfer attempt may be abandoned, and an error reported to the software layer that uses the protocol. Each data fragment needs a unique identifier that should be used during acknowledgement.

Another way to implement retransmission is for the receiver to request it when a fragment with a particular sequence number is not received, after a more recent fragment has been received. This eliminates the need for acknowledgement.

IP is best effort, it neither retransmits nor prevents duplicate messages from arriving. UDP retains these drawbacks, large datagrams may be dropped if the network is unreliable, they may also arrive out of order. TCP handles retransmission, making it reliable and robust at the cost of throughput.

Error checking and correction

Error checking codes such as CRC codes can be added to data fragments so that errors during transmission can be detected. Redundancy in the data can ensure that data can be corrected even when there are errors. This is useful in scenarios where retransmission is expensive or not possible at all.

UDP and TCP are capable of checking header and data integrity based on a checksum value. They do not have data correction capability. Since TCP does retransmission, it can recover from errors by asking the sender to retransmit.

Multiple networks paths

The communication protocol stack may have to deal with multiple network paths to the destination, for instance a Bluetooth PAN and a WiFi link. The decision to choose one over the others may be based on the knowledge of which is more reliable, is currently active, has better throughput and so on. IP prioritizes one interface over the other using routing metric.

Connection (re)establishment

The state of the connection can be detected using keepalive or heartbeat messages. If the receiver responds to heartbeat messages, the connection is alive. Otherwise, it is considered broken and an error reported to the application. Heartbeat messages compete with regular data, so they may be used when no data activity is present. Connection reestablishment may require user intervention in case of persistent problems with the network.

Protocols such as TCP initiate and maintain a session with the receiver. A termination in this connection is negotiated. TCP supports keepalive, it can be enabled on a per connection basis. UDP on the other hand does not maintain a connection, it is entirely stateless. Termination of a connection due to persistent problems in the network is not handled gracefully by UDP.

Compression and encryption

Compression can reduce the bandwidth required to transport data. Domain specific compression algorithms are usually more efficient than generic compression algorithms like Deflate, for instance JPEG is better at compressing image data, and MP3 is better at compressing music. Encryption ensures that data cannot be read by parties other than the sender and the receiver. Encryption is quite an elaborate and complex topic involving key exchange, and several kinds of crypto algorithms.

Rate/flow control

Rate control, also called throttling, prevents the network and network nodes from being overwhelmed, averting effects such as packet loss. It can also be used to divide the available bandwidth between users, when it is scarce. Rate control can also be applied when available bandwidth changes, commonly referred to as adaptive rate control.

Store and forward

Some considerations need to be made as to what happens to messages when delivery fails, when there is a power outage for instance. The protocol can store messages in a persistent queue and forward them at a later time. This is also sometimes referred to as fire and forget, since the application fires a message and is assured that the other end will receive it, even after a significant delay.

Software design patterns and data structures

Certain data structures and patterns that can be very useful are queues, priority queues, observer, and chain of responsibility.

Reset password in Ubuntu

If you have forgotten the root password you can reset it quite easily by booting into single-user mode. Reboot the PC and press ESC. You’ll get the GRUB screen below.

Press e to edit the first entry in the boot menu. Add single to the line for the kernel as shown below.

Press F10 to reboot. You’ll be booted into the single-user mode and can change the password for any user thus:

passwd login

iPad Mini

Almost a year and a half ago I wished Apple did a 7 inch tablet keeping the iPod Touch (generation 4) in mind. They delivered. iPad Mini is everything I had wished and imagined then. For those migrating from iPad 1, 2 or iPhone 3GS, it’s every bit as desirable as the iPod Touch was to me a while back.

I will not be buying an iPad Mini though. The reason being, I am used to a retina (greater than 300 ppi) display. I won’t have anything less.