conedogers

Will code for race tires


Leave a comment

302lb deadlift this morning


I have been working for that one for a while now. Breaking the 300lbs limit on a dead lift has eluded me for a while now. I would get right up to it and then never get the next lift more than a couple of inches off the ground. My last record was 295lbs.

So yeah, being an old Ford kind of guy, getting a 302 deadlift personal record is fitting. :)

20140418-091433.jpg

 

I am running out of room!  I need a bigger bar I think.

That lift wiped me out.  We had a WOD of 4 rounds of the following

  • 20 dumb bell lunges
  • 10 strict pullups
  • 10 toes to bar
  • 20 burpees
  • 40 double unders (I did 80 singles with several attempts for double unders)
  • 2 minute rest

I made one round and barely started the second round and stopped.  I just couldn’t finish because I was toast…  Did I say that lift was hard? yeah… it was hard


5 Comments

who I am and why I’m here


I am a software engineer by trade and I am always looking for new opportunities. Blogging has become a way for me to demonstrate the skills that I have as a developer.

That is the clean cut, chiseled response for today’s blog.  I have been working on this blog for a while now.  I think offering a little history on why I started conedogers is a great way to introduce this blog, it’s also a good story…

While my day job is working as a Software Engineer in silicon valley, I like to go racing on the weekends.  I have been a member of the SCCA since 2000, and I have been auto crossing with the SCCA since I joined.  Autocrossing is a time trial styled event.  Using a large paved area (parking lot or airport paddock) we setup a course and cars are assigned to a class depending on the car and what you have done to modify it.  It’s a very competitive sport that builds up your driving skills using your daily driver in most cases.  It is a very cheap form of racing.  I was racing my 2004 Lancer Evolution, a turbocharged AWD car that was the factory base platform used to build rally cars for professional teams.  The Evo was a blast to drive, I had modified it quite extensively to the point where it was around 400 horsepower to the wheels, and it kept all of the factory emission equipment in place for legal (but very fast) street driving.   I already had the car on a trailer because it was stupid fast on the street.  Really I had everything I needed to proceed to the next step and build a track car and destroy the value of the Evo in the process.  I had begun the process to build my track car, I bought new rims, and I was ready to pull out the AC and start on some serious weight reduction but decided to wait until after the first autocross event of 2012 to start tearing into the car.

Then I saw this car at the event…

 

_J5V4171 - Version 2

a 1991 Van Dieman Formula Ford owned by Mark Mervich

The car is a Formula Ford, a spec race car built with a light tubular frame chassis and powered by a 1.6 liter Ford “Kent” engine.  This race series has run without any large changes since 1967 when Formula 1 champion Jim Clark put one of these Kent Cortina engines built by Ford into a Formula 2 chassis.  The combination is brilliant.  The car empty weighs about 900 pounds depending on who built the car.  The car with driver is usually in the 1100 pound range.  With a horsepower rating of around 110hp, the hp to weight ratio is perfect for great acceleration and fabulous handling.  If you want a career as a professional driver, this is the first race car you drive after go karts.  Michael Andretti, Jeff Gordon, Arton Senna, Michael Schumacher, and others have all got their starts in this formula.  As the formula fords have evolved over the years, you eventually get what’s called an orphan.  With the 40+ year history of Formula Ford, a historic class has been introduced.  But with all classes of these types, there is a cut off date.  So there are older cars that may be just out of the historic class, but are too slow to keep up with the modern cars.  These are the orphans…  They might be too slow to be competitive in road racing, but they are still very competitive auto crossing them.  And as a bonus, they are incredibly cheap to run as an autocross car.

Anyhow I digress…

I know the owner, and he offered to let me drive it.  HELL YEAH…. so I tried to sit in the car.   I use the term “sitting” loosely.  Its more like strapping it on, the car fits you like a glove.  Unfortunately for me at the time, a glove that was a couple sizes too small…  I could fit in a manner of speaking, mash my feet on all three pedals at the same time, and no I could not turn the steering wheel, there was no room for my arms to move.   Huston, we have a problem…

But no matter, I was hooked.  All race prep on the EVO stopped dead in their tracks and I started to get the car ready to sell.  I even stopped racing to save money to buy a Formula Ford.  After about 6 months, I sold my Lancer Evolution.  I still have the page I used to sell it on my blog, you can view it here My 2003 Mitsubishi Lancer Evolution.  I still miss driving that car to this day..   But no matter, I found a Formula Ford off the internet from a forum http://www.apexspeed.com.  Apexspeed has everything and anything about the formula ford.  The combined knowledge up there really helped figuring out A) what to buy, B) what to look out for.

