Skip to content →

diego.org Posts

MHTabBarController

Source: https://github.com/dougdiego/MHTabBarController

I forked MHTabBarController, which is a custom tab bar controller for iOS 5.  I forked it to accomplish two things.

  1. I wanted to use Quartz to draw my arrow instead of using images.
  2. I wanted my arrows to go down in addition to up.

To change the direction of the arrow, just set the pageIndicatorDirection variable like:


MHTabBarController *tabBarController = [[MHTabBarController alloc] init];
tabBarController.pageIndicatorDirection = PageIndicatorDirectionDown;

You can also easily modify the colors in MHTabBarController.m here:


// TAB Colors
#define SELECTED_TAB_COLOR UIColorFromRGB(0xCF785B)
#define SELECTED_TAB_TITLE_COLOR UIColorFromRGBWithAlpha(0xFFFFFF,0.5f)
#define DESELECTED_TAB_COLOR UIColorFromRGB(0xF5EECD)
#define DESELECTED_TAB_TITLE_COLOR UIColorFromRGB(0xAF553A)

ScreenshotDownScreenshotUp

Comments closed

devonThinkToDayOne – Apple Script

Source: https://github.com/dougdiego/devonThinkToDayOne

An AppleScript to export item(s) from DEVONthink to Day One.

Requirements

Download and install Day One Command Line Interface: http://dayoneapp.com/downloads/dayone-cli.pkg

Instructions

  1. Open DEVONthink and select the entries you want to export. You can select 1 or more than 1.
  2. Run the script. An entry will be made into Day One for each entry you selected in DEVONthink.

Configurations

To make the name of the DEVONthink entry a header in Day One, set the following property to ON:


property dayHeader : "OFF"

By default the create date of the entry in DEVONthink is used as the entry date in Day One. I organize my entries in DEVONthink like: 20110101-journal, 20110102-journal. If you use this format, set the following property to “ON”


property extractDateFromTitle : "OFF"

Note: you can modifiy the script if you use a diffent format for you note name.

Credit

The inspiration for this script came from:

Comments closed

evernoteToDayOne – AppleScript

Source: https://github.com/dougdiego/evernoteToDayOne

An AppleScript to export item(s) from Evernote to Day One.

This code was originally taken from the work done by Justin Lancy at: http://veritrope.com/code/export-evernote-items-to-day-one/

I added the property:


property extractDateFromTitle : "OFF"

I organized all my Evernote entries by the title rather than create date. I gave them a title like “20130718-notes”. When this property is set to “ON” the date is taken from the title instead of the create date.

Follow the link above for details on how to run the script.

Comments closed

iOS 7 App Redesigns

iOS 7 App Redesigns is a tumblr showing an iOS 7 redesign next to an iOS 6 design. Great site to get you think about how to update your own apps.

ios7_app_redesigns_instagram

Comments closed

Android App using only half the screen

When running an Android Application, I found that  it was only using half the screen as in the screenshot here.


I had this problem when the android:minSdkVersion was set to 3 in the AndroidManifest.xml

For example the following caused the issue:


<uses-sdk android:minSdkVersion="3" />

When I set it to something higher than 3, it used the whole screen. For example:


<uses-sdk android:minSdkVersion="8" />
Comments closed

Replacing the gasket on a front loading GE Washer

Recent our front loading GE washer started leaking all over the floor. At first it was not obvious what was causing the leak. Eventually I found that the gasket on the door was torn and water was leaking through it.

After searching online, this appeared to be a common problem with front loading GE washers.

Our model number is: WH08X10036 Given this I search for the right part number. These sites were helpful:

http://searspartsdirect.com
http://appliancepartspros.com
http://repairclinic.com

And I found the part number I needed was: WH08X10036.

I found the part on Amazon: GE WH08X10036 Gasket for Washer

Installing it was not easy. Luckily I found this helpful video: http://www.appliance-repair-it.com/GE-front-loader-washer.html

Comments closed

mbuzzy iPhone app

mbuzzy iPhone app

For the past couple of months, I’ve been working on an iPhone app for the social networking site: mbuzzy.com. It just went live into the App Store. Check it out: mbuzzy.app

Comments closed

Three20: Uploading an image to a server

Here’s an example to upload an image (or any data file) to a server:


– (void) uploadMediaForUserId: (NSString*) userId {
NSMutableDictionary *parameters = [NSMutableDictionary dictionaryWithObjectsAndKeys:
kAPIVersion, @"v",
nil];
// Media Name
if( TTIsStringWithAnyText(_mediaName)){
[parameters setObject:_mediaName forKey:@"n"];
}

// Media Description
if( TTIsStringWithAnyText(_mediaDescription)){
[parameters setObject:_mediaDescription forKey:@"d"];
}

// REST resource, where kMedia: @"/users/%@/media";
NSString *resource = [NSString stringWithFormat:kMedia, userId];

// Create the URL, where kServerURL is something like "http://www.dougdiego.com"
NSString *url = [kServerURL stringByAppendingFormat:@"%@?%@", resource, [parameters gtm_httpArgumentsString]];
// Resulting URL looks like: http://www.dougdiego.com/users/12345/media

TTURLRequest* request = [TTURLRequest requestWithURL:url delegate:self];
request.httpMethod = @"POST";

NSString * imageLocalUrl = [NSString stringWithFormat:@"documents://%@",_mediaFilename];
NSData *imageData = UIImageJPEGRepresentation(TTIMAGE(imageLocalUrl), 0.6);

// Set the media file with the parameter: file
[request addFile:imageData mimeType:@"image/jpeg" fileName:@"file"];

request.cachePolicy = TTURLRequestCachePolicyNoCache;
request.cacheExpirationAge = TT_CACHE_EXPIRATION_AGE_NEVER;

TTURLJSONResponse* response = [[TTURLJSONResponse alloc] init];
request.response = response;
TT_RELEASE_SAFELY(response);

[request send];
}
Comments closed

Three20: Swipe to delete

Need to implement Swipe to delete in your Three20 project? In order to do so, I added the 3 following methods to my datasource (TTListDataSource subclass):


– (BOOL) tableView: (UITableView *)tableView canEditRowAtIndexPath: (NSIndexPath *)indexPath {
return YES;
}

– (void)tableView:(UITableView *)tableView commitEditingStyle: (UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
[tableView beginUpdates];
if (editingStyle == UITableViewCellEditingStyleDelete) {
// Make sure the row is there to delete
if([_myModel.messages count] >= indexPath.row){
// Get the object to delete
MyObject* myObject = [[_myModel.messages objectAtIndex:indexPath.row] retain];

// Remove the object, in my case this makes an API call
[self removeObjectById: myobject.id];

// Remove the object from the array
[_myModel.messages removeObjectAtIndex:indexPath.row];

// clean up
TT_RELEASE_SAFELY(myObject);
}
// Delete the row from the UITableView
[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObjects:indexPath, nil] withRowAnimation:YES];
}
[tableView endUpdates];
}

– (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return [_myModel.messages count];
}

Note: before adding the numberOfRowsInSection method, I was getting NSInternalInconsistencyException errors.

Comments closed