Skip to content

Instantly share code, notes, and snippets.

setListAdapter(new ArrayAdapter<string>(this, R.layout.list_item, strings) {
@Override
public View getView(int position, View convertView, ViewGroup parent) {
View row;
if (null == convertView) {
row = mInflater.inflate(R.layout.list_item, null);
} else {
row = convertView;
}
@sudar
sudar / yql.html
Created October 9, 2010 12:53
Code samples to access YQL. More details at http://sudarmuthu.com/blog/code-sample-to-access-yql
<html>
<head>
<title>YUI in YQL</title>
<script src="http://yui.yahooapis.com/3.4.1/build/yui/yui-min.js"></script>
<script type="text/javascript">
YUI().use('node', 'yql', function(Y) {
Y.YQL('SELECT * FROM upcoming.events WHERE location = "Bangalore"', function(r) {
// process the result json object
WebView wv = (WebView) findViewById(R.id.wv1);
@sudar
sudar / dotdeb.sh
Created January 25, 2011 16:48
Adding dotdeb repository to apt-get source list to install PHP 5.3.x. More details at http://sudarmuthu.com/blog/2011/01/25/installing-php-5-3-x-in-ubuntu-through-apt-get-or-aptitude.html
gpg --keyserver keys.gnupg.net --recv-key 89DF5277
gpg -a --export 89DF5277 | sudo apt-key add -
@sudar
sudar / gist:836170
Created February 20, 2011 18:17
.htaccess rule to change from date based permalinks to postname permalinks
RedirectMatch permanent ^/blog/[0-9]{4}/[0-9]{2}/[0-9]{2}/([a-z0-9-/]+) http://sudarmuthu.com/blog/$1
@sudar
sudar / AdjustVolume.java
Created March 5, 2011 10:27
Adjusting volume in Android. Explanation of the code can be found at http://sudarmuthu.com/blog/adjusting-the-volume-in-android-through-code
AudioManager audioManager = (AudioManager) getApplicationContext().getSystemService(Context.AUDIO_SERVICE);
@sudar
sudar / MediaPlayerServiceConnection.java
Created March 5, 2011 10:59
Finding the currently playing song in Android
/**
* The service connection class that allows you to talk to the MediaPlayer Service
*
* @author "Sudar Muthu (http://sudarmuthu.com)"
*
*/
private class MediaPlayerServiceConnection implements ServiceConnection {
public com.htc.music.IMediaPlaybackService mServiceHtc;
public com.android.music.IMediaPlaybackService mServiceAndroid;
<?php
require_once('geoplugin.class.php');
$geoplugin = new geoPlugin();
$geoplugin->locate();
echo get_posts_by_tag("{$geoplugin->city},$geoplugin->region}", 5);
?>
public class ConditionalCompile {
private static final Logger LOGGER = Logger.getLogger(ConditionalCompile.class);
private final static boolean doLogging = false;
public static void importantMethod( ) {
// Do some set up code.
if (doLogging) {
LOGGER.debug("Set up complete, beginning phases.");
}
// do first part.
ADK demo start
ADK Init
ADK protocol rev. 1
Accessory mode switch attempt
ADK Init
Acc.mode device detected
Endpoint Structure:
EP0: