July 27, 2010

[SOLVED] PHP: How upload file using cURL?


<?php
$request_url = ‘http://www.akchauhan.com/test.php’;
$post_params['name'] = urlencode(’Test User’);
$post_params['file'] =@.'demo/testfile.txt’;
$post_params['
submit'] = urlencode(’submit’);

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $request_url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, $post_params);
$result = curl_exec($ch);
curl_close($ch);
?>


Source: How upload file using cURL?.

July 18, 2010

[SOLVED]Market Slowness and Accessibility on cyanogenmod's CM6 RC1

After upgrading to the latest Cyanogen I notices, that the Android Market is quiet slow and does not show my downloaded apps in the download section. 2 Fixes to repair this:

1) Take the following source and save in file named vending_preferences.xml

<?xml version='1.0' encoding='utf-8' standalone='yes' ?>
<map>
<boolean name="local_db_sync_required" value="false" />
<int name="SERVER_VERSION" value="1000" />
<string name="vending_tos_version">1.0.0</string>
<long name="MARKET_LAST_HEARTBEAT_TIMESTAMP" value="1271657433127" />
<long name="last_sync_time" value="1271659724720" />
<long name="last_tickle_id" value="1271657514775" />
<int name="reconciled_version" value="1710" />
<boolean name="metadata_paid_apps_enabled" value="true" />
<string name="vending_backup_state">vending</string>
<string name="vending_tos_version">1.0.0</string>
</map>

Now push to /data/data/com.android.vending/shared_prefs/vending_preferences.xml :

adb push vending_preferences.xml /data/data/com.android.vending/shared_prefs/vending_preferences.xml

Next you do in a terminal window (device or via adb shell):

su
cd /data/data/com.android.vending/cache
rm *
reboot

Source: MattiDroid - Mobile Blog: N1/G1: Market Slowness and Accessibility.

July 17, 2010

[SOLVED]How customize/extend/ Spinner

You will need to take control over what goes into the ListView and
Spinner. I have not experimented with these techniques on Spinner, but
on ListView, you will need to override getView() (on ArrayAdapter) or
newView() and bindView() (on CursorAdapter).
Here is a free excerpt from one of my books that demonstrates the technique:

http://commonsware.com/Android/excerpt.pdf

In your case, you would use your Typeface object to update the font used
by the TextView widgets in your rows.

In principle, you could do this via a wrapping adapter -- this would be
more reusable but a bit slower. I have an AdapterWrapper base class here:

http://github.com/commonsguy/cwac-adapter

and some projects that use it here:

http://github.com/commonsguy/cwac-endless
http://github.com/commonsguy/cwac-thumbnail


You also need to override getDropDownView().

Source: How to change the Typeface of ListView and Spinner - Android Beginners Google Groups.

July 7, 2010

[SOLVED] Edit SQLite database of your app from your PC

Very nice solution to browse and edit the SQLite database file of your app directly from your PC.

  1. Download

  2. Set right path in settings.ini

  3. start it


java -jar AndroidDBEditor.jar


Or you can create small batch file AndroidDBEditor.bat
@echo off
rem set current path
set CURRENT_PATH=%~dp0

rem replace slashes
set CURRENT_PATH=%CURRENT_PATH:\=/%

echo sqliteeditorpath=%CURRENT_PATH%sqlitebrowser.exe > settings.ini
rem start app
java -jar AndroidDBEditor.jar

Android DB Editor - troido.de its all about android.

July 1, 2010

[SOLVED] Set right permissions for svn repository


Additionally you should set umask 002 while working with a repository so that all new files will be writable by owner and group. This is made mandatory by creating a wrapper script for svn and svnserve:



mv /usr/bin/svn /usr/bin/svn.orig &&
mv /usr/bin/svnserve /usr/bin/svnserve.orig &&
cat >> /usr/bin/svn << "EOF"
#!/bin/sh
umask 002
/usr/bin/svn.orig "$@"

EOF
cat >> /usr/bin/svnserve << "EOF"
#!/bin/sh
umask 002
/usr/bin/svnserve.orig "$@"

EOF
chmod 0755 /usr/bin/svn{,serve}



Source: Running a Subversion Server.

[SOLVED] Fix default protocol (http...) association in WIndows


Setting default browser manually


You can manually set the default browser by selecting it as the the default program for individual file types and protocols, as follows:




  • Windows XP and earlier: Open the Control Panel from the Windows Start menu.

    • In Windows 2000 and earlier, or if Windows XP is using the Control Panel "Classic View": Click on "Folder Options -> File Types".

    • In Windows XP, if using the Control Panel "Category View": Click on "Performance and Maintenance". Then, click on "File Types" in the left column under the heading "See Also".



  • Windows 7 and Vista: Click the Start button, open "Default Programs" and then click "Associate a file type or protocol with a program". For detailed instructions, see the Microsoft article here for Vista or here for Windows 7. Note: On Windows Vista (or above), you may be unable to associate the HTTP HTTPS or FTP protocols with SeaMonkey because it does not appear as an available option. See this forum topic for additional information.


Assign the following protocols and file types to the browser you wish to set as default:




  • URL:HyperText Transfer Protocol (HTTP protocol)

  • URL:HyperText Transfer Protocol with Privacy (HTTPS protocol)

  • URL:File Transfer Protocol {FTP protocol)

  • HTML File

  • HTM File (optional)


In Windows XP and earlier, you can find the URL protocols listed above in File Types, under extension "N/A" or "(NONE)".




Source: Default browser - MozillaZine Knowledge Base.