By July of 2012, I had my eye on a Swift FB 91.  This was a race car that was originally designed by Swift Racing here in the United states, but the design was licensed to a new company in the UK in 1988.  By the design was a uniquely UK design, or what is called a euroswift over here.  I found my car in Delaware, bought it sight unseen, not even sure I would fit at that point.  I got the race car delivered out west and was relieved to see that I actually could fit in this car.

IMG_0654

The Formula Ford is a blast to drive!  There is really nothing that is street legal that compares to whole experience of driving a car like this.  I think the best way to put it is like this:  if you could take the latest Corvette, Porsche, Mustang, any pure sports car and distill it like a fine whiskey or bourbon liquor, then the formula Ford would be that 20 year old whiskey aged to perfection.

I started this blog to document the restoration of this car, but quickly realized that these vehicles are so unique that any blog I could do on this car would not go to far (there are only 5 models like this one left in the world!!).  But there are topics that can be covered on basic maintenance.  My first article on this covered some expensive repairs, but another on changing the gear ratios in the transmission has proven to be very popular.  My traffic spikes on the week before a Formula ford race events in the UK, Australia, and New Zealand with people looking at the article and obviously changing their gear sets before the next event :)

Now I am looking for ways to increase the traffic enough to support my hobby!

_J5V7416 - Version 2


Leave a comment

200lb front squat


It’s been a while since I did a fitness post.  Still going strong, and getting stronger.

yeah… New personal record there. I stopped before I got real heavy. If I pushed it further I would need to use a belt and really work on keeping my form. I had the time this morning, I think I could have gone up another 10-15lbs, but we still had our WOD to do

 

a 15 minute AMRAP

  • 6 pull-ups
  • 8 thrusters @ 75lbs on a bar
  • 10 single arm dumb bell snatch @ 35lbs
  • 100 meter run

 

Featured Image -- 1053


Leave a comment

Smalltalk about Objective-C


chrisw52:

This is a good review of Objective-C from a windows coder’s point of view.

Originally posted on codemouse:

Ok not so much a small talk, but more a ramble with an objective. (wow, geek humor is really bad).

Thats_the_joke

I’ve had the fortunate ability to spend the past 2 weeks or so getting ramped up on all things iOS and Objective-C for an internal project my company is working on. As a guy who has historically programmed in C-style languages and environments (.NET, Java, C/C++, and JavaScript), I thought this language would be pretty easy to pick up.  I was both right and wrong.

Of course, the core syntax of Objective-C IS almost exactly the same as C, which is great. For me to read through the code and understand which method was calling which other method and why and how, to follow the pointers and references, and the basic structure and syntax were all easy.  Then came the hard part.  Understanding both the Smalltalk-inspired messaging features that are…

View original 1,512 more words


Leave a comment

Watch out with assertions. Truth about NSAssert and assert functions in iOS.


chrisw52:

Some good tips on using the assertions in IOS

Originally posted on lines of code:

This article points out differences between NSAssert and assert functions in Objective-C. Let’s go for it.

An assertion is a predicate (a true–false statement) placed in a program to indicate that the developer thinks that the predicate is always true at that place. If an assertion evaluates to false at run-time, an assertion failure results, which typically causes execution to abort. – Wikipedia

We all know and use assertions. Or at least, we should. Most common are NSAssert and NSParameterAssert. Each thread has its own NSAssertionHandler object created for it. When invoked with an assertion, an NSAssertionHandler prints an error message that
includes the method and class (or function) containing the assertion and then it raises an
NSInternalInconsistencyException. There is also a assert() function defined in assert.h of the C Standard Library.

View original 180 more words


1 Comment

Using SQLite in your IOS applications part III


In this article we introduce a new feature into the example application that was built in the last article  “Using SQLite in your IOS applications part II” that will allow us to explore different data types found in SQLite.  A photo of the contact will be added to the database.

modify storyboards

the first step is to add a UIimageView to the AddContactViewController, ViewContactViewController, and the UpdateContactViewController panes in the storyboard.

  • Add a new section and change the title to “Photo”.
  • drag a UIImageView onto the new tableViewCell in the photo section and resize to suite your tastes

Add a new UIImageView to the app to display the contacts photo

Once you have modified the storyboards, we need to hook up the UIImageView to a property within each controllers class object.

In each of the controller classes, we add the following property

