Admins eHow

March 29, 2014

How to return your Google Play Edition HTC One to stock Sense

Filed under: Android — Tags: , , , , , , , , — admin @ 10:41 am

I have a HTC One (m7u) which originally came with HTC Sense OS, As I am a fan of stock android, I had it converted to a Google Play Edition HTC One when it was released.
Recently I noticed a purple tint in low light pictures taken by my HTC One, I did some research and I found out it is a hardware issue and camera should be replaced by HTC. I still had warranty but as I had done extensive modifications to my phone, it was possible that HTC refuses to repair it under warranty. so I decided to revert it back to stock sense and it took me around 12 hours to figure out how to do this properly. so I am writing this guide to help others who may have the same issues.
HTC One is one of the most complex devices I’ve ever worked with when you want to tweak it. It comes with a locked boot-loader which you need to unlock with a cryptographic key obtained from HTC. other than that , it has a security lock which you can turn on or off (known by s-on & s-off). I will not go into great details of these features as there are a lot of resources about them on Internet.
Lets get to reverting back your HTC One to stock ROM. My assumption is that you have a phone with unlocked bootloader and s-off and a non-stock ROM on it (Google Play Edition in my case).
Before we get to flashing things into your phone, you should check your current phone mid (model id) and cid (custom id). there is a chance that the custom ROM which you have flashed into your phone has changed your phone mid and cid and stock ROM will not install on your phone unless you revert them back into original values.
In order to check your phone mid and cid, reboot your phone into boot-loader mode by adb with following command (I assume you know how to work with adb and fastboot, if you dont just google for it and learn it) :

adb reboot bootloader

after phone is in bootloader mode, issue the following command :

fastboot getvar all

here is the output for me :

(bootloader) version: 0.5
(bootloader) version-bootloader: 1.54.0000
(bootloader) version-baseband: 4T.21.3218.21
(bootloader) version-cpld: None
(bootloader) version-microp: None
(bootloader) version-main: 3.62.1700.1
(bootloader) version-misc: PVT SHIP S-OFF
(bootloader) serialno: XXXX
(bootloader) imei: XXXX
(bootloader) meid: 00000000000000
(bootloader) product: m7_u
(bootloader) platform: HBOOT-8064
(bootloader) modelid: PN0712000
(bootloader) cidnum: GOOGL001
(bootloader) battery-status: good
(bootloader) battery-voltage: 4338mV
(bootloader) partition-layout: Generic
(bootloader) security: off
(bootloader) build-mode: SHIP
(bootloader) boot-mode: FASTBOOT
(bootloader) commitno-bootloader: dirty-0e82187e
(bootloader) hbootpreupdate: 11
(bootloader) gencheckpt: 0

These are important information :

(bootloader) version-bootloader: 1.54.0000 : bootloader is 1.54 , so it will not work with revone tool to lock the bootloader again. we need bootloader 1.44 to Lock it completely.
(bootloader) product: m7_u : the phone variation is m7u (GSM Only) and not m7ul (GSM & LTE). it is important when you want to choose the stock ROM.
(bootloader) modelid: PN0712000 : PN0712000 is Google Play Edition model which is different from my phone stock. I need to revert it back to original before I can flash the stock ROM.
(bootloader) cidnum: GOOGL001 : GOOGL001 is Google Play Edition custom id which is different from my phone stock. I need to revert it back to original before I can flash the stock ROM.
(bootloader) security: off : my phone is in s-off state. I need to make it s-on.

Now we have to change modelid and cid to original values. you can find your phone modelid on the back of your phone. it starts with PN so it is easy to find and there are only a few possible values based on the region of the phone.
There are 3 ways to change modelid of your phone :
1.Flashing an Engineering bootloader on your phone and changing modelid through fastboot commands (NOT RECOMMENDED)
2.Change modelid through adb, explained here :
3.Change modelid through TWRP/CWM recovery, explained here :

After changing the modelid reboot into bootloader and confirm it has been changed properly.
Fortunately changing cid is much easier and can be done through a single command in boot-loader mode (change YOURCID to your stock cid value) :

