February 20, 2010

[SOLVED] Android: Get File Path of Gallery Image



  1. // To open up a gallery browser

  2. Intent intent = new Intent();

  3. intent.setType("image/*");

  4. intent.setAction(Intent.ACTION_GET_CONTENT);

  5. startActivityForResult(Intent.createChooser(intent, "Select Picture"),1);


  6. // To handle when an image is selected from the browser, add the following to your Activity

  7. @Override

  8. public void onActivityResult(int requestCode, int resultCode, Intent data) {


  9. if (resultCode == RESULT_OK) {


  10. if (requestCode == 1) {


  11. // currImageURI is the global variable I'm using to hold the content:// URI of the image

  12. currImageURI = data.getData();

  13. }

  14. }

  15. }


  16. // And to convert the image URI to the direct file system path of the image file

  17. public String getRealPathFromURI(Uri contentUri) {


  18. // can post image

  19. String [] proj={MediaStore.Images.Media.DATA};

  20. Cursor cursor = managedQuery( contentUri,

  21. proj, // Which columns to return

  22. null, // WHERE clause; which rows to return (all rows)

  23. null, // WHERE clause selection arguments (none)

  24. null); // Order-by clause (ascending by name)

  25. int column_index = cursor.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);

  26. cursor.moveToFirst();


  27. return cursor.getString(column_index);

  28. }



Android Snippets: Get File Path of Gallery Image.

[SOLVED] Android: Save bitmap to location


try {
     
FileOutputStream out = new FileOutputStream(filename);
     bmp
.compress(Bitmap.CompressFormat.PNG, 90, out);
} catch (Exception e) {
    e
.printStackTrace();
}


Android : Bitmap save to location - Stack Overflow.

February 9, 2010

[SOLVED] Tracking events are not available for this shipment

If you getting "Tracking events are not available for this shipment" in "Previous Shipments" by Borderlinx.com.

Just chat with support and get your DHL tracking number ;)

February 5, 2010

[SOLVED] Fix Broken cynogenmod upgrade on G1

I have broke my cynogenmod installation - no google apps . After I tried to repair installation with HTC repair image I got black schreen on boot.

With this tutorial a repapaired my G1. Thank you guys for it.

Full Update Guide - G1/Dream Firmware to CyanogenMod - CyanogenMod Wiki.

[SOLVED] Starting XEN control daemon - proxy_arp: No such file or directory

Starting XEN control daemon: xend/etc/xen/scripts/network-route: line 27: /proc/sys/net/ipv4/conf/eth/proxy_arp: No such file or directory
/etc/xen/scripts/network-route: line 27: /proc/sys/net/ipv4/conf/eth/proxy_arp: No such file or directory
/etc/xen/scripts/network-route: line 27: /proc/sys/net/ipv4/conf/eth/proxy_arp: No such file or directory

Finally I had spare time to work on this problem. I learned that all I
had to do was to set the device to use explicitly in

/etc/xen/xend-config.sxp:
(network-script 'network-route netdev=eth0')

I guess in Xen <3.2 eth0 was the default setting.

Solved for me.


via Debian Bug report logs - #477525.

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
Press ENTER
Type: Reboot
Press ENTER


If this doesn't work, you can also try

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

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


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

// Use jQuery via $j(...)
$j(document).ready(function(){
$j("div").hide();
});

// Use Prototype with $(...), etc.
$('someid').hide();
</script>
</head>
<body></body>
</html>


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
Output:



Stopping MySQL database server: mysqld.

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


# mysqld_safe --skip-grant-tables &
Output:



[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
Output:



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.

mysql>

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
Output:



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);
sendIntent
.setType("plain/text");
emailIntent.putExtra(Intent.EXTRA_EMAIL, new String[] { "user@host.com" });
sendIntent
.putExtra(Intent.EXTRA_SUBJECT, "Photo");
sendIntent
.putExtra(Intent.EXTRA_STREAM, Uri.parse("file:///sdcard/dcim/Camera/filename.jpg"));
sendIntent
.putExtra(Intent.EXTRA_TEXT, "Enjoy the photo");
startActivity
(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. */
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);

//---change to landscape mode---
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
}
}

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

setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);




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. */
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.main);

/* 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);
initListView();
}

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. */
refreshFavListItems();

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

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

}


});
/*mFavList.setOnItemLongClickListener( new AdapterView.OnItemLongClickListener
(){
@Override
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
// ===========================================================

@Override
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()) {
case CONTEXTMENU_DELETEITEM:
/* Get the selected item out of the Adapter by its position. */
Favorite favContexted = (Favorite) mFavList.getAdapter()
.getItem(menuInfo.position);
/* Remove it from the list.*/
fakeFavs.remove(favContexted);

refreshFavListItems();
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.

December 15, 2009

Getting Things Done with Thunderbird

Labels

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 com.google.android.apps.maps

that let me uninstall and install the new maps.


forum.xda-developers.com

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:
    $string="ThisXlineXhasXsomeXx'sXinXit":
$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";


perl.com

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:1.8.1.23) Gecko/20090812 Lightning/0.9 Thunderbird/2.0.0.23
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:1.9.1.5) 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.

Anleitung:

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\etfsboot.com" -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.

social.answers.microsoft.com

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.



image



● ● ●" beerpla.net