@property ( nonatomic, weak ) IBOutlet UIImageView *photo;

After adding the property, remember to connect the IBOutlet for each photo property to their UIImageViews on the storyboard.  When that is done, compile the code to fix and build errors or warnings, and we are done here.

Modify database schema

For this sample, we introduce a new data type into the schema.  The new database scheme  introduces a new SQL data types supported by SQLite, the blob.  Blobs are primarily used for storing binary data, like photos and short videos, audio, etc..  Basically, a blob can hold any piece of data that cannot be represented by any of the other SQL data types supported by SQL.  For this sample we are using a blob to story a PNG image of a contact.

     TABLE Contacts (idx INTEGER NOT NULL DEFAULT 0 PRIMARY KEY AUTOINCREMENT,
         firstname Varchar DEFAULT NULL,
         lastname Varchar DEFAULT NULL,
         phone Varchar DEFAULT NULL,
         photo BLOB DEFAULT NULL);

If you have decided to try and modify the code from the previous sample, you will need to alter the database instead of creating a new one. To do this, we need to add code to the SQLiteManager class to alter the Contacts table to include the Blob for the photo.

    NSString *path = [self databasePath];

    // if the path does not exist, then we need to initialize the database.
    if ([fileManager fileExistsAtPath:path] == YES)
    {
        // check to see if we have attempted to upgrade the database before.
        // we only want to run the ALTER command once after an upgrade.
        if ( [[NSUserDefaults standardUserDefaults] boolForKey:@"FirstRun"] == NO) {
            // the file exists, so all we need to do is alter the existing table.
            sqlite3 *database = [self newConnection];
            // the database file does not exist, so we need to create one.
            if (database)
            {
                // load the SQL commands that will create the database
                NSString *sqlCommands = @"ALTER TABLE Contacts ADD photo BLOB DEFAULT NULL;";

                // any error message that sent back from sqlite when creating the database will go here.
                char *szErrorMessage = NULL;

                // execute the sql commands
                int error = sqlite3_exec(database, [sqlCommands UTF8String], NULL, NULL, &szErrorMessage);

                if (error == SQLITE_OK)
                {
                    NSLog(@"successfully created database");
                    [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"FirstRun"];
                }
                else {
                    NSLog(@"Failed with error %s", sqlite3_errmsg(database));
                }

                [self closeConnection:database];
            }
        }
    }

All we do here is add a new Blob to the end of the table record. Which brings up an important point. It is safer to Add new records to a table, but deleting columns can be problematic with the underlying flat file system used to store the physical database on the file space in your device. So be careful when modifying your tables.

Code changes for photos

The next step is to modify the Person object to include a UIImage to hold the photo retrieved from the database.  Each of the categories that were implemented are affected and need to be changed to accommodate the photo column retrieved in each SQL query.

Person object modifications

In the person.h header file, add a property for the photo, and declare the overloaded setter selector for the photo property.

@property (nonatomic, copy) UIImage  *photo;

-(void) setPhoto:(UIImage *)value;

In the person.m file we add the implementation for the setPhoto selector.

-(void) setPhoto:(UIImage *)value
{
    if (photo == nil) {
        photo = value;
    }
    else {
        photo = value;
        self.dirty = YES;
    }
}

With these changes the person object can now track the photo of the contact in the database.  Now we need to look at the categories that are affected by the changed database schema.

Person (AddNewPerson)

In the last article, we used a SQL string to insert records into the database. This time we use sqlite3_bind functions to bind the parameters in the prepared statement that is ready to execute. The process is really very simple. The column data is filled in left to right, each column is identified numerically.
With simple data types like integers and floating point numbers, the binding is straight forward. Like strings, we need to label the blob data as SQLITE_TRANSIENT to signal the database engine on how to treat the memory we are passing to it. When inserting large pictures, these transactions can take time. this is a good candidate for a background thread or something to be scheduled as a background task on the run loop.


