Saturday, November 29, 2014
Sunday, October 6, 2013
How do I troubleshoot boot problems when stuck at the Ubuntu splash screen?
http://askubuntu.com/questions/306543/how-do-i-troubleshoot-boot-problems-when-stuck-at-the-ubuntu-splash-screen
Besides the below, if the GUI does not start automatically, run "sudo apt-get install ubuntu-desktop" and then "sudo reboot".
Some keys to remember.
Alt + left arrow turns the boot splash into terminal login prompt during the boot.
Ctrl + Alt + F1 switches back to the command prompt from GUI.
Besides the below, if the GUI does not start automatically, run "sudo apt-get install ubuntu-desktop" and then "sudo reboot".
Some keys to remember.
Alt + left arrow turns the boot splash into terminal login prompt during the boot.
Ctrl + Alt + F1 switches back to the command prompt from GUI.
How do I troubleshoot boot problems when stuck at the Ubuntu splash screen?
I was tweaking some settings on my Ubuntu 12.04 install. Specifically I was altering the default color scheme of the terminal, following these instructions
Now whenever I boot Ubuntu, I get stuck in the purple screen that says "Ubuntu" with the moving dots. If I hit ENTER Ubuntu booting continues. I'm not asking about solving my specific problem (which is definitely caused my be doing weird things) instead I'm asking how would I go about digging into what's going on at boot? What logs should I look at? What kind of thing should I look for? How would I troubleshoot this issue? I would like to "learn how to fish" and go figure out what is probably a stupid issue. I tried the boot repair utility, however that does not appear to do the trick. Boot repair appears to be focussed more on GRUB, which is functioning fine. | |||
Thursday, October 3, 2013
Restore screen size and position in gVim
http://vim.wikia.com/wiki/Restore_screen_size_and_position
Copy & paste the following codes to your _gvimrc or .gvimrc.
It works good.
Version 1 (Vim 7 and above)
Version 2 (Vim 6 and above)
Comments
Copy & paste the following codes to your _gvimrc or .gvimrc.
It works good.
Restore screen size and position
Talk0
1,603PAGES ON
THIS WIKI
THIS WIKI
This tip is useful if you always want Vim to startup in the same location and size as the time you exit it. Most applications (i.e. FireFox) do this already. Another reason to use this tip is if you often have more than one Vim (GUI on Windows) running. Quite often I will have one per project, each instance editing multiple buffers. When I start Vim, I name it (based on the project or tool I launched it from).
gvim myFile1 myFile2 gvim --servername MyProject filename1 filename2 filename3 gvim --servername VS_NET filename
When I re-open Vim I like its screen position and size to be the same as they were when Vim was closed. The scripts below can be added to your .vimrc file. They offer 2 configuration options which can be set at the bottom before the autocmds:
" To enable the saving and restoring of screen positions. let g:screen_size_restore_pos = 1 " To save and restore screen for each Vim instance. " This is useful if you routinely run more than one Vim instance. " For all Vim to use the same settings, change this to 0. let g:screen_size_by_vim_instance = 1
Version 1 (Vim 7 and above)
Edit
This version uses Vim's
readfile()
and writefile()
functions to access the file used to save the size/position. That in addition to the use of the split()
function makes this version unusable in Vim 6.x.if has("gui_running") function! ScreenFilename() if has('amiga') return "s:.vimsize" elseif has('win32') return $HOME.'\_vimsize' else return $HOME.'/.vimsize' endif endfunction function! ScreenRestore() " Restore window size (columns and lines) and position " from values stored in vimsize file. " Must set font first so columns and lines are based on font size. let f = ScreenFilename() if has("gui_running") && g:screen_size_restore_pos && filereadable(f) let vim_instance = (g:screen_size_by_vim_instance==1?(v:servername):'GVIM') for line in readfile(f) let sizepos = split(line) if len(sizepos) == 5 && sizepos[0] == vim_instance silent! execute "set columns=".sizepos[1]." lines=".sizepos[2] silent! execute "winpos ".sizepos[3]." ".sizepos[4] return endif endfor endif endfunction function! ScreenSave() " Save window size and position. if has("gui_running") && g:screen_size_restore_pos let vim_instance = (g:screen_size_by_vim_instance==1?(v:servername):'GVIM') let data = vim_instance . ' ' . &columns . ' ' . &lines . ' ' . \ (getwinposx()<0?0:getwinposx()) . ' ' . \ (getwinposy()<0?0:getwinposy()) let f = ScreenFilename() if filereadable(f) let lines = readfile(f) call filter(lines, "v:val !~ '^" . vim_instance . "\\>'") call add(lines, data) else let lines = [data] endif call writefile(lines, f) endif endfunction if !exists('g:screen_size_restore_pos') let g:screen_size_restore_pos = 1 endif if !exists('g:screen_size_by_vim_instance') let g:screen_size_by_vim_instance = 1 endif autocmd VimEnter * if g:screen_size_restore_pos == 1 | call ScreenRestore() | endif autocmd VimLeavePre * if g:screen_size_restore_pos == 1 | call ScreenSave() | endif endif
Version 2 (Vim 6 and above)
Edit
Here is an alternative script which uses a regular Vim buffer to manipulate the vimsize file instead of Vim 7's readfile() and writefile() functions.
" Restore screen size and position " Saves data in a separate file, and so works with multiple instances of Vim. if has("gui_running") function! ScreenFilename() if has('amiga') return "s:.vimsize" elseif has('win32') return $HOME.'\_vimsize' else return $HOME.'/.vimsize' endif endfunction function! ScreenRestore() " - Remembers and restores winposition, columns and lines stored in " a .vimsize file " - Must follow font settings so that columns and lines are accurate " based on font size. if !has("gui_running") return endif if g:screen_size_restore_pos != 1 return endif let vim_instance = (g:screen_size_by_vim_instance==1?(v:servername):'GVIM') " read any existing variables from .vimsize file silent! execute "sview " . escape(ScreenFilename(),'%#\ $') silent! execute "0/^" . vim_instance . " /" let vim_name = matchstr(getline('.'), '^\w\+') let vim_cols = matchstr(getline('.'), '^\w\+\s\+\zs\d\+') let vim_lines = matchstr(getline('.'), '^\w\+\s\+\d\+\s\+\zs\d\+') let vim_posx = matchstr(getline('.'), '^\w\+\s\+\d\+\s\+\d\+\s\+\zs\d\+') let vim_posy = matchstr(getline('.'), '^\w\+\s\+\d\+\s\+\d\+\s\+\d\+\s\+\zs\d\+') if vim_name == vim_instance execute "set columns=".vim_cols execute "set lines=".vim_lines silent! execute "winpos ".vim_posx." ".vim_posy endif silent! q endfunction function! ScreenSave() " used on exit to retain window position and size if !has("gui_running") return endif if !g:screen_size_restore_pos return endif let vim_instance = (g:screen_size_by_vim_instance==1?(v:servername):'GVIM') silent! execute "split " . escape(ScreenFilename(),'%#\ $') silent! execute "0/^" . vim_instance . " /" let vim_name = matchstr(getline('.'), '^\w\+') if vim_name == vim_instance delete _ endif $put = vim_instance . ' ' . &columns . ' ' . &lines . ' ' . \ (getwinposx()<0?0:getwinposx()) . ' ' . \ (getwinposy()<0?0:getwinposy()) silent! x! endfunction if !exists('g:screen_size_restore_pos') let g:screen_size_restore_pos = 1 endif if !exists('g:screen_size_by_vim_instance') let g:screen_size_by_vim_instance = 1 endif autocmd VimEnter * call ScreenRestore() autocmd VimLeavePre * call ScreenSave() endif
Comments
Edit
Feel free to add comments here for script improvements.
For the Version 2 script, since it uses Vim buffers for the manipulations it would be useful to disable all autocmds before opening splitting the buffer and re-enable them when closing the buffer. Many people have lots of plugins installed which can make opening buffers somewhat expensive (and therefore unnecessary time delay). Using the Vim 7 readfile() and writefile() functions avoid this overhead.
Android Source Repo GPG public key not found
http://stackoverflow.com/questions/19126603/android-source-repo-gpg-public-key-not-found
\
the guide about repo on source.android.com fails.
Getting another repo is the answer.
\
the guide about repo on source.android.com fails.
Getting another repo is the answer.
Android Source Repo GPG public key not found
I am running Linux Mint 14 and trying to download the android source. I followed the instruction for setting up the environment and when I was trying to get the source with repo, I got the following error.
I've tried importing the public key from the instruction, try generating my own GPG keys, as well as symbolic linking the directories ~/.gnupg and ~/.repoconfig/gnupg both ways and I still get the same error. I also tried to deleting the ~/.repoconfig and ~/.gnupg and still no luck.Any help would be appreciated. | |||
i found a solution here:http://www.marshut.com/wrrts/repo-release-1-12-4.html
[quote] Sorry, I realized today that we didn't upload the newest version of the launcher. I'll update the documentation. For the meantime, please use: curl http://commondatastorage.googleapis.com/git-repo-downloads/repo > ~/bin/repo chmod a+x ~/bin/repo sha1 e197cb48ff4ddda4d11f23940d316e323b29671c If verification errors persist, you can blow away (or move) your ~/.repoconfig dir to ensure the new public keys are imported. Sorry for the trouble everyone! [/quote] | |||||||
|
Wednesday, October 2, 2013
How MMS, Multi-media Messaging Service works ?
From wikipedia...only technical part is cited.
http://en.wikipedia.org/wiki/Multimedia_Messaging_Service
Some key points are...
1. MMSC(Multimedia Messaging Service Centre) works as the core function.
2. The end-most system in carrier-side is HTTP-capable.
3. Using SMS control-channel, carrier network checks the capability of mobile user's handset for MMS. Url for the MMS is contained in the SMS control message.
4. The MMS-capable handset will pull the MMS content from carrier network using MMS URL.
5. The MMS-incapable handset may receive the MMS URL as SMS text body, which can be a link to a web browser.
6. MMS may be encoded in MIME or MIME-like format and may be converted into other format by carrier network function so that the mobile user handset can process.
fyi
Once the MMSC has received a message, it first determines whether the receiver's handset is "MMS capable", that it supports the standards for receiving MMS. If so, the content is extracted and sent to a temporary storage server with an HTTP front-end. An SMS "control message" containing the URL of the content is then sent to the recipient's handset to trigger the receiver's WAP browser to open and receive the content from the embedded URL. Several other messages are exchanged to indicate status of the delivery attempt.[6] Before delivering content, some MMSCs also include a conversion service that will attempt to modify the multimedia content into a format suitable for the receiver. This is known as "content adaptation".
If the receiver's handset is not MMS capable, the message is usually delivered to a web based service from where the content can be viewed from a normal internet browser. The URL for the content is usually sent to the receiver's phone in a normal text message. This behaviour is usually known as the "legacy experience" since content can still be received by a phone number, even if the phone itself does not support MMS.
The method for determining whether a handset is MMS capable is not specified by the standards. A database is usually maintained by the operator, and in it each mobile phone number is marked as being associated with a legacy handset or not. It can be a touch 'hit or miss', since customers can change their handset at will and this database is not usually updated dynamically.
MMS does not utilize one's own operator maintained data plan to distribute multimedia content. Operator maintained data plans are only used when message included links (if any) are explicitly clicked.
E-mail and web-based gateways to the MMS (and SMS) system are common. On the reception side, the content servers can typically receive service requests both from WAP and normal HTTP browsers, so delivery via the web is simple. For sending from external sources to handsets, most carriers allow MIME encoded message to be sent to the receiver's phone number with a special domain. An example of this would be PTN@messaging.carrier.com, where PTN is the public telephone number. Typically the special domain name is carrier specific.
http://en.wikipedia.org/wiki/Multimedia_Messaging_Service
Some key points are...
1. MMSC(Multimedia Messaging Service Centre) works as the core function.
2. The end-most system in carrier-side is HTTP-capable.
3. Using SMS control-channel, carrier network checks the capability of mobile user's handset for MMS. Url for the MMS is contained in the SMS control message.
4. The MMS-capable handset will pull the MMS content from carrier network using MMS URL.
5. The MMS-incapable handset may receive the MMS URL as SMS text body, which can be a link to a web browser.
6. MMS may be encoded in MIME or MIME-like format and may be converted into other format by carrier network function so that the mobile user handset can process.
fyi
Technical description[edit]
MMS messages are delivered in a completely different way from SMS. The first step is for the sending device to encode the multimedia content in a fashion similar to sending a MIME e-mail (MIME content formats are defined in the MMS Message Encapsulation specification). The message is then forwarded to the carrier's MMS store and forward server, known as the MMSC (Multimedia Messaging Service Centre). If the receiver is on another carrier, the relay forwards the message to the recipient's carrier using the Internet.[5]Once the MMSC has received a message, it first determines whether the receiver's handset is "MMS capable", that it supports the standards for receiving MMS. If so, the content is extracted and sent to a temporary storage server with an HTTP front-end. An SMS "control message" containing the URL of the content is then sent to the recipient's handset to trigger the receiver's WAP browser to open and receive the content from the embedded URL. Several other messages are exchanged to indicate status of the delivery attempt.[6] Before delivering content, some MMSCs also include a conversion service that will attempt to modify the multimedia content into a format suitable for the receiver. This is known as "content adaptation".
If the receiver's handset is not MMS capable, the message is usually delivered to a web based service from where the content can be viewed from a normal internet browser. The URL for the content is usually sent to the receiver's phone in a normal text message. This behaviour is usually known as the "legacy experience" since content can still be received by a phone number, even if the phone itself does not support MMS.
The method for determining whether a handset is MMS capable is not specified by the standards. A database is usually maintained by the operator, and in it each mobile phone number is marked as being associated with a legacy handset or not. It can be a touch 'hit or miss', since customers can change their handset at will and this database is not usually updated dynamically.
MMS does not utilize one's own operator maintained data plan to distribute multimedia content. Operator maintained data plans are only used when message included links (if any) are explicitly clicked.
E-mail and web-based gateways to the MMS (and SMS) system are common. On the reception side, the content servers can typically receive service requests both from WAP and normal HTTP browsers, so delivery via the web is simple. For sending from external sources to handsets, most carriers allow MIME encoded message to be sent to the receiver's phone number with a special domain. An example of this would be PTN@messaging.carrier.com, where PTN is the public telephone number. Typically the special domain name is carrier specific.
Tuesday, September 24, 2013
How to resolve the problem when Ubuntu on VMWare cannot get the ip address.
Ubuntu 3.8.0 64-bit installed on VMWare 9 could not get the ip address.
Network is configured as DHCP in Ubuntu and the bridge mode is set on VMWare VM configuration.
At first run, it worked and even samba service with Windows 7, the host OS worked successfully.
Today it does not work at all and no ip address is acquired when I checked with 'ifconfig' command.
Shutting down and restarting the VM was not the solution.
Googling told me the answer.
Set the /etc/network/interfaces file as follows.
============================
auto eth0
iface eth0 inet dhcp
============================
There was "lo" instead of "eth0".
Still I don't understand why it worked before and now I have to change the above file.
In some linux, the file is /etc/networking/interfaces, the google told.
Thanks, Google.
Network is configured as DHCP in Ubuntu and the bridge mode is set on VMWare VM configuration.
At first run, it worked and even samba service with Windows 7, the host OS worked successfully.
Today it does not work at all and no ip address is acquired when I checked with 'ifconfig' command.
Shutting down and restarting the VM was not the solution.
Googling told me the answer.
Set the /etc/network/interfaces file as follows.
============================
auto eth0
iface eth0 inet dhcp
============================
There was "lo" instead of "eth0".
Still I don't understand why it worked before and now I have to change the above file.
In some linux, the file is /etc/networking/interfaces, the google told.
Thanks, Google.
Sunday, September 22, 2013
ODEX decompilation
ODEX is an Optimized DEX, which means a .odex file is a runtime instance of the dalvik byte code binary .dex file.
Usually .dex file exists inside of .apk and it turns into .odex when running and stored in the dalvik cache. If the binary file exists in the form of .odex file, then it exists outside of .apk file and it is not stored in the dalvik cache. .odex file can boost the initial loading performance of android app.
To decompile .dex files
1. Convert .dex file into .jar file using dex2jar utility.
2. Look into .jar file using jd-gui
or extract .jar file into .class files and convert .class files into .java files using jad utility.
To decompile .odex files, you need some prior steps changing .odex file into .dex file.
0. prerequisites
- baksmali.jar & smali.jar from http://code.google.com/p/smali/downloads/list
- system/framework folder and the files in it.(This is usually included in the system.img of rom images.)
- Of course, the target .odex file.(for example "target_sample.odex")
1. Convert .odex file into Smali format files using baksmali utility.
java -jar baksmali.jar -d system/framework -x target_sample.odex
-Here baksmali.jar filename may be changed depending on the file name and the version of baksmali.
- "system/framework" folder may be different depending on the place where you put it.
- Then the Smali formatted files are generated in the "out" folder.
2. Bind the smali formatted files into .dex file.
java -jar smali.jar -o classes.dex out
-Here smali.jar filename may be changed depending on the file name and the version of smali.
- "-o" option is for designating the output file name of .dex file, so you can change the classes.dex into anything you want.
- the last "out" is the folder name generated in the prior step.
Now you have the .dex file and you can proceed the dex/java decompilation.
=======================================================================
Here I wrote a batch file script for the above steps.
Put a .odex file & framework folder and run the script.
Then the decompilation of .odex-->.dex-->.jar-->.java is done at one shot.
All the result and the related files are saved into a folder given as the argument of the script.
The argument should be the name of .odex file without the extension .odex.
The assumptions are as follows.
0. In Windows7 environment, jdk is installed.(Test with jdk 1.7.0_25)
1. dex2jar-0.0.9.13 folder exists. Of course dex2jar.bat should be there.
2. baksmali-2.0b6.jar exists.
3. jad.exe exists.
4. smali-2.0b6.jar exists.
5. Save the below script as odex2jard.bat.
(If some files have different version, then the script should be revised accordingly.)
===========================Start of script ================================
@echo off
if x%1x == xx (
echo ....................................
echo No argument.
echo ....................................
goto usage
)
if not exist .\%1.odex (
echo ....................................
echo %1.odex file does not exist.
echo ....................................
goto usage
)
if exist .\%1.dex (
echo ....................................
echo %1.dex file exists.
echo Move or remove existing %1.dex file.
echo ....................................
goto usage
)
if exist .\%1_dex2jar (
echo ....................................
echo %1_dex2jar folder exists.
echo Move or remove existing %1_dex2jar folder.
echo ....................................
goto usage
)
if exist .\%1_dex2jar.jar (
echo ....................................
echo %1_dex2jar.jar file exists.
echo Move or remove existing %1_dex2jar.jar file.
echo ....................................
goto usage
)
if exist .\%1 (
echo ....................................
echo The result is saved into %1 folder.
echo Move or remove existing %1 folder.
echo ....................................
goto usage
)
if exist .\out (
echo ....................................
echo "out" folder is used as temp.
echo Move or remove "out" folder.
echo ....................................
goto usage
)
if not exist .\framework (
echo ....................................
echo No "framework" folder!!
echo The framework folder should be right here.
echo Cautious not to be system/framework!!
echo ....................................
goto usage
)
java -jar baksmali-2.0b6.jar -d framework -x %1.odex
java -jar smali-2.0b6.jar -o %1.dex out
rmdir /S /Q .\out
call .\dex2jar-0.0.9.13\dex2jar.bat %1.dex
mkdir %1_dex2jar
cd %1_dex2jar
jar xvf ..\%1_dex2jar.jar
cd ..
.\jad -o -d %1_dex2jar -r -s java %1_dex2jar/**/*.class
mkdir %1
move .\framework %1
move .\%1.odex %1
move .\%1.dex %1
move .\%1_dex2jar.jar %1
move .\%1_dex2jar %1
echo ....................................
echo DONE !!
echo ....................................
goto :eof
:usage
echo .
echo Usage:
echo ....................................
echo odex2jard.bat "target_filename"
echo ....................................
echo No file extension at "target_filename"
echo eg) For abc.odex, type as follows
echo odex2jard.bat abc
echo ....................................
goto :eof
=========================== Endof script =================================
Usually .dex file exists inside of .apk and it turns into .odex when running and stored in the dalvik cache. If the binary file exists in the form of .odex file, then it exists outside of .apk file and it is not stored in the dalvik cache. .odex file can boost the initial loading performance of android app.
To decompile .dex files
1. Convert .dex file into .jar file using dex2jar utility.
2. Look into .jar file using jd-gui
or extract .jar file into .class files and convert .class files into .java files using jad utility.
To decompile .odex files, you need some prior steps changing .odex file into .dex file.
0. prerequisites
- baksmali.jar & smali.jar from http://code.google.com/p/smali/downloads/list
- system/framework folder and the files in it.(This is usually included in the system.img of rom images.)
- Of course, the target .odex file.(for example "target_sample.odex")
1. Convert .odex file into Smali format files using baksmali utility.
java -jar baksmali.jar -d system/framework -x target_sample.odex
-Here baksmali.jar filename may be changed depending on the file name and the version of baksmali.
- "system/framework" folder may be different depending on the place where you put it.
- Then the Smali formatted files are generated in the "out" folder.
2. Bind the smali formatted files into .dex file.
java -jar smali.jar -o classes.dex out
-Here smali.jar filename may be changed depending on the file name and the version of smali.
- "-o" option is for designating the output file name of .dex file, so you can change the classes.dex into anything you want.
- the last "out" is the folder name generated in the prior step.
Now you have the .dex file and you can proceed the dex/java decompilation.
=======================================================================
Here I wrote a batch file script for the above steps.
Put a .odex file & framework folder and run the script.
Then the decompilation of .odex-->.dex-->.jar-->.java is done at one shot.
All the result and the related files are saved into a folder given as the argument of the script.
The argument should be the name of .odex file without the extension .odex.
The assumptions are as follows.
0. In Windows7 environment, jdk is installed.(Test with jdk 1.7.0_25)
1. dex2jar-0.0.9.13 folder exists. Of course dex2jar.bat should be there.
2. baksmali-2.0b6.jar exists.
3. jad.exe exists.
4. smali-2.0b6.jar exists.
5. Save the below script as odex2jard.bat.
(If some files have different version, then the script should be revised accordingly.)
===========================Start of script ================================
@echo off
if x%1x == xx (
echo ....................................
echo No argument.
echo ....................................
goto usage
)
if not exist .\%1.odex (
echo ....................................
echo %1.odex file does not exist.
echo ....................................
goto usage
)
if exist .\%1.dex (
echo ....................................
echo %1.dex file exists.
echo Move or remove existing %1.dex file.
echo ....................................
goto usage
)
if exist .\%1_dex2jar (
echo ....................................
echo %1_dex2jar folder exists.
echo Move or remove existing %1_dex2jar folder.
echo ....................................
goto usage
)
if exist .\%1_dex2jar.jar (
echo ....................................
echo %1_dex2jar.jar file exists.
echo Move or remove existing %1_dex2jar.jar file.
echo ....................................
goto usage
)
if exist .\%1 (
echo ....................................
echo The result is saved into %1 folder.
echo Move or remove existing %1 folder.
echo ....................................
goto usage
)
if exist .\out (
echo ....................................
echo "out" folder is used as temp.
echo Move or remove "out" folder.
echo ....................................
goto usage
)
if not exist .\framework (
echo ....................................
echo No "framework" folder!!
echo The framework folder should be right here.
echo Cautious not to be system/framework!!
echo ....................................
goto usage
)
java -jar baksmali-2.0b6.jar -d framework -x %1.odex
java -jar smali-2.0b6.jar -o %1.dex out
rmdir /S /Q .\out
call .\dex2jar-0.0.9.13\dex2jar.bat %1.dex
mkdir %1_dex2jar
cd %1_dex2jar
jar xvf ..\%1_dex2jar.jar
cd ..
.\jad -o -d %1_dex2jar -r -s java %1_dex2jar/**/*.class
mkdir %1
move .\framework %1
move .\%1.odex %1
move .\%1.dex %1
move .\%1_dex2jar.jar %1
move .\%1_dex2jar %1
echo ....................................
echo DONE !!
echo ....................................
goto :eof
:usage
echo .
echo Usage:
echo ....................................
echo odex2jard.bat "target_filename"
echo ....................................
echo No file extension at "target_filename"
echo eg) For abc.odex, type as follows
echo odex2jard.bat abc
echo ....................................
goto :eof
=========================== Endof script =================================
Subscribe to:
Posts (Atom)