Cheap $2 WiFi adapter to work on Raspberry Pi (mt7601)

Raspberry Pi mt7601 WiFi
Had this WiFi adapter since more than 9 months. Raspbian couldn’t recognize it. Further reading shows that the driver is not included in the kernel and might never be too.

I came across this project on Github but again, could not get it to compile.

Googling more, came across this post. Running the code below solved it 😀


$ wget https://dl.dropboxusercontent.com/u/80256631/mt7601-3.18.7-755.tar.gz
$ tar xzf mt7601-3.18.7-755.tar.gz
$ ./install.sh

Now I can complete my project about controlling a toy car by a phone’s gyroscope using REST API

Debian

I was charged of implementing a tunnel with RObust Header Compression (ROHC). Boss asked me which server you want to do the job? Naturally, I said Ubuntu. He said, OK, I’ll give you Debian. I said to myself it shouldn’t be a hassle Ubuntu and Debian are same. Ubuntu is derived from it. But to my surprise, Debian seems to be another Operating System completely.

sudo

First surprise, Debian doesn’t comes with sudo. On my VPS on which i had only root account, I installed sudo and created another user instead of root directly


# adduser nayar sudo
# apt-get install sudo
# su nayar
$ sudo blah blah...

When I installed Debian in my VirtualBox, it would ask a password for root and another password for the user. If i remember well, Ubuntu doesn’t asks for password for root. Do you think it’s a security issue for user root to have a password? My gut says so. Not proven.

Certificate Authority (CA) with OpenSSL

I was following a tutorial which says run the following code

/etc/ssl/misc/CA.pl -newca/usr/lib/ssl/misc/CA.pl -newca

apt-get install

The following command would yield the same results on Ubuntu as well as on Debian. They’re classics.

# apt-get install gcc cmake build-essentials git

But for other stuffs, gotta hunt real hard to know which package is providing for x library or modules. Why are there these diferences? grrrrr

Anyways, these differences are making me learn a lot but delays my work though.

Composer

It’s awesome, isn’t it? For those who don’t know it, “Composer is a tool for dependency management in PHP”. For example, if you are going to use Slim Framework with Twig Templating system, just create a file named ‘composer.json’ in your working folder with the following contents


{
  "require": {
    "slim/slim": "2.*",
    "twig/twig": "1.*"
  }
}

Then run the following command:

$ composer install

It shall download them in a folder named vendor. Include the following code in your PHP script:

require 'vendor/autoload.php';

All libraries just work like magic 😀

Apparently Composer has some sort of repository where people upload their codes. I didn’t want to signup on their website to put my library. I’m sort of a control freak. I wanted to host my code on Github and yet people include my library in the Composer magic. Yes! Composer supports downloading from Github.


{
  "repositories": [
    {
      "url": "https://github.com/Nayar/mera-framework-php",
      "type": "git"
    }
  ],
  "require": {
    "slim/slim": "2.*",
    "twig/twig": "1.*",
    "meraframeworkphp": "*"
  },
}

However i was getting this error when I was initializing composer repositories.

Loading composer repositories with package information
Reading composer.json of meraframeworkphp (master)
Installing dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

Problem 1
– The requested package meraframeworkphp could not be found in any version, there may be a typo in the package name.

Potential causes:
– A typo in the package name
– The package is not available in a stable-enough version according to your minimum-stability setting
see for more details.

Read for further common problems.

Composer uses Git tags to actually find the repository version. Ran the following in my library git then it worked awesome:

$ git tag -a v1.0.0 -m 'First release'
$ git push origin v1.0.0

First Name vs Given Name in Designing REST API

Been reading the book RESTful Web APIs by Leonard Richardson & Mike Amundsen. One section that is worth blogging about it the discussion on First Name vs Given name.

Traditionally, lots of forms we filled in our lives contained “First Name”, “Middle Name” and “Last Name”. As a database designer, I’d have 3 fields for it too. But what is “First Name” and “Last Name”?

Richardson and Amundsen in their book titled “RESTful Web APIs” state that:

“For instance, “first name” is not an accurate term. It’s an artifact of Western culture, in which we put the a person’s given name first. In some other cutltures, the family name comes first. The current oresident of China is named Xi Jinping. His “first name” is Jinping. That’s why givenname is a better semantic descriptor than firstname.”

I always write my name as Nayar Joolfoo (Nayar being given name and Joolfoo my surname).

If ever i were to write my surname first, i’d write it like this: JOOLFOO Nayar which makes it pretty clear what is my given name and surname.