fastboot oem writecid YOURCID

Note : CID is also dependent on the region and your phone carrier, if you dont know your stock cid, your best bet is to search on forums like xda-developers where many users around the world have shared their modelid and cid and carrier names.
After changing the cid reboot into bootloader and confirm it has been changed properly.
Now that we have proper mid and cid, we can relock bootloader and flash stock ROM. in order to relock bootloader issue the following command while you are in bootloader mode :

fastboot oem lock

Note : Please note your boot-loader has changed into RELOCKED state which shows you had voided your warranty ! we will fix it later using revone tool.
You can find the proper ROM for your htc one on this website :
the ruu zip is pretty large and is approximately 1GB. download the ruu zip for your device and place it inside your adb folder and rename it to
reboot into HTC RUU mode (Rom Update Utility) while you are in boot-loader mode :

fastboot oem rebootRUU

You can recognize the RUU mode by a black screen and a silver htc logo in center.
After you are in RUU mode issue the following command TWICE :

fastboot flash zip

It is important to issue the command twice because first time it updates the bootloader and reboots into RUU mode again ready for ROM to be flashed.
If you have done every step correctly , your stock ROM should be flashed into your device now and you can see the progress on screen.
When flashing is over and you get a success message , it is time to reboot the device :

fastboot reboot

Your phone should boot into stock ROM now. it may take a while as this is like the first boot of the phone. but there is still two steps to be done :
1. Locking bootloader (it is in Relocked state now)
2. Turning Security ON (S-ON)
In order to Lock the bootloader like original we will use a tool called revone.
Please read this guide on how to use revone to Lock your bootloader :
Note 1 : Revone will not work on hboot 1.54 or above, if by any chance you have boot-loader 1.54 or higher, you need to downgrade your hboot to version 1.44.
Note 2 : You may need to run revone more than once to work. for me personally it took two tries to get a success message.
After you got a success massage from revone , reboot back into bootloader and make sure your bootloader is in Locked state.
The last step is to turn the security on, it is very easy, just run the following command in bootloader :

fastboot oem writesecureflag 3

Now your device is 100% back to stock and you can return it for warranty :) just reboot the phone and install all the official OTA updates.

November 6, 2013

Installing rtorrent+rutorrent on Debian 7 Wheezy

Filed under: General — admin @ 4:00 am

Here is a simple guide on how to install rtorrent/rutorrent on Debian 7 Wheezy , It may also work on Ubuntu and other Debian based Linux distros.

Install prerequisite packages :

apt-get install gcc pkg-config libssl-dev g++ make libncurses5-dev libsigc++-2.0-dev libcurl4-openssl-dev subversion screen nano

Install XMLRPC-C , it is required for rutorrent communication with rtorrent :

svn co xmlrpc-c
cd xmlrpc-c
make install

Install LibTorrent required by rtorrent :

tar zxvf libtorrent-0.13.3.tar.gz
cd libtorrent-0.13.3
make install

Install rtorrent client :

tar zxvf rtorrent-0.9.3.tar.gz
cd rtorrent-0.9.3
./configure --with-xmlrpc-c
make install

Now, we have to make a user for rtorrent and configure it :

useradd user1
mkdir -p /home/user1/rtorrent
mkdir -p /home/user1/rtorrent/.session
mkdir -p /home/user1/rtorrent/download
chown -R user1:user1 /home/user1

Copy rtorrent sample config from rtorrent source directory to user1 home directory :

cp rtorrent-0.9.3/doc/rtorrent.rc /home/user1/.rtorrent.rc

Now you can customize the configuration :

nano /home/user1/.rtorrent.rc

But what you need to customize are following options :

directory = /home/user1/rtorrent/download
session = /home/user1/rtorrent/.session
scgi_port = localhost:5000

It is time to run rtorrent, This command runs rtorrent as user1 :

su - user1 -c 'screen -fa -d -m rtorrent'

Now we can install Apache + php5 which is required by rutorrent :

apt-get install libapache2-mod-php5

Enable auth_digest module which is required for rutorrent authentication :

a2enmod auth_digest

