Making a “Responsive” Blog

It turned out to be a quick and fairly easy job considering the fact that it’s the first time I’m paying with @media screen stuffs.

Changing the main divs’ “width” to “max-width” did magic. The blog was like 75% responsive already.

- width: 1000px;
+ max-width: 1000px;

Then comes the most tedious part: fine tuning the interface.

response3

After wards, trimming margins, paddings was necessary to maximise the precious pixels on mobile devices.

@media screen and (max-width: 430px){
#container {
   padding: 3px:
}

.article {
   margin: 0px;
}
}

response2

I still need to work on the side boxes. Still undecided what info would mobile uses want to see. I guess time posted should go above the article and the tags/categories below. It might be a challenge to do this one.

The New My.T set-top box (Orange Mauritius)

liveboxwrapping

Got the new My.T tv set top box. The wrapping looks cool. But the real box is like this.

liveboxtrue

The image quality is same as before. Yep. No HD. The maximum setting supported is 1080I, not 1080p.

The channels are unwatchable on high definition. The sound becomes choppy.

Navigation from the remote control has considerable lag.

liveboxremote

It is not now that Orange will be providing good service. The device is a really low end one. Don’t get excited about it. Switch to bees if you want to try something else.

Automatic Server Deployment with Git/SSH

Uploading your files to servers is a pain. I was using git-ftp previously. But i wanted to use a pure git protocol coupled with ssh.

Copy your existing working directory to your server in lets say /var/www to be served as web; make sure it contains a .git folder.

on your local machine:
git remote add myserver nayar@example.com:/var/www/.git

on your server:
cd /var/www
git config receive.denyCurrentBranch ignore
mv ./.git/hooks/post-update.sample ./.git/hooks/post-update
chmod a+x post-update

modify the contents of ./git/hooks/post-update as follows

#!/bin/sh
GIT_WORK_TREE=/var/www/ git reset –hard

The setting up is over. Lets test if it’s working:-

on your local machine:
Make some changes to your local files
git commit -a -m 'changing file x'
git push origin master

The files on your server should have been updated accordingly 😉

Emotion for Dummies (Machines)

Imagine one morning your car just refuses to start because it is feeling depressed. Or it performs badly on the road not exceeding 60 km/h. You would most probably be like “B*tch please. What The F*ck is wrong with you. Get the f*ck moving!!!”

Emotions are sometimes considered as a negative thing especially for heart broke people. Brilliant students fail their exams. Neways, let’s make a hypothesis if machines would be more performant with “emotions”.

Source: hccanet.org
Source: hccanet.org

The “Sad” Car
Same thing applies for a car. If you just press the accelerator down most of the time, you’re definitely wearing down the parts if you don’t do proper maintenance with it. If the car knew that it’s owner doesn’t “love” him, it would have not ran fast. It would go on an average speed like 60-80km/h max.

Advantages:-
1. Car wear is reduced. Hence heavy maintenance cost is reduced. $$$
2. A driver who goes fast on a probably worn on car is a serious security risk both for the car and driver.

When the car “cares” about itself, the driver also travels safer.

The “Happy” Car
If car is a happy, it knows it can push it’s limit to the maximum. It has a “trust” relationship with its owner. IF you let your wife drive, the it would be great if the car would go into “scared” state behave accordingly. I think you got the point 😛

Modelling Emotions using Fuzzy Logic
I’m supposed to learn Fuzzy Logic for my Final Year Project. I’ll try to make a tiny demo. For non-techical people, you might just skip to The Evil Playboys section.

Let’s make a tiny simulation of such a car. We will have 2 input variables namely “care” which will be between 0 – 10. Accelerator will be between 0 – 1. Speed will be between 0 – 150. Did that in Fuzzy Logic Toolbox in 30 mins. Not that good but quite usable.

The rules:-

snapshot30

Case 1: No love 🙁
No Care, No Acceleration

Case 2: Trying to push the car
snapshot24

Case 3: Moderate care, moderate accelaration.
snapshot26

Case 4: Increasing care, same acceleration
snapshot27

Case 5: Pushing own accelerator fully
snapshot28

Case 6: Perfect car with full accelerator pressed
snapshot29

The Evil Playboys

Ofcourse. Some people might use it for their own benefits and “play with emotions” of others. Giving the machines false “pats” and turning off their sensors or hacking into the system to make the “happy” value higher would surely increase the productivity on the short term. But at the end, it always results in broken hardwares and <3. What do you think?

Setting Git server on VPS

Previously, I had set up a git server on my laptop. My friends would access it using my always changing IP. Furthermore, my laptop has to remain online.

Setting up a vps as git server
First create a git user
$sudo adduser git

A user and a group git would be created

Create accounts for your collaborators too using the same commands
$ sudo adduser rambo
$ sudo adduser rofler

Creating a group for the peeps working on a specific project.
$ sudo addgroup kuyon

Adding the collaborators to the group kuyon
$ sudo adduser rambo kuyon
$ sudo adduser rofler kuyon

Create a directory for each project you are working. By convention, it should end with .git

$ sudo mkdir /git/meraproject.git
$ sudo git init --bare
$ sudo chown -r git:kuyon /git/meraproject.git
$ sudo chmod -r 070 /git/meraproject.git

The above permission means that no one except those found in the group kuyon would have read, write and execute permission.

Now your collaborators can push an existing git project using this command

$ git remote add origin rambo@example.com:/git/meraproject.git
$ git push -u origin master

Roffler can clone the repository using rofler@example.com:/git/meraproject.git

Then the normal git workflow continues and life continues…

Note: the commands were written on Ubuntu Server 13.04