Skip to content

Instantly share code, notes, and snippets.

@pawitp
pawitp / Android.mk
Created August 8, 2011 10:16
Possible LibCameraWrapper implementation for Galaxy S II
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES:= LibCameraWrapper.cpp
LOCAL_SHARED_LIBRARIES:= libdl libutils libcutils libcamera_client
LOCAL_MODULE := libcamera
LOCAL_MODULE_TAGS := optional
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_SRC_FILES:= LibCameraWrapper.cpp
LOCAL_SHARED_LIBRARIES:= libdl libutils libcutils libcamera_client
LOCAL_MODULE := libcamera
LOCAL_MODULE_TAGS := optional
128 Pawit 18 175.5 N
12 Phruksa 18 181.5 N
public class ExpandableArray {
private int[] m_array;
private int m_length;
public ExpandableArray() {
// First initialize to a capacity of 2
m_array = new int[2];
m_length = 0;
}
@pawitp
pawitp / calendar.sql
Created November 24, 2011 13:30
Bug report for astrid
CREATE TABLE Attendees (_id INTEGER PRIMARY KEY,event_id INTEGER,attendeeName TEXT,attendeeEmail TEXT,attendeeStatus INTEGER,attendeeRelationship INTEGER,attendeeType INTEGER);
CREATE INDEX attendeesEventIdIndex ON Attendees (event_id);
CREATE TABLE CalendarAlerts (_id INTEGER PRIMARY KEY,event_id INTEGER,begin INTEGER NOT NULL,end INTEGER NOT NULL,alarmTime INTEGER NOT NULL,creationTime INTEGER NOT NULL DEFAULT 0,receivedTime INTEGER NOT NULL DEFAULT 0,notifyTime INTEGER NOT NULL DEFAULT 0,state INTEGER NOT NULL,minutes INTEGER,UNIQUE (alarmTime, begin, event_id));
CREATE INDEX calendarAlertsEventIdIndex ON CalendarAlerts (event_id);
CREATE TABLE CalendarCache (_id INTEGER PRIMARY KEY,key TEXT NOT NULL,value TEXT);
CREATE TABLE CalendarMetaData (_id INTEGER PRIMARY KEY,localTimezone TEXT,minInstance INTEGER,maxInstance INTEGER);
CREATE TABLE Calendars (_id INTEGER PRIMARY KEY,account_name TEXT,account_type TEXT,_sync_id TEXT,dirty INTEGER,name TEXT,calendar_displayName TEXT,calendar_color INTEGER,calendar_ac
package pawitp.apartmentmanager;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
public class DbAdapter {
// You'll want to load this from resource
private static char[][] T9_MAP = new char[][] {
{ '0' }, // Default
{ '1' },
{ '2', 'a', 'b', 'c' },
{ '3', 'd', 'e', 'f' },
{ '4', 'g', 'h', 'i' },
{ '5', 'j', 'k', 'l' },
{ '6', 'm', 'n', 'o' },
{ '7', 'p', 'q', 'r', 's' },
import java.util.Scanner;
public class HexToDecWithBonus {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.print("Enter hex: ");
int dec = in.nextInt(16);
System.out.println("Decimal: " + dec);
System.out.println("Binary: " + Integer.toBinaryString(dec));
}
@pawitp
pawitp / Main.java
Created February 24, 2012 06:13
Question 1 - OCR
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
@pawitp
pawitp / main.c
Created October 21, 2012 01:44
UInput Event Injector (Inject Event into Android via kernel)
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include <linux/input.h>
#include <linux/uinput.h>
#define die(str, args...) do { \