+(id)addNewPersonWithFirstName:(NSString *)firstName LastName:(NSString *)lastName phoneNumber:(NSString *)phoneNumber andPhoto:(UIImage *)photo intoDatbase:(sqlite3 *)database
{
    Person *contact = nil;

    // here we build a string for the complete SQL query and values to insert.
    NSString *query = @"INSERT INTO Contacts (firstname, lastname, phone, photo) VALUES (?,?,?,?)";
    int success = -1;
    sqlite3_stmt *statement = nil;

    int error = sqlite3_prepare_v2(database, [query UTF8String], -1, &statement, NULL);
    if ( error != SQLITE_OK)
    {
        // error
        NSLog(@"Error failed to prepare sql with err %s", sqlite3_errmsg(database));
    }
    else
    {
        // Now bind the variable to the prepared statement
        sqlite3_bind_text(statement, 1, [firstName UTF8String], -1, SQLITE_TRANSIENT);
        sqlite3_bind_text(statement, 2, [lastname UTF8String], -1, SQLITE_TRANSIENT);
        sqlite3_bind_text(statement, 3, [phoneNumber UTF8String], -1, SQLITE_TRANSIENT);

        // now we store the image into the database as a PNG for better compression.
        sqlite3_bind_blob(statement, 4, [UIImagePNGRepresentation(photo) bytes], [UIImagePNGRepresentation(photo) length], SQLITE_TRANSIENT);

        // execute the query
        success = sqlite3_step( statement );
        if ( success == SQLITE_DONE )
        {
            // successful insertion into the database, now create the person object.
            success = (int)sqlite3_last_insert_rowid(database);
            contact = [[Person alloc] initWithPrimaryKey:success AndDatabase:database];
            contact.first = firstName;
            contact.last = lastName;
            contact.phone = phoneNumber;
            contact.photo = photo;
        }
    }

    // cleanup
    sqlite3_finalize(statement);
    statement = NULL;

    return contact;
}

 

Person (ReadPersons)

The modifications to the read persons category are pretty easy.  We have to modify the SQL SELECT statement to include the photo.

        sqlite3_stmt *statement = NULL;

        int error = sqlite3_prepare_v2(database, "SELECT idx, firstname, lastname, phone, photo FROM Contacts", -1, &statement, NULL);

then we process the bytes retrieved from the query results and put them into a UIImage for local storage.

                UIImage *photo = nil;

                // We need two parameters to get the BLOB data.  the actual blob and the length in bytes.
                NSData *imageData = [NSData dataWithBytes:sqlite3_column_blob(statement, 4) length:sqlite3_column_bytes(statement, 4)];
                if (imageData) {

                    // got it, stuff it into a UIImage
                    photo = [UIImage imageWithData:imageData];
                }

                // insert into an object
                Person *contact = [[Person alloc] initWithPrimaryKey:primaryKey AndDatabase:database];
                if (contact) {
                    contact.first = firstName;
                    contact.last = lastName;
                    contact.phone = phone;
                    contact.photo = photo;

                    [results addObject:contact];
                }

Person (WritePerson)

Writing the photo out is just as easy.  We need to get the photo represented in a byte sequence for storage in a blob.  To do this on IOS we need to get access to the raw bytes stored within the UIImage.  The IOS SDK provides a pair of functions UIIMagePNGRepresentation() and UIImageJPEGRepresentation().  These functions return a NSData Object that will have a pointer to either the Jpeg or PNG representation of the UIImage.  From there we can use the NSData object to get access to the raw bytes and the length in bytes of the image.

First we modify the prepared statement.
        sqlite3_stmt *statement = NULL;

        const char *query = "UPDATE Contacts SET firstname = ?, lastname = ?, phone = ?, photo = ? WHERE idx = ?";
        error = sqlite3_prepare_v2(_database, query, -1, &statement, NULL);
Bind the image to the blob.  Make sure to label the memory properly so the database engine knows how to handle it properly, there is no automatic garbage collection here.
            // now we store the image into the database as a PNG for better compression.
            sqlite3_bind_blob(statement, 4, [UIImagePNGRepresentation(self.photo) bytes], (int)[UIImagePNGRepresentation(self.photo) length], SQLITE_TRANSIENT);
            sqlite3_bind_int(statement, 5, (int)self.primaryKey);

Once you have bound the image to the SQL prepared statement, you can execute it. This can be time consuming, so like the AddNewPerson category, this is a good candidate for background processing.

Implement UIImagePickerController

the only thing left to do is implement the UIImagePickerController.  This class is used to select photos, take video, or use the camera to take snapshots, which is what we are going to do here.  Implementing this controller we step outside the storybook code and implement this controller manually.

To implement the control we need to implement the protocols from the UIImagePickerControllerDelegate, UINavigationControllerDelegate, and the UIActionSheetDelegate to present a simple choice dialog.

