Since being boisterous is a direct consequence of hollow knowledge, I’ll write about some cool tech I recently had a chance to look into. To keep things simple and clutter free, I have links to pre-requisite information and for reference and further reading. While working on nothing in the current project, I looked into how a dual clutch transmission works and how data is transmitted in between various subsystems in an automobile.

I’m a bottom feeder. I work nonce and talk much. I need appreciation and want to portray myself as a know-it-all. I enforce my perspective of things on others and get irked when they balk. I’m a sycophantic suck up and I’ll be that because my intelligence limits me to work on meaningful things. I use low cunning and honeyed language to escape work. I’m narcissistic and I cannot bear someone else outshining  me.

Having a keen interest in transmission systems or colloquially, gearbox, it was intriguing to understand how a dual clutch transmission (DCT) sends an upshift recommendation to the instrument cluster. From wikipedia: “A transmission is a machine in a power transmission system, which provides controlled application of the power.”. In a car (or vehicle), the internal combustion engine is the power unit and it provides, through the transmission system, power to the drive wheels. The transmission unit, for example, is designed to deliver more torque in lower gears and higher power in higher gears (gear ratios). From manual transmissions that have dominated road cars till now to the new DCTs, transmission systems have become more complex and more efficient.

You can read about various transmissions in the wiki link above, we will be concentrating on DCTs. As the name suggests, the transmission consists of two clutches cleverly mounted over each other. Quintessentially, it is two manual transmissions fused into one. The advantage lies in the fact that each sub unit has alternating set of gear trains and each sub unit has its own clutch (“Dual” clutch).  Refer to the diagram below. This setup, along with the required electronics, gives the driver an option of fully automatic mode where the gearbox ECU handles everything and also a manual mode where the driver is required to shift gears.


I’m an over excited socially overactive low life. I talk about random disconnected things. I like to be the centre of attention and hence usually let my self esteem flood the drains. I’m entertaining, doubt that not! I have no knowledge of all things and all knowledge of no things. I have a limited perspective of things but I think that I have seen and done much. I’m a motor mouth and I care to give no thoughts behind my words.

I’m a pseudo philosophical wannabe. I talk about varied things hanging on the fringes of reality. I do so because I want people to think of me as a stoner without knowing that I’m being thought of as an idiot. But I pay it no heed because I have my own set of pseudo philosophical views conforming to the general dogma surrounding stoners and I have no imagination. I have a bad boy outlook and I think that makes me cool.

In my studies, I looked into how, in manual mode, the driver is notified of an upshift at the best possible moment. Looking a bit deeper into DCT, each clutch hosts a transmission shaft. The transmission shafts are concentric and each transmission shaft is connected to a separate gear train system. The gear train is arranged in a constant mesh with “odd” gears (1, 3, 5 ,7) on the inner shaft and “Even” gears (2, 4, 6 and reverse) on the outer shaft. The gear train transmits power from the engine, via the engaged gear, to the differential that drives the drive wheels.

The gears are engaged by shifting the gear selector. The selected gear is free to spin on the drive shaft. The gear selector is fixed with the drive shaft and hence will turn the drive shaft. When the selector is locked with the gear, it will spin at the same speed and hence driving the drive shaft. The gearbox ECU is intelligent enough to pre-select the next required gear. The setup is such that the next required gear will always lie on the other transmission shaft (DCT is a sequential transmission). Hence it only requires disengaging the current clutch and engaging the other. In the automatic mode, this whole operation is controlled by the gearbox ECU and manual mode, the actual changing of gears is left to the driver.

transmission-dual-clutch (1)

Arrows indicate power transmission.

In automotive electronics, communication between various subsystems is done predominantly using the CAN protocol. Each ECU processes a CAN packet whenever it receives or transmits data. What message a CAN packet will carry and the priority of each message is decided by the designer. Since it is a bus protocol and there are n-number of ECUs interacting with the bus simultaneously, CAN protocol has to decide which data packet will be transmitted on the bus. The protocol ensures that the data with the highest priority wins the bus.

I’m prone to flattery and will tell anyone, who is ready to listen, about things that I do. I like to convolute things and make an impression by giving grandiose solutions to petty problems. I over work, over think and over react. I like sycophantic suck ups because they feed my ego and  I surround myself with such. I make random useless dry jokes and laugh about it, out loud and expect others to do so.

The gearbox ECU assimilates the current driving conditions and predicts the best possible moment to upshift a gear. This message is transmitted from the gearbox ECU to the instrument cluster and the driver is notified visually or audibly about the same. In some applications, flooring the pedal (hard acceleration) sets the “kickdown” mode. The gearbox ECU downshifts to lower gears giving more acceleration and then upshifts again accordingly. DCT allows for lightening fast gear shifts and also hassle free driving while cruising in the automatic mode.

I’m a generic socially acceptable meatbag. I go to social gatherings and I talk shit to people. I talk to shit people too about shit agendas and other shit people. I enjoy having behind-the-back conversations and forming opinions. I form opinions based on other opinions and I’m steadfast on those opinions because I think they are my own opinions. I cannot imagine working more than I’m given to do. I’m old wave but I try to be new school. I’m working hard and getting by until the day I die.

PS: This article is not a tutorial or a study aid. This post is for infotainment purposes and the author takes no responsibility for the dearth of technical information.





It means an expression/article of praise. Its’ been a while since I have updated my blog. I’m happy actually. Not that rainbows and butterfly kind of happy but life-is-going-good happy. I have a social circle and they talk to me too, which is nice. As per social conventions, you should say good things about people who have a positive impact on you. I have 4+1 elements in this set of human entities and in this panegyric I’ll try and describe these 4+1 elements.

At work, I have nothing much to do so I was working on Qt/QML. Qt is to C++ what Android is to Java. Like Android, Qt is not pure C++ and rather extends C++ and makes it more awesome (as if C++ needed to be any more awesome). QML is a declarative language that is used to design UIs and together with Qt, one can create powerful desktop applications independent of platform. A friend asked me for a comprehensive tutorial and I’ll try to elucidate a sample music player application I made in Qt/QML. It’s nothing much really but it does implement concepts of models, views, delegates and exposing variables from C++ code to QML. You can download the code here and must have the latest updated version of Qt Creator.

