Skip to content

Instantly share code, notes, and snippets.

@curt-labs
curt-labs / gist:915783
Created April 12, 2011 15:52
exec_bad_access when logging frame
if (pageControl == nil) {
pageControl = [[UIPageControl alloc] init];
pageControl.frame = CGRectMake(0, 0, scrollView.superview.frame.size.width, 15);
pageControl.bounds = CGRectMake(30, (scrollView.superview.frame.size.height -20), scrollView.superview.frame.size.width, 15);
//pageControl.center = CGPointMake((scrollView.frame.size.width +5), [[UIScreen mainScreen] applicationFrame].origin.y);
NSLog(@"frame = %@", pageControl.frame);
NSLog(@"bounds = %@", pageControl.bounds);
}
@curt-labs
curt-labs / gist:917688
Created April 13, 2011 15:03
With popover
ProductView *prodView = (ProductView *)self.view; //Reference to view
//create close button
UIBarButtonItem *closeButton = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(closePopup)] autorelease];
//image from the product
UIImageView *imageView = [[UIImageView alloc] initWithImage:[[prodView prodImage] backgroundImageForState:UIControlStateNormal]];
imageView.contentMode = UIViewContentModeScaleAspectFit;
imageView.contentScaleFactor = .8;
@curt-labs
curt-labs / gist:917695
Created April 13, 2011 15:06
with modal
ProductView *prodView = (ProductView *)self.view; //Reference to view
//create close button
UIBarButtonItem *closeButton = [[[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(closePopup)] autorelease];
//image from the product
UIImageView *imageView = [[UIImageView alloc] initWithImage:[[prodView prodImage] backgroundImageForState:UIControlStateNormal]];
imageView.contentMode = UIViewContentModeScaleAspectFit;
imageView.contentScaleFactor = .8;
@curt-labs
curt-labs / ProductScrollView.h
Created April 13, 2011 15:19
Scroll view not showing horizontal indicator
@interface ProductScrollView : ContentController <UIScrollViewDelegate> {
IBOutlet UIScrollView *scrollView;
Vehicle *sharedVehicle;
VehiclePicker *sharedPicker;
NSMutableArray *productArray;
NSMutableArray *viewControllers;
BOOL arrayPopulated;
}
@property (nonatomic, retain) UIScrollView *scrollView;
#import <UIKit/UIKit.h>
@interface MyOverlayView : UIView {
}
- (void)awakeFromNib;
- (void)dealloc;
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event;
@curt-labs
curt-labs / gist:3370383
Created August 16, 2012 14:12
Scala ODBC Connection to SQL Server
import java.sql.{Connection, DriverManager, ResultSet}
Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver")
val conn = DriverManager.getConnection("jdbc:sqlserver://216.17.90.83;databaseName=CurtDev;user=*******;password=XXXXXX;useUnicode=true;characterEncoding=UTF-8")
try {
val statement = conn.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_READ_ONLY)
val rs = statement.executeQuery("select * from Part")
while(rs.next()) {
println(rs.getInt("partID"))
@curt-labs
curt-labs / gist:3439908
Created August 23, 2012 18:24
Convert catID to catTitle via CURT API
type APICategory struct {
Parent Category
Conent []Content
Sub_categories []Category
}
type Category struct {
CatID int
DateAdded string
ParentID int
@curt-labs
curt-labs / Happpi_Getting_Started.php
Created August 28, 2012 14:13
Happpi PHP Library Examples - Examples on how to use the CURT PHP Library known as Happpi.
<?php
require_once('libraries/happpi/LoadAll.php'); // points to the LoadAll.php file for loading the library.
?>
<!doctype html>
<html>
<head>
</head>
<body>