Thursday, December 6, 2012

Reset your Ubuntu password in 3 easy steps

Have you forgotten your Ubuntu password ?
Don't worry you are not alone.

Here is how you can easily reset your Ubuntu password.

Step 1 : Booting into recovery mode

As soon as you see GRUB loading screen with "Press ESC to enter menu". Make sure to press "ESC key".


You will be presented with options to boot into "ubuntu xx.xx kernel xx.xx generic" and " "ubuntu xx.xx kernel xx.xx generic (recovery mode)" . Choose the recovery mode.

Step 2:  Entering Shell

You will be shown "Recovery menu" with multiple options including "root   Drop to shell prompt". Select this option to enter the shell.with root access.


Step 3 : Resetting the password


Now that you are on root shell, use the following commands to reset your password.

passwd [user_name]
for example,
passwd wiredsoup 

 Follow the instructions, and use the following commands once you are done confirming your new password.

sync
reboot -f


That's it :) enjoy logging into you Ubuntu again.

Thursday, November 15, 2012

I2C (Inter Integrated Circuit Bus) : Serial Communication

I2C quick tutorial

I2C (sometimes 2 is in superscript) and read as "eye-two-see" or "eye-square-see" is a serial communication  protocol introduced by Philips semiconductors in early 80s.

I2C is a 2-wire Interface (TWI) with mostly a single master and multiple slaves , there are multiple master configurations possible too.

I2C signals

  1. Data :  SDA  ===========> Always bi-directional
  2. Clock:  SCL ===========> Bi-directional only in Multi-Master Mode

Ground : GND ==========> Common Ground between the two Devices
5V supply

By convention , I2C operates on 5V signals. So make sure you put a level translation buffer in between  if your device is 3.3V tolerant.

Maximum allowable capacitance on the lines is 400 pF and typical device capacitance is 10 pF. So how many devices are supported on single I2C Bus ?

The communication is always Master initiated, Master (typically a Microcontroller) places the address of Slave device with which Master intends to communicate on the Bus. All Slave devices monitor the SDA pin to determine if Master is sending their address. Only the Slave with Matched address can communicate with Master.

The advantages of I2C other than it being a very low cost to implement are
  • Supports multiple devices on only 3 wires
  • Is implemented in Hardware as well as Software (Bit-Banged I2C)
  • Supports Multi Master configuration
  • Many examples available on the Internet
If I had to belittle I2C I would say , The disadvantages of I2C are
  • Short Distances only
  • Slow Clock speeds (Typically 100Khz)
  • Faster Clocked devices cannot coexist with Slower devices on the same bus

I2C Typical Connections
Both SCL and SDA are Open-Drain drivers, which means that the device can drive it low, but cannot drive it High. To drive the line High, you must provide a pull up through a resistor as seen in the above figure. You only need one pull up for SDA and one for SCL irrespective of how many devices are connected to the bus.

Data Transfer Protocol over I2C

When I2C master wishes to communicate with slave devices, it stars by generating a "Start Condition" on the SDA line. "Start Condition" is defined as SDA line going low while SCL is high. Similarly when Master devices wishes to end the transfer, it generates a "Stop Condition" on the line. Stop Condition is defined as SDA going High when SCL is High.


The receiving device ACKnowledges the transfer after every 8 bits (MSB first), by driving SDA Low for Positive ACK and driving SDA High. This means that there are 9 clock cycles per 8-bits of data. 8-bit data and 1-bit for ACK. If the receiver is not ready to receive any more data, it should keep SDA high for 9th bit so the transmitter aborts the transfer.



Data can change while the SCL is low, but it should not change with SCL is high.

Device Addressing

Device Addressing is another section of I2C that confuses new comers. Addresses on I2C bus are 7-bit, but as explained before, the transfers are all 8-bit + 1-bit for ACK, then where did this 7-bit address come from ? Here is how.




In the images above, it is a little bit more clear as in how the addressing is done in I2C. 7-Bit slave address (128 slave devices addressable ) , 8th bit for is it going to be a Read (1) or a Write (0) command, and 9th bit for ACK from the receiver. Always remember, Even address (8th bit zero)  for WRITE and Odd address (8th bit one) for READ.

Example 1
Here is an example where Master device is writing to a Slave. It starts by addressing a Slave device by its 7-bit Address and putting 8th-bit Low indicating a Write Command.



The "Green" bounded parts are Bits transfered by Master, and everything else is transfered by Slave.

Example 2
Master wants to read from Slave



But it is rarely this simple. Devices have multiple internal registers to which you want to write to or read from, so how do you do that ?

Writing to an internal register of an I2C slave

  1. Start Condition (Put automatically if Hardware I2C is used)

  2. Send I2C address of the slave with R/W bit low (even address) for write.
  3. Send the address of the internal register
  4. Send data byte
  5. Send more data bytes if needed
  6. Send Stop Condition (Automatic if Hardware I2C is being used) 

Reading from an Internal Register of an I2C Slave device

