February 25, 2010

[SOLVED]Android: Column span in TableLayout


<!-- snipped -->
<TableLayout android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:stretchColumns="*">
<TableRow>
<TextView android:id="@+id/info"
android:layout_span="3"
android:text="@string/info"
android:layout_gravity="center_horizontal" />
</TableRow>
<TableRow>
<Button android:id="@+id/button_add" android:text="+" />
<TextView android:text="@string/label" />
<TextView android:id="@+id/amount" />
</TableRow>
<!-- snipped -->
</TableLayout>
<!-- snipped -->


TableLayout supports column span on Android Development.

February 21, 2010

[SOLVED] Android: Hide the Title bar in an Android View


@Override
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);

requestWindowFeature(Window.FEATURE_NO_TITLE);
...


Hide the Title bar in an Android View by using the Window Class | mgmblog.com.

February 20, 2010

[SOLVED] Android: Save Image to Media Provider on Android




  1. Uri saveMediaEntry(String imagePath,String title,String description,long dateTaken,int orientation,Location loc) {


  2. ContentValues v = new ContentValues();


  3. v.put(Images.Media.TITLE, title);


  4. v.put(Images.Media.DISPLAY_NAME, displayName);


  5. v.put(Images.Media.DESCRIPTION, description);


  6. v.put(Images.Media.DATE_ADDED, dateTaken);


  7. v.put(Images.Media.DATE_TAKEN, dateTaken);


  8. v.put(Images.Media.DATE_MODIFIED, dateTaken) ;


  9. v.put(Images.Media.MIME_TYPE, "image/jpeg");


  10. v.put(Images.Media.ORIENTATION, orientation);




  11. File f = new File(imagePath) ;


  12. File parent = f.getParentFile() ;


  13. String path = parent.toString().toLowerCase() ;


  14. String name = parent.getName().toLowerCase() ;


  15. v.put(Images.ImageColumns.BUCKET_ID, path.hashCode());


  16. v.put(Images.ImageColumns.BUCKET_DISPLAY_NAME, name);


  17. v.put(Images.Media.SIZE,f.length()) ;


  18. f = null ;




  19. if( targ_loc != null ) {


  20. v.put(Images.Media.LATITUDE, loc.getLatitude());


  21. v.put(Images.Media.LONGITUDE, loc.getLongitude());


  22. }


  23. v.put("_data",imagePath) ;


  24. ContentResolver c = getContentResolver() ;


  25. return c.insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, v);


  26. }



Save Image to Media Provider on Android - Java - Snipplr.

[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.