So I have 4+1 elements in this set of human entities. 4 of us are in a group and we talk on this messaging application where they laugh and respond or simply respond. The other element is whom this article is meant for. The Guy and I discuss not about piffling things such as human dealings (a.k.a bitching) and talk about better things such as world happenings and imaginative ideas that may not happen in real life. This one is rathe for new ideas, adventures and experiences and values friendship. This one thinks that I’m erudite so I assume that there is something wrong with this one. And as a matter of fact, there is. This one has his own world and is lost most of the time in that world. It would be condescending to say that The Guy should adjust the volume of his voice but its’ ok. At least he speaks not shit like most other humans do.

Sweet P is sweet. This one is happy go lucky and has an infectious smile. This one is artistic and sees a world full of colours and possibilities. This one also yearns for new experiences and has a lot to see and do. This one too thinks that I’m erudite so there must be something wrong with her too. And there is. This one is too happy. I wish that this one gets to see the fucked up side of life soon. One becomes a true sage when they experience downward spiral as zealously as upward spiral.

Open Qt Creator and start a new Qt Quick application. Like most languages today, it scaffolds a basic skeleton for your application. A “main.cpp” file and a “main.qml” file. The CPP file is the controller and QML is the application UI. I added a “player.h” file that defines a class for the music player and a “player.cpp” that defines the controller logic for the music player. If you run the application, it will show a menubar with buttons on the bottom and a “load area” on top. The “load area” is where the UI of the music player will be loaded on click. QML looks like CSS on steroids and if you have an understanding of CSS its’ easy to grasp QML quickly.

QML is used to define “elements” of a UI. Every element has an ID and we refer to an element by its ID. Qt Creator is called so because you can create a UI by dragging and dropping (and editing properties) an element in the Creator window. If you see my “main.qml” file, there is a Loader element. This is the “load area” and we can load an external QML directly into this load are with the Loader element. To make an element clickable, we define, within that element, a mouse area. Mouse area defines an “onClicked” signal which is used to define the function of the element if it is clicked.

