December 15, 2009

Getting Things Done with Thunderbird


Thunderbird allows you to apply labels (similar to Outlook flags as mentioned in Using Flags and Rules in Outlook) to emails. Unfortunately only one flag can be assigned to a message at a time (is that a problem or am I trying to be overly complicated?) but the labelled messages are easy to see if you have a full inbox (which you don't of course, do you?)

To access the labels go to Tools > Options > Display > Labels (tab)

I have the following labels set up:

  • Action

  • Waiting For

  • Defer

  • Archive

  • Delete

Unfortunately it would appear that 5 labels are the maximum you can have at the moment, but in terms of GTD this is enough. The only reason I could see you needing more is if you wanted specific project labels or one for personal messages, but then you could always get rid of the "Archive" and "Delete" options.

Getting Things Done with Thunderbird :: Learning to be productive One Day At A Time ::.

November 23, 2009

[SOLVED]Paketdatei war nicht richtig signiert

NM I got it working I just had to

adb remount

adb shell rm /system/sd/app/*Maps*

adb shell rm /system/sd/app/*maps*

adb shell rm /system/sd/dalvik-cache/*Maps*

adb shell rm /system/sd/dalvik-cache/*maps*

adb shell rm /data/app/*Maps*

adb shell rm /data/app/*maps*

adb shell rm /data/dalvik-cache/*Maps*

adb shell rm /data/dalvik-cache/*maps*

adb shell rm /system/app/*Maps*

adb shell rm /system/app/*maps*

adb uninstall

that let me uninstall and install the new maps.

How can I count the number of occurrences of a substring within a string?

If you want a count of a certain character (X) within a string, you can use the tr/// function like so:
$count = ($string =~ tr/X//);
print "There are $count Xs in the string";

This is fine if you are just looking for a single character. However, if you are trying to count multiple character substrings within a larger string, tr/// won't work. What you can do is wrap a while loop around a pattern match.
    $string="-9 55 48 -2 23 -76 4 14 -44";
$count++ while $string =~ /-\d+/g;
print "There are $count negative numbers in the string";

November 7, 2009

My Thunderbird extensions list

Generated: Sat Nov 07 2009 01:14:44 GMT+0100
User Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv: Gecko/20090812 Lightning/0.9 Thunderbird/
Build ID: 2009081210

Enabled Extensions: [43]

My Firefox extensions list

Generated: Sat Nov 07 2009 01:05:09 GMT+0100

User Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv: Gecko/20091102 Firefox/3.5.5 GTB5 (.NET CLR 3.5.30729)

Build ID: 20091102152451

Enabled Extensions: [45]


November 3, 2009

[SOLVED]In dem Ordner in dem die Anwendung heruntergeladen wurde können keine neuen Dateien erstellt oder gespeichert werden.


1. DLMWin7HP64DE.exe (oder vergleichbare .exe-Datei) herunterladen, jedoch nicht ausführen.

2. DLMWin7HP64DE.exe » Eigenschaften » Reiter Kompabilität » Checkbox Programm als ein Administrator ausführen

3. DLMWin7HP64DE.exe » Als Administrator ausführen und warten, bis alle Dateien heruntergeladen worden sind

4. Win7-HP-Retail-de-de-x64.exe (oder vergleichbare .exe-Datei) » Als Administrator ausführen

5. Trotz fehlerhaftem Entpacken der Dateien (siehe o.g. Fehlermeldung) fortfahren

6. Oscdimg herunterladen, die .zip-Datei entpacken und deren Inhalt nach C:/Windows/System32 kopieren

7. Den durch 4. erstellten Ordner expandedSetup nach C:/ kopieren

8. Start » cmd » Als Administrator ausführen

9. Eingabe: Oscdimg.exe -u2 -b"C:\expandedSetup\boot\" -h "C:\expandedSetup" C:\7.iso

10. Windows 7 USB/DVD Download Tool herunterladen und installieren

11. Windows 7 USB/DVD Download Tool ausführen, den Anweisungen folgen und unter Schritt 3 die auf C: liegende 7.iso-Datei einbinden

Sollte diese Methode bei jemandem Erfolg haben, insbesondere auf Hinsicht auf die Funktion der Product Keys, würde ich mich freuen, wenn er dies hier preisbigt.

October 8, 2009

[SOLVED]How To Sort Folders The Same Way As Files In Total Commander

"The option is right there, in the middle, Sorting Directories. The default is Always by name. Change it to Like files (also by time) and you’re done.


● ● ●"

September 24, 2009

[SOLVED]Disable Debug Output for Ajax in CakePHP


class AppController extends Controller {

var $components = array('RequestHandler');

var $helpers = array('Html','Form','Ajax');

function beforeFilter() {

if ( $this->RequestHandler->isAjax() ) {






September 23, 2009

[SOLVED]How to use the “sysout” snippet in Eclipse with selected text?

"The sysout template acts upon entire Java statements.

1. Highlight a statement in the editor.

2. Hit CTRL-SPACE (or whatever you have set up for content assist.)

3. Type sysout then hit enter. Note that when you're typing sysout it will temporarily overwrite your statement (but it will come back wrapped by System.out.println when you hit enter.)"

September 15, 2009

[SOLVED]Way to install games & applications on your samsung star

"1. First download a java game compatible for your phone.

2.Create a jad file using JADMaker (Download JadMaker from games & software section).

3.Just drag and drop your .jar file and the jad maker will automatically make the .jad file.

4. Connect the phone to PC and start "Samsung New PC Studio". Open the File browser and go to "External Memory". Create a directory there e.g games

5.Then copy the .jar and .jad files into that folder.

6.Disconnect the phone from PC now.

7.Go to Menu -> Browse -> Enter URL

Type ->

8.Browse down and you will see "Quick Download". Click it. Then enter quick download code as 51799 . Download and install it. Exit from browser.

9.Go to Menu -> Applications -> Games and more -> LiteFTP

10.You will be in LiteFTP menu

Select Mmc (Memory card) and click OK.

11.You should be able to see the folders in memory card. Select games folder (dont enter it) and press "123" button. Then press "1" (This will copy the game folder). Select "Back". You should be back in "root" directory.

12.In root directory you will see a folder with "dont enter" symbol named "My PrivateMy PhotoMy Video .......". Select it and press OK to enter it.

13.There will be nothing in the folder. Now paste the game folder. So press "3" to paste.

Exit the LiteFTP.

14. Open "Keypad" and type "*#6984125*#" (Without quotes)

This will automatically open "Admin setting"

Select "4 Internals" and enter "*#9072641*#" (without quotes). And confirm. This will take you to "Internals" menu. Select "6 Storage settings".

15. Select "2 Update media database"

then select "3 Update Java DB"

then select "10 Create Ax Dat File"

Exit from all those menus.

16.Now go to Menu -> Applications -> "Games and more" You should be able to see new icon "LiteFTP/files/Erix". Rename it if you want to. Then start the game."

September 9, 2009

[SOLVED]I cant get any of these chm files to open.



September 3, 2009

[SOLVED] Use Firefox location bar as search box

"By default in Firefox you can type one or more keywords in the location bar. Firefox recognizes that it is not an URL and uses I'm Lucky search with Google search engine for version < 2; it uses Google search by name for Firefox version 2 and above. Here is how you can change it.

1. Type about:config in the location bar and press Enter.

2. Type keyword.URL in filter and double-click on the displayed line. You will note that the default value is something like:

3. Change it to the query string of another search engine of your choice. For example if you want to use our blog results for your default search then you should replace it with:

5. Hit OK and close the browser tab.

You are done. Now you can use your favorite search engine to search using your location bar, instead of Google."

[SOLVED] Mozilla Thunderbird exceeded maximum number of connections to IMAP server

"When looking at emails in several IMAP folders one after the other in Mozilla Thunderbird, I got the following error message and was unable to view that folder and the emails in it.

Unable to connect to your IMAP server. You may have exceeded the maximum number of connections to this server. If so, use the Advanced IMAP Server Settings dialog to reduce the number of cached connections.

You may have exceeded the maximum number of connections to this server

This is normally due to the configuration of the IMAP server (such as Courier-IMAP) which may be configured to only allow a certain number of connections per IP address. Fortunately you can usually solve the issue in Thunderbird by changing the number of cached connections in the advanced settings.

From the menu, select "Tools" and then "Account Settings". This looks similar to the screenshot below:

mozilla thunderbird account settings

Next, select "Server Settings" under the appropriate account (at the very least you'll have one account, plus the local folders), and click the "Advanced" button, as shown in the screenshot above. This will show a new configuration dialog like the one show in the screenshot below:

setting the maximum number of server connections to cache

To fix the problem, change the "Maximum number of server connections to cache" value. The default setting is 5. Changing it to 3 or less worked for me, but setting it to 1 should work in all cases and make the error go away."

August 26, 2009

automatic ad-hoc in vista

"this guide helps you to share your dsl/cable internet connection without a need of a wireless router using only a windows vista laptop that has a wifi adhoc capabilities

1st: go to control panel and hit on networking. click on manage connections and setup a new wifi adhoc network and for example we'll name it "wireless"

2nd: after your name the network profile its for you to have it secure or not.

3rd:save your network

4th: go to task scheduler and create a task name it as 'automatic adhoc'

5th: the program you need to run is called netsh.exe(you can find this at c:/windows/system32/)and add this following

command "wlan connect name=profilename" without the quotes ok. change the profilename into wireless

6th: do not start in windows startup but choose to start it in windows logon

7th: now you're good to go. everytime you turn on your laptop you can share it in you neighborhood"

August 25, 2009

[cmd]Batch - Filename Parameter Extensions

"When a parameter is used to supply a filename then the following extended syntax can be applied:

we are using the variable %1 (but this works for any parameter)

%~f1 - expands %1 to a Fully qualified path name - C:\utils\MyFile.txt

%~d1 - expands %1 to a Drive letter only - C:

%~p1 - expands %1 to a Path only - \utils\

%~n1 - expands %1 to a file Name, or if only a path is present - the last folder in that path

%~x1 - expands %1 to a file eXtension only - .txt

%~s1 - changes the meaning of f, n and x to reference the Short name (see note below)

%~1 - expand %1 removing any surrounding quotes (")

%~a1 - display the file attributes of %1

%~t1 - display the date/time of %1

%~z1 - display the file size of %1

%~$PATH:1 - search the PATH environment variable and expand %1 to the fully qualified name of the first match found.

The modifiers above can be combined:

%~dp1 - expands %1 to a drive letter and path only

%~nx2 - expands %2 to a file name and extension only"

August 17, 2009

[SOLVED]Eclipse and .svn Android AIDL Problem

Today after adding my android project to svn repository I got

syntax error    entries /src/.svn  line 1  Android AIDL Problem

After searching internet for solutions I installed subversion plug-in (did not helped) but this...

It is worked for me:

  • Delete your project from eclipse (not from disk).

  • "File"->"New.."->"Project"->"Android Project"

  • in "New Adroid Project"-Dialog selected "create project from existing source" (find your project on HDD)->"Finish"

my .classpath-file
<?xml version="1.0" encoding="UTF-8"?><classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="gen"/>
<classpathentry kind="con" path=""/>
<classpathentry kind="output" path="bin"/></classpath>

August 11, 2009

Android ImageLoader - load images sequencially in the background

"A few days ago I started to learn android… and it’s been a fairly smooth transition from flash. Although I have to say, as flash developers we’re just spoiled. We take for granted all the background stuff flash does for us to make coding that much easier.

One of those things is Loading images. in flash we have the Loader class which makes loading images very easy.

var loader:Loader = new Loader();

loader.load(new URLRequest("myimage.jpg"));

In java/android it takes a few more lines

HttpURLConnection conn = (HttpURLConnection) new URL("myimage.jpg").openConnection();



InputStream inStream = conn.getInputStream();

Bitmap bitmap = BitmapFactory.decodeStream(inStream);



The code above runs in the same thread so you’ll lock up your UI until the image has finish loading. Adding the Threading code adds quite a bit more code. So I decided to create an ImageLoader class to make my life just a little easier. Now I can load an image to an ImageView with one line of code.

ImageLoader.getInstance().load(myImageView, "myimage.jpg", true);

The last parameter tells the ImageLoader class to cache that the bitmap.

The ImageLoader class loads images sequentially so you don’t slow your mobile device down to a crawl. To cancel Loading simply call clearQueue() and to clear the cache call clearCache()

Here’s the class





import java.util.HashMap;

import java.util.Iterator;

import java.util.LinkedList;

import java.util.Queue;



import android.os.Handler;

import android.widget.ImageView;

public class ImageLoader {

static private ImageLoader _instance;

static public ImageLoader getInstance() {

if (_instance == null) {

_instance = new ImageLoader();


return _instance;


private HashMap _urlToBitmap;

private Queue _queue;

private DownloadThread _thread;

private Bitmap _missing;

private boolean _busy;


* Constructor


private ImageLoader () {

_urlToBitmap = new HashMap();

_queue = new LinkedList();

_busy = false;


public Bitmap get(String url) {

return _urlToBitmap.get(url);


public void load(ImageView image, String url) {

load(image, url, false);


public void load(ImageView image, String url, boolean cache) {

if (_urlToBitmap.get(url) != null) {

if(image!=null) {



} else {


queue(image, url, cache);



public void queue(ImageView image, String url, boolean cache) {

Iterator it = _queue.iterator();

if (image!=null) {

while (it.hasNext()) {

if ( {





} else if (url!=null) {

while (it.hasNext()) {

if ( {






_queue.add(new Group(image, url, null, cache));



public void clearQueue() {

_queue = new LinkedList();


public void clearCache() {

_urlToBitmap = new HashMap();


public void cancel() {


if ( _thread != null ) {


_thread = null;



public void setMissingBitmap(Bitmap bitmap) {

_missing = bitmap;


private void loadNext() {

Iterator it = _queue.iterator();

if (!_busy && it.hasNext() ) {

_busy = true;

Group group =;


// double check image availability

if (_urlToBitmap.get(group.url) != null) {

if (group.image!=null) {



_busy = false;


} else {

_thread = new DownloadThread(group);





private void onLoad() {

if (_thread != null) {

Group group =;

if (group.bitmap != null) {

if (group.cache) {

_urlToBitmap.put(group.url, group.bitmap);


if (group.image != null) {



} else if (_missing != null) {

if (group.image != null) {





_thread = null;

_busy = false;



private class Group {

public Group(ImageView image, String url, Bitmap bitmap, boolean cache) {

this.image = image;

this.url = url;

this.bitmap = bitmap;

this.cache = cache;


public ImageView image;

public String url;

public Bitmap bitmap;

public boolean cache;


private class DownloadThread extends Thread {

final Handler threadHandler = new Handler();

final Runnable threadCallback = new Runnable() {

public void run() {




private HttpURLConnection _conn;

public Group group;

public DownloadThread(Group group) { = group;



public void run() {

InputStream inStream = null;

_conn = null;

try {

_conn = (HttpURLConnection) new URL(group.url).openConnection();



inStream = _conn.getInputStream();

group.bitmap = BitmapFactory.decodeStream(inStream);



inStream = null;

_conn = null;

} catch (Exception ex) {

// nothing


if (inStream != null) {

try {


} catch (Exception ex) {}



inStream = null;

_conn = null;;


public void disconnect() {

if (_conn != null) {







July 31, 2009

[ImageMagick] Montage, Arrays of Images (contact sheet)

"montage -label '%f' balloon.gif medical.gif logo: present.gif shading.gif \ -tile x1 -shadow -geometry '60x60+2+2>' label_shadow.jpg "

July 7, 2009

Vista: Register DLLs Elevated Using the Context Menu

"To add the Register command in the context menu that’ll run the Regsvr32.exe command under elevated rights, you need to use the runas verb. Here is a REG file that I created, adds the runas verb for DLL and OCX file types in the following registry keys:
HKEY_CLASSES_ROOT \ Dllfile \ runas
HKEY_CLASSES_ROOT \ Ocxfile \ runas

1. Download the file register_runas.reg and save to Desktop.

2. Right-click on the file and choose Merge.

3. Click Yes when you’re asked for confirmation.

You should now see the Register (as Administrator) command in the right-click menu for DLL and OCX file types.


June 30, 2009

Remove ugly sound on HTC HERO boot (SuperHero)

You should write in your windows console (do not forget install Android SDK)
adb remount 
adb shell
#cd /system/media
#rm boot.mp3

Alternatively you can replace boot image and sound

June 23, 2009

Using a Horizontal Progress Bar in Android

"I was working on my Android downloader application yesterday, when I ran into a bit of a snag. I wanted to display a list of downloads (similar to the Firefox downloads window). Each item in the list should show the file name and a horizontal progress bar. I started to implement this, and several hours later stumbled upon the archaic solution. I wanted to share this, both to help anybody who may be trying to do something similar, and also to illustrate how the lack of good documentation is hurting aspiring Android developers.

I thought that I could put a ProgressBar instance in my xml, set it to be indeterminate, give it a max and a value, and be done. However, it wasn't nearly that easy. After a few hours of hunting on Google and the Android Groups, I stumbled upon the solution in an online preview of The Busy Coder's Guide to Android Development. In short, I had to set the following on my ProgressBar's XML:



to get horizontal progressbar just put

android:maxHeight="20dip" android:layout_width="fill_parent"></ProgressBar>

into your \res\layout\main.xml

June 18, 2009

yGuard - Java™ Bytecode Obfuscator and Shrinker

"yGuard is a free Java bytecode obfuscator and shrinker that improves your software deployment by prohibiting unwanted access to your source code and drastically shrinking the processed Jar files at the same time.

* yGuard is absolutely free! Contrary to expensive commercial products of our competitors providing the same amount of features as yGuard or less, yGuard is free.
* yGuard is an Ant task! Existing tools use proprietary mechanisms to invoke or configure the task of obfuscation. As an Ant task, yGuard can be seamlessly integrated into your deployment process using XML syntax.
* yGuard provides highly configurable name obfuscation that will protect your intellectual property from reverse engineering.
* yGuard provides elaborate code shrinking functionality through dependency analysis.
* yGuard 2.0 offers a new powerful and easy to use XML syntax that allows the effortless definition of code entities e.g. based on pattern sets or inheritance.
* yGuard will correctly obfuscate and shrink programs that depend on external libraries.
* yGuard can automatically rename and adjust textual resource files according to the obfuscation scheme.
* yGuard can scramble and unscramble or shrink line number table information. This means that debugging an obfuscated program is still achievable without weakening the obfuscation.
* yGuard can create patches! During each obfuscation run, yGuard produces XML output that can be used to create subsequent patches of already deployed obfuscated applications.
* yGuard supports JDK 1.5 features and correctly obfuscates classes compiled with its new features. "

May 18, 2009

How do I pass parameters to a batch file?

"A. When you call a batch file, you can enter data after the command that the batch file refers to as %1, %2, etc. For example, in the batch file hello.bat, the following command
@echo hello %1 boy

would output
hello john boy

if you called it as
hello john

The following table outlines how you can modify the passed parameter.
Parameter Description
%1 The normal parameter.
%~f1 Expands %1 to a fully qualified pathname. If you passed only a filename from the current directory, this parameter would also expand to the drive or directory.
%~d1 Extracts the drive letter from %1.
%~p1 Extracts the path from %1.
%~n1 Extracts the filename from %1, without the extension.
%~x1 Extracts the file extension from %1.
%~s1 Changes the n and x options’ meanings to reference the short name. You would therefore use %~sn1 for the short filename and %~sx1 for the short extension.

The following table shows how you can combine some of the parameters.
Parameter Description
%~dp1 Expands %1 to a drive letter and path only.
%~sp1 For short path.
%~nx1 Expands %1 to a filename and extension only.

To see all the parameters in action, put them into the batch file testing.bat, as follows.
@echo off
echo fully qualified name %~f1
echo drive %~d1
echo path %~p1
echo filename %~n1
echo file extension %~x1
echo short filename %~sn1
echo short file extension %~sx1
echo drive and directory %~dp1
echo filename and extension %~nx1

Then, run the file with a long filename. For example, the batch file run on the file c:\temp\longfilename.long would produce the following output.
fully qualified name c:\TEMP\longfilename.long
drive c:
path \TEMP\
filename longfilename
file extension .long
short filename LONGFI~1
short file extension .LON
drive and directory c:\TEMP\
filename and extension longfilename.long

This method also works on the second and subsequent parameters. You simply substitute the parameter for 1 (e.g., %~f2 for the second parameter’s fully qualified path name).

The %0 parameter in a batch file holds information about the file when it runs and indicates which command extensions you can use with the file (e.g., %~dp0 gives the batch file’s drive and path)."

May 15, 2009


"This assumes that your project layout looks something like this:


* In the top of your project trunk, execute the following:

svn propedit svn:externals .

* This will open an editor session. In the file opened by your editor, each line indicates a different external svn repo to pull. The first segment of the line is the directory where you want the pull to exist. The last segment is the svn repo URL to pull. You can have an optional middle argument indicating the revision to use. Some examples:
o Pull framework repo from head:


o Pull framework repo from revision 2616:

framework -r2616

* After saving and exiting, update the repo:

svn up

* Commit changes:

svn commit

One thing to note: any directory you specify for an svn:externals checkout should not already exist in your repository. If it does, you will get an error like the following:

svn: Working copy 'sharedproject' locked
svn: run 'svn cleanup' to remove locks

After that add default username for svn host (because we do not have username of external repository)

  • Linux

vi ~/.ssh/config
User <svnuser>

  • Windows - set default username for <svn-host> via putty

May 6, 2009

I got an error saying "This client is too old to work with working copy '...' ". How can I fix it without upgrading Subversion?

"Sometimes the working copy metadata format changes incompatibly between minor releases. For example, say you have a working copy created with Subversion 1.4.4, but one day you decide to try out Subversion 1.5.0. Afterwards, you attempt to switch back to 1.4.4, but it doesn't work — it just gives the above error.

This is because 1.5.0 upgraded your working copy format to support some new features (in this case, changelists, the keep-local flag, and variable-depth directories). Although 1.4.4 doesn't know anything about these new features, it can at least recognize that the working copy format has been upgraded to something higher than it can handle.

1.5.0 upgraded the working copy for a good reason: it realizes that 1.4.4 does not know about these new features, and that if 1.4.4 were to meddle with the working copy metadata now, important information might be lost, possibly causing corruption (see issue #2961, for example).

But this automatic upgrade behavior can be annoying, if you just want to try out a new release of Subversion without installing it permanently. For this reason, we distribute a script that can downgrade working copies when doing so is safe:

Run that script with the "--help" option to see how to use it. As future versions of Subversion are released, we will try to keep this FAQ entry up-to-date with potential downgrade scenarios and their implications."

April 27, 2009

HTTP Status Codes


  • 100 Continue

  • 101 Switching Protocols

  • 102 Processing

  • 200 OK

  • 201 Created

  • 202 Accepted

  • 203 Non-Authoritative Information

  • 204 No Content

  • 205 Reset Content

  • 206 Partial Content

  • 207 Multi-Status

  • 226 IM Used

  • 300 Multiple Choices

  • 301 Moved Permanently

  • 302 Found

  • 303 See Other

  • 304 Not Modified

  • 305 Use Proxy

  • 306 (Unused)

  • 307 Temporary Redirect

  • 400 Bad Request

  • 401 Unauthorized

  • 402 Payment Required

  • 403 Forbidden

  • 404 Not Found

  • 405 Method Not Allowed

  • 406 Not Acceptable

  • 407 Proxy Authentication Required

  • 408 Request Timeout

  • 409 Conflict

  • 410 Gone

  • 411 Length Required

  • 412 Precondition Failed

  • 413 Request Entity Too Large

  • 414 Request-URI Too Long

  • 415 Unsupported Media Type

  • 416 Requested Range Not Satisfiable

  • 417 Expectation Failed

  • 418 I'm a teapot

  • 422 Unprocessable Entity

  • 423 Locked

  • 424 Failed Dependency

  • 425 (Unordered Collection)

  • 426 Upgrade Required

  • 500 Internal Server Error

  • 501 Not Implemented

  • 502 Bad Gateway

  • 503 Service Unavailable

  • 504 Gateway Timeout

  • 505 HTTP Version Not Supported

  • 506 Variant Also Negotiates

  • 507 Insufficient Storage

  • 510 Not Extended

see also : RFC2616 HTTP/1.1, RFC2324 HTCPCP/1.0


April 23, 2009

WirelessKeyView - Recover lost wireless network key

"WirelessKeyView recovers all wireless network keys/passwords (WEP/WPA) stored in your computer by the 'Wireless Zero Configuration' service of Windows XP and by the 'WLAN AutoConfig' service of Windows Vista. It allows you to easily save all keys to text/html/xml file, or copy a single key to the clipboard.


April 22, 2009

Vi: Undo

"u | Undo the latest change. U | Undo all changes on a line, while not having | moved off it (unfortunately). :q! | Quit vi without writing. :e! | Re-edit a messed-up file."

April 20, 2009

XUL: XUL Explorer

"XUL Explorer is a XULRunner application that provides an easy way to experiment with XUL. It’s a simple editor that can preview XUL inline or in a separate popup window. It has a list of code snippets (small fragments of XUL or JavaScript) that can be quickly inserted into the editor. The XUL can be loaded from and saved to files. A XUL validator and the Error Console are both available to help debug problems. The help menu provides access to XUL information on MDC. There is even simple “keyword” help lookup for XUL elements. "

XUL: Passing arguments and displaying a dialog

"The following code demonstrates how to pass custom arguments to a dialog, process those arguments in the dialog, and return user-modified arguments to the caller. The code to open a dialog named mydialog.xul and pass it arguments:

var params = {inn:{name:"foo", description:"bar", enabled:true}, out:null};
window.openDialog("chrome://myext/content/mydialog.xul", "",
"chrome, dialog, modal, resizable=yes", params).focus();
if (params.out) {
// User clicked ok. Process changed arguments; e.g. write them to disk or whatever
else {
// User clicked cancel. Typically, nothing is done here.



// Called once when the dialog displays
function onLoad() {
// Use the arguments passed to us by the caller
document.getElementById("name").value = window.arguments[0];
document.getElementById("description").value = window.arguments[0].inn.description;
document.getElementById("enabled").checked = window.arguments[0].inn.enabled;

// Called once if and only if the user clicks OK
function onOK() {
// Return the changed arguments.
// Notice if user clicks cancel, window.arguments[0].out remains null
// because this function is never called
window.arguments[0].out = {name:document.getElementById("name").value,
return true;

April 14, 2009

Open Source Keystroke Launcher

"Launchy is a free windows and linux utility designed to help you forget about your start menu, the icons on your desktop, and even your file manager.

Launchy indexes the programs in your start menu and can launch your documents, project files, folders, and bookmarks with just a few keystrokes!"

April 5, 2009

Apache virtual hosts quick and easy

"Step 1: Creating the index pages

Like already mentioned before, we have to create subdirectory and page index files first. Suse normaly stores the web pages in the following directory:


We will use the same directory but will create a subdirectory for every virtual host.

mkdir /srv/www/htdocs/server_port80
mkdir /srv/www/htdocs/server_port8090
mkdir /srv/www/htdocs/server_www
mkdir /srv/www/htdocs/server_www1

You can later store you content in this directories. Let’s just create a single file called index.html that contains a message about the type of the server. An example file could look like this:

This is my webserver working on
Port 80.

Please change the content to your needs and save a modified index file in every subdirectory.

Step 2: Setup IP based virtual host

Suse stores the vhost configuration files in the following directory:


During the start-up process, Apache will automatically use all files located in this directory for the final configuration.

You can easily create new vhost configuration files by using the template like this:

cd /etc/apache2/vhosts.d/
cp vhost.template vhost-port80.conf

This will copy the default template and will create a configuration file that we will later use for our IP-based virtual host running on port 80. I recommend using vi to edit the file. Please open it like this:

vi vhost-port80.conf

As you can see, the file has everything you need to setup a virtual host, but also includes a lot of explanations and comments. To get a slim file please delete it.

Here are the lines you should change for your Apache configuration:

VirtualHost – set IP address and port here
ServerAdmin - your webmaster’s email adress
DocumentRoot – path to your web page contend (see step1)
ErrorLog - path to the error log file
CustomLog - path to the access log file
UseCanonicalName - leave it to off in this case
ScriptAlias – if you like to run cgi scripts on your web page, this is the location.

The file could look like this:

ServerAdmin webmaster@myserver.comThis e-mail address is being protected from spam bots, you need JavaScript enabled to view it
DocumentRoot /srv/www/htdocs/server_port80
ErrorLog /var/log/apache2/server_port80.log
CustomLog /var/log/apache2/access_port80.log combined
HostnameLookups Off
UseCanonicalName Off
ServerSignature On
ScriptAlias /cgi-bin/ "/srv/www/htdocs/server_port80/cgi-bin/"

AllowOverride None
Options +ExecCGI -Includes
Order allow,deny
Allow from all

Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all

If you like to run you web page on a different port, please use the following configuration file:

ServerAdmin webmaster@myserver.comThis e-mail address is being protected from spam bots, you need JavaScript enabled to view it
DocumentRoot /srv/www/htdocs/server_port8090
ErrorLog /var/log/apache2/server_port8090.log
CustomLog /var/log/apache2/access_port8090.log combined
HostnameLookups Off
UseCanonicalName Off
ServerSignature On
ScriptAlias /cgi-bin/ "/srv/www/htdocs/server_port8090/cgi-bin/"

AllowOverride None
Options +ExecCGI -Includes
Order allow,deny
Allow from all

Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all

A web server normally listens on port 80. If you like to change this or to add port 8090, you have to hack the listen.conf file. Please see step 4 for more information.

Step 3: Setup a name-based virtual host

Create a new file using the default template similar to step2:

cd /etc/apache2/vhosts.d
cp vhost.template vhost-www.conf

Here are the important hacks you have to make:
ServerName – use name you would like to see in the URL
UseCanonicalName On

With UseCanonicalName on Apache will use the ServerName and Port directives to construct the canonical name for the server. This name is used in
all self-referential URLs, and for the values of SERVER_NAME and SERVER_PORT in CGIs.

If you have more IP addresses for your server or if you like to use different ports, please change the following line:


The file could look like this:

ServerAdmin webmaster@myserver.comThis e-mail address is being protected from spam bots, you need JavaScript enabled to view it
DocumentRoot /srv/www/htdocs/server_www
ErrorLog /var/log/apache2/server_www.log
CustomLog /var/log/apache2/access_www.log combined
HostnameLookups Off
UseCanonicalName On
ServerSignature On
ScriptAlias /cgi-bin/ "/srv/www/htdocs/server_www/cgi-bin/"

AllowOverride None
Options +ExecCGI -Includes
Order allow,deny
Allow from all

Options Indexes FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all

Step 4: Hack the listen.conf file

The following file allows you to bind Apache to specific IP addresses and/or ports.

Please change the following lines here:

Listen - add the port or ports on which you would like to run you web pages
NameVirtualHost - this directive tells Apache on which IP address and, optionally, which port to listen for requests by clients containing the domain name in the HTTP header. The first argument can be a fully qualified domain name, but it is recommended to use the IP address. The second argument is the port and is optional. By default, port 80 is used and is configured via the Listen directive.

The file could look like this:

Listen 80
Listen 8090

Listen 443


To trouble shot you configuration, you should run the following command from the linux console:

tail –f /var/log/messages

Please do not forget the restart Apache after changing the configuration using the following commands (watch for errors):

service apache2 restart


/etc/init.d/apache2 restart"

April 2, 2009

Nagios - A Extensible Host and Service Monitoring

"7. Apache Security Preparation

Nagios has by default the authentication for the web interface activated.

That means after Nagios has been started and you try to access the web interface a login windows appears. Nagios has already a default user defined in the contacts.cfg (user: nagiosadmin) so we just have to create a apache password file where we store the password for it.

Do this with the following command and set the password to nagios:

# htpasswd2 -c /opt/nagios/etc/htpasswd.users nagiosadmin
Password: nagios

NOTE: LDAP can also be used for user authentication and requires just a view changes to the apache configuration. But the users still have to be defined in the contacts.cfg. LDAP is used just for verifying the password. I will cover this later.

NOTE: If you do not like to define every user in the contacts.cfg and security is not the case for you, you can modify the cgi.cfg and change all "authorized_for..." parameters to "authorized_for...=*". That will give all user that authenticate to the web server (or LDAP) all permissions even they do not exist in the contacts.cfg. After ny modification to the cgi.cfg restart Nagios.
8. Apache and Nagios Startup

So now all configurations are done and we can startup the applications.

During the Nagios installation an apache config file (nagios.conf) was placed in /etc/apache2/conf.d. So we first have to restart apache to activate that configuration.

# rcapache2 restart

After that we can start Nagios for the first time. In earlier version it was always a very good idea to do a configuration verify before restarting. Otherwise Nagios could be interrupted if there were errors in. In this new version now Nagios does this automatically when it is started or reloaded. If configuration errors were found the restart / reload operation is aborted and you get a information where the error is. Correct it and retry the operation.

As we use the default configuration and we made no mistakes Nagios should start up:

# /etc/init.d/nagios start

If you would like, add Nagios for automatic startup at system boot time:

# insserv nagios

9. Nagios Test

Now Nagios should be available at the following URL: http:///nagios

As you do have the authentication settings modified you should get an authentication window where you have to enter the user nagiosadmin with password nagios."

March 26, 2009

How to create a self-signed SSL Certificate


The following is an extremely simplified view of how SSL is implemented and what part the certificate plays in the entire process.

Normal web traffic is sent unencrypted over the Internet. That is, anyone with access to the right tools can snoop all of that traffic. Obviously, this can lead to problems, especially where security and privacy is necessary, such as in credit card data and bank transactions. The Secure Socket Layer is used to encrypt the data stream between the web server and the web client (the browser).

SSL makes use of what is known as asymmetric cryptography, commonly referred to as public key cryptography (PKI). With public key cryptography, two keys are created, one public, one private. Anything encrypted with either key can only be decrypted with its corresponding key. Thus if a message or data stream were encrypted with the server's private key, it can be decrypted only using its corresponding public key, ensuring that the data only could have come from the server.

If SSL utilizes public key cryptography to encrypt the data stream traveling over the Internet, why is a certificate necessary? The technical answer to that question is that a certificate is not really necessary - the data is secure and cannot easily be decrypted by a third party. However, certificates do serve a crucial role in the communication process. The certificate, signed by a trusted Certificate Authority (CA), ensures that the certificate holder is really who he claims to be. Without a trusted signed certificate, your data may be encrypted, however, the party you are communicating with may not be whom you think. Without certificates, impersonation attacks would be much more common.

Step 1: Generate a Private Key

The openssl toolkit is used to generate an RSA Private Key and CSR (Certificate Signing Request). It can also be used to generate self-signed certificates which can be used for testing purposes or internal usage.

The first step is to create your RSA Private Key. This key is a 1024 bit RSA key which is encrypted using Triple-DES and stored in a PEM format so that it is readable as ASCII text.

openssl genrsa -des3 -out server.key 1024

Generating RSA private key, 1024 bit long modulus
e is 65537 (0x10001)
Enter PEM pass phrase:
Verifying password - Enter PEM pass phrase:

Step 2: Generate a CSR (Certificate Signing Request)

Once the private key is generated a Certificate Signing Request can be generated. The CSR is then used in one of two ways. Ideally, the CSR will be sent to a Certificate Authority, such as Thawte or Verisign who will verify the identity of the requestor and issue a signed certificate. The second option is to self-sign the CSR, which will be demonstrated in the next section.

During the generation of the CSR, you will be prompted for several pieces of information. These are the X.509 attributes of the certificate. One of the prompts will be for "Common Name (e.g., YOUR name)". It is important that this field be filled in with the fully qualified domain name of the server to be protected by SSL. If the website to be protected will be, then enter at this prompt. The command to generate the CSR is as follows:

openssl req -new -key server.key -out server.csr

Country Name (2 letter code) [GB]:US
State or Province Name (full name) [Berkshire]:New Jersey
Locality Name (eg, city) [Newbury]:EastOrange
Organization Name (eg, company) [My Company Ltd]:Mycompany
Organizational Unit Name (eg, section) []:IT
Common Name (eg, your name or your server's hostname) []
Email Address []
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []:
An optional company name []:

Step 3: Remove Passphrase from Key

One unfortunate side-effect of the pass-phrased private key is that Apache will ask for the pass-phrase each time the web server is started. Obviously this is not necessarily convenient as someone will not always be around to type in the pass-phrase, such as after a reboot or crash. mod_ssl includes the ability to use an external program in place of the built-in pass-phrase dialog, however, this is not necessarily the most secure option either. It is possible to remove the Triple-DES encryption from the key, thereby no longer needing to type in a pass-phrase. If the private key is no longer encrypted, it is critical that this file only be readable by the root user! If your system is ever compromised and a third party obtains your unencrypted private key, the corresponding certificate will need to be revoked. With that being said, use the following command to remove the pass-phrase from the key:

cp server.key
openssl rsa -in -out server.key

The newly created server.key file has no more passphrase in it.

-rw-r--r-- 1 root root 745 Jun 29 12:19 server.csr
-rw-r--r-- 1 root root 891 Jun 29 13:22 server.key
-rw-r--r-- 1 root root 963 Jun 29 13:22

Step 4: Generating a Self-Signed Certificate

At this point you will need to generate a self-signed certificate because you either don't plan on having your certificate signed by a CA, or you wish to test your new SSL implementation while the CA is signing your certificate. This temporary certificate will generate an error in the client browser to the effect that the signing certificate authority is unknown and not trusted.

To generate a temporary certificate which is good for 365 days, issue the following command:

openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
Signature ok
subject=/C=US/ST=NewJersey/L=EastOrange/O=Mycompany Group/OU=IT/CN=Mycompanygroup/

Getting Private key

Step 5: Installing the Private Key and Certificate

When Apache with mod_ssl is installed, it creates several directories in the Apache config directory. The location of this directory will differ depending on how Apache was compiled.

chmod 755 /etc/httpd/conf/ssl.crt/server.crt
mv /etc/httpd/conf/ssl.crt/server.crt /etc/httpd/conf/ssl.crt/server1.crt
cp server.crt /etc/httpd/conf/ssl.crt/server.crt
chmod 600 /etc/httpd/conf/ssl.crt/server1.crt
chmod 600 /etc/httpd/conf/ssl.crt/server.crt

chmod 755 /etc/httpd/conf/ssl.key/server.key
mv /etc/httpd/conf/ssl.key/server.key /etc/httpd/conf/ssl.key/server1.key
cp server.key /etc/httpd/conf/ssl.key/server.key
chmod 600 /etc/httpd/conf/ssl.key/server1.key
chmod 600 /etc/httpd/conf/ssl.key/server.key

Step 6: Configuring SSL Enabled Virtual Hosts

SSLEngine on
SSLCertificateFile /etc/httpd/conf/ssl.crt/server.crt
SSLCertificateKeyFile /etc/httpd/conf/ssl.key/server.key
SetEnvIf User-Agent ".*MSIE.*" nokeepalive ssl-unclean-shutdown
CustomLog logs/ssl_request_log "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"

Step 7: Restart Apache and Test

/etc/init.d/httpd stop
/etc/init.d/httpd start"

March 20, 2009

InnoSetup - exclude files

"Specifies a list of patterns to exclude, separated by commas. This parameter cannot be combined with the external flag.

Patterns may include wildcard characters ("*" and "?"). Note that unlike the Source parameter, a simple Unix-style pattern matching routine is used for Excludes. Dots in the pattern are always significant, thus "*.*" will not exclude a file with no extension (instead, use just "*"). Also, question marks always match exactly one character, thus "?????" will not exclude files with names less than five characters long.

If a pattern starts with a backslash ("") it is matched against the start of a path name, otherwise it is matched against the end of a path name. Thus "foo" will only exclude a file named "foo" at the base of the tree. On the other hand, "foo" will exclude any file named "foo" anywhere in the tree.

The patterns may include backslashes. "foobar" will exclude both "foobar" and "subdirfoobar". "foobar" will only exclude "foobar".

Source: "*"; Excludes: "*.~*"
Source: "*"; Excludes: "*.~*,Temp*"; Flags: recursesubdirs

March 19, 2009

HOWTO: Automatically get svn revisions number under windows

"The example below shows how keywords in a template file are substituted in the output file.

// Test file for SubWCRev: testfile.tmpl

char *Revision = "$WCREV$";
char *Modified = "$WCMODS?Modified:Not modified$";
char *Date = "$WCDATE$";
char *Range = "$WCRANGE$";
char *Mixed = "$WCMIXED?Mixed revision WC:Not mixed$";
char *URL = "$WCURL$";

#if $WCMODS?1:0$
#error Source is modified

// End of file

After running SubWCRev.exe path\to\workingcopy testfile.tmpl testfile.txt, the output file testfile.txt would looks like this:

// Test file for SubWCRev: testfile.txt

char *Revision = "3701";
char *Modified = "Modified";
char *Date = "2005/06/15 11:15:12";
char *Range = "3699:3701";
char *Mixed = "Mixed revision WC";
char *URL = "

#if 1
#error Source is modified

// End of file

Reloading profile - how to reload Unix profile

"Use the following command to reload a unix profile (/etc/profile, ~/.profile, ~/.bash_profile ...):
$ . ~/.profile
$ . /etc/profile

Notice: . (dot) is a command that originates from source command. On some unix flavours (FreeBSD 6 for example) source command works still:
$ source ~/.profile
$ source /etc/profile

.profile settings overwrite those in /etc/profile. You can also use .bash_profile in your home directory to customize your bash shell's profile.

Basically, if you need to load shell variables from any file just run the . (dot) command, followed by space and (the absolute path is necessary) the path to the file. (Be carefull what file you're loading variables from because you meight overwrite some important environment variables and your system could become unstable). "

March 18, 2009

WORKED: Automated APPS to SD (EASY!!!!)

"1. Must have a rooted phone
2. Must have two partitions on the sd card (fat32 for everything, and ext2 for "expanding" the phone's memory).
3. Must have Android SDK installed (so that adb will work)

Ok.. So I got sick of all the commands running back and forth. I found that I'm wiping my phone several times testing out new things and didn't want to continuously put in all these commands to get the apps to sd thing to work.

Therefore, I created a file to automatically do it for me!!! I just run this file with the usb connected to the phone, and let it run all the commands.

I've attached a file "". Download this file and extract it to your c:

The folder it extracts NEEDS to be at c:/tmp

After extracting, navigate to the folder and double click on "appsToSD1.bat". Follow the instructions and you'll be on your way.

It worked for me.... ...but Im not sure if ext2 patitioon should be primary

...I made it primary and it worked...

$ df
/dev: 49520K total, 0K used, 49520K available (block size 4096)
/sqlite_stmt_journals: 4096K total, 0K used, 4096K available (block size 4096)
/system: 69120K total, 66180K used, 2940K available (block size 4096)
/system/modules: 1532K total, 1532K used, 0K available (block size 4096)
/system/xbin: 3172K total, 3172K used, 0K available (block size 4096)
/system/sd: 1033712K total, 5116K used, 1028596K available (block size 4096)
/data: 76544K total, 21760K used, 54784K available (block size 4096)
/cache: 69120K total, 1160K used, 67960K available (block size 4096)
/sdcard: 6172916K total, 588568K used, 5584348K available (block size 4096)

sdcard - 6GB
sd - 1GB

$ mount
rootfs on / type rootfs (ro)
tmpfs on /dev type tmpfs (rw,mode=755)
devpts on /dev/pts type devpts (rw,mode=600)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
tmpfs on /sqlite_stmt_journals type tmpfs (rw,size=4096k)
/dev/block/mtdblock3 on /system type yaffs2 (ro)
/dev/block/loop0 on /system/modules type cramfs (ro)
/dev/block/loop1 on /system/xbin type cramfs (ro)
/dev/mmcblk0p2 on /system/sd type ext2 (rw,noatime,nodiratime,errors=continue)
/dev/block/mtdblock5 on /data type yaffs2 (rw,nosuid,nodev)
/dev/block/mtdblock4 on /cache type yaffs2 (rw,nosuid,nodev)
/dev/block/mmcblk0p1 on /sdcard type vfat (rw,dirsync,nosuid,nodev,noexec,uid=1000,gid=1000, fmask=0711,dmask=0700,codepage=cp437,iocharset=iso 8859-1,utf8)

$ cd /data
$ ls -al
ls: can't open '.': Permission denied
$ su
# ls -al
drwxrwx--x 1 1000 1000 2048 Oct 5 07:41 .
drwxr-xr-x 12 0 0 0 Mar 18 17:31 ..
drwxrwxrwx 1 1000 1000 2048 Oct 5 07:41 anr
lrwxrwxrwx 1 0 0 14 Mar 18 17:30 app -> /system/sd/app
lrwxrwxrwx 1 0 0 22 Mar 18 17:30 app-private -> /system/sd/app-private
drwxrwx--x 1 1000 1000 2048 Oct 5 07:41 dalvik-cache
drwxrwx--x 1 1000 1000 2048 Oct 5 07:41 data
drwxrwx--x 1 2000 2000 2048 Oct 5 07:41 local
drwxrwx--- 1 0 0 2048 Oct 5 07:41 lost+found
drwxrwx--t 1 1000 9998 2048 Oct 5 07:41 misc
drwx------ 1 0 0 2048 Oct 5 07:41 property
drwxrwxr-x 1 1000 1000 2048 Oct 5 07:41 system
drwxr-xr-x 1 1000 1000 2048 Mar 15 12:15 tombstones

Launchy: The Open Source Keystroke Launcher

"Launchy is a free windows and linux utility designed to help you forget about your start menu, the icons on your desktop, and even your file manager.

Launchy indexes the programs in your start menu and can launch your documents, project files, folders, and bookmarks with just a few keystrokes!"

March 16, 2009

How To Install Firebug In Browsers Other Than Firefox

"Firebug Lite makes it possible to put Firebug into any web browser! You should be able to use it with Internet Explorer, Opera, Safari, Chrome, and any other browser that supports JavaScript. Firebug Lite is written in JavaScript, so you can include it on a webpage with the following code:

Or even better you can use this bookmarklet:

Firebug Lite"

Firefox: Tab Scope

"Shows a popup on tabs and enables you to preview and navigate tab contents through popup. Major features are:

* Real-time preview of tab contents
* Navigate (Back/Forward/Reload/Stop) through popup
* Scroll pages or frames in preview with mouse wheel
* Click links or buttons directly in preview"

Firefox: FaviconizeTab

"This extension adds a new "FaviconizeTab" option to the context menu of the tab.
When it is clicked, The width of the tab becomes small up to the size of favicon.
It returns to the former size when "FaviconizeTab" is clicked again."

March 15, 2009

HOWTO: Combining multiple Word documents into a single document.

"In Word 2000, do the following:

1. Open the first document

2. Move cursor to end of that document (or the next page after the end)

3. Go to "Insert" on the top menu, and from the dropdown list select "File", and browse to the next document.

Repeat steps 2 and 3 until all documents (chapters) have been added."

March 14, 2009

[SOLVED] Android: How to register an Android device without a sim or data plan

"When you start up the phone without a sim card, it goes into a locked screen that says "no sim card found", and you can't even get into the registration app. So the first step is to get around that screen. You have to connect to your phone with adb shell and get root access, and then type the following command:
sqlite3 /data/data/ "INSERT INTO system (name, value) VALUES ('device_provisioned', 1);"

And then reboot the phone. When it starts up again it will go into the registration screen instead of the locked "no sim card" screen.

This assumes that you have the sqlite3 binary on your phone. This binary is provided in RC30 v1.2. Alternatively, you could manually copy the binary to your phone with adb push, or put it on the sdcard and copy it to your phone. I can post a copy of just the sqlite3 binary if needed.


The second step is to enable and configure wifi, so that the registration process can connect to the google servers. In an

adb shell

session, type the following command:

am start -a android.intent.action.MAIN -n

This doesn't have to have root access to work. It works fine with the "shell" user that adb on non-modded phones runs as.

That command will bring up the settings page on your phone. From there, you can enable wifi and connect to your wifi network, and then proceed with registration as per normal"



March 12, 2009

Learn CSS Positioning in Ten Steps

"This tutorial examines the different layout properties available in CSS: position:static, position:relative, position:absolute, and float."

Greasemonkey on steroids for Android

"inserts custom JavaScript for any pages that match a URL pattern. Here's a script that would insert a "Scan Barcode" button like the one shown earlier:
view plaincopy to clipboardprint?

1. // ==UserScript==
2. // @name Scan barcode into
3. // @description Add button to search box to scan barcode
4. // @author Jeffrey Sharkey
5. // @include http://**
6. // ==/UserScript==
8. function generate(item) {
9. var helper = document.createElement('input');
10. helper.type = 'button';
11. helper.value = 'Scan barcode...';
12. helper.addEventListener('click', function(event) {
13. // use the intentHelper bridge to fire an intent to Barcode Scanner
14. // it's available in Market, or from
15. var result = window.intentHelper.startActivityForResult(JSON.stringify({
16. action:'',
17. category:['CATEGORY_DEFAULT']
18. }));
20. // parse the result we get back, and read the barcode from the extras
21. result = JSON.parse(result);
22. item.value = result['extras']['SCAN_RESULT'];
23. }, false);
24. return helper;
25. }
27. // find the 'query' form field
28. var items = document.body.getElementsByTagName('input');
29. for(i in items) {
30. var item = items[i];
31. if( == 'query') {
32. // build our 'scan barcode' helper button
33. // then insert it after the query form field
34. var helper = generate(item);
35. item.parentNode.insertBefore(helper, item.nextSibling);
36. }
37. } "

March 10, 2009

Auto Rotate for the Android Browser

"Installation Instructions (you must have root access):

* Download the updated Browser.apk
* Run the following from the command prompt to back up your current Browser file to your sdcard and install the new one:
o adb remount
o adb pull /system/app/Browser.apk BrowserBackup.apk
o adb push BrowserBackup.apk /sdcard
o adb shell rm /system/app/Browser.odex
o adb push Browser.apk /system/app"

WORKED: Rooting your G1

"On RC29 phones and lower, anything you type into your keyboard is also being run in a hidden console with root permissions. More information regarding that at the bottom of this post. But, to get root access, do the following:


1. Download recovery.img and copy it to your SD card (see the previous instructions on how to copy from your computer to your Phone's SD card).
2. Download the Hard SPL and copy the zip file to the SD card.
3. All files must be on the root of your SD card.
4. Restart your phone. Wait for your phone to start up fully and show the home screen.

5. After your phone starts up, at the home screen, hit the enter key twice, then type "telnetd" and hit enter again. (Yes, it will start up a contact search, don't worry. Just type it.)
6. Download an Android "Telnet" application from the Market and connect to localhost.
7. If you connect successfully, you will have a root prompt "#".
8. Type the following into Telnet (these commands will give you root access easier in the future):
* mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
* cd sdcard
* flash_image recovery recovery.img
* cat recovery.img > /system/recovery.img

Now you have root!"

Why should you root your Dream/G1?

" * You can install a full Linux distribution, like Debian.
* You can run applications that require root, like Screenshot and Auto Rotate your Browser and or any other application.
* You can install the latest Android build directly from the Android source tree.
* Customize your boot image.
* Create full backups of the state of your phone.
* Create custom ROMs.
* Install Applications to your SD Card to save space.
* Use your phone as a tether to connect your computer/laptop to the internet.
* Turn your phone into a wireless router that provides internet access.

Well, hopefully one of those reasons convinced you to get root access on your phone!"

HOW TO: downgrade, root and upgrade ANY G1/Dream (even Continental European)

- Micro SD card formated FAT32 (128 MB to 2 GB), Sandisc cards may not work (but worked for me).
- Connected Windows Mobile device (application unlocked)

SD Card:
- Format recommended

format F: /FS:FAT32 /A:4096

(Replace F: with your SD card reader drive letter.)

1. Insret SD card to WM device and connect it do desktop. WM has to be application unlocked.
2. Download QMAT (
3. Start QMAT and select Hardware Forensics -> Generate HTC Goldcard
4. Select Dream from the list of devices, Click "Get SD Card Serial from WINCE Device" and then "Save Goldcard Image to WINCE SD".
5. Copy DREAIMG.NBH to the root of sd (UK - RC7 recommended for our DREA110)
6. Power off the G1, put the card inside, hold camera button and press power button
7. Press power button to start flashing
8. To apply HardSPL, root & upgrade:
9. You don't need the GoldCard any more (HardSPL fixes it, you should be able to flash any image now). So format the SD once again or borrow to a friend to downgrade his G1. "

WORKED: Application unlocked WindowsMobile (WM) device

"1) Simply put the *.zip file with the regeditSTG.exe in it with ActiveSync into a folder on your phone (but not onto the memory card).
2) Unzip the file with the *.zip program that comes with your phone.
3) Now start regeditSTG.exe and change the following Registry Keys:

HKEY_LOCAL_MACHINE\Security\Policies\Policies0001001 = 2
-> Change the value data from 2 to 1

HKEY_LOCAL_MACHINE\Security\Policies\Policies0001005 = 16
-> Change the value data from 16 to 40

HKEY_LOCAL_MACHINE\Security\Policies\Policies0001017 = 128
-> Change the value data from 128 to 144

HKEY_LOCAL_MACHINE \Security\Policies\Policies
-> Add new value "0000101b": Dword = 1

After you have done all these steps close Regedit STG with the task manager (TaskMan) of your phone and reboot. That’s it.
Your phone is now totally application unlocked."

March 5, 2009

S-bit set on the user

"With Linux processes run under a user-ID. This gives them access to all resources (files etc...) that this user would have access to. There are 2 user IDs. The real user-ID and the effective user-ID. The effective user-ID is the one that determines the access to files. Save the following script under the name idinfo and make it executable (chmod 755 idinfo).

#idinfo: Print user information
echo " effective user-ID:"
id -un
echo " real user-ID:"
id -unr
echo " group ID:"
id -gn

When you run the script you will see that the process that runs it gets your user-ID and your group-ID:

effective user-ID:
real user-ID:
group ID:

When Tux runs your idinfo program then he gets a similar output that shows the process now running under the ID of tux. The output of the program depends only on the user that runs it and not the one who owns the file.

For security reasons the s-bit works only when used on binaries (compiled code) and not on scripts (an exception are perl scripts). Therefore we create a C-program that will call our idinfo program:

int main(){
/*secure SUID programs MUST
*not trust any user input or environment variable!! */

char *env[]={"PATH=/bin:/usr/bin",NULL};
char prog[]="/home/alice/idinfo";
if (access(prog,X_OK)){
fprintf(stderr,"ERROR: %s not executable\n",prog);
printf("running now %s ...\n",prog);
execle(prog,(const char*)NULL,env);


Compile the program with "gcc -o suidtest -Wall suidtest.c" and set the s-bit on the owner:

>chmod 4755 suidtest
>chmod u+s suidtest

Run it! What happens? Nothing ? Run it from a different user!

The file suidtest is owned by alice and has the s-bit set where normally the x is for the owner of the file. This causes the file to be executed under the user-ID of the user that owns the file rather than the user that executes the file. If Tux runs the program then this looks as follows:

>ls -l suidtest
-rwsr-xr-x 1 alice users 4741 Jan 1 21:53 suidtest

running now /home/alice/idinfo ...
effective user-ID:
real user-ID:
group ID:

As you can see this is a very powerful feature especially if root owns the file with s-bit set. Any user can then do things that normally only root can do. A few words on security. When you write a SUID program then you must make sure that it can only be used for the purpose that you intended it to be used. Always set the path to a hard-coded value. Never rely on environment variables or functions that use environment variables. Never trust user input (config files, command line arguments....). Check user input byte for byte and compare it with values that you consider valid.

When a SUID program is owned by root then both the effective and the real user-ID can be set (with setreuid() function).

Set-UID programs are often used by "root" to give ordinary users access to things that normally only "root" can do. As root you can e.g modify the suidtest.c to allow any user to run the ppp-on/ppp-off scripts on your machine.

Note: It is possible to switch off Suid when mounting a file system. If the above does not work then check your /etc/fstab. It should look like this:
/dev/hda5 / ext2 defaults 1 1
If you find the option "nosuid" there then this Suid feature is switched off. For details have a look at the man-page of mount. "

An Illustrated Guide to SSH Agent Forwarding

"In this paper, we'll present the various forms of authentication available to the Secure Shell user and contrast the security and usability tradeoffs of each. Then we'll add the extra functionality of agent key forwarding, we hope to make the case that using ssh public key access is a substantial win. "

March 2, 2009

Unicode characters up to uFFFF full list of character ranges.

"# Blocks-5.1.0.txt
# Date: 2008-03-20, 17:41:00 PDT [KW]
# Unicode Character Database
# Copyright (c) 1991-2008 Unicode, Inc.
# For terms of use, see
# For documentation, see UCD.html
# Note: The casing of block names is not normative.
# For example, "Basic Latin" and "BASIC LATIN" are equivalent.
# Format:
# Start Code..End Code; Block Name

# ================================================

# Note: When comparing block names, casing, whitespace, hyphens,
# and underbars are ignored.
# For example, "Latin Extended-A" and "latin extended a" are equivalent.
# For more information on the comparison of property values,
# see UCD.html.
# All code points not explicitly listed for Block
# have the value No_Block.

# Property: Block
# @missing: 0000..10FFFF; No_Block

0000..007F; Basic Latin
0080..00FF; Latin-1 Supplement
0100..017F; Latin Extended-A
0180..024F; Latin Extended-B
0250..02AF; IPA Extensions
02B0..02FF; Spacing Modifier Letters
0300..036F; Combining Diacritical Marks
0370..03FF; Greek and Coptic
0400..04FF; Cyrillic
0500..052F; Cyrillic Supplement
0530..058F; Armenian
0590..05FF; Hebrew
0600..06FF; Arabic
0700..074F; Syriac
0750..077F; Arabic Supplement
0780..07BF; Thaana
07C0..07FF; NKo
0900..097F; Devanagari
0980..09FF; Bengali
0A00..0A7F; Gurmukhi
0A80..0AFF; Gujarati
0B00..0B7F; Oriya
0B80..0BFF; Tamil
0C00..0C7F; Telugu
0C80..0CFF; Kannada
0D00..0D7F; Malayalam
0D80..0DFF; Sinhala
0E00..0E7F; Thai
0E80..0EFF; Lao
0F00..0FFF; Tibetan
1000..109F; Myanmar
10A0..10FF; Georgian
1100..11FF; Hangul Jamo
1200..137F; Ethiopic
1380..139F; Ethiopic Supplement
13A0..13FF; Cherokee
1400..167F; Unified Canadian Aboriginal Syllabics
1680..169F; Ogham
16A0..16FF; Runic
1700..171F; Tagalog
1720..173F; Hanunoo
1740..175F; Buhid
1760..177F; Tagbanwa
1780..17FF; Khmer
1800..18AF; Mongolian
1900..194F; Limbu
1950..197F; Tai Le
1980..19DF; New Tai Lue
19E0..19FF; Khmer Symbols
1A00..1A1F; Buginese
1B00..1B7F; Balinese
1B80..1BBF; Sundanese
1C00..1C4F; Lepcha
1C50..1C7F; Ol Chiki
1D00..1D7F; Phonetic Extensions
1D80..1DBF; Phonetic Extensions Supplement
1DC0..1DFF; Combining Diacritical Marks Supplement
1E00..1EFF; Latin Extended Additional
1F00..1FFF; Greek Extended
2000..206F; General Punctuation
2070..209F; Superscripts and Subscripts
20A0..20CF; Currency Symbols
20D0..20FF; Combining Diacritical Marks for Symbols
2100..214F; Letterlike Symbols
2150..218F; Number Forms
2190..21FF; Arrows
2200..22FF; Mathematical Operators
2300..23FF; Miscellaneous Technical
2400..243F; Control Pictures
2440..245F; Optical Character Recognition
2460..24FF; Enclosed Alphanumerics
2500..257F; Box Drawing
2580..259F; Block Elements
25A0..25FF; Geometric Shapes
2600..26FF; Miscellaneous Symbols
2700..27BF; Dingbats
27C0..27EF; Miscellaneous Mathematical Symbols-A
27F0..27FF; Supplemental Arrows-A
2800..28FF; Braille Patterns
2900..297F; Supplemental Arrows-B
2980..29FF; Miscellaneous Mathematical Symbols-B
2A00..2AFF; Supplemental Mathematical Operators
2B00..2BFF; Miscellaneous Symbols and Arrows
2C00..2C5F; Glagolitic
2C60..2C7F; Latin Extended-C
2C80..2CFF; Coptic
2D00..2D2F; Georgian Supplement
2D30..2D7F; Tifinagh
2D80..2DDF; Ethiopic Extended
2DE0..2DFF; Cyrillic Extended-A
2E00..2E7F; Supplemental Punctuation
2E80..2EFF; CJK Radicals Supplement
2F00..2FDF; Kangxi Radicals
2FF0..2FFF; Ideographic Description Characters
3000..303F; CJK Symbols and Punctuation
3040..309F; Hiragana
30A0..30FF; Katakana
3100..312F; Bopomofo
3130..318F; Hangul Compatibility Jamo
3190..319F; Kanbun
31A0..31BF; Bopomofo Extended
31C0..31EF; CJK Strokes
31F0..31FF; Katakana Phonetic Extensions
3200..32FF; Enclosed CJK Letters and Months
3300..33FF; CJK Compatibility
3400..4DBF; CJK Unified Ideographs Extension A
4DC0..4DFF; Yijing Hexagram Symbols
4E00..9FFF; CJK Unified Ideographs
A000..A48F; Yi Syllables
A490..A4CF; Yi Radicals
A500..A63F; Vai
A640..A69F; Cyrillic Extended-B
A700..A71F; Modifier Tone Letters
A720..A7FF; Latin Extended-D
A800..A82F; Syloti Nagri
A840..A87F; Phags-pa
A880..A8DF; Saurashtra
A900..A92F; Kayah Li
A930..A95F; Rejang
AA00..AA5F; Cham
AC00..D7AF; Hangul Syllables
D800..DB7F; High Surrogates
DB80..DBFF; High Private Use Surrogates
DC00..DFFF; Low Surrogates
E000..F8FF; Private Use Area
F900..FAFF; CJK Compatibility Ideographs
FB00..FB4F; Alphabetic Presentation Forms
FB50..FDFF; Arabic Presentation Forms-A
FE00..FE0F; Variation Selectors
FE10..FE1F; Vertical Forms
FE20..FE2F; Combining Half Marks
FE30..FE4F; CJK Compatibility Forms
FE50..FE6F; Small Form Variants
FE70..FEFF; Arabic Presentation Forms-B
FF00..FFEF; Halfwidth and Fullwidth Forms
FFF0..FFFF; Specials
10000..1007F; Linear B Syllabary
10080..100FF; Linear B Ideograms
10100..1013F; Aegean Numbers
10140..1018F; Ancient Greek Numbers
10190..101CF; Ancient Symbols
101D0..101FF; Phaistos Disc
10280..1029F; Lycian
102A0..102DF; Carian
10300..1032F; Old Italic
10330..1034F; Gothic
10380..1039F; Ugaritic
103A0..103DF; Old Persian
10400..1044F; Deseret
10450..1047F; Shavian
10480..104AF; Osmanya
10800..1083F; Cypriot Syllabary
10900..1091F; Phoenician
10920..1093F; Lydian
10A00..10A5F; Kharoshthi
12000..123FF; Cuneiform
12400..1247F; Cuneiform Numbers and Punctuation
1D000..1D0FF; Byzantine Musical Symbols
1D100..1D1FF; Musical Symbols
1D200..1D24F; Ancient Greek Musical Notation
1D300..1D35F; Tai Xuan Jing Symbols
1D360..1D37F; Counting Rod Numerals
1D400..1D7FF; Mathematical Alphanumeric Symbols
1F000..1F02F; Mahjong Tiles
1F030..1F09F; Domino Tiles
20000..2A6DF; CJK Unified Ideographs Extension B
2F800..2FA1F; CJK Compatibility Ideographs Supplement
E0000..E007F; Tags
E0100..E01EF; Variation Selectors Supplement
F0000..FFFFF; Supplementary Private Use Area-A
100000..10FFFF; Supplementary Private Use Area-B

# EOF"

February 28, 2009

Linux fdisk

"There was several suggestions to deal with partitions using linux fdisk on this forum but little explanation how. Since linux fdisk is much more complex than DOS fdisk it can be very confusing, especialy to inexpirienced windows user, so I decided to write something about metter.
First of all you will need some linux distribution. Let it be DSL (damn small linux). After you create bootable media, connect disk you want to format and boot.


Fdisk needs to know the name of device it will work with. It means that you will need to open root console antype : "fdisk ". In linux it goes like this:
IDE disks:

primary master - /dev/hda
primary slave - /dev/hdb
secondary master - /dev/hdc
secondary slave - /dev/hdd

scsi disks are seen as /dev/sda, /dev/sdb, /dev/sdc etc.

USB disks are seen as SCSI.

[note]Some older (pre 2.6 kernel) sets IDE DVD/CD burners to mount like scsi device. It is because of compatibility with burning software which worked only with scsi devices[note]


After you typed "fdisk ", you are in fdisk prompt. Typing "p" you can get list of partitions allready present. For example:

Command (m for help): p

Disk /dev/hda: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/hda1 * 1 9601 77120001 83 Linux
/dev/hda2 9602 9729 1028160 82 Linux swap

Command (m for help):

Here you can see (in this case) two primary partitions one ext3 (linux) and second "linux swap" type. Disk can be splited in 4 primary partitions of which one can be extended and they are named from /dev/hda1 to /dev/hda4. One of them can be extended partition which can contain logical partitions. Logical partitions are allways named from /dev/hda5 upward, /dev/hda6, /dev/hda7...
[on IDE disks you can have up to 63 logical partitions and on SCSI disk you can have it up to 15]


In fdisk prompt type "n".
Now, you have to choose what type your new partition will be.

Command (m for help): n
Command action
e extended
p primary partition (1-4)

After you choose type of partition, if there are more than one option you will be asked for partition number.
Next you will be asked for start cylinder and by default it is the lowest possible. I suggest leaving it as it is. Next you will need to enter end cylinder, default is last possible. Here you can enter values like +size or +sizeM or +sizeK or +sizeG where size is number of bytes, sizeG is GB, +sizeM is MB and sizeK is KB (+1024, +8192K, +13M, +4G).


Partition type needs to be defined. Type L, and listing will show.

Command (m for help): L

0 Empty 1c Hidden W95 FAT3 70 DiskSecure Mult bb Boot Wizard hid
1 FAT12 1e Hidden W95 FAT1 75 PC/IX be Solaris boot
2 XENIX root 24 NEC DOS 80 Old Minix c1 DRDOS/sec (FAT-
3 XENIX usr 39 Plan 9 81 Minix / old Lin c4 DRDOS/sec (FAT-
4 FAT16 <32M 3c PartitionMagic 82 Linux swap c6 DRDOS/sec (FAT-
5 Extended 40 Venix 80286 83 Linux c7 Syrinx
6 FAT16 41 PPC PReP Boot 84 OS/2 hidden C: da Non-FS data
7 HPFS/NTFS 42 SFS 85 Linux extended db CP/M / CTOS / .
8 AIX 4d QNX4.x 86 NTFS volume set de Dell Utility
9 AIX bootable 4e QNX4.x 2nd part 87 NTFS volume set df BootIt
a OS/2 Boot Manag 4f QNX4.x 3rd part 8e Linux LVM e1 DOS access
b W95 FAT32 50 OnTrack DM 93 Amoeba e3 DOS R/O
c W95 FAT32 (LBA) 51 OnTrack DM6 Aux 94 Amoeba BBT e4 SpeedStor
e W95 FAT16 (LBA) 52 CP/M 9f BSD/OS eb BeOS fs
f W95 Ext'd (LBA) 53 OnTrack DM6 Aux a0 IBM Thinkpad hi ee EFI GPT
10 OPUS 54 OnTrackDM6 a5 FreeBSD ef EFI (FAT-12/16/
11 Hidden FAT12 55 EZ-Drive a6 OpenBSD f0 Linux/PA-RISC b
12 Compaq diagnost 56 Golden Bow a7 NeXTSTEP f1 SpeedStor
14 Hidden FAT16 <3 5c Priam Edisk a8 Darwin UFS f4 SpeedStor
16 Hidden FAT16 61 SpeedStor a9 NetBSD f2 DOS secondary
17 Hidden HPFS/NTF 63 GNU HURD or Sys ab Darwin boot fd Linux raid auto
18 AST SmartSleep 64 Novell Netware b7 BSDI fs fe LANstep
1b Hidden W95 FAT3 65 Novell Netware b8 BSDI swap ff BBT

Command (m for help):

Now, type t, choose partition you created and enter code of type you want.
Type "w" and that's it, you are done. If you want fdisk to do nothing and forget changes you have done, type "q", fdisk will do nothing until you exit it.

You will see effect next time when you remount device.

Fdisk has loads of other useful functions (defining number of cylinders, heads or sectors for example) and list of his functions you can get with typing "m".

Hope this was helpfull and sorry for my englisch."