Install rutorrent+pluins :

tar zxvf rutorrent-3.6.tar.gz
mv rutorrent /var/www

tar zxvf plugins-3.6.tar.gz
mv plugins /var/www/rutorrent/

Tip : The only plugin which you need is httprpc. you can disable or delete all the rest.

Configure user1 on rutorrent :

mkdir -p /var/www/rutorrent/conf/users/user1
cp /var/www/rutorrent/conf/config.php /var/www/rutorrent/conf/users/user1
nano /var/www/rutorrent/conf/users/user1/config.php

Make sure $scgi_port in config.php matches scgi_port in rtorrent config file :

$scgi_port = 5000;

For rutorrent web authentication create .htaccess file in rutorrent directory :

nano /var/www/rutorrent/.htaccess

Copy and paste the following inside .htaccess :

AuthName "Restricted Area"
AuthType Basic
AuthUserFile /etc/.htpasswd
AuthGroupFile /dev/null
require valid-user

Create password file for Apache :

htdigest -c /etc/.htpasswd "Restricted Area" user1

Now we need to configure Apache to allow .htaccess override :

nano /etc/apache2/sites-enabled/000-default

Change :

<Directory /var/www/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride None
    Order allow,deny
    allow from all

To :

<Directory /var/www/>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    allow from all

And finally restart apache :

/etc/init.d/apache2 restart

Now you should be able to access your rtorrent/rutorrent on this address : http://IP_SERVER/rutorrent

October 24, 2012

The proper way to benchmark disk write performance in Linux

Filed under: CentOS,Debian,linux — Tags: , , , , — admin @ 7:46 am
dd bs=1M count=512 if=/dev/zero of=test conv=fdatasync

The result is something like this :
512+0 records in
512+0 records out
536870912 bytes (537 MB) copied, 1.43334 s, 375 MB/s

October 14, 2012

How to enable AHCI support for Windows on an iMac, MacBook or etc

Filed under: Apple — Tags: , , , , , , — admin @ 9:18 am

Apple does all the dirty tricks to show the iSheeps that Apple is a superior brand and provides superior performance compared to competition, the last one I found is that it disables AHCI support for Windows on its hardware. By disabling AHCI (which you have already paid for it and Apple hardware has this feature) it forces Windows to use ATA controller disk drivers which is considerably slower than AHCI and has less features. for example you wont have TRIM support on your SSD disk on your Windows.
By doing so, Apple gives you this feeling that Windows is slower than Mac OSX on the same hardware.
Hopefully there is a workaround for this fraud of Apple. You will need to modify the Master Boot Record of your Windows drive.
This workaround only works for Macs with Intel disk controllers. If you have Nvidia chipset, it will not work for you. You may confirm it in device manager of Windows.
First step is to make sure windows tries to load AHCI drivers after AHCI is enabled in boot loader. if you miss this step you will get a BSOD on booting windows and you will need to restore old MBR for windows too boot up.
Open your Windows registry editor and make sure “Start” Value in the following keys are set to 0.


Also we need the modified MBR which you can download from here : patchedcode.bin
Put the patchedcode.bin on a USB stick which we can use later.
OK, We are done in Windows. Now we need to boot using a Linux Live CD or MacOSX Install Disk. both will work.
Put the bootable CD or USB stick into your computer and reboot.
When you hear the boot sound (the white screen appears) hold down the option (alt) key. you should get the option to boot from CD or USB stick.
Boot from CD or USB stick and Open a Terminal Window.
First lets get a backup from current MBR so in case of any problems we can roll back to it.
Also please note I am assuming your windows disk is /dev/disk0. if yours is different you may need to change it.
Put in your USB stick, change directory to it and run the following command :

dd if=/dev/disk0 of=backup.bin bs=512 count=1

it will make a backup from your MBR to backup.bin
now it is time to write the new MBR to disk :

diskutil umountdisk /dev/disk0
dd if=patchedcode.bin of=/dev/disk0 bs=440 count=1

All done ! now reboot into windows :

shutdown -r now