Loader {
 id: contentLoader
 x: 1
 y: 0
 width: 1023
 height: 324
MouseArea {
 id: mouseArea2
 anchors.fill: parent
 onClicked: {
     contentLoader.source = "mediaPlayer.qml"

The important and confusing part, like margins in CSS, are anchors. You must read about anchors yourself but it basically means how an element is positioned relative to its’ parent.

Coming to “mediaPlayer.qml”, it looks much the same as “main.qml”. The focus areas are “FolderListModel”, ListView and MediaPlayer. In QML and in general, data is cast into a model. Model is how your data is defined. In this case, we are going to access a folder pointed to by the “musicUrl” variable (we will come back to this). A Model is used by a View to format the data you’re accessing. In this case, we are formatting it in a List and hence the ListView. A View uses a delegate. A Delegate defines how each element in a data set is rendered. In our case, each song in our music folder is enclosed in a clickable rectangle. If you click on it, it will start playing that song. We are using QtMultimedia library to play songs and it defines a MediaPlayer element. You can check out the available parameters of MediaPlayer and QtMultimedia library in the links. Here, we update the “source” parameter of the MediaPlayer element when we click on a song shown in the list. The available parameters of MediaPlayer are used further down the code for example: mediaPlayer.metaData.title and mediaPlayer.metaData.author.

 FolderListModel {
   id: folderListModel
   folder: musicUrl // TODO: write C++ Controller. Done
   nameFilters: [qsTr("*.mp3")]
   showDirs: false
 ListView {
   id: playList
   x: 9
   y: 8
   width: 261
   height: 308
   spacing: 5
   flickDeceleration: 1000
   model: folderListModel
   delegate: Rectangle {
     x: 23
     y: 21
     width: 234
     height: 56
     gradient: Gradient {
         GradientStop {
         position: 0
         color: "#ffffff"
     GradientStop {
         position: 0.881
         color: "#ae5151"
 Text {
   id: song
   text: model.fileName
   anchors.fill: parent
   verticalAlignment: Text.AlignVCenter
   horizontalAlignment: Text.AlignHCenter
   font.pixelSize: 12
   wrapMode: Text.WordWrap
   MouseArea {
     anchors.fill: parent
     onClicked: {
         mediaPlayer.source = model.fileURL

The third element of the set of human entities is Soni. This one is our darling. We all revere this one and look up to this one. This one is quite mature and emotionally and mentally stable. This one seldom thinks that I’m erudite so there is not much wrong with her. This one is a bit haughty and I feel lucky that I’m in talking terms with this one. Lucky because she is sorted enough to filter out obtuse humans out of her life. This one has experienced much and knows how to hold her composure and stature in direst of situations. This one is the coolest human entity I have come across till now. Right now, this one is globetrotting.

Yanka is not in the messaging group but the technical aspect of this article is meant for this one. This one is one hap chick. This one has a flamboyant style statement. This one is amiable and if you ask this one for some time, she will give you time. This one will sit and listen to you and talk to you. Although this one speaks almost 100 words within a minute but you can slow it down and process it mentally if you aren’t distracted by that sparkling smile. This one thinks that I’m intelligent but I give her that… not her fault, this one doesn’t know me much. Which is good for this one’s mental well being.

Lady D. This one is awesome. This one thinks I’m a fucking idiot and hence there is nothing wrong with this one. This one is different. Out of the pack. I can relate with this one and I like to think that this one and I have same mental frequencies. This one is funny, intelligent… pretty. A whole package just to take your breath away. This one is a bit narcissistic but that’s alright. It suits this one’s persona. You can sit with this one and observe her without getting involved and you won’t be bored. This one has an active (if not over active) mind and cannot sit still. I find many a similarity between this one and myself. I’m mentally (over) active and cannot sit still either. This one is striving to be mentally and emotionally stable like Soni and will eventually get there. This one has naught capacity for bullshit. This one forms clear opinions and characterises deliberately and clinically which I find utterly cool. This one thinks that she is all been there and done that but the only experience that she has is of that one city which was her first home away from home. Given all her imperfections though, this one is perfect in every way. If I ever decide to take a chance with some human, this one would be the one.

Coming to the “player.h” file, here we define a class that will eventually help us get the songs out of our directory and into the list model. In Qt, every class must extend the QObject class. I won’t go into the nitty gritty pieces of this class and directly jump to the implementation of the function definitions. QStandardPaths define all the standard paths in the OS for example, all the paths in the $PATH variable in a terminal are defined in this header file. In “player.cpp”, we extract the standard path to our music folder in the constructor of class “player”.

player::player(QObject *parent) : QObject(parent)
     musicPaths = QStandardPaths::standardLocations(QStandardPaths::MusicLocation);
     musicUrl = QUrl::fromLocalFile(musicPaths.isEmpty() ? QDir::homePath() : musicPaths.first());

The musicUrl variable is set in the controller as shown above. We must expose this variable somehow to QML so that it is accessible in QML. To do this, we add this variable to the root context of the main application engine.

engine.rootContext()->setContextProperty(QStringLiteral("musicUrl"), p.getMusicUrl());

This piece of wonder basically allows us to execute a function defined in our controller whenever the said variable is referred to in the QML. This is pretty fucking cool.

Well, this panegyric comes to an end. These 4+1 elements of this set of human entities are awesome. All opinions presented here are a solely the authors perspective. It is not the author’s intention to degrade anybody but if you feel degraded, feel free to take out time and jump off of a cliff.

Yours truly,

Windows, yes Windows.


Rain, apathy and boredom. That is how the last few weeks have been. To make things worse, I was pushed into this new project forcing me to dabble with Windows 8.1 and its deployment process.

So apparently, you may think “Deploy Windows 8.1? You had to write a blog for that?!”. Well let me tell you, you fuck stick, there is a difference between installation and deployment. You do an installation when you set up everything from a brand new Windows CD. Deployment is a process where you directly apply a pre configured Windows image to the system. Got it? Good.

So before starting… or just lets start, yeah. You have to download some stuff before you start. To be more elaborate, what you are downloading is Windows Assessment and Deployment Kit (ADK). It is a suite of tools required to configure and deploy Windows 8 on a machine. Please follow instruction on how to obtain and how to install Windows ADK on your machine. I assume that you have done so.

We will start with Windows Pre Installation Environment or WinPE. It is a scaled down version of the failed Windows Vista and provides a minimal command line interface to run deployment and other scripts. After you install Windows ADK, you’ll have WinPE with other tools… we make a copy of it.

If you installed the ADK, you’ll have a command line environment called Deployment and Image Servicing Tools (DISM), you must run this as an admin:


Once it starts up, assuming that your PC is 32 bit (mine is), fire off the command:

copype x86 C:\winpe_x86

replace “x86” with “amd64” if you are on a 64 bit machine. This will copy the required files into a folder named “winpe_x86” (create the folder beforehand).

We have to mount the image. Once upon a time that would have excited me because I was working on Linux. Now its just… boring. Fire off: (you’ll have to make a mount folder in the previously created folder)

dism /mount-image /imagefile:c:\winpe_x86\media\sources\boot.wim /index:1 /mountdir:c:\winpe_x86\mount

You can customize it. As an example, here is how to add packages for PowerShell and language packs and other dependencies for PowerShell. You can get commands to add packages all over the net.

dism /image:C:\winpe_amd64\mount /Add-Package /PackagePath:"C:\Program Files (x86)\Windows Kits\8.1\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\WinPE-NetFx.cab"
dism /image:C:\winpe_amd64\mount /Add-Package /PackagePath:"C:\Program Files (x86)\Windows Kits\8.1\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\en-us\WinPE-NetFx_en-us.cab"
dism /image:C:\winpe_amd64\mount /Add-Package /PackagePath:"C:\Program Files (x86)\Windows Kits\8.1\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\WinPE-PowerShell.cab"
dism /image:C:\winpe_amd64\mount /Add-Package /PackagePath:"C:\Program Files (x86)\Windows Kits\8.1\Assessment and Deployment Kit\Windows Preinstallation Environment\amd64\WinPE_OCs\en-us\WinPE-Powershell_en-us.cab"

Plug in a flash drive and install WinPe on it. Fire off: (after plugging in the flash drive of course, I’ll assume the drive letter is F:).

dism /unmount-image /mountdir:c:\winpe_x86 /commit
makewinpemedia /UFD C:\winpe_x86 F:

Now, starts the fun part. We will capture an image of the running system. To do so, you have to “Sysprep” the machine into Audit mode. Go to run and type “sysprep”. A window will open and you have to execute “sysprep” executable file.


from the first drop down menu, select Audit mode and make sure you have checked Generalize. Let shutdown options remain same. When the system shuts down, connect the flash drive created above and restart the system. It will boot into WinPE:


I have fired the “DISKPART” command which lists the current partitions on the hard drive. To capture an image then, you must do: basically, you are capturing the current state of the windows partition on your systems (C drive in most cases) to your pen drive (“install.wim”)

dism /capture-image /capturedir:c:\ /imagefile:F:\install.wim /name:"DeploymentTestImage"

Now that you have captured an image, lets customize it. Type exit to exit from WinPE and reboot the system. When the system reboots, you have to mount the captured image to customize it. Mount the captured image by typing the following in DISM command prompt (above): make a “mount” folder under C: before continuing

dism /mount-image /imagefile:f:\install.wim /index:1 /mountdir:c:\mount

When you navigate to “mount” folder, you can see that it looks like the C drive of your current system. Common folders like “PerfLogs”, “Windows\System32” etc are present. I’ll change the wallpaper as a basic customization as I’m not a Windows whiz kid. Navigate to Windows\System32\Web\Wallpaper. You’ll see the default wallpaper that you get when you do your first install (img0.jpg). Replace it with your own wallpaper. Note that you might have to take admin privileges to do that.

Dismount the image and commit changes:

dism /unmount-image /mountdir:c:\mount /commit

Now again reboot the system whilst the flash drive is plugged in. Now,

If you are on a BIOS machine, this is the layout. We have to make partitions before deployment. We use “DISKPART” to make these partitions.

// Create Partitions BIOS
// These commands are used with DiskPart to
// set up the drive and create three partitions
select disk 0
// System partition
create partition primary size=350
format quick fs=ntfs label="System"
assign letter="S"

// Windows partition
create partition primary size=15000
// Format Windows partition
format quick fs=ntfs label="Windows"
assign letter="W"
create partition primary size=10000
format quick fs=ntfs label="User"
assign letter="D" // the "D:\" Drive

// Recovery image partition
create partition primary
format quick fs=ntfs label="Recovery image"
assign letter="R" 
set id=27
list volume

You can alternatively run create a text file (partitions.txt) with the above commands and run diskpart as:

diskpart /s partitions.txt

To deploy the final captured image, I made this batch file to automate the process (actually borrowed it):

rem    Usage:   ApplyImage WimFileName 
rem    Example: ApplyImage F:\install.wim ==

rem == Copy the image to the recovery partition ==
md R:\RecoveryImage
copy %1 R:\RecoveryImage\Install.wim

rem == Apply the image to the Windows partition ==
dism /Apply-Image /ImageFile:"R:\RecoveryImage\Install.wim" /Index:1 /ApplyDir:W:\

rem == Copy boot files to the System partition ==
W:\Windows\System32\bcdboot W:\Windows

:rem == Copy the Windows RE image to the System partition ==
md S:\Recovery\WindowsRE
xcopy /h W:\Windows\System32\Recovery\Winre.wim S:\Recovery\WindowsRE\

:rem == Register the location of the recovery tools ==
W:\Windows\System32\Reagentc /Setreimage /Path S:\Recovery\WindowsRE /Target W:\Windows

:rem == Register the location of the push-button reset recovery image. ===
W:\Windows\System32\Reagentc /Setosimage /Path R:\RecoveryImage /Target W:\Windows /Index 1

You can read about the command line options and documentation for the commands used any where on the web (if you google correctly).

Thats it. There, you have a pen drive having a custom Windows 8.1 image that you can deploy on any system. It will take half as much time as a full installation and automatically create partitions etc. I have started to like Windows 8.1… will see what else can I do.

A few bad days


“Choose life. Choose a job. Choose a career. Choose a family. Choose a fucking big television. Choose washing machines, cars, compact disc players and electrical tin openers. Choose good health, low cholesterol and dental insurance. Choose a starter home. Choose your friends. Choose leisure wear and matching luggage. Choose a three-piece suit on a hire purchase in a range of fucking fabrics. Choose D.I.Y and wondering who the fuck you are on a Sunday morning. Choose sitting, watching mind-numbing spirit crushing game shows stuffing fucking junk food into your mouth. Choose rotting away at the end of it, pissing your last in a miserable home. An embarrassment to the selfish, fucked up brats you have spawned to replace yourselves. Choose your future. Choose life.”

Well, that is from the opening scene of the best movie ever made: Trainspotting. That being said, the last few days have been an utter devastation to the above “regime”. So I took a detour from my usual ramblings and started working on a Perl project called “Complain management system”. It’s not a big fucking deal really, but this is my first commercial project in Perl and it is quite simple. To keep things simple and clutter free (this is not a tutorial…), please refer to this tutorial for details.

The requirements are as follows:

  • Perl. On Linux systems, you must have it installed already. If not, use your favorite package manager (I use apt) and install it. On Windows, go for Strawberry perl.
  • Catalyst. Catalyst is an agile MVC framework written in Perl. It is very robust and increases the development speed considerably. You can use CPAN to install it.

I’ll assume that you already are a Perl programmer because I cannot really get into the intricacies as such. I’ll directly start with how to use the Catalyst framework to make a small web application. The source code will be upped on git.

Now exactly like Mark Renton, I chose not to choose life. I chose something else. And again like Mark Renton, there were no reasons. Who needs reasons anyway when you got weed? The month that started with a good bright fucking smile on my face ended with me fallen on the freakin’ road about to be bowled over by a double fucking decker bus.

“Goa! Dude I have 5 days off and I’m not fucking them up eating at the miserable mess food you love to stuff your mouth with!” said my friend. So we went to Kashid. One of the best trips of my life. Starting with the ferry ride from Gateway of India, the journey was memorable… weed, beer, beach, silver sand, moonlit night, high tide and the cool nightly sea breeze. The water was fresh and sparkling right until the moment I lost my phone.

So starting with starting to write a web application in Perl. I’ll be using Linux obviously so all you Windows lovers are on your own. Open your terminals and fire off:

code-ninja@GeniuSisMe:~/Projects$ catalyst.pl MyApp

This will dump a long output which will result into a directory being made in your PWD (mine is Projects) by the name “MyApp”. When you change into the MyApp directory, you’ll see that there are some sub-directories and some Perl scripts. The “lib” directory will contain your code, the “root” directory has all the HTML code, the “script” directory has generated scripts to help you test and develop your application.

MVC is an acronym for Model View Controller architecture. You can read about it on Wiki. Essentially, it is a paradigm which divides your projects into three modules namely Model, View and the Controller. Model is the database, View is what you see in the browser and Controller is the bond between View and the Model. Lets make a Catalyst Controller. Fire off:

code-ninja@GeniuSisMe:~/Projects/MyApp$ perl script/myapp_create.pl controller Complain

It will again dump some output which essentially will generate a template controller for you to play with. Open “MyApp/lib/Controller/Complain.pm” in your favorite text editor. You’ll see just one sub-routine (“index”):

sub index :Path :Args(0) {
    my ( $self, $c ) = @_;

    $c->response->body('Matched Complain::Controller::Complain in Complain.');

This is supposed to be programmed by the developer. You can add more complex routines and stuff you want to do with the data.

But no! I will not give up! It was just a phone I lost! For a brief moment, I ate like a fucking pig and worked out at the gym. Went out and got fucked up without having any fucking idea about my miserable and depleting funds

“Lets go out and eat!” said Dang. I acceded. The Baghdadi restaurant in South Mumbai is awesome. Order a Chicken Curry and the guys will serve you with a whole chicken floating in a decadent curry. Whole… full, not cut. One big fucking piece of the meat you love to devour. “Lets go to Malabar hills and smoke up!” said Sammy. So we went to Malabar hills and smoked up. Came back… there is only 100 bucks in my account and there are 2 full weeks before I get my salary and I live in Mumbai. Fuck.

And so started the miserable week of utter penury. No food, no outing, no beer and only weed. No fucking idea about how I’d manage the 2 weeks, I give up eating like a fucking pig and working out at the gym. I give up taking a bus to work and started walking 3kms to reach my office. No money means no food during lunch time… not even a freakin’ banana.

So lets see… Now that we know how to make a controller, we will see how to make a model and a view. We write a small SQL script to make a database. Note that I’m using the SQLite3 database and the commands I fire will be specific to it.

We make a table in our database which will store user’s complain amongst other things.

PRAGMA foreign_keys = ON;

CREATE TABLE complain (
    userName TEXT,
    userAddress TEXT,
    userContact TEXT,
    productSerial INTEGER,
    productType INTEGER,
    productMake TEXT,
    complain TEXT,
    status INTEGER -- 0: open, 1: processing, 2: closed
INSERT INTO complain VALUES(1, 'Code Ninja', 'Andheri', '98111111111', '0112358', 'Laptop', 'HP', 'Screen Crapped up!', 0);

save it under any name you want (I called it complain.sql). Then give it to your database engine so that it creates a table.

code-ninja@GeniuSisMe:~/Projects/Complain$ sqlite3 complain.db < complain.sql
code-ninja@GeniuSisMe:~/Projects/Complain$ sqlite3 complain.db
sqlite> select * from complain;
/* whatever output */

To enable the model, we say:

code-ninja@GeniuSisMe:~/Projects/Complain$ perl script/complain_create.pl model DB DBIC::Schema Complain::Schema create=static dbi:SQLite:complain.db on_connect_do="PRAGMA foreign_keys = ON"

Don’t worry about the complex commands, you don’t really need to know them. I know what each of the commands mean but it really doesn’t matter if you don’t. Now, if you look in the “lib” directory of your project, you can see a new sub-directory called Model. Open the Perl module you see inside it. It has a Perl representation of the data columns you just made in your SQL script.

The mess where I eat refused to give me any credits because I was already in debt to them for 20 freakin’ bucks. But I disabused this nice cigarette shop guy from not giving me credit and coaxed him for my constant supply of tetra-pack milkshake and cigarettes. So, no phone, no money, one milkshake and cigarettes to go through the day. Ripped my landlady off of 500 bucks (never to be returned) and some more out of my colleagues at work. They are too friendly and don’t expect things back… good for me.

Under such conditions, the grass was a luring distraction. When you are on junk, you have only one worry… scoring. When you are off it, you are suddenly obliged to give a fuck about all kinds of things. Got no money, got no girl… about human relationships that don’t really matter. So I gave in to my senses and rolled a joint and took a long fucking drag.

And that long fucking drag could not satiate my will of fucking myself up. Its never enough… you must go out and fuck everything all over again. You know you cannot afford it but you cannot also ignore the craving. To top it, the attachment, the feelings I had for the one girl I fell for became overwhelming… I missed her, way too much. So I get higher than usual and planned to go out (knowing that I haven’t got any money). Got on the wrong bus and I stepped out of it in the wrong way… against the direction of motion. Slipped and the road was thick with traffic as it was peak traffic hours. Saw death, right in front of me… a red double decker.

For the view, we will need a few more things. First we will need a view controller that will to and fro the data between Model and the HTML web page. Second, we will need a page template that will be rendered as an HTML page by the Catalyst engine. For the template, we will use the Template Toolkit along with jqDock and a bit of jQuery. To make a view controller, fire off:

code-ninja@GeniuSisMe:~/Projects/MyApp$ perl script/myapp_create.pl view TT TT

This will create Template Toolkit view that the Catalyst engine renders into a complete HTML page. It will also create another sub-directory under “lib” called “View”. You must follow that tutorial I linked above because I’m not writing a fucking tutorial. I’m just elucidating what all is there to make a small web application in Perl.

And in this situation, the quote “A friend in need is a friend indeed”, was tested. Found a gem :). Thanks to the guy that I was able to survive this state of penury without affecting all my debauchery. Now, I have got money… got a bonus from work (for my work with this application) and now…

“The truth is, I’m a bad person, but that’s gonna change. I’m gonna change. I’m cleaning up and moving on. Going straight and choosing life. I’m looking forward to it already. I’m going to be just like you. The job, the family, the fucking big television, the washing machine, the compact disc players and electrical tin openers, good health, low cholesterol, dental insurance, mortgage, starter home, leisure wear, luggage, three-piece suit, D.I.Y, game shows, junk food, children, walks in the park, good at golf, washing the car, choice of sweaters, family christmas, indexed pension, tax exemptions, clearing gutters, getting by, looking ahead, till the day you die!”

The code can be found here. I haven’t uploaded the SQL script I used but you can make it yourself. The README has everything you need to know about how to run the application.

An idiot’s gudie to socialism


Hello everyone :). Well, since my last post, I have got 10 more follows. Behold the fields in which I grow my fucks, lay thine eyes upon it and thou shalt see it is barren (I like you guys even if I haven’t met you, you are awesome… thats my way of saying thank you 🙂 ). Anyways, today we will learn how to socialize and analyze an Allwinner A23 tablet.

That girl I really like… she says I should go out and socialize. I thought I should give it a try. So this Sunday, I FORTUITOUSLY, get out of my room and see a random guy coming downstairs from the room above. He has a cycle… lets try him.

Me: “Hey… hi. You live upstairs. Did you just move in?”

Him: “yea… you live downstairs?”

Me: *thinking to myself* obviously you moron. “Cool… do you mind if I hangout with you guys? I’m kinda new here and don’t have much friends and all…”

Him: *thinking to himself* what kind of a moron is he? “Oh yea! that’d be cool!”

So… I socialized! We hung out for a while, had a fag or two and then dinner. He is quite cool. He is a mechanical engineer and I have no idea how I know that he has been into 2 relationships.

So this new tablet I got at work. It runs on an Allwinner A23 SoC and Allwinner boasts that it is the most efficient SoC ever built for a tablet device. And their claim ain’t faulty. In the “quick boot mode”, it takes less than 3 seconds for the tablet to boot. The “high speed mode” is blissfully fast but the problem is, the tablet is not recognized by ADB.

Luckily, the vendor managed to, somehow, install Debian LXDE into the NAND partition and we can select to boot Debian in the “Backup and reset” option under Android settings. Thats 1337! I wish I could do that but since I cannot right now, we will try and see what all drivers and libs Debian loads. We will then hack the drivers (next post probably) and have a powerful fully dual booting tablet at our disposal.

Booting the tablet into Debian, the first hurdle: touchscreen doesn’t work. The USB OTG works and I’m able to interface a mouse and a keyboard. So I have a complete desktop system with a 7″ screen, MALI-400 GPU and a 1.8 GHz dual core SoC.

Me: “So what you do?”

Him: “I’m a mechanical engineer. I work in aviations.”

Me: *thinking to myself* another fucking engineer. “Cool… I’m a R&D Engineer. How long have you been in Mumbai?”

Him: *thinking to himself* another fucking engineer. “Two and a half months approx.”

… *Some more random talk.*

Lesson/analysis 1: You just talk random shit to people. If someone is very chirpy and enthusiastic to present their perspective of things, clearly the person has had a social life and knows how to put their point across.

Lesson/analysis 2: Talking random shit is not hard. Well, its not easy either. There is this destitute homeless woman who walks the street just outside our quarters. The way she is living is not logical. I don’t really need to prove how its not logical but the guy had to prove why it is logical.

Me: “Why would someone live like that?! Its not logical!”

Him: “Whats not logical in it?”

Me: “She doesn’t have any plans. She doesn’t know what she will wake up to tomorrow. If you live linearly, you’ll always know whats gonna happen tomorrow!”

Him: *thinking to himself* This guy is so full of himself… dumb fuck. “but thats the point! she doesn’t know whats gonna happen tomorrow and therefore she is happy! She lives in the moment and doesn’t have any sense of right or wrong.”

Me: *thinking to myself* what kind of a dumb fuck would think this way? “Is that so? You can do that?”

Him: “yea obviously!” *you dumb fuck*.

What I meant to say was, if you have 2 hands, 2 legs, a brain and all of them working properly, you are not allowed to be… beggarly. If you have nothing to wake up to every morning, if you have nothing to drive you everyday, whats the point of living?

So opening up the terminal and firing a few of my default favorites:

root@debian:/# lsmod
Module            Size            Used by
sunxi_keyboard    2753              0
mali            159916              0
lcd               6964              0
disp           1046693              3 mali, lcd
nand            245773              2

Cool, Debian uses the “sunxi_keyboard” driver for OTG support. It doesn’t load a touchscreen driver. Although it ships with 2 pre-compiled modules (FT5x and GSLX680), the drivers are not loaded on boot (even after mod’ing /etc/modules). Conclusion, the touchscreen is NOT a Focal Tech or GSLX. Next wi-fi.

bash: lshw: command not found
bash: lspci: command not found

Fuck! But reading /var/log/messages, Linux does configure RTL8723BS wi-fi driver. `lsmod’ does not show it though. So lets mod /etc/modules… bingo! The driver loaded! But I need wi-fi tools (iwconfig and family). Since I cannot chroot into the tablet I’m at losfer words!

Lets see what else… reading /var/log/messages more closely, this is Debian Linaro 14.x or something (Linux Debian kernel 3.4.39). I even got the u-boot.

Me: “well yeah, you are not immature but there is some adolescence in you.”

Him: “I’m adolescent?! Tell me more!” *dude, you are the first shit who said that.*

Well… the guy rides to work on his cycle. I’m thinking of doing the same… its the best option. No fuel and traveling expenditure. But if the first thing that came to your mind was “I’m saving the environment by using a bicycle!” you are NOT immature, you are adolescent! Immaturity would have been like when one does not know how to listen to others.

Lesson/analysis 3: act normal. The person you are talking is another human being. Just like you are. They go to work, they have ideologies and principles that are NOT in sync with yours, they have had their share of troubles and you are not the only fuck in the world who has suffered!

Lesson/analysis 4: after reading this… don’t try and make an opinion of anyone. Its an exercise in vain. Your perception of a person maybe totally wrong or maybe so correct that it may hurt you and/or the person. Or even the person may not be at all what you analyzed. That would suck cuz then you’d have to question your ability of analysis!

I have written 1051 words. Fuck… that too on how to socialize. Geez…

May the force be with you,




Well… hello again. Finally, I have got the opportunity to make something of my fucked up life. I feel glad to know that I’m now a Research and Development Engineer in Datamini Technologies (India) Limited. They manufacture computer hardwares such as RAMs, mouse, keyboards, desktop systems etc. My current project is on dual booting a fully fledged Linux system on an Android tablet and it is going good. It is good because having a fully featured Linux OS on a tablet device is very awesome. We can have many things that Android lacks (such as the GCC C compiler and other things).

I have relocated to Mumbai, Maharashtra. It is one of the biggest cities in India catering to thousands of living souls. Named after Goddess Mumba (Mumba Devi or as they say Mumba “Bai”), the city is beautiful (espl South Mumbai) and neat. People are good but the weather ain’t. Since Mumbai is a port city, we have what they call a maritime climate. Neither too hot, nor too cold. But its sticky during the day. Humidity increases but again, due to the maritime climate, it doesn’t feel that hot. Its been just 20 days since my arrival here and I haven’t got the chance of exploring as such. I will in a due course of time.

I have managed to make the dual boot work, complete with the touch screen and all. There are some quirks and that too because of the corrupt hardware configuration file (or that is what my research guide says). It has been done before but my research is unique because the processor I’m working on is newer than what is already done. I’m working on an Allwinner A20. On the A13 the source works perfectly but I guess that the Sunxi kernel is not fully updated for the A20. And therein lies the quirks.

The touchscreen is driven by FocalTech’s FT5X chip. I got that from lsmod’ding the tablet’s Android root shell. Luckily, the Sunxi source has the FT5X driver. Maybe due to some glitch in the code or maybe due the corrupt script.bin file, the touchscreen works only on two thirds of the screen and requires some heavy calibration. I had to hack the code a bit and now the kernel loads the touchscreen driver as a touch PAD. I can drag the mouse pointer around and click on stuff just like using a laptop’s touch pad. Apart from that, Android uses the RTL8188EU USB WiFi driver. Again, the Sunxi code provides the driver but I can’t seem to make it work as the OS doesn’t detect a wireless LAN interface (wlan0). Finally, the OTG port doesn’t work no matter what I do.

I’m currently putting up in a place called Bhandup. Its a small sub-urban umm area, if you may (its not exactly a town), and is not that cool. I mean not as cool as my home was. And my home is also somewhat similar to Bhandup with respect to the ambiance. I made friends… well, I’m co-existing with people. My room mate is this utterly cool guy I know from back home and he plays guitar and sings and teaches German at some academy. We can talk and well… he is quite cool over all. His girl is nice too. She is friendly and we guys really hit off well. My other room mates are good too but I haven’t come to know them as well (and its not gonna happen any time soon either).

I haven’t got the chance of really exploring the city learning its history and all but I did get the chance of going to some famous places around. I have just been to South Mumbai (or as I like to call it, South of Heaven) and its really an awesome place. It is one of the poshest places in Mumbai and very beautiful. Here, take a look:


Thats the Churchgate Station on the left (yes, thats a railway station) and the Eros theater on the right. Thats a panorama shot of the Churchgate Station crossing. Going straight on the opposite side, we end up on the Marine Drive:


I’m still working trying to figure out why my WiFi is not being detected on my installation of the Sunxi kernel. In all probabilities it is because of the corrupt hardware file I mentioned earlier. I can confirm this because Android works without any glitches on the same tablet. I had to flash the tablet once before and I guess I must have corrupted the original script file. Whatever the case maybe… I’ll have to test it.

The setup and initial hacks are all very easy. You really don’t have to be a ninja to do that. You just need a fast computer and some knowledge of compiling kernels. The hacks later require a bit involvement as I had to look at the sources and play with them. For instance, I had to change BTN_TOUCH to BTN_TOOL_FINGER in the FT5X driver source so that it gets detected as a touch pad instead of a touchscreen. Also I had to remove the IRQF_TRIGGER_FALLING macro to make the touch work at all. The worst thing is, A20 is not documented as well as A13. So the R&D is going a bit slower than I anticipated.

So anyways, I’ll wrap up… this was a random post because I felt like writing something. Life has taken an uplift and I feel glad about it. Coming out of severe failures and setbacks in the past, this is my moment of savoring the achievement albeit trivial.

happy hacking folks.

May the force be with you,


The A20.


Hola mi amigos! Life’s been going smoothly since my last article. After a long time, I did a brilliant hack that I’d love to share. Whats so brilliant about it? Well, I got an Allwinner A20 based Android tablet and I dual booted Ubuntu 12.04 LXDE on it. Very hacky, very time consuming but you’ll get to learn about the system quite a bit.

Well, lets start with a rooted Android tablet running on an Allwinner A20 processor. This processor is based on ARMv7 core. Assuming that your tablet is rooted (check XDA for rooting methods or just Google it. I personally used vRoot to root my LG E450), lets pull out a file from the device. On a Linux box (mine is Mint Nadia) type:

# adb devices
// prints a list of attached devices. Hopefully, you have one device attached.
# adb shell

mkdir /mnt/tmp
mount -t vfat /dev/block/nanda /mnt/tmp

# adb pull /mnt/tmp/script.bin

Now, for the starters, what is this “script.bin“? It is the device configuration file. Allwinner does this because this is a smart way of tweaking the Linux kernel without having to recompile the kernel. This is very cool. You can tweak video resolutions, general purpose IO pins etc. I’ll R&D some more into this and let it out here.

The Allwinner A20 is based on the ARMv7, so to compile, rather cross compile, the code on some other (x86) architecture, you’ll need the GCC ARM compiler and some other tools. This will install the GCC compiler and some other tools (that you may already have).

# apt-get install gcc-4.7-arm-linux-gnueabihf ncurses-dev uboot-mkimage build-es

Allwinner has their own bootloader that they use in their SoCs. It sets up a basic a structure to load and boot a Linux kernel. ON A SD CARD! So now, we clone the git of U-Boot and manually build the source. Pretty. Fucking. Cool.

# git clone -b sunxi https://github.com/linux-sunxi/u-boot-sunxi.git

got it? Now, cross compile! 😀

# make a20-olinuxino_micro ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf-

The interesting thing is a20-olinuxino_micro. Open the cloned directory and surf to boards.cfg. Open it. There you will see how many ARM processors U-Boot supports. This parameter to the `make’ command says that the compiler should compile the code according to the A20 architecture.There are many other boards (RPi being eyed upon) that you can hack. If you have an ancient laptop like mine, you can go and have like 15 cups of coffee and roam around for a while and stretch so much that you tear yourself apart. Because compilation will take time.

Allwinner has their own version of embedded Linux called SunXI. We have to compile it to generate a bootable image (uImage) that will boot the actual kernel. The booting process is as follows: (please correct me if I’m wrong)

  • U-Boot loads the `uImage’ from the SD card to RAM
  • uImage deflates the actual kernel and sets up parameters to boot the kernel.
  • The kernel is loaded from an ext3 partition on the SD card and since it is (will be) compiled for ARMv7, it just works.

Clone Allwinner’s SunXI. Fire this command:

# git clone https://github.com/linux-sunxi/linux-sunxi

Now, again we cross compile. Before that, we have to tell the kernel that we are going to compile it specifically for the A20 architecture. If you have compiled kernels before you’ll know that arch//configs has configuration required for many architectures. Open arch/arm/configs. There you will see many device configuration files. They define basic kernel setups to compile kernel for a particular processor. For the A20 processor, we have to use sun7i_defconfig. It will set up the kernel according to A20 processor. Again, I’ll play with it in coming weeks and let you know what it actually is. Fire this command. I assume that your PWD is the cloned directory (linux-sunxi).

# make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- sun7i_defconfig

We have to now compile the kernel image. The GCC compiler is very efficient. You can specify number of processors to be used while compiling the source. Again assuming that your PWD is linux-sunxi, fire this:

# make -j2 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- uImage modules

The `-j2 ‘ option tells the compiler that I have two cores in my host processor and it should use both the cores. If you have 4 cores, you can say -j4… fucking awesome. The above command compiles the kernel and generates kernel image and all the essential modules that the kernel requires. Again, go have some coffee and take a walk with your girl… this will take time. Much time.

That being done, we have to now install the compiled kernel modules. Fire off:

# make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -j2 INSTALL_MOD_PATH=out modules_install

This will install the compiled modules in a directory called “out”. If you open this directory, you’ll see that the compiled modules and firmware are generated. We will copy these files to a stock Ubuntu kernel (hang on!).

Buy/get/borrow/steal a 4-8GB SD card. We will partition the card and install the kernel in it. To partition the card, insert it into your laptop’s (I have a laptop so…) SD/MMC reader and do: (on my Mint Nadia, the SD card is shown as /dev/mmcblk0, type fdisk -l to see what your SD card is called in /dev)

# fdisk /dev/mmcblk0
Command (m for help): n
Partition type:
p (primary...)
e (extended...)
Select (default p): p
Partition number (1-4, default 1):
Using default value 1
First sector (2048-7744511, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-7744511, default 7744511): +16M

This partition will later be formatted as a vfat partition and will save the script.bin and the uImage. Similarly, create another partition that will store Ubuntu Linux. You may optionally create a swap space… I didn’t so I skip this step.

Command (m for help): n
Partition type:
   p   primary (1 primary, 0 extended, 3 free)
   e   extended
Select (default p): p
Partition number (1-4, default 2):
Using default value 2
First sector (34816-7744511, default 34816):
Using default value 34816
Last sector, +sectors or +size{K,M,G} (34816-7744511, default 7744511):
Using default value 7744511

Cool… write the changes to your card using the `w’ command in fdisk prompt. We now format the partitions. First partition will be vfat and second will be ext3.

Note that after partition, my sd card looks like this:

Disk /dev/mmcblk0: 7948 MB, 7948206080 bytes
4 heads, 16 sectors/track, 242560 cylinders, total 15523840 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000

        Device Boot      Start         End      Blocks   Id  System
/dev/mmcblk0p1            2048       34815       16384   83  Linux
/dev/mmcblk0p2           34816    15523839     7744512   83  Linux

To format the partition then, I fire the command:

# mkfs.vfat /dev/mmcblk0p1 // format partition 1 to vfat
# mkfs.ext3 /dev/mmcblk0p2 // format partition 2 to ext3

Awesome, now lets dd. We dd because to write the bootloader (U-Boot) we have to copy data block by block. We are not copying a file, we are actually, in a way, writing the firmware on the SD card.

# dd if=u-boot-sunxi/u-boot-sunxi-with-spl.bin of=/dev/mmcblk0 bs=1024 seek=8

When you compile U-Boot, you get “u-boot-sunxi-with-spl.bin”. No I know not what it really does (to be honest, I don’t know what SPL is). Note that I’m NOT writing it to a partition (its in bold).

Now download Ubuntu LXDE from here. Mount partition 1 and copy script.bin and uImage.

# mount /dev/mmcblk0p1 /media/code-ninja/uboot
// I assume that you're in your Root Home directory and script.bin is in PWD
# cp {linux-sunxi/arch/arm/boot/uImage,script.bin} /media/code-ninja/uboot

Now mount the second partition and untar the downloaded Ubuntu 12.10 in this partition. You now have a ready to boot Ubuntu on the SD card. Remember that you installed modules in a directory called “out”? Copy everything from that directory to Ubuntu’s “/lib” like:

# cp -r linux-sunxi/out/ /media/code-ninja/Root/lib // I call my Ubuntu ext3 partition "Root"

Now the hackiest part. We have to configure the installed OS before we can start using it. This version of Ubuntu is devoid of any UI or other good things. We will chroot into it and install. But the catch is, it is compiled for ARM architecture… how will you run it on a x86 machine?! The solution is: qemu-arm-static.

This is a static version of the QEMU virtual machine and is used to run a command line OS without having to start the full-fledged emulator. From your host machine, do this:

# cp /usr/bin/qemu-arm-static /media/code-ninja/Root/usr/bin

Now, lets set up a basic chroot environment and login to our Ubuntu. Lets hack:

# mount -t proc /proc /media/code-ninja/Root/proc
# mount -t sysfs /sys /media/code-ninja/Root/sys
# mount -o bind /dev /media/code-ninja/Root/dev
# mount -o bind /dev/pts /media/code-ninja/Root/dev/pts
# chroot /media/code-ninja/Root
root@GeniuSisMe:~/# // I'm in!

Now just install whatever you want (language packs, browser… make your pick). You can install LXDE by saying:

# apt-get install lxde-core // I haven't done this, so no GUI for me... yet.

After you’re satisfied with your build, plug in the SD card into your tablet and boot to enjoy Ubuntu!

Following are the screen shots: Thats an Allwinner Pad.

Linux booting on Android A20 tablet.

Linux booting on Android A20 tablet.

The signature Penguins of Linux! Pretty cool, eh?!

Tell me how your dual boot goes! Till then… Sionara!

May the force be with you.