This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Data.SqlClient; | |
using System.Data; | |
using System.Collections.Generic; | |
namespace AdoUsageDemo | |
{ | |
// While I prefer to use LINQ for these types of database actions, we have some code | |
// in some of our applications that has been around for a while where we cannot take the | |
// time to upgrade them. So this is to demonstrate how to refactor older ADO.NET code in |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
This is a convenience class for storing login credentials | |
This depends on SFHFKeychainUtils from http://github.com/ldandersen/scifihifi-iphone/tree/master/security | |
and you must add Security.framework to your project | |
*/ | |
/********************************************** | |
//CredentialManager.h | |
#import <Foundation/Foundation.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Converts properties to synthesizers | |
1. :%s/@property (\(.*, \|\).*)\s.*\s\**\(.*\);/@synthesize \2;/g | |
2. :%s/@property (\(.*, \|\).*)\s.*\s\**\(.*\);/@synthesize \2 = _\2;/g | |
Converts properties to release calls | |
3. :%s/@property (\(.*, \|\).*)\s.*\s\**\(.*\);/ [_\2 release]; _\2 = nil;/g | |
Example: | |
input: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using NUnit.Framework; | |
namespace NumberConversions | |
{ | |
[TestFixture] | |
public class ConversionTests | |
{ | |
private const string VALID_NUMBER = "12345"; | |
private const string INVALID_NUMBER = "BR549"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// need this to be able to run in .net 2.0. The result of this is to be sent up | |
// to the server by the client so that we can determine what versions of the | |
// .net framework that our users have installed | |
private string GetAvailableFrameworks() | |
{ | |
string frameworkRegistryPath = @"Software\Microsoft\.netframework"; | |
List<string> versions = new List<string>(); | |
RegistryKey key = Registry.LocalMachine.OpenSubKey(frameworkRegistryPath); | |
if (key == null) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace AppServer.Models | |
{ | |
/// <summary> | |
/// This is a generic server response container that provides a way to | |
/// transfer any serializable type between the client and the server with | |
/// meta info about the data being transferred | |
/// </summary> | |
/// <typeparam name="T">The type of the Payload Property</typeparam> | |
public class ServerResponse<T> | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.yourgwtapp.client.dto; | |
import com.google.gwt.core.client.JavaScriptObject; | |
public class ServerResponse<T extends JavaScriptObject> extends JavaScriptObject { | |
protected ServerResponse() { } | |
public final native T getPayload() /*-{ return this.Payload; }-*/; | |
public final native boolean getSuccess() /*-{ return this.Success; }-*/; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (NSDate *)convertXmlDate:(NSString *)xmlDate { | |
NSDateFormatter *dateFormat = [[NSDateFormatter alloc] init]; | |
[dateFormat setDateFormat:@"yyyy-MM-dd'T'HH:mm:ss.SSS"]; | |
NSDate *date = [dateFormat dateFromString:xmlDate]; | |
[dateFormat release]; | |
return date; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Foundation/Foundation.h> | |
@class MetaSearchService; | |
@protocol MetaSearchServiceDelegate <NSObject> | |
- (void)metaSearchComplete:(MetaSearchService *)service; | |
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import <Foundation/Foundation.h> | |
#import "ASIHTTPRequestDelegate.h" | |
#import "MetaSearchServiceDelegate.h" | |
extern NSString *const META_SEARCH_URL; | |
extern NSString *const META_SEARCH_SOAP; | |
extern NSString *const META_SEARCH_SOAP_ACTION; | |
@interface MetaSearchService : NSObject<ASIHTTPRequestDelegate,NSXMLParserDelegate> { | |
NSMutableString *currentString; |
OlderNewer