Skip to content

Instantly share code, notes, and snippets.

@anujb
anujb / gist:4056794
Created November 12, 2012 00:00
UICollectionView in Practice
public class ProductViewController : UICollectionViewController {
ProductViewModel productViewModel;
public static NSString CellId = new NSString ("product_cell");
public ProductViewController () : base(new ProductCollectionLayout()) {
}
public override void ViewDidLoad () {
base.ViewDidLoad ();
@anujb
anujb / gist:2093402
Created March 19, 2012 03:38
mwc post-build error
/Library/Frameworks/Mono.framework/External/xbuild/Novell/Novell.MonoDroid.Common.targets: Error: Error executing task GenerateJavaStubs: AndroidManifest.xml : error 1: Unable to find library 'com.google.android.maps'.
@anujb
anujb / gist:1976020
Created March 5, 2012 02:07
dispatch_sync task extensions pattern
public static class Db {
public static bool IsInitialized { get; private set; }
static SQLiteConnection _db;
static SyncTaskScheduler _syncScheduler;
public static void Initialize(string dbPath) {
if(IsInitialized) return;
@anujb
anujb / gist:1918035
Created February 26, 2012 18:07
sqlite3_key error
at (wrapper managed-to-native) SQLite.SQLite3:Decrypt (intptr,string,int)
at SQLite.SQLiteConnection..ctor (System.String databasePath) [0x00031] in /Users/abhatia/projects/monotouch/playground/SqlCipherNet/SQLite.cs:108
at SqlCipherNetSample.AppDelegate.FinishedLaunching (MonoTouch.UIKit.UIApplication app, MonoTouch.Foundation.NSDictionary options) [0x00015] in /Users/abhatia/projects/monotouch/playground/SqlCipherNet/SqlCipherNetSample/SqlCipherNetSample/Main.cs:53
at (wrapper managed-to-native) MonoTouch.UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
at MonoTouch.UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x00042] in /Developer/MonoTouch/Source/monotouch/src/UIKit/UIApplication.cs:29
at SqlCipherNetSample.Application.Main (System.String[] args) [0x00000] in /Users/abhatia/projects/monotouch/playground/SqlCipherNet/SqlCipherNetSample/SqlCipherNetSample/Main.cs:32
@anujb
anujb / gist:1855900
Created February 17, 2012 22:40
btouch uitableviewdatasource inlined
using System;
using System.Drawing;
using MonoTouch.Foundation;
using MonoTouch.CoreFoundation;
using MonoTouch.UIKit;
using MonoTouch.ObjCRuntime;
using MonoTouch.CoreGraphics;
using MonoTouch.MapKit;
using MonoTouch.CoreLocation;
using MonoTouch.CoreAnimation;
@anujb
anujb / gist:1848523
Created February 16, 2012 22:53
btouch error
Undefined symbols for architecture i386:
"_kTileSize", referenced from:
-[KalMonthView initWithFrame:] in libKalUniversal.a(KalMonthView.o)
-[KalMonthView drawRect:] in libKalUniversal.a(KalMonthView.o)
-[KalMonthView sizeToFit] in libKalUniversal.a(KalMonthView.o)
-[KalTileView drawRect:] in libKalUniversal.a(KalTileView.o)
-[KalTileView resetState] in libKalUniversal.a(KalTileView.o)
-[KalMonthView initWithFrame:] in libKalUniversal.a(KalMonthView.o)
-[KalMonthView drawRect:] in libKalUniversal.a(KalMonthView.o)
-[KalMonthView sizeToFit] in libKalUniversal.a(KalMonthView.o)
@anujb
anujb / gist:1603316
Created January 12, 2012 21:40
LocationManager
public class LocationManager
{
public static CLLocationManager CoreLocationManager { get; set; }
public static CLLocation OldLocation { get; private set; }
public static CLLocation NewLocation { get; private set; }
public static CLHeading NewHeading { get; private set; }
static Action<CLLocationUpdatedEventArgs> _LocationUpdated;
public static Action<CLLocationUpdatedEventArgs> LocationUpdated {
@anujb
anujb / gist:1598280
Created January 12, 2012 02:57
device crash log
Incident Identifier: 651AFC03-1E6A-462D-B134-5BAD9D3A9C94
CrashReporter Key: 533b5800e07a9aede27ff4effd68e96158ef1720
Hardware Model: iPad2,1
Process: FireHouse [2905]
Path: /var/mobile/Applications/31F6EA63-F5B5-49A4-B78B-7A0EDE39FF6E/FireHouse.app/FireHouse
Identifier: FireHouse
Version: ??? (???)
Code Type: ARM (Native)
Parent Process: launchd [1]
@anujb
anujb / gist:1598213
Created January 12, 2012 02:36
btouch device crash
Incident Identifier: CE8D4697-1C9B-4D11-BAC4-279E424E364A
CrashReporter Key: 533b5800e07a9aede27ff4effd68e96158ef1720
Hardware Model: iPad2,1
Process: FireHouse [2530]
Path: /var/mobile/Applications/2708E047-0585-443A-A256-8B8087240DD0/FireHouse.app/FireHouse
Identifier: FireHouse
Version: ??? (???)
Code Type: ARM (Native)
Parent Process: launchd [1]
@anujb
anujb / gist:1524277
Created December 27, 2011 16:35
Background HttpServer
public override void DidEnterBackground(UIApplication application)
{
Console.WriteLine("Entered Background State...");
var taskId = UIApplication.SharedApplication.BeginBackgroundTask(() => { });
Thread task = new Thread(new ThreadStart(() => {
RegisterBackgroundHttpServer(application, taskId);
}));