Thursday, October 31, 2013

Matlab Reshape Matrix

Recently I faced a problem with reshaping a matrix. Here is how I solved it.

Input: x = n*1 matrix
Output: y = a*b matrix where a*b = n


x =  3
       6 ]

      [ 1  2
y =  3  4
       5  6]


y = reshape(x, 2, 3)
y = transpose(y)

Tuesday, February 5, 2013

Make a Micro SIM from a Regular SIM

Recently I needed a micro SIM card for using in a Nexus 4 phone. Since AT&T wanted me to get a data plan for getting a micro SIM (which is ridiculous!), I made the micro SIM from the regular SIM card I have. Here is how to do it.

  • Download and print the following image. Use original image size while printing.

  • Use a ruler and ruler to extend the lines of micro SIM
  • Place the SIM card on the paper so that it fits in the border of Mini SIM in the image.
  • Use pencil and ruler to draw lines over the SIM card using the extended lines of micro SIM as reference.
  • Use a sharp scissor to cut the SIM.
  • Don't worry if does fit in the phone after the first try. Just trim it as necessary.
  • Make sure that the golden part is not cut in any way.

Saturday, January 19, 2013

Samsung Nexus S: Flush Jelly Bean Factory Image

I have been waiting for OTA for several months with no luck. So finally decided to flush my Samsung Nexus S with Jelly Bean 4.1.2 factory image. Here is how I did it. 
  1. (PC) Download Nexus Root Toolkit from here (don't worry. I did not root my phone, just unlocked it for flushing!). 
  2. (PC) Install the software. When prompted, choose your device. In my case, it was Samsung Nexus S, 850MHz, i9020a. Allow the software to download necessary files for your phone.
  3. (PC) Connect your phone to the PC with a USB cable. Run the 'Nexus Root Toolkit' software and click on 'Unlock'. Follow the on screen instructions to unlock your phone.
  4. (PC) Download Nexus S factory image from here
  5. (PC) Unzip the downloaded image in the installation directory of Nexus Root Toolkit. In my case the path was C:\Program Files\WugFresh Development\data
  6. (Phone) Turn off your device 
  7. (Phone) Go to Bootloader (press&hold volume up button then press&hold power button) 
  8. (PC) Go to the folder where you unzipped the factory image. Make sure that the folder contains adb.exe and fastboot.exe.
  9. (PC) Double click on flash-all.bat file. This will flush the factory image in the phone.
  10. (PC) When done, click on 'OEM Lock in the Nexus Root Toolkit to lock bootloader again.
Enjoy your Jelly Bean:)