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
@property (weak, nonatomic) IBOutlet UIActivityIndicatorView *AboutActivityIndicator; | |
@synthesize AboutActivityIndicator = _aboutActivityIndicator; | |
[_aboutActivityIndicator startAnimating]; | |
[_aboutActivityIndicator stopAnimating]; |
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
1. Here’s your data controller class | |
#import <Foundation/Foundation.h> | |
#import <sqlite3.h> | |
#import "UserObject.h" | |
@interface DataController : NSObject | |
{ | |
sqlite3 *databaseHandle; | |
} | |
-(void)initDatabase; |
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
NSData *jsonData = [fixJSONString dataUsingEncoding:NSUTF8StringEncoding]; | |
NSMutableArray *jsonArray = [NSJSONSerialization JSONObjectWithData:jsonData options:NSJSONReadingMutableContainers error:&parseError]; | |
if (jsonArray) | |
{ | |
NSMutableArray *userObjects = [[NSMutableArray alloc]init]; | |
for(NSDictionary *item in jsonArray) { | |
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
//in your header | |
@property (weak, nonatomic) IBOutlet UIButton *ProfilePictureButton; | |
UIViewController <UIImagePickerControllerDelegate, UIActionSheetDelegate> | |
//in your implementation | |
@synthesize ProfilePictureButton = _profilePictureButton; | |
//implementation details | |
[self setProfilePictureButton:nil]; |
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
- (IBAction)LaunchSafariButtonClick:(UIButton *) sender { | |
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"https://www.yoururl.com"]]; | |
} |
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
from google.appengine.api import memcache | |
if memcache.get('yourindexpage'): | |
self.response.out.write(memcache.get('yourindexpage')) | |
else: | |
template = jinja_environment.get_template('/index.html') | |
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
Here’s how you can run it on a Windows machine, but works quite well on Linux too (or Cygwin). | |
C:\>python -m SimpleHTTPServer | |
Serving HTTP on 0.0.0.0 port 8000 ... |
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
Let’s say you have a WordPress blog at another domain and you want to show it on another domain. | |
Well, you’re better off using a more standard way of incorporating a WordPress blog into your website (just google around), but if you need to do something more custom, here’s a possibility. | |
Here’s some pseudo code for a .Net application – you get the idea. One thing to keep in mind is that XMLDocument is not serializable, so if you want to save it in a session state or do something else, you will need to work around it. | |
Dim xmlReader As XmlReader = xmlReader.Create("your website blog url goes here/feed/rss") | |
Dim xmlDocument As XmlDocument = New XmlDocument | |
xmlDocument.Load(xmlReader) | |
Dim xmlNameSpaceManager As XmlNamespaceManager = New XmlNamespaceManager(xmlDocument.NameTable) |
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
Dim connString As String = ConfigurationManager.ConnectionStrings("your_database").ConnectionString | |
Dim sqlString As String = "" | |
Dim sqlConnection As New SqlConnection(connString) | |
sqlString = "insert into [ss].[dbo].[MyGuestBook] (firstName) values (@firstName);" | |
Dim sqlCommand As New SqlCommand(sqlString, sqlConnection) | |
Dim paramFirstName = New SqlParameter("firstName", SqlDbType.VarChar) | |
paramFirstName.Value = inputFromUserCleanedFirstName | |
sqlCommand.Parameters.Add(paramFirstName) |
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
$pdo = new PDO('mysql:dbname=your_database;host=localhost', $username, $password); | |
//don't use whatever the user typed in, use a variable | |
$stmt = $pdo->prepare('SELECT * FROM MyGuestBook WHERE firstName = :firstName'); | |
//that variable is then assigned to whatever the user typed in, but it's escaped and treated safely | |
$stmt->execute(array(':firstName' => $firstName)); |