Posts

One sequence per table or one sequence per database

Let us assume that you are implementing RESTful APIs for your service. Your service has the following two models: users and tweets. While inserting new entities, you should genertate IDs. The IDs for each of these models can be generated in two ways: You can use a sequence (if you are using Oracle) or autoincrement feature (if you are using MySQL) to have per model IDs. You can use a global sequence for all the models. If you are following the first strategy, you will have user IDs 1, 2, 3, 4, etc. and tweet IDs 1, 2, 3, 4, etc. If you are following the second strategy, you will have user IDs 1, 3, 4, 8, etc. and the tweet IDs 2, 5, 6, 7, etc.  Thinking about it, I felt that using the first strategy will leak information. Consider some one doing a tweet every day at 10:00 AM and get the tweet ID. If first day the tweet ID is 100, and the second day the tweet ID is 200, etc. That person can infer that your system is receiving 100 tweets/day. I don't know how sensitive thi...

The issue with Emacs "cd" function and CDPATH

Recently I wasted sometime trying to figure out an issue with "cd" function and autocompletion in Emacs, while I had a value set for CDPATH environment variable. I hope it saves some time for someone who might bump into the same issue. I had CDPATH environment variable set and it didn't have "." (current directory) as one of the components. When I tried autocompletion while running "cd" function, it didn't show any of the subdirectories under the current directory. The directories it showed for completion were from somewhere else. As soon as I added ".", I was able to see all the subdirectories of current directory in the autocompletion list. Hope this saves some time for you as well.

Enabling multiple cores in VirtualBox

Image
This post is a follow up to my earlier post  Moving from VMWare Player to VirtualBox . Once you have set up your VirtualBox instance, the first challenge you will face is that the guest OS may possibly be very slow due to the fact that the number of cores allowed is only one. Hence you will have to increase the number of cores that your guest OS can make use of. Open the VirtualBox manager, click on your VM, then click on the Settings button. In the Settings window, click on the System on the left pane and select the Processor tab on the right. In this page, you can increase the number of processors. If you haven't already enabled the virtualization in your processor, you are likely to get an error when you click on OK. The error message will look like this: Failed to open a session for the virtual machine Lubuntu. VD: error VERR_NOT_SUPPORTED opening image file 'C:\VMs\Lubuntu.vmdk' (VERR_NOT_SUPPORTED). Result Code: E_FAIL (0x80004005) Component: Console Interfa...

Moving from VMWare Player to VirtualBox

This is my first post this year. Wishing you a happy New Year. Until a week back, I was using VMWare Player for my personal use to learn different OSes. Using VMWare Player, I was trying out various Linux distros. I have been a fan of VMWare Player for six years now. Offlate I started seeing theese limitations: I bought a new i7 quad core laptop. Even though I have 8 cores, my VMWare Player will not allow me to create a VM with more than 2 cores. I used to enjoy the vmnetcfg command line tool which used to come with VMWare Player. But it has been removed from recent installations. Due to this, I was unable to configure NAT port-forwarding. I used to be able perform packet sniffing using vnetsniffer command line tool. That also has been removed in the recent distributions. You cannot run a 64bit guest OS in VMWare Player. Hence I could not run my guest Linux OS distros with more than 3 GB of RAM. Before I started using VMWare Player primarily, I was evaluating VirtualBox. A...

Elisp utility to open SQLplus from a remote host

If you are in a situation when you have to login to an intermediate or jump host to open SQLplus session to your database, here is a utility that you can make use of. You can store this utility in your .emacs file. Then the utility can be invoked interactively from inside Emacs, by typing "Alt-x open-remote-sqlplus-session-interactive". With autocmpletion, you can specify the session alias that you would like to open. To make the best use of the utility, you need to specify the list of jump hosts and the SQLplus connection strings in the "alias-to-jumphosts-alist" variable. If you need to run any custom commands immediately after opening SQLplus session (in addition to commands in your login.sql or glogin.sql files), you can add these commands in list-of-sqlplus-setup-commands. I find this utility to be a tremendous time saver. Hope you also find it the same way. Here is the utility as a gist:

Have a timestamp, for Christ's sake!

This post is an appeal to all the developers and content writers. Please take it seriously. Let us help each other by following the simple guideline of timestamping each artifact that is produced. Whenever you encounter an issue, or while troubleshooting a problem, what is the first thing you do? I just copy and paste the error message in Google and search if someone else have encountered the same problem and if a resolution is available. Sometimes I get conflicting resolutions showing up in the Google results. For e.g. one site might suggest me to perform task A to resolve the problem, while another site might suggest to perform task B. If I have time, I will try each one of them until the issue is resolved. But unfortunately I find it a terrible waste of my time. Instead of appreciating the good intention of the author to share his wisdom, I end up cursing the person. Why? The reason most of the times is very simple. Those articles don't have a date and time about when they ...

Who invented email?

Sometime back I received a link in my Facebook account shared by one of my friends which claims that Mr. V.A. Shiva Ayyadurai is the one who invented email. My first reaction was WTH? As far as I know, email existed since early 70s. As per the article, Mr. Ayyadurai invented email  in 1978. I spent a lot of time in that website reading through all the documents and verifying how far it is true. To the best of my knowledge, as per the documented evidence, I am convinced that Mr. Ayyadurai is the inventor of email . But just around the same time, another link surfaced in Hacker News, with the title " Email Will Never Die - The Man Who Invented It Reveals Why ". The article wrongly claims that Mr. Ray Tomlinson was the one who invented email in 1971. While I hold high respect for the hacks of Mr. Tomlinson to send a file from one machine to another machine, the SNDMSG program by no way comes close to the email as we know it today. Worse, until the end of the article, the a...