Abhay Rana aka Capt. Nemo

How does the sdslabs.co.in domain name work?

A very common asked question is about our domain name and how does it work locally. When we launched filepanda, and our preliminary homepage a long time ago, we had been using the easy to remember IP address http://192.168.208.208.

Now, however we are using the domain name sdslabs.co.in for all our services, including DC. To understand how this works, you will have to understand how the name resolution of a domain name takes place.

The Domain Name System (DNS) is a hierarchical distributed naming system for computers, services, or any resource connected to the Internet or a private network. It associates various information with domain names assigned to each of the participating entities.

- Wikipedia

DNS is basically a service which resolves domain names to IP addresses. If you own a domain name, you can point it to wherever you want. This is usually done in the administration panel of your hosting services. We have setup multiple domains on our nameserver (mitsu.in as of the moment) to point to the IP address 192.168.208.x.

For instance sdslabs.co.in points to 192.168.208.208, echo.sdslabs.co.in points to 192.168.208.204 and so on. This is done via updating something called A records (this is the part of resolution which transaltes to IPv4 addresses).

The benifits of having such a system in place are enormous:

  • Users don't have to remember IP addresses, and can easily remember the site address.
  • We can move around services, applications over different machines, and it will only take a single update to change the name resolutions
  • We could add alternative fallback servers easily (by having multiple A record entries) for a domain. We could even use this to point sdslabs.co.in domain to something that is hosted online, for instance.
  • We can have catchy, and simple to remember urls for eg https://sdslabs.co.in/login, and https://sdslabs.co.in/logout

Also, we are running all our services on https, which is not dependent upon the visibility of the website. Even though the site is hosted locally, the process of certificate signing remains exactly the same as any other site. Once we aquire a SSL certificate and attach it to our web-server, the visibility of the domain does not matter to the browser at all.

Note: For the benifit of those not in IIT Roorkee, we are running multiple web-service on the domain sdslabs.co.in, which is only served locally, as it resolves to a local IP address (192.168.208.208)

Coming back to rails

I've worked with rails previously before , but that was a long time back and even though I've continued to dabble with it, I'd never built anything complete or large enough with it. This time, however, I'm working on an actual large-scale application with all the nuts-and-bolts that make rails such a pleasure to work with. Since I'm coming back to rails after such a long time, I thought I'd document some of the cool new features that I've found in rails this time around.

Spring

One of the major discomforts of working with rails on the command line was that it is heavy and slow. Spring works behind the scenes on the second issue, namely speed. Here's how the project's README describes itself:

Spring is a Rails application preloader. It speeds up development by keeping your application running in the background so you don't need to boot it every time you run a test, rake task or migration.

You can update all the binaries in your PROJECT_ROOT/bin/ directory (which include rails, bundle and rake) to make use of spring by executing the following command:

bundle exec spring binstub --all

Any further execs (such as ./bin/rake -T) will make use of the spring pre-loader leading to much faster startup times. You can even use spring against the default system binaries by prefixing the commands with spring, such as spring rake -T.

Resque-Scheduler

I needed a job queue for background tasks and polling API services, and what better tool to use than resque. I'm using it in combination with resque-scheduler for running tasks on cron. How it works is that in addition to your main rails server and a long running resque job process, a separate resque-scheduler rake task is kept running, which loads up the schedule and inserts tasks accordingly into the resque queue as per the schedule.

For those new to resque in general, you can start the two processes by:

QUEUE=* rake environment resque:work #To start resque
rake resque:scheduler

Note that we are pre-loading the rails environment in the resque:work task as it will load rails for you across all of your tasks. Also note that you will need the following two lines in your Rakefile to get these tasks to run:

require 'resque/tasks'
require 'resque/scheduler/tasks'

Also remember to define the resque:setup task according to the resque-scheduler README, which would load the schedule and config as needed.

This blog post is a work-in-progress and I will continue to update it with bits of rails-foo as I learn more.

Rake-notes

I'd never tried using notes before, and as it turns out, using rake:notes is easy and super-awesome. Its allows you to spread your notes about TODOs, FIXMEs and such throughout your codebase and take a bird-eye's look at them with just a single command.

Read more about it at http://siong1987.com/posts/powerful-and-hidden-rake-notes-in-rails/

A month with the System76 Galago Ultra Pro

With my recent CCTC Winnings, I decided to purchase a new laptop as my old Dell Inspiron was not performing up to the mark. Being of a time before the Intel i-series launch, it was also severely lacking in several features, most notably virtualization support, which is badly needed these days.

After taking a thorough look at the various offerings in the market (and being disappointed by most of them), I decided to go with the [System Galago Ultra Pro][galago] for the following reasons:

  • Linux Support (Just Ubuntu actually, but its nice to have a laptop that supports and comes with Linux pre-installed).
  • Intel HD 5200 Graphic Card. Even though the nVidia/ATI support has been getting better in Linux these days, I wanted a graphic card that I could use without worry, for both playing games, using webGL without having to worry about things like overheating and switching card modes (optimus/bumblebee and whatnot).
  • Haswell. Not many manufacturers are currently offering Haswell lineups, and System76 is one of the few with them in the market.

