Ian Murdock, Co-founder of Debian, passes away

It made me very sad to read this morning that one of the founders of Debian has passed away. Yep. the IAN in DebIAN.

Official reason for his death is not yet known at the time of writing. His contribution in the open source community is priceless. Thanks a lot for that Ian.

If ever some people caused your death prematurely, hope they… you guess the rest.

My Car: Volkswagen Polo Mk3 (6N)

I present to you my new “old” car. Here you go:

Exterior

The Front

IMG_20151205_144245

The back

Volkswagen Polo Mk3

The Rims

I must say it is one of the ugliest rims ever designed. No money to put alloy wheels for now :(.
IMG_20151205_144253

 

Interior

The Steering Wheel

image

No Power Steering in this car. Such a pain to get out from home or to park it back. For my driving test, I learned to park using Power Steering and passed the test using Power Steering. Now I gotta learn how to park all over again and get laughed at for making lots of to and fro movements as compared to other drivers (including ladies ones) 🙁

But once the car is moving, the steering wheel is responsive and smooth like butter. No vibrations whatsoever. The height can also be adjusted which is a plus.

The Turn Signals

Since it’s a german car, It’s found on the left side of the steering wheel. Why can’t they put it on the right side? Cost issues? You are supposedly be selling “luxury” cars for premium a price but you can’t switch the signal levers for left-hand drive countries? I bet Japanese car do invert theirs.

I accidentally switched on my windshield wipers few times when I was supposed to put my full bean or signal my actions. But with habit it’ll be fine i guess.

IMG_20151205_121746

Manual Transmission

I wanted a manual transmission to really understand the car I was driving. To learn how to drive. To be economic. To have greater control. What could be better than that? It got a 5 speed gearbox.

Yesterday I went to PORLWI by Light festival and got stuck in a huge traffic jam through Caudan.

But I managed to survive it, park the car (took like 10 mins), walk around then return home happily 😀

IMG_20151205_121832

Side mirrors

The side mirrors position are controlled electrically. However it doesn’t fold in and out automatically.

IMG_20151205_122850

Light controls

Japanese cars usually have the controls on the turn signal levers. In this car, we have a rotary switch to activate the light beam. For full beam, just pull the turn signal lever.

 

IMG_20151205_122902

Accessories

 

IMG_20151205_121824

Radio

It got a Pioneer AM/FM radio, CD player installed. No fucking AUX port. Such a disappointment for me for not being able to play my own MP3. Can’t even read a CD-RW that I bought yesterday. Thinking of

  1. replacing the whole radio set with a new one with Bluetooth enabled
    • Rs 4500 – Rs 5000 locally
    • Rs 800 – 2000 from eBay after 2/5 weeks
  2. Buying an FM transmitter
    • Rs ~700 locally
    • Rs ~300 on eBay after 2/5 weeks

Any advice?

Other

Engine

It’s a 1043 cc. Just enough to get moving and not get speeding tickets 😉

Automobile layout

It’s a Front-Wheel Drive (FWD) car. Don’t expect to do “drifts” with this car.

Comfort

The driver’s and front passenger seats are very comfortable even on crappy roads. The shock absorbers seem to be doing their job perfectly. Didn’t have the opportunity to sit at the back while someone is driving. Sister says it’s not that bad.

It’s a relatively quiet ride too. The engine noise don’t infiltrate the cabin too much.

Pride of ownership

You’d always want to buy a car from someone who treats his car well. The car still had the owners manual in the glovebox which is an excellent sign of a responsible owner. The car was very clean in and out.

12274387_10206953480468488_6089029988762381246_n

Even the original Volkswagen key ring holder was still their as well as the second key.

Summary

Fully functional car. Almost everything is manual and unassisted. Can’t really complain for lack of AC,power steering, central lock, power windows for the price (Rs 70 – 80k) and age (MR 96).

Great car 😀

Think my next car will be a Volkswagen Polo MK4 (9N3) or later or a KIA Rio. But that’ll take a while 😛

Stupid MacOS. Can’t fucking compile NodeJS libraries without XCode

In your package.json

{
  "name": "macsucks",
  "version": "0.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "node-curl": "^0.3.3"
  }
}
$ npm install

Damn that thing swears at me.

> node-curl@0.3.3 install /Users/nayar/Codes/untitled folder/node_modules/node-curl
> sh src/generate_curl_options_list.sh && (node-gyp rebuild || node-waf configure build)

extract constants from /usr/include/curl/curl.h
generate src/integer_options.h
generate src/string_options.h
generate src/integer_infos.h
generate src/string_infos.h
generate src/double_infos.h
xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

Let me try to download that fucking XCode. I open the app store. Create my account. It won’t fucking let me finish the procedure without me adding my credit card details :@

Screen Shot 2015-11-07 at 11.21.24 AM

WTH Apple?

UPDATE: I’m being able to download the XCode .dmg from this url: https://developer.apple.com/downloads/

Protect your NodeJS/Express routes with HTTP Basic Auth

Not all parts of your website or REST APIs you do require same level of protection. For example, a GET /api/dimounes is pretty harmless.

The Express/NodeJS code for such a route may be like follows:

app.get('/api/dimounes/',function(req,res){
  var rows = // Get the people from database, file or anywhere
  res.send(rows);
});

Let’s say now you want to add more ‘dimoune’. We create a new route for it but we’ll use HTTP POST verb instead of GET.

app.use(bodyParser.urlencoded({extended: true }));
app.use(bodyParser.json());

app.post('/api/dimounes/',function(req,res){
  var sql = "INSERT INTO dimounes (name,sex) VALUES ('" + req.body.name + "' , " + req.body.sex + ");";
  // run sql or mongo insert
  res.send("ok");
});

Problem here is everyone can do POST request and spam your database to corrupt it. Let’s protect the POST route so that it requires the user to authenticate.

$ npm install http-auth --save

Let’s define our username and password

var auth = require('http-auth');
var basic = auth.basic({
        realm: "Protected Area"
    }, function (username, password, callback) { // Custom authentication method.
        callback(username === "nayar" && password === "mydumbpassword");
    }
);

All we have to do is add auth.connect(basic) as a middleware in our routes we want to protect

app.post('/api/dimounes/',auth.connect(basic),function(req,res){
  var sql = "INSERT INTO dimounes (name,sex) VALUES ('" + req.body.name + "' , " + req.body.sex + ");";
  // run sql or mongo insert
  res.send("ok");
});

And there you go! Let’s try it with AJAX calls with jQuery 😉

$.ajax({
  method: "post",
  url: "/api/dimounes/",
  data: {
    name : "Nayar",
    sex: "male"
  },
  success: function( data ) {
    console.log(data);
  },
  });

You shall get a popup in your browser asking for your username and password. If you are using curl, just add the credentials using the -u

curl -nayar:mydumbpassword -H "Content-Type:application/json" -X POST --data '{"name":"nayar","sex":"male"}' http://example.com/api/dimounes

NOTE: As we saw in this article (click), Express doesn’t parse HTTP body, we have to add this line at the top for the above command to work in curl.

app.use(bodyParser.json());