Reading from an I2C slave device having internal registers is a wee bit tricky but not tricky enough to get you boggled up. Read from the slave device starts with a write operation in which we write the internal register address to the slave device which we want to read from.


  1. Start condition
  2. Send I2C address of the slave with R/W bit Low (even Address) for write.
  3. Send the address of the internal register
  4. Send "Start Condition" again, referred to as (Restart) in this scenario
  5. Send the I2C address of the slave device with R/W bit High (Odd address) for read operation.
  6. Read data byte
  7. Read more data byes if needed
  8. Send a stop condition.

I hope this helped :) leave your questions in comments.

Monday, November 12, 2012

How to install Google Analytics in Wordpress


How to Install Google Analytics in WordPress ?

This was my question a few minutes ago, and here is the most simple answer :)
Assuming you have Google Analytics set up. If you haven't then start by signing up for Google Analytics account http://www.google.com/analytics/ , its free and simple.

1 - Copy the code that you received in from Google Analytics, and paste it in your theme’s header.php right above the < / head > tag . [Preferred way] 
OR
2 - Copy the code that you received in from Google Analytics, and paste it in your theme’s footer.php right above the < / body > tag 
Theme's header.php and footer.php can be found by going into your Wordpress dashboard > Appearance > Editor
Now on your right you will see a sidebar listing all your pages. Locate the header.php or footer.php whichever you want.


If its still not working, leave your questions in the comments :)

Enlightenment

Enlightenment

Enlightenment


The image is not at all out of context here ... I happened to meet a relative by a relation I never knew of before that day, and I learned so much from him. He gave me insight into how things work around us... how we are surrounded by conspiracies ... hidden meanings behind all the stuff that we ignore just like that.

It was such a knowledgeable meet that I thought I'd share the enlightenment with others too... *sharing is caring* and after all its not your fault that his highness isn't your relative .

*Spice* has been added ofcourse 

Enlightenment clauses:
  1. Aj kal telecom engineers tou kaddu ki tara pare hain market mein, na koi hath lagata hai na koi poochta hai... bas paray paray sar jatay hain aur phir export ho jate hain.
  2. Mein ne apne bare baitay ko *Multi National * company mein naukri karwani hai, jaise yeh jo Telenor wagera . 
  3. Aj kal internet per paise kamana bohat sokha (easy) ho gaya hai ... pehlay zamanay mein tou mehnat ki kamai hoti thi.
  4. Cheeny salay (Chinese Rascals) bas sasta kaam hi kartay hain hamesha.
  5. Jiss ishtehaar (advertisement) mein bachi na nachay us ishtehaar se kuch nahin bikta.
  6. Tarang ka ishtehaar tou *my favorite* hai.
  7. Shadi 27 saal (27 years) k bad hi karni chahie mard ko.
More enlightenment when he came to know I am a Telecom Graduate , working as a firmware developer in a Private firm.

  1. Dekho na apna haal, Telecom degree ki , kia faida hua ? ab kisi *fum-wea* name ki private company mein kam kar rahay ho. Chinese name lag ra hai *fum-wea*.
  2. Yeh Honda , shonda sab bakwas hai ... mein ne Raavi khareedi hai CD70 , aise bhagti hai jaise khoti k dum per aag ho.
  3. KFC tou best hai.

Noticing I was holding an Android phone 

  1. Goray bhi kia bala (Monster) hain, salay humain in shashkon mein phansa ker khud dunya hila chori hai inhon ne.
  2. Yeh sab Muslims k khilaf sazish ka aik hissa hai mere dost. Yeh camera wala mobile Americans chahain tou kabhi bhi tumharay mobile camera ko istemal kar k dekh sakte hain k tum kahan ho.
  3. Waise yeh tumharay phone (Android) aur iPhone mein farak kia hai ? hai tou iPhone bhi touchscreen... tou wohi le lete.
Last but not least,

  1. Ap ka facebook id kia hai ?
Feel free to translate any of these clauses to your native language... 

Tuesday, November 6, 2012

Income Tax 2012-2013 Slab rates for Pakistan


So I needed these slab rates today to calculate my share of contribution (Income Tax) to our beloved Mr President's doggie bank. I thought it may be useful for others too.
Here are Income Tax rates (Slab rates) for Pakistan for the year 2012 - 2013. All you need now is a calculator.
Tax slabs of salary income has been reduced from 17 to 6 in the finance act 2012-13 which are as under:
  1. Salary Income less than 400000 tax will be 0%
  2. Salary Income exceeds 400000 but does not exceed 750000  tax will be 5% of amount exceeding 400000
  3. Salary Income exceeds 750000 but does not exceed 1500000 tax will be 17500 + 10 % of amount exceeding 750000
  4. Salary Income exceeds 1500000 but does not exceed 2000000  tax will be 95000+ 15% of  amount exceeding 1500000
  5. Salary Income exceeds 2000000 but does not exceed 2500000 tax will be 175000 + 17.5% of amount exceeding 2000000
  6. Salary Income exceeds 2500000 tax will be 420000 + 20% of amount exceeding 2500000.