The other few machines I did consider included the Apple MBP, Lenovo Ideapad, Dell Sputnik 13. The MBP was rejected because I wanted a Linux machine, and it was overly costly; the Ideapad had a touch screen, which I abhor; and finally the Sputnik is too expensive as well.

A few other machines were rejected because I was exclusively looking for a 14-inch screen, due in part to my experience with my previous bulky machine.

Hardware Review

The build quality of the Galago is above average, but its still a flimsy offering, when compared to the MBP or other business class offerings such as the Vostro. A lot of the Galago reviews on the internet talk about the defective keyboards, but I faced no such issues. It seems to have been fixed, and the keyboard has been iterated several times since, I think.

The IPS screen (1920x1080) is a real gem, and I've gotten used to watching everything in full HD these days. The laptop has 2 small fans on the lower side, and they hardly ever kick in, making it a quiet laptop. The only times it heats up much is when I'm playing demanding games or doing something GPU intensive. A few issues that I've actually faced with it include:

  • The Esc key not responding to all presses. I have to hit it with a slightly extra pressure for each keypress to register. However, this is just a quirk I've come to accept, and work around. My muscle memory soon overtook and I'm now used to pressing it hard.
  • Missing Media keys. It does have the usual Mute, Volume, and the Play/Pause keys, but the next/previous media keys are missing on the keyboard.
  • The charger getting heated up (a lot). It even heats up when the charger is not connected to the laptop.
  • The inbuilt speaker quality is definitely not above average. I usually use my earphones with it, so its not much trouble to me anyway.
  • The "clickpad" becomes a "touchpad" in Windows, which means drag-drop becomes extremely uncomfortable if you're not used to it. I've installed the official touchpad drivers in Windows from knowledge76, but I could not find a setting to use "clicks" instead of "touch".

As an aside, I really like the keyboard layout (I don't like numeric keypads much) and the placement of Del-End keys, which is incidentally same as my previous laptop. I really dislike those layouts where you have to press a combination of Fn+Some key just to trigger Page Up/Down. A note to laptop manufacturers : Please stop messing with the keyboards.

Having a branded Ubuntu key is also a good show-off at some places :)

Software Side

Despite being built for Linux, I've still faced a few software issues on Linux. None of these are a deal-breaker though for me. The first time I realized that it wasn't really built for Linux was when I booted using my external to Ubuntu 12.04 and the WiFi didn't work. Apparently you need a combination of System 76 custom (though open-source) drivers and 14.04 on this machine to get the drivers to work. This is one of the reasons I haven't downgraded to Elementary Luna (which is based on Ubuntu 12.04). The issues I've faced (along with my workarounds) include:

  • Flash not working on Google Chrome Stable. I talked to System76 support over this, and I'm yet to get it working. As a workaround, I've been using Google Chrome Unstable (which I usually use anyway), and it detects flash fine.
  • WebGL support in Chrome is a bit sketchy. Chrome stable doesn't detect the graphic card as supported, while the Chrome Unstable version did detect it as working for a while, but the graphic card was either removed from the whitelist, or added to the blacklist in a future update, making it non-working again. Currently, I'm using the "Disable WebGL Blacklist" flag from chrome://flags to get it working.
  • Webcam not being detected. This has gotten me a bit puzzled. It was working fine on the fresh Ubuntu 14.04 setup, but some driver issue is preventing it from working now. I think a dist-upgrade should fix it, but I'm not sure. I might try to re-install the system76-driver package if that doesn't work. Update: It started working again after just a restart.
  • Another minor issue I face is that the brightness key on the keyboard (Fn+F8/F9) allows you to take the brightness level all the way down to zero. So you could make your screen pitch-black, with absolutely no idea how to get it back to normal. This happens only on ubuntu, though.

Overall

Despite its few quirks, I'm liking my new laptop. I'm enjoying gaming on it (on both Linux and Windows), and it has more than enough power to run whatever combination of VMs I want to.

Gaming

All the Linux games from my various Humble Bundle purchases are finally being put to good use. The only game that I haven't been able to run is Oilrush, which doesn't support Intel Graphic cards on Linux for some reason. Some of the games that I've tried and enjoy on Linux include:

  • Mark of the ninja
  • The Swapper
  • Counter Strike Source
  • Don't Starve
  • Fez
  • Bit Trip Runner 2

I haven't tried gaming much on Windows, but I do play Blur (admittedly a 3 year old game) sometimes on it at the highest settings.

Specs

The only thing I upgraded in my laptop was an increase in RAM from the default of 4GB to 8GB, primarily because I intend to run lots of VMs on this machine. The rest is same as the specs on the official site (scroll to bottom):

Processor: Intel(R) Core(TM) i7-4750HQ CPU @ 2.00GHz
RAM: Samsung, SODIMM DDR3 Synchronous 1600 MHz (0.6 ns), M471B5173QH0-YK0 (4GiB) x2
Graphic Card: Intel Iris Pro Graphics 5200 with 128 MB eDRAM, Crystal Well Integrated Graphics Controller
Hard Disk:  Western Digital, WDC WD5000LPVX-2, 500GB (465GiB)
Operating System: Ubuntu 14.04 (Pre-installed)
Desktop Environment: Pantheon, using the elementary-os-daily PPA
Memory: 8GB 204 pin Dual Channel DDR3 @ 1600 MHz

If you're interested in getting any further details about the laptop, feel free to contact me.