- Find your LG mobile phone's Model and Serial Number. e.g. My phone model is P690F and its S/N is 123ABCD123456(it is labeled under battery).
- Type the following address in your web browser's url field:
http://csmg.lgmobile.com:9002/svc/popup/model_check.jsp?model=[model]&esn=[serial_number]
replace the [model] and [serial_number] with your LG phone's model and serial number. - Type return to load the page. It should returns a string. You need to view the page source:
- On Firefox: Tools -> Web Developer -> Page Source (Ctrl+U or Command+U)
- On Safari: Right click blank area in the page, select View Source in the context menu
- On IE: View -> Source
- Find the number inside <ESN></ESN> tag
- Type the following address in your web browser's url field:
http://csmg.lgmobile.com:9002/csmg/b2c/client/auth_model_check2.jsp?esn=[esn_number]
substitute the [esn_number] with the ESN number we get from last step. - Load the page (it is a blank page in web browser), you need to view page source, you can then see the ROM update url inside <sw_url></sw_url> tag.
Search This Blog
How to download official ROM updates for your LG mobile phone
Mac OS X: share your internet connection wirelessly
There is no WIFI available in my office. The internet connection of my Mac is via Ethernet. I want to share my internet connection to my android phone so that it can download apps. The following instructions shows how I share the (Ethernet) internet connection of my Mac to my mobile phone via wireless/WIFI.
-
Open System Preferences and select Sharing
- Select Internet Sharing, set "Share your connection from Ethernet", "To computers using Wi-Fi", then click Wi-Fi Options... button
- In the Wi-Fi options window, set the Network Name, Security and Password, then click OK button:
- Tick Internet Sharing, in the confirm window click Start button:
- Now the WiFi hotspot is running, you should see the green light and Internet Sharing: On
Trouble shooting
- The client computer/mobile phone will fail to connect to the WIFI network (fail to request IP address from the network) if the your Mac has Firewall turned on and it is configured to blocking all incoming connections (It will of course block the DHCP requests from the WIFI clients). To Resolve it, you need to untick the Block all incoming connections option:
- Open System Preferences then Security & Privacy,
- click Firewall Options... button:
- Untick Block all incoming connections
- Open System Preferences then Security & Privacy,
Android: Save your apk files from Google Play Store
- Method 1: Use SaveAPK + OI File Manager
- Install OI File Explorer from Google Play Store
- Install SaveAPK from Google Play Store
- Run SaveAPK and select the application(apk) you want to save, then select the directory to store the apk (on SD card)
- Method 2: Use Astro File Manager
- Install Astro File Manager from Google Play Store
- Start Astro File Manager then select Application Backup, backup the applications and the apk files will be store in backups/ directory on SD card.
Android: WIFI Proxy without root
On some Android 2.3.X phones(e.g. my Acer Liquid Metal S120, WIFI proxy settings are missed in WIFI settings. The work around are below:
- Use Opera Browser
- Install from Google Play, or if you dont have internet connection you can download the apk from http://ftp.opera.com/pub/opera/android/mobile/1200/ on another computer, transfer to your phone and installed it
- Open the Opera browser app, in the URL field, type opera:config, at this time the Preferences Editor should have opened in your screen.
- Scroll down to proxy menu, in the HTTP Server and HTTPS Server, enter your proxy setting with the following format <Proxy IP>:<Port>. E.g. 192.168.1.1:3128
- Install "HTTP proxy settings" app in Google play. (It may not work on some phones.)
Use google code prettify in blogger
- Login to blogger, "Template" -> "Edit HTML" -> "Proceed"
- Copy the following code, and paste them right before </head> in the template html:
<link href="http://google-code-prettify.googlecode.com/svn/trunk/src/prettify.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" language="javascript" src="http://google-code-prettify.googlecode.com/svn/trunk/src/prettify.js"></script> <script type="text/javascript" language="javascript" src="http://google-code-prettify.googlecode.com/svn/trunk/src/lang-css.js"></script>
- Replace <body> with <body onload="prettyPrint()">
- Now you can format your code use prettify, for example:
<code class="prettyprint lang-js"> <!-- your code here--> </code>
or
<pre class="prettyprint lang-js"> <!-- your code here--> </pre>
SEE ALSO:
Upgrade Ubuntu 10.04 server to 12.04 LTS
According to Ubuntu 12.04 release notes, "It is generally recommended that users of Ubuntu 10.04 LTS wait until the first point release, due in July, before upgrading."
If you do want to wait until the 12.04.1 is released in July 2012, follow the following steps:
If you do want to wait until the 12.04.1 is released in July 2012, follow the following steps:
- Ensure you're up to date with latest updates for Ubuntu 10.04:
sudo apt-get update sudo apt-get upgrade
- Install update-manager-core if it is not already installed:
sudo apt-get install update-manager-core
- Edit /etc/update-manager/release-upgrades and set Prompt=lts:
[DEFAULT] Prompt=lts
- Launch the upgrade tool, and follow the on-screen instructions:
sudo do-release-upgrade -d
NOTE:
At the end of the upgrade process you will be required to restart the server in order to boot into the new kernel. If you do not have access to the console of the system you are upgrading, you may need to edit /boot/grub/menu.lst and change the default boot kernel to the newly installed 12.04 kernel. If this step is not performed your server may attempt to boot into the 10.04 LTS kernel and will hang.Ubuntu 12.04 (Gnome 3): enable system proxy in terminal
- To enable the proxy:
gsettings set org.gnome.system.proxy.socks host 'proxy.yourcompany.com' gsettings set org.gnome.system.proxy.socks port 3128 gsettings set org.gnome.system.proxy mode 'manual'
- To disable the proxy:
gsettings set org.gnome.system.proxy mode 'none'
See also
Linux: Extract archive files in various formats
File Extension | Required Utility | Command to extract | Command to install the required utility |
---|---|---|---|
.tar | tar | tar -xvf file.tar | sudo apt-get install tar |
.tar.gz .tgz | tar gunzip | tar -zxvf file.tar.gz tar -zxvf file.tgz | sudo apt-get install tar gzip |
.tar.bz2 .tbz2 | tar bunzip2 | tar -jxvf file.tar.bz2 tar -jxvf file.tbz2 | sudo apt-get install tar bzip2 |
.tar.xz | tar unxz | tar -Jxvf file.tar.xz | sudo apt-get install tar xz-utils |
.rar | unrar | unrar -x file.rar | sudo apt-get install unrar |
.zip | unzip | unzip file.zip | sudo apt-get install unzip |
.gz | gunzip | gunzip file.gz | sudo apt-get install gzip |
.bz2 | bunzip2 | bunzip2 file.bz2 | sudo apt-get install bzip2 |
.Z | uncompress | uncompress file.Z | sudo apt-get install gzip |
.7z | 7z | 7z -x file.7z | sudo apt-get install p7zip |
Add digg button into blogger post
- Login to blogger dashboard
- Select "Template" then click "Edit HTML"
- Click "Proceed"
- Tick "Expand Widget Templates"
- Search for "<data:post.body/>", replace it with the following code:
<p> <!-- DIGG --> <div style='float:right; margin-left:10px;'> <script type='text/javascript'> digg_url = '<data:post.url/>'; </script> <script src='http://digg.com/tools/diggthis.js' type='text/javascript'/> </div> <data:post.body/> </p>
SEE ALSO:
add ADSENSE to blogger post by modifying the template
- Login to your adsense account, create the AD unit and copy the code
- Convert the code into safe HTML code (paste the code below and click convert):
- Login to blogger, select the blog you want to edit, select "Template", then click the "Edit HTML" button:
- Click "Proceed":
- Tick "Expand Widget Templates":
- Ctrl + F (or Command + F on Mac OS X) to search for
<data:post.body/>
- Right above that line, paste below code:
<b:if cond="data:blog.pageType == "item""> <div style='float: left; padding: 0px 8px 8px 0px;'> CONVERTED ADSENSE CODE FROM STEP 2 </div> </b:if> <data:post.body/>
- Save the template.
SEE ALSO:
Javascript: convert HTML special characters
HTML special characters
- & (ampersand) becomes &
- " (double quote) becomes " when ENT_NOQUOTES is not set.
- ' (single quote) becomes '' only when ENT_QUOTES is set.
- < (less than) becomes <
- > (greater than) becomes >
- # (hash) becomes #
Javascript function to convert HTML special characters
function converHtml(s) {
var e = document.createElement("div");
e.innerText = e.textContent = s;
return e.innerHTML.replace(/"/g, """).replace(/#/,'#').replace(/'/,''');
}
See also
Shell script: for loop through file names with spaces
- Use find:
find . -print0 | while read -d $'\0' f do cat "$f" done
- Use IFS:
#!/bin/bash IFS_BAKCUP=$IFS IFS=$(echo -en "\n\b") # $1 is the directory contains the files for f in $(ls $1) do echo "$f" done IFS=$IFS_BACKUP
- Use Array:
See also
Extract .xz file on Ubuntu Linux
- Install xz-utils:
sudo apt-get install xz-utils
- Extract .xz file:
unxz file.xz
- Extract .tar.xz file:
tar -Jxvf file.tar.xz
See also
Compile and install wget on Mac OS X
- Make sure you have Xcode installed
- Download the wget source code: http://ftp.gnu.org/pub/gnu/wget/wget-1.12.tar.gz
- Compile and install:
tar xzvf wget-1.12.tar.gz cd wget-1.12 ./configure make sudo make install
Note:
I tried only version wget-1.12. The later version of the source code may not be so easy to compile.git: share repository with a group
- When init the repository, you can:
git init --shared=group
- On an existing repository, you can:
git config core.sharedRepository group
See also
Telstra LG Optimus Spirit P690F V10F Chinese ROM
- Official Web Page
- Purchase unlock code from ebay
- How to flash V10F_00.kdz ROM(China Chinese/English)
- You need a Windows PC (Windows XP sp3 or Windows 7 32/64 bit)
- Download the V10F_00.kdz ROM(China Chinese/English)
- Download and install Windows USB driver
- Download and install Software Update utility
- Download and extract KDZ_FW_UPD_EN.7z
- Configure your phone: Settings -> Applications -> Development, Tick USB Debugging
- Connect your phone to the Windows PC using USB cable and wait until all the drivers are installed automatically
- Connect the phone but DO NOT turn on USB storage
- Run KDZ_FW_UPD.exe as Administrator
- Set Type: 3GQCT Phone Mode: DIAG
- Select the V10F_00.kdz file
- Press Lauch Software Update to start and wait (for 6~10 minutes) until you see --FINISHED-- line. (In the meantime, your phone gets into Emergency mode.)
- The phone should reboot itself. For me, it failed to reboot, it hangs in the LG splash logo then reboots again infinitely. To fix it, turn off the phone and then press and hold the Power + Volume Down + Home buttons. Wait till you see the droid with the progress bar under it then release the buttons.
LG P690 Official ROM updates (.kdz)
- How to download official stock ROM for LG phone
- Indian LG P690 V10E ROM
- Australian Telstra LG P690F V10C ROM
- LG P690 (China) Chinese V10F ROM
See also
Java: Map allows multiple values
public class Key {
}
public class Value {
}
public class MapExample {
private Map<Key, List<Value>> _map;
public MapExample {
_map = new HashMap<Key, List<Value>>();
}
public void addValue(Key key, Value value) {
List<Value> vs = _map.get(key);
if(vs==null){
vs = new ArrayList<Value>();
vs.add(value);
_map.put(key,vs);
return;
}
vs.add(value);
}
public List<Value> getValues(Key key) {
return _map.get(key);
}
}
Java: How to count the number of ocurrences of an element in a Collection
Java 6 Collections has a static method: frequency(Collection<?> c, Object o):
int numOccurs = Collections.frequency(list, elem);
git statistics
- Command 1:
git log --pretty=format:%ae | gawk -- '{ ++c[$0]; } END { for(cc in c) printf "%5d %s\n",c[cc],cc; }'
- Command 2:
git log --pretty=format:%an | awk '{ ++c[$0]; } END { for(cc in c) printf "%5d %s\n",c[cc],cc; }' | sort -r
- Command 3:
git shortlog -sne
- gitstats is script to generate full statistical html pages with charts. You can install it on Ubuntu Linux using the following command:
To generate stats for a git repository:sudo apt-get install gitstats
gitstats /path/to/repo.git /dst/
Create self-extractable archive installer on Linux/Unix
The solution is simple to explain: The self-extractable file are joint from an extractor shell script and an tar archive, which contains the actual contents to be extracted and installed into the system. The extractor script is a text file while the archive file is binary. They are joint together using cat to make the self-extractable archive. Thus, the self-extractable archive file should have the following parts:
- Script part: The extractor shell script, extract.sh:
#!/bin/bash # # the extractor script # # create a temporary directory TMP_DIR=$(mktemp -d InstXXXXXX) # extract the archive ARCHIVE=`awk '/^__ARCHIVE_BEGIN__/ {print NR + 1; exit 0; }' $0` tail -n+$ARCHIVE $0 | tar xzvf -C $TMP_DIR ## Alternatively you can use sed #sed -e '1,/^__ARCHIVE_BEGIN__$/d' "$0" | tar xzvf -C $TMP_DIR CUR_DIR=$(pwd) # execute install.sh cd $TMP_DIR; $TMP_DIR/install.sh cd $CUR_DIR rm -rf $TMP_DIR exit 0 __ARCHIVE_BEGIN__
- Archive Part: The tar.gz archive contains the contents to install. Inside the archive, there should be an installer script, which is executed when extractor script has extracted the archive into a temporary directory. Therefore, the archive should contains below:
- the installer script: install.sh:
#!/bin/bash # # The installer script (example only, you should modify to adapt your needs.) # CUR_DIR=$(pwd) SRC_DIR=$(cd $(dirname $0);pwd) DST_DIR=/usr/local/example sudo mkdir -p $DST_DIR cp -pr ./* $DST_DIR/
- the actual content files
- the installer script: install.sh:
- To start, we need to prepare thhe directory structure like below:
The archive directory is the directory contains the install.sh and the actual content files to install. The extract.sh file is extractor script../archive ./archive/bin ./archive/doc ./archive/install.sh ./archive/lib ./build.sh ./extract.sh
- The build.sh script:
#!/bin/bash # # The builder script # cd archive tar pczvf ../arc.tar.gz ./* cd .. cat extract.sh arc.tar.gz > install.bin rm arc.tar.gz chmod +x install.bin
- The final self-extractable installer: install.bin
See Also
- http://stackoverflow.com/questions/955460/how-do-linux-binary-installers-bin-sh-work
- Bash Self-Extracting Script
Eclipse: org.apache.batik.dom.svg is missing
When installing eUML2, it complains about:
requires 'bundle org.apache.batik.dom.svg 1.6.0' but it could not be found
To solve the problem, you need to install GMF plugins.
ls: list only directories
- Method 1:
ls -d */
- Method 2:
ls -l | grep '^d'
- Method 3:
find . -type d -maxdepth 1 -mindepth 1
Detect OS in Java
public class Test {
public static void main(String[] args) {
System.out.println(System.getProperty("os.name"));
}
}
Access private field via reflection in Java
public class A {
private int i = 5;
}
public class B {
public static void main(String[] args) {
A a = new A();
Field iField = a.getClass().getDeclaredField("i");
iField.setAccessible(true);
return iField.getInt(a);
}
}
Suspend/Resume a process by sending SIGSTOP/SIGCONT signals
- To suspend the process:
kill -SIGSTOP 123
- To resume the process:
kill -SIGCONT 123
Note:
On some systems, you may need to use following commands:
- To suspend the process:
kill -STOP 123
- To resume the process:
kill -CONT 123
- To list the available signals:
kill -l
Linux/Unix process state codes
PROCESS STATE CODES
Here are the different values that the s, stat and state output specifiers
(header "STAT" or "S") will display to describe the state of a process.
D Uninterruptible sleep (usually IO)
R Running or runnable (on run queue)
S Interruptible sleep (waiting for an event to complete)
T Stopped, either by a job control signal or because it is being traced.
W paging (not valid since the 2.6.xx kernel)
X dead (should never be seen)
Z Defunct ("zombie") process, terminated but not reaped by its parent.
For BSD formats and when the stat keyword is used, additional characters may
be displayed:
< high-priority (not nice to other users)
N low-priority (nice to other users)
L has pages locked into memory (for real-time and custom IO)
s is a session leader
l is multi-threaded (using CLONE_THREAD, like NPTL pthreads do)
+ is in the foreground process group
git shortlog on bare repository
git shortlog command on a bare repository hangs. You have to specify --bare option:
git --bare shortlog
tar preserve permissions
- Create archive preserving permissions:
tar pczvf arc.tar.gz arc/
- Extract archive preserving permission:
tar pxzvf arc.tar.gz
Eclipse Egit: push git tags
- Right click the project root, Select Team -> Remote -> Push...
- Click Next> button
- Click Add All Tags Spec button, then click Finish button
See also
Ubuntu: script works in terminal fails in cron
Solution:
- initialize the environment variables by sourcing /etc/bash.bashrc before executing your script.
0 0 * * * source /etc/bash.bashrc; /path/to/yourscript.sh
Subscribe to:
Posts (Atom)