Skip to content

Instantly share code, notes, and snippets.

/*
* Exercise 5-2. Write getfloat, the floating-point analog of getint. What
* type does getfloat return as its function value?
*/
#include <stdio.h>
#include <ctype.h>
int getch(void);
void ungetch(int);
/*
* Exercise 5-3. Write a pointer version of the function strcat that we
* showed in Chapter 2:strcat(s, t) copies the string t to the end of s.
*/
#include <stdio.h>
void my_strcat(char *s, char *t)
{
while (*s)
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<ImageView
android:src="@drawable/nba"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"/>
class RowAdapter extends CursorAdapter {
private final LayoutInflater mInflater;
public RowAdapter(Context context, Cursor c, boolean autoRequery) {
super(context, c, autoRequery);
mInflater = LayoutInflater.from(context);
}
public RowAdapter(Context context, Cursor c) {
@shaobin0604
shaobin0604 / tcpl-ex-4-12.c
Created November 23, 2009 10:02
tcpl-ex-4-12.c
/*
* Exercise 4-12. Adapt the ideas of printd to write a recursive version of
* itoa; that is, convert an integer into a string by calling a recursive
* routine.
*/
#include <math.h>
#include <string.h>
void itoa(int n, char s[])
/*
* Exercise 4-2. Extend atof to handle scientific notation of the form
* 123.45e-6 where a floating-point number may be followed by e or E and an
* optionally signed exponent.
*/
#include <stdio.h>
#include <ctype.h>
#define EPSILON 0.000001
/*
* Exercise 4-1. Write the function strindex(s,t) which returns the position
* of the rightmost occurrence of t in s, or -1 if there is none.
*/
#include <stdio.h>
#include <string.h>
int strindex(char s[], char t[]);
int main(void)
mParameters.removeGpsData();
mParameters.setJpegQuality(85);
mParameters.setGpsLongitude(longitude);
mParameters.setGpsLatitude(latitude);
mParameters.setGpsAltitude(altitude);
mParameters.setGpsTimestamp(timestamp);
camera.setParameters(mParameters);
camera.takePicture(null, null, jpegPictureCallback);
mParameters.remove("gps-latitude");
mParameters.remove("gps-longitude");
mParameters.remove("gps-altitude");
mParameters.remove("gps-timestamp");
mParameters.set("jpeg-quality", 85);
mParameters.set("gps-latitude", String.valueOf(25.050357818603516));
mParameters.set("gps-longitude", String.valueOf(102.70413208007813));
mParameters.set("gps-altitude", String.valueOf(1800.0));
mParameters.set("gps-timestamp", String.valueOf(
@shaobin0604
shaobin0604 / gist:233733
Created November 13, 2009 10:21
Android GPS Setting
// check if gps is enabled
locationManager.isProviderEnabled("gps");
// jump to gps setting
startActivity(new Intent("android.settings.LOCATION_SOURCE_SETTINGS"));