In Windows you should see windows installs the new AHCI drivers. also you may check that by looking into device manager.
Also I recommend you to download and install “Intel Matrix Storage Manager” to update your AHCI drivers to intel’s ones.
If anything goes wrong, you can revert back to old MBR by following commands in Terminal :

diskutil umountdisk /dev/disk0
dd if=backup.bin of=/dev/disk0 bs=440 count=1

October 12, 2012

How to install transmission 2.71 on Debian 6.0 Squeeze

Filed under: General — admin @ 6:41 am

Installing transmission 2.71 on Debian 6 is a little tricky and is not as straight forward as installing by apt-get.
Here is how you can do it.

First you need to manually install libevent 2.0 :

apt-get install make gcc
tar zxvf libevent-2.0.20-stable.tar.gz 
cd libevent-2.0.20-stable
make install

then some prerequisite packages for later installation :

apt-get install libssl-dev pkg-config libcurl4-openssl-dev intltool tar bzip2

now it is time to download and configure transmission :

tar jxvf transmission-2.71.tar.bz2
cd transmission-2.71
./configure --enable-lightweight --enable-daemon

now if you try to compile (make) the package you will get the following error :

tr-utp.c:65: error: conflicting types for ‘UTP_Write’
../third-party/libutp/utp.h:116: note: previous declaration of ‘UTP_Write’ was here
make[1]: *** [tr-utp.o] Error 1
make[1]: Leaving directory `/root/transmission-2.71/libtransmission’
make: *** [all-recursive] Error 1

in order to fix this error open this file in transmission directory :

nano ./third-party/libutp/utypes.h

and comment following lines :

// #ifndef __cplusplus
// typedef uint8 bool;
// #endif

and add following line just after above lines :

#ifndef __cplusplus
#include <stdbool.h>
typedef uint8 bool;

save file and exit. return to transmission root directory and make and install.

make install

September 5, 2012

How to verify mod_deflate, gzip working ?

Filed under: Apache — Tags: , , , — admin @ 12:42 pm

Lets say you have enabled compression in your web server by mod_deflate, gzip and now want to verify if the content is really compressed, here is how to do it :

1.Easy way :
Go to this link :
Enter your website URL inside “Web Page URL” and click on “Check”

2.Technical way :
Make sure curl is installed on your server. then run following command (change to your own domain) :

curl -I -H 'Accept-Encoding: gzip,deflate'

what you should look for in output is this line :

Content-Encoding: gzip

if it is not there, the content is not compressed.
here is the output for AdminseHow :

root@x~# curl -I -H 'Accept-Encoding: gzip,deflate'

HTTP/1.1 406 Not Acceptable
Server: ApacheBooster/1.3
Date: Wed, 05 Sep 2012 12:39:22 GMT
Content-Type: text/html; charset=UTF-8
Content-Length: 8740
Connection: keep-alive
Vary: Accept-Encoding,Cookie,User-Agent
X-Powered-By: W3 Total Cache/
Content-Encoding: gzip
Last-Modified: Wed, 05 Sep 2012 12:39:22 GMT
X-Cacheable: YES
Accept-Ranges: bytes
X-Varnish: 1984902025
Via: 1.1 varnish
age: 0
X-Cache: MISS

The content is compressed. YAY :D
PS : I know the response is “HTTP/1.1 406 Not Acceptable”, it is because of mod_security installed on server which prevents such simple automated requests to be served. but it doesn’t matter for our test.

September 3, 2012

Install SNMP on Debian

Filed under: Debian — Tags: , , , — admin @ 10:15 am

The following easy steps will install snmp daemon on your Debian server :

apt-get install snmpd snmp

now snmpd simple configuration ( change SECRET_NAME to a complex string ) :

echo rocommunity SECRET_NAME > /etc/snmp/snmpd.conf

restart snmpd :

/etc/init.d/snmpd restart

last step to check snmpd is working ( change SECRET_NAME to the string you have chose before ) :

snmpwalk -v 1 -c SECRET_NAME -O e

you should get an output like below :

iso. = STRING: "Linux debian 2.6.32-5-686 #1 SMP Sun May 6 04:01:19 UTC 2012 i686"
iso. = OID: iso.
iso. = Timeticks: (7026) 0:01:10.26
iso. = STRING: "root"
iso. = STRING: "debian"
iso. = STRING: "Unknown"
iso. = Timeticks: (0) 0:00:00.00
iso. = OID: iso.
iso. = OID: iso.
iso. = OID: iso.
iso. = OID: iso.
iso. = OID: iso.
iso. = OID: iso.
iso. = OID: iso.
iso. = OID: iso.
iso. = STRING: "The SNMP Management Architecture MIB."
iso. = STRING: "The MIB for Message Processing and Dispatching."
iso. = STRING: "The management information definitions for the SNMP User-based Security Model."
iso. = STRING: "The MIB module for SNMPv2 entities"
iso. = STRING: "The MIB module for managing TCP implementations"
iso. = STRING: "The MIB module for managing IP and ICMP implementations"
iso. = STRING: "The MIB module for managing UDP implementations"
iso. = STRING: "View-based Access Control Model for SNMP."

July 16, 2012

How to auth Squid by Radius through PAM in Debian

Filed under: Debian — Tags: , , , , , — admin @ 9:20 am

install libpam-radius-auth

apt-get install libpam-radius-auth

open /etc/pam_radius_auth.conf

nano /etc/pam_radius_auth.conf

and add the following lines into it. Your_IP and PORT are the IP address and Port of Radius sever. SecretKey is the Secret of radius server. 3 is the timeout in seconds.

# server[:port] shared_secret      timeout (s)
YOUR_IP:PORT SecretKey 3

Change the permissions :

chown root /etc/pam_radius_auth.conf
chmod +r /etc/pam_radius_auth.conf

create /etc/pam.d/squid :

nano /etc/pam.d/squid

and add the following lines :

auth sufficient
account sufficient

Now install Squid if you have not installed it yet :

apt-get install squid

Lets try and see if Squid PAM works successfully through Radius auth, run the following command and enter username and password with a space between them :

username password

OK means radius server has accepted the authentication details. ERR means there is a problem.
Now configure Squid to use pam_ath, open /etc/squid/squid.conf :

nano /etc/squid/squid.conf

Add the following lines to the begging of the file :

auth_param basic program /usr/lib/squid/pam_auth
auth_param basic children 5
auth_param basic realm REALM
auth_param basic credentialsttl 2 hours

Add following line in acl section :

acl password proxy_auth REQUIRED

Add following line before http_access deny all :

http_access allow password

April 17, 2012

How to create a mirror of a site using wget

Filed under: General,linux — Tags: , , , — admin @ 7:33 am

First you need to make sure you have the latest version of wget, some distros are still being released with older versions of wget which has some bugs regarding mirroring functionality. currently the latest version is 1.13.4, so if you don’t have the latest version, you can download and build it from following link :

after building the wget, make sure the latest version is being used :

wget -V

output :

GNU Wget 1.13.4 built on linux-gnu.

+digest +https +ipv6 -iri +large-file +nls -ntlm +opie +ssl/gnutls 

    /usr/local/etc/wgetrc (system)
Locale: /usr/local/share/locale 
Compile: gcc -DHAVE_CONFIG_H -DSYSTEM_WGETRC="/usr/local/etc/wgetrc" 
    -DLOCALEDIR="/usr/local/share/locale" -I. -I../lib -I../lib -O2 
Link: gcc -O2 -Wall -lgnutls -lgcrypt -lgpg-error -lz -lrt ftp-opie.o 
    gnutls.o ../lib/libgnu.a 

Copyright (C) 2009 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Originally written by Hrvoje Niksic <>.
Please send bug reports and questions to <>.

OK, you are good to go now, just execute the following command and relax :)

wget -mkp -e robots=off http://site

April 11, 2012

My favorite smartphone wallpapers

Filed under: Android,General — Tags: , , , , , — admin @ 6:36 pm

These are my favorite wallpapers on my SGSII, I hope you enjoy them :)

You can download them here : SGSII-Wallpapers

Older Posts »

Powered by WordPress