January 25, 2010

Linux commands

Find the test in files, show fund lines with line number and highlight it
$ find . -name '*.php' -exec grep -Hn --color "TEXT_TO_FIND" {} \;

January 19, 2010

[SOLVED] Bypassing SSL errors in Thunderbird

If you getting "Secure Connection Failed" on your network calender wich is added via https url.
Set up exceptions by going to:

Tools | Options | Advanced | Certificates | View Certificates | Servers | Add Exception

via Bypassing SSL errors in Thunderbird 2.x on Jay Paroline - Grooveshark Dev.

January 17, 2010

[SOLVED] How to leave domU console for dom0

To log in on that virtual machine run:

xm console xen1.example.com

Type CTRL+] if you are at the console, or CTRL+5 if you're using PuTTY to go back to dom0

via The Perfect Xen 3.1.0 Setup For Debian Etch (i386) - Page 3 | HowtoForge - Linux Howtos and Tutorials.

January 16, 2010

[SOLVED] "Open" and "Uninstall" Greyed Out in Android Market

With ROOT Access:

1) Terminal Emulator
Type: rm -r data/data/com.android.vending/cache
Type: Reboot

If this doesn't work, you can also try

2) Terminal Emulator
Type: rm -r data/data/com.android.vending/databases/*
Type: Reboot

You need to reboot because the Market App is always resident and will not update its cache and databases until it is restarted

via "Open" and "Uninstall" Greyed Out - Android Market Help.

January 7, 2010

[SOLVED]Using jQuery with Other Libraries

<script src="prototype.js"></script>
<script src="jquery.js"></script>
var $j = jQuery.noConflict();

// Use jQuery via $j(...)

// Use Prototype with $(...), etc.

via Using jQuery with Other Libraries - jQuery JavaScript Library.

January 6, 2010

[SOLVED] Syntax highlighting CakePHP using Eclipse

  1. Open your Eclipse workspace;

  2. Click on Window | Preferences;

  3. On the Preference Dialog expand the General node on the tree;

  4. Click on Content-Types under General;

  5. On the right panel under Content-Types, expand the Text node;

  6. Select PHP Source under the Text node;

  7. You’ll see the list of files associated on the list below e.g. File-Associations;

  8. Click on the Add button and type the fie extension e.g. *.ctp under file-type;

  9. Click on Ok to add the file-type;

  10. Click on Ok to close the Preference Window;


Syntax highlighting CakePHP using Eclipse « Rio Bautista’s TechLog.

January 4, 2010

[SOLVED]Recover MySQL root Password

Step # 1 : Stop mysql service

# /etc/init.d/mysql stop

Stopping MySQL database server: mysqld.

Step # 2: Start to MySQL server w/o password:

# mysqld_safe --skip-grant-tables &

[1] 5988
Starting mysqld daemon with databases from /var/lib/mysql
mysqld_safe[6025]: started

Step # 3: Connect to mysql server using mysql client:

# mysql -u root

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1 to server version: 4.1.15-Debian_1-log

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.


Step # 4: Setup new MySQL root user password

mysql> use mysql;
mysql> update user set password=PASSWORD("NEW-ROOT-PASSWORD") where User='root';
mysql> flush privileges;
mysql> quit

Step # 5: Stop MySQL Server:

# /etc/init.d/mysql stop

Stopping MySQL database server: mysqld
STOPPING server from pid file /var/run/mysqld/mysqld.pid
mysqld_safe[6186]: ended

[1]+ Done mysqld_safe --skip-grant-tables

Step # 6: Start MySQL server and test it

# /etc/init.d/mysql start
# mysql -u root -p

Recover MySQL root Password.

January 3, 2010

Loco Roco

Есть такая добрая игра на PSP. Очень хочется поиграть ;).

Смахивает слегка на Gish

[SOLVED]Attach a file from SD Card to email

Intent sendIntent = new Intent(Intent.ACTION_SEND);
emailIntent.putExtra(Intent.EXTRA_EMAIL, new String[] { "user@host.com" });
.putExtra(Intent.EXTRA_SUBJECT, "Photo");
.putExtra(Intent.EXTRA_STREAM, Uri.parse("file:///sdcard/dcim/Camera/filename.jpg"));
.putExtra(Intent.EXTRA_TEXT, "Enjoy the photo");
(Intent.createChooser(sendIntent, "Email:"));

Trying to attach a file from SD Card to email - Stack Overflow.

[SOLVED] Set Screen Orientation Programmatically

There are times where you need to ensure that your application is displayed only in a certain orientation. For example, suppose you are writing a game that should only be viewed in landscape mode. In this case, you can programmatically force a change in orientation using the setRequestOrientation() method of the Activity class:

package net.learn2develop.OrientationAware;
import android.app.Activity;
import android.content.pm.ActivityInfo;
import android.os.Bundle;

public class Orientation extends Activity {
/** Called when the activity is first created. */
public void onCreate(Bundle savedInstanceState) {

//---change to landscape mode---

To change to portrait mode, use the ActivityInfo.SCREEN_ORIENTATION_PORTRAIT constant:


Developing Orientation-Aware Android Applications.

Creating a ContextMenu on a ListView

package org.anddev.contextmenusample;

import java.util.ArrayList;

import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.ContextMenu;
import android.view.View;
import android.view.MenuItem;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.View.OnCreateContextMenuListener;
import android.view.View.OnLongClickListener;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.AdapterView.AdapterContextMenuInfo;
import android.widget.AdapterView.OnItemLongClickListener;

public class ContextMenuSample extends Activity{

// ===========================================================
// Final Fields
// ===========================================================
protected static final int CONTEXTMENU_DELETEITEM = 0;

// ===========================================================
// Fields
// ===========================================================

protected ListView mFavList;
protected ArrayList<Favorite> fakeFavs = new ArrayList<Favorite>();

// ===========================================================
// "Constructors"
// ===========================================================

/** Called when the activity is first created. */
public void onCreate(Bundle icicle) {

/* Add some items to the list the listview will be showing. */
fakeFavs.add(new Favorite("John""nice guy"));
fakeFavs.add(new Favorite("Yasmin""hot girl"));
fakeFavs.add(new Favorite("Jack""cool guy"));

this.mFavList(ListView) this.findViewById(R.id.list_favorites);

private void refreshFavListItems() {
mFavList.setAdapter(new ArrayAdapter<Favorite>(this,
android.R.layout.simple_list_item_1, fakeFavs));

private void initListView() {
/* Loads the items to the ListView. */

/* Add Context-Menu listener to the ListView. */
mFavList.setOnCreateContextMenuListener(new OnCreateContextMenuListener() {

public void onCreateContextMenu(ContextMenu menu, View v,
ContextMenuInfo menuInfo) {
// TODO Auto-generated method stub
menu.add(0, CONTEXTMENU_DELETEITEM,0"Delete this favorite!");


/*mFavList.setOnItemLongClickListener( new AdapterView.OnItemLongClickListener
public boolean onItemLongClick(AdapterView<?> av, View v, int pos, long id) {
Log.i("Debug", "Log id "+id+" pos "+pos);
return false;


// ===========================================================
// Methods from SuperClass/Interfaces
// ===========================================================

public boolean onContextItemSelected(MenuItem aItem) {
AdapterContextMenuInfo menuInfo = (AdapterContextMenuInfo) aItem.getMenuInfo();

/* Switch on the ID of the item, to get what the user selected. */
switch (aItem.getItemId()) {
/* Get the selected item out of the Adapter by its position. */
Favorite favContexted = (Favorite) mFavList.getAdapter()
/* Remove it from the list.*/

return true/* true means: "we handled the event". */
return false;

// ===========================================================
// Inner and Anonymous Classes
// ===========================================================

/** Small class holding some basic */
protected class Favorite {

protected String name;
protected String kindness;

protected Favorite(String name, String kindness) {
this.name = name;
this.kindness = kindness;

/** The ListView is going to display the toString() return-value! */
public String toString() {
return name + " (" + kindness + ")";

public boolean equals(Object o) {
returninstanceof Favorite && ((Favorite) o).name.compareTo(name) == 0;

Creating a ContextMenu on a ListView :: anddev.org - Android Development Community | Android Tutorials.

[SOLVED] Grub on serial console

If you do not see any grub menu via your serial console.
Just check if you have in /boot/grub/menu.lst

the line with
gfxmenu (hd0,4)/message
just comment it.

Now, if you reboot your server, you will see the grub menu.