Good luck to anyone in " 10% "  :)  *pwn intended*

Sunday, February 12, 2012

Photo a day


Photo a day is a new picture organization app by our very own Pakistani group "Smasherzz". The main purpose of the app is literally as its named, i-e a photo a day. Which in my view is also a negative point for the app. But we will get to the details in a moment, first lets have a get go at the app and its features.

Purpose
Photo A Day tries to make it easier for the android user to keep its "a memory a day" picture organized by dates. Its like the movie "Memento" . If he had this app, his life would have been a lot easier :). But unfortunately that's about it. The app does just that.
Though its a great effort but there is much to be longed for in the app.

My experience
I spent around 15 minutes on using and exploring the app for features, but as described above, its literally just "photo a day" app. Nothing more, nothing less. I have seen better apps for the purpose on the market which in my view also lack a couple of essential features which I'll be listing below.

Wishlist
If this app is to be popular or gain number in downloads, the developers will have to put focus on the following areas.

1- UI

The UI is a major turn off and definitely needs work and attention. Here is a screenshot of what the app actually looks like under the icon.


If this app is to make money, UI is the first thing that needs changing.

2- No flick ?

It was a surprise for me when the calendar month didn't change on swipe / flick of the thumb.

3- FC oh my!

If you click on the previous month's date appearing in current month, like in the screen shot above. The app will FC. (Force Close)

4- No ownership of files

I would never like an app to try and take over my base.. "All my base are not belong to you" as the wise Panda once said. It is recommended that the developers use a separate folder to save thumbs of the images assigned.

5- No Timeline ?

In an app that says "photo a day" should have a scroll-able timeline feature to be able to browse through the dates and images.

6- A photo a day ? literally ?

I would like my photos arranged by date, yes Sir. by Month, Yes Sir, but do I have one photo every day ? No Sir. This should be a more of a assign "photos" to a specific date instead of "A photo A day"

7- Sharing is caring

There should be a "share" button which allows sharing images via facebook, Gmail or say MMS ?

8- No cloud sync

If I were to keep this app for a memory of my say , son growing up or my valentine ;) I'd definitely want it to keep my memories safer than an SD card crash away. How about Picasa for sync ? its Google product. Or say your own cloud storage ?

Links :
Facebook
Android Market
QR Code


Saturday, February 11, 2012

Traffic Pakistan


Traffic Pakistan is a newly launched first of its kind traffic reporting service for Pakistan. Currently launched in three major cities:
  • Islamabad
  • Karachi
  • Lahore
Though simple yet a very useful and creative idea brought to life. In Pakistan, you are bound to get stuck in traffic blocks when you leave for someplace. But this innovative service can help you save your time. As it provides latest updates regarding different roads / places in the respective city.

Its a purely user contribution based service, relying entirely on the input by users. More the people start using and contributing it, more useful the service will get because it fetches updates based on users input. 

Amazingly, people of Islamabad have come up with a very unique way of utilizing this service, and that is Updates on CNG pumps in Islamabad.
For example:
  • F7 caltex is serving two lines at a time. Can be time saving
  • long bloody line for cng at pso f8 and caltex f8. Oh my!!
Given the chance, this can be a very useful community.

Using Traffic Pakistan

Getting Updated
Getting updates from Traffic Pakistan is as simple as 
  • Opening the website www.trafficpakistan.com and following your respective city. Search for your point of interest and you are done.
  • Getting updates via SMS is very intuitive and easy to remember, you just send an SMS to +92-312-5554065 containing this text: "traffic islamabad" for last 5 updates related to Islamabad. Or "traffic islamabad islamabad highway" for last 5 updates related to "Islamabad Highway" in Islamabad.

Similarly for other cities, your SMS should be "traffic CityName PointOfInterest" for specific updates about a point of interest or "traffic CityName" for city updates.

Contributing/Updating Traffic Status
Traffic Pakistan does not require any kind of registration to be a contributor, it is open for all. You can be a part of community in two ways,
  • Twitter: When posting updates meant for Traffic Pakistan, use the following "hashtags" in your tweet.And Traffic Pakistan will automatically get updated.
  • #lhrtraffic for Lahore
  • #isbtraffic for Islamabad
  • #khitraffic for Karachi 
  • SMS: If you don't use Twitter, you can still be a part of this fast growing community. You can SMS at +92-312-5554065 starting with the following keywords:
  • lhrtraffic for Lahore
  • isbtraffic for Islamabad
  • khitraffic for Karachi
for example : SMS "isbtraffic faizabad is blocked by protestors" will update Islamabad Channel with the post, its that simple.

On successful post, you will receive an acknowledgement from Traffic Pakistan indicating that your post was successful .

For help, simply SMS "help traffic" on +92-312-5554065 .  Don't forget to save this number/

We at Wired Soup think that given the restrictions and support by the Government in Pakistan, its a very useful service for the community, but its success depends on the usage by the community. Next time you plan to go out shopping, make sure you have checked www.trafficpakistan.com