Apr
22
2012

jQuery Autocomplete with ASP.NET



I rethought the ChickenPing recipe cloud ‘Add Recipe’ form at the weekend, and one thing which I got hung up on was jQuery’s autocomplete with ASP.NET.

I was using a tag cloud plugin which acts as a proxy for an autocomplete TextBox. There were two main problems, first is getting ASP.NET to serve JSON instead of a SOAP wrapper, and second is getting the actual response out of the JSONP wrapped outer response.

Autocomplete can’t quote bridge the gap on it’s own, so you need to firstly handle the actual passing of the request with source: function(request, respond), then parse the inner result with success: function(response) { respond(response.d);
Read more »

Mar
1
2012

Pressable Bar Buttons with addObserver



Posted in iOS

While implementing a wooden skin for ChickenPing, one thing I wasn’t happy with was the fact the text position on skinned navigation bar buttons didn’t change when tapped, as shown below.

Pressed/unpressed states

Read more »

Jan
11
2012

Finding Next Available Name in Objective-C



Posted in iOS

Useful method for finding the next available unique name in a batch of strings.

Eg: give it A list of { “Name”, “Name 1″, “Name 2″ } and it will return “Name 3″.

Read more »

Jan
3
2012

Internal Subnav with BlogEngine.NET



Posted in ASP.NET

One of the great ASP.NET web apps I’ve started using is BlogEngine.NET, a fairly simple yet powerful CMS. While it handles basic CMS type functionality without problems, there are something which it doesn’t make particularly easy, such as displaying navigation trees.

This can be largely overcome by extending some of the controls which BlogEngine ships with, such as the post list. I changed this to display a list of sub pages for the current page. Once you set a page’s parent page, the subnav is rendered on the masterpage.

Read more »

Dec
25
2011

Improved componentsJoinedByString:



Posted in iOS

To format list of categories, ingredients etc in a more readable way for ChickenPing, I use a function which joins a list of strings using a separator and a final separator. Eg:

    NSArray *items = [[NSArray alloc] initWithObjects:@"Item1", @"Item2", @"Item3", nil];
    NSString *joined = [Utils implode:items withSeperator:@", " trimStrings:true lastSeparator:@" and "];
    // returns "Item1, Item2 and Item3"

It’s more flexible than NSArraycomponentsJoinedByString: because it includes an optional last separator and the option to trim strings. Code is below.

Read more »

Nov
26
2011

jQuery Collapsible Panel Plugin



Posted in JavaScript

One of the things I find myself constantly doing with jQuery is making divs expand and collapse based on clicks on other elements. Collapsible panels are a great way of achieving progressive disclosure. I got sick of writing the same code on multiple pages so I wrote a plugin instead.

This creates an accordian style header which expands a linked panel when clicked.

Demo
Download
Read more »

Nov
6
2011

Zipcode distance matching with SQL Server



Posted in Programming

I recently needed to add a nearest postcode/zip lookup using SQL Server based on latitude and longitude. This finally gave me a chance to play around with the Geography datatype in SQL Server 2008.

There are various places to source data from. This usually depends how much information you get, but 10 minutes of googling found me 60000 city/state/zip/lat/long records. For reference, my table looks like this:

CREATE TABLE [dbo].[ZipCodes](
	[Zip] [nvarchar](20) NOT NULL,
	[City] [nvarchar](100) NOT NULL,
	[State] [nvarchar](100) NOT NULL,
	[Latitude] [FLOAT] NOT NULL,
	[Longitude] [FLOAT] NOT NULL,
	[Timezone] [INT] NOT NULL,
	[IsDST] [bit] NOT NULL,
 CONSTRAINT [PK_ZIpCodes] PRIMARY KEY CLUSTERED 
(
	[Zip] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

Read more »

Oct
16
2011

Pagination and Delegates in a UITableView



Posted in iOS

I recently needed to create a table view where the user could scroll to the bottom to load more data, similar to Facebook’s ‘pull to refresh’. This shows a loading indicator while more data is retrieved. To do this I used a delegate which is implemented by a custom table view cell.
Read more »

Oct
1
2011

DevExpress Scheduler: ID of Repeating Appointment



Posted in ASP.NET

Since I started using the DevExpress Scheduler a few weeks back I’ve found a few limitations in the 2011 version. The killer for me was the lack of appointment IDs for recurring appointments.
Read more »

Jul
28
2011

iOS App Signing Errors



Posted in iOS

For the last day, I’ve been on the brink of pulling my hair out trying to fix a bizarre error when trying to deploy an app to my iPhone. Everything worked fine in the simulator, but when I tried to deploy it to the device, I kept getting “The entitlements specified in your application’s Code Signing Entitlements file do not match those specified in your provisioning profile.”

Read more »



Page 1 of 3212345...102030...Last »