@interface AddContactViewController : UITableViewController <uiimagepickercontrollerdelegate, uiactionsheetdelegate,="" uinavigationcontrollerdelegate="">
@property (weak, nonatomic) IBOutlet UITextField *firstName;
@property (weak, nonatomic) IBOutlet UITextField *lastName;
@property (weak, nonatomic) IBOutlet UITextField *phone;
@property (weak, nonatomic) IBOutlet UIImageView *photo;

@property (nonatomic, assign) sqlite3 *database;

@property (nonatomic, weak) id delegate;

-(IBAction)cancel:(id)sender;
-(IBAction)done:(id)sender;
-(void)takePhoto;

@end

We also add a new selector takePhoto. In this method we implement the action sheet that we use to let the user select what kind of photo to take.
The result of the action sheet is used to configure the UIImagePickerController.

#pragma mark - UIActionSheetDelegate
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex
{
    BOOL bCancel = NO;
    UIImagePickerController *photoPicker = [[UIImagePickerController alloc] init];
    photoPicker.delegate = self;
    photoPicker.allowsEditing = YES;

    // we are processing a photo
    switch (buttonIndex)
    {
        case 0: // take photo
        {
            if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
                photoPicker.sourceType = UIImagePickerControllerSourceTypeCamera;
            }
            break;
        }
        default:
            // cancel
            bCancel = YES;
            break;
    }
    if ( !bCancel )
    {
        // present the view controller.
        [self presentViewController:photoPicker animated:YES completion:nil];
    }
}

Once we have configured the UIImagePickerController the UIActionSheetDelegate launches the view. Once the view has loaded, you will be able to take a picture.  The slideshow gallery demonstrates the application flow.

This slideshow requires JavaScript.

Once you have picked a photo or canceled, the UIImagePickerController will signal one of protocols that it defines. Pretty simple really, there are two protocol methods to implement, one for success, the other for canceling.

#pragma mark - UIImagePickerControllerDelegate
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
    UIImage *selectedImage = (UIImage *)[info valueForKey:UIImagePickerControllerEditedImage];
    if ( selectedImage != nil )
    {
        self.photo.image = selectedImage;

    }
    [self dismissViewControllerAnimated:YES completion:nil];
}

- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker
{
    [self dismissViewControllerAnimated:YES completion:nil];
}

implementing the UIImagePickerController is really not too difficult. Once you have the code hooked up, we need a way to call the action sheet. For this example, the selecting of a table cell is used to invoke the action sheet.


- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    // make sure we only invoke the UIImagePickerController on the photo table view cell.
    if (indexPath.row == 0 && indexPath.section == 0) {
        [self takePhoto];
    }
}

-(void)takePhoto
{
    UIActionSheet *dialog = nil;

    // present the action sheet that offers the user the choices for photos.
    // open a dialog with an OK and cancel button
    dialog = [[UIActionSheet alloc] initWithTitle:@""
                                         delegate:self
                                cancelButtonTitle:@"Cancel"
                           destructiveButtonTitle:nil
                                otherButtonTitles:@"Take Photo", @"Choose Existing Photo", @"Edit Photo", nil];

    dialog.actionSheetStyle = UIActionSheetStyleBlackTranslucent;

    // show the action dialog on top of the photo.
    [dialog showFromRect:self.photo.frame inView:self.view animated:YES];

}

And that’s it. Using blobs in your SQLite database is really quite easy, almost as easy as handling string data.

Source code

The source code for this blog entry is available on GitHub.

references

IOS Human interface guidelines : Modal Contexts

Binary Data Programming guide for Cocoa

IOS developer library : About the Camera and Photo Library

SQLite

 

Using SQLite in your IOS applications part II

Using SQLite in your IOS applications part I

Building Sqlite into your IOS applications 


Leave a comment

9 steps to Create a Successful Gaming App!


chrisw52:

This is a pretty good checklist for any mobile app, not just games.

Originally posted on Gre8ive Apps:

You dream to create a gaming app and make big bucks from it. Wondering what it takes? All you need is the desire and a game plan. Let’s not waste time. Begin now!

1. Do market research.


 

  • The most critical factor is your understanding of the market place for any business. To begin with, you can check out App Store which is loaded with array of categories.
  • The first and foremost thing to do is to get the feel of the market. Become an app addict. Invest your time in training period, studying about the successful apps and playing them as they will tell you volumes about market. The more number of hours you spare studying them the better image you retrieve about their common traits and the desirability of users. Maintain notes for an app’s success are its ranking and consistency.
  • Figure out what people want and…

View original 851 more words

Follow

Get every new post delivered to your Inbox.

Join 203 other followers