This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * 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); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * 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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?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"/> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * 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[]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| * 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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // check if gps is enabled | |
| locationManager.isProviderEnabled("gps"); | |
| // jump to gps setting | |
| startActivity(new Intent("android.settings.LOCATION_SOURCE_SETTINGS")); |