Skip to content

Instantly share code, notes, and snippets.

View ChrisRisner's full-sized avatar

Chris Risner ChrisRisner

View GitHub Profile
- (void)fetchedData:(NSData *)responseData {
NSError* error;
//Build a JSON object from the response Data
NSArray* json = [NSJSONSerialization
JSONObjectWithData:responseData //1
options:kNilOptions
error:&error];
//Go through each POI in the JSON data and pull out the important fields
@ChrisRisner
ChrisRisner / Constants.h
Created September 14, 2012 18:36
GeoDemo-ios3
@interface Constants : NSObject
#define kBgQueue dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0)
extern NSString *kGetPOIUrl;
extern NSString *kGetSASUrl;
extern NSString *kAddPOIUrl;
extern NSString *kContainerName;
@end
- (IBAction)tapPostPOI:(id)sender {
UIImage *image = imageView.image;
NSData *data = UIImagePNGRepresentation(image);
//Just pass the call over to our generic serviceCaller
[serviceCaller postToUrl:sasURL
withBody:data andPostType:@"PUT" andContentType:@"image/jpeg" withCallback:^(NSString *response) {
//This is the callback code that the ServiceCaller will call upon success
labelSasUrl.text = response;
if ([response isEqualToString:@""])
@ChrisRisner
ChrisRisner / Constants.h
Created September 14, 2012 21:56
GeoDemo-Android-1
public class Constants {
public static final String kFindPOIUrl = "http://yoursubdomain.azurewebsites.net/api/Location/FindPointsOfInterestWithinRadius";
}
@ChrisRisner
ChrisRisner / add_poi.xml
Created September 21, 2012 02:56
GeoDemo-Android-2
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/scrollview"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:id="@+id/lblAddPoiHeader"
@ChrisRisner
ChrisRisner / add_poi_getsas.java
Created September 21, 2012 03:54
geodemo-android-3
private class GetSASTask extends AsyncTask<String, Void, String> {
@Override
protected String doInBackground(String... params) {
getSas();
return _blobImagePostString;
}
/***
* Handles results of getting SAS.
* This happens on the UI Thread
*/
@ChrisRisner
ChrisRisner / TodoDetailsViewController.h
Created September 21, 2012 21:18
MobileServices and iOS 2
@class TodoDetailsViewController;
@protocol TodoDetailsViewControllerDelegate <NSObject>
- (void)todoDetailsViewController:(TodoDetailsViewController *)controller didFinishWithTodo:(NSString *)todoId andTodoText:(NSString *)todoText;
@end
@interface TodoDetailsViewController : UIViewController<NSURLConnectionDelegate, UIImagePickerControllerDelegate, UINavigationControllerDelegate> {
@private
NSNumber* todoId;
NSMutableData* receivedData;
@ChrisRisner
ChrisRisner / activity_details_vars.java
Created September 24, 2012 19:08
MobileServices and Android 2
private Button mBtnSaveTodo;
private Button mBtnPickImage;
private Button mBtnMarkTodoComplete;
private TextView mLblTodoText;
private EditText mTxtTodoText;
private boolean mIsAddingNewTodo;
private String mTodoText;
private int mTodoId;
private ImageView mImageView;
private Uri mImageUrl;
#import <UIKit/UIKit.h>
@interface SecondViewController : UIViewController
@end
@ChrisRisner
ChrisRisner / update_primary_keys.sql
Created October 2, 2012 01:57
Create Mobile Service with Existing db
ALTER TABLE fakeblog.entries
ADD PRIMARY KEY (id);
ALTER TABLE fakeblog.Users
ADD PRIMARY KEY (id);