Category Archives: Technology

Next step completed, Apple Developer Program signup.

Well, after reading the 37-page EULA, which, for a 37 page EULA was not that tough to stomach, I completed the registration request, sent off my annual fees and now I await to here the disposition of my request for acceptance into the Apple iPod/iPad/iPhone Application Development family.

In the mean time, I continue to narrow in on the first of what I hope to be a few lucrative and useful Apps, and begin physical device testing next week.

It’s almost 4:00PM now, maybe I should go and get some lunch…


UPDATE:

Developer License delivered! It takes a while to get the CSR generated, sent to Apple the the completed Certificate returned. Then it has to be installed and integrated into the IDE/SDK. But once that’s done, I’m deploying apps for test to my iPhone.

The stakes (and motivation) just got a lot higher!

First image manipulation App – DONE

Shot of image manip app, here with the image shunk to a fractional size.

I have been writing code like a mad-man. 8-10 hours per day for the company I work for, then another 6-8 for my own education. Well beyond the ‘Hello World’ apps of just a week or so ago.

Of the apps I’ve worked on in the last few days, this one involved the most code writing. Well mostly copying from examples in the books. Some examples were downright scary! Like one that executed a division of two calculated numbers without doing a check to see if the divisor was zero! Want to crash a program? Divide some number by zero. I’ve not yet any language that takes too kindly to such shenanigans!

So.. back on topic. The App. It’s pretty simple and uses and embedded image (you can’t just pick one and mess it up), but it leverages a bunch of the built in functions in the SDK that are just fantastic.

It’s pretty easy to handle event driving multi-touch gestures in the code. The design of the iPhone itself was groundbreaking.. but now seeing he amazing work Apple developers did in the SDK.. it’s.. jaw dropping. They really designed a full system, not some bolted together pile of .DLLs and crap that competitors doe (ever written an app in the old MFC? NIGHTMARE!).

So.. the education continues. I’m at little bit closer to getting the match functions of my first *real to be published* app spec’d out. I don’t think I’ll need tangent and radian calculations, or need to use the Pythagorean Theorem to solve for the distance between two points in Cartesian space…. but if I do, I now have it well embedded in my brain how to do it.

Upward and onward…. just another day in the life of a professional computer geek working hard to comfortably retire before he dies.

iPhone Apping – 5 more Apps (3 completed, 2 underway)

A little peek at the apps I've been working on.
It’s been a really good and really bad few days of writing iPhone Apps based on a couple of books I’ve been reading. About 8 hours were burned slamming my head on the table, because the tutorial was just not *quite* clear enough on the exact actions suggested to accomplish a task.

It was not until I decided to just S-can it (for the 3rd time) and move onto the next task, and finally another after that, when I realized just exactly what the author really meant to say when wiring up a bunch of Objective-C code. Then I also found that I’d checked a checkbox (I have a newer SDK version with an option not shows in the texts) that really hosed me up by creating a TABLE based window when I wanted a NORMAL window. Lesson learned.

No matter what, I have deleted all the old ‘Hello World’ apps and have constructed 3 complete functioning aps that display, overlay and swap images. I picked a few of my favorites from recent work. The results are pretty good! It’s not *easy* to write iPhone apps, but with some planning, and not Boat in the Water shot-gun hacky-do programming.. it can be a pretty quick development cycle.

So the two Apps I intend to release for public consumption are now underway. Once is about 50% complete (I need to port some PERL code I have to Objective-C) and the other is a just a bare-bones framework and a bunch of scribbled notes. No matter.. progress has been made!

CIDR Calculator Demo

For those that were breathlessly waiting for me to publish one of my Sys Admin tools.. here is a little one, that I discussed a couple of weeks back.

It’s the CIDR Block Notation Converter. I use it quite frequently in my line of work. Now, I could of course used many of the other online CIDR translates available. Simply using a tool (like a car, or a computer) often requires little or no knowledge of how it, or one of it’s sub-systems works. But, to fully utilize a tool, you should understand it’s origin, it’s function and often you will find other, unrealized purposes for the tool.

Such as the car. You get your driver’s license (people should also need a computer license, they can also be dangerous to one’s self), plob behind the seat and go to the store. But, if you understand some of the mechanics, you might realize it’s useful for more than getting your latte at StarSucks, or a back of dog bones at the pet store. With a little tweaking, you could use it to cross deserts, mountains, even compete and MAKE MONEY with it.

A little knowledge is a powerful thing, so I embarked on reading the specifications for IPv4 (not ipv6… not going there.. yet, in fact I don’t believe CIDR notation has any meaning in IPv6.. digressing..) and CIDR notation so that I could not only understand it’s inner utility but how to write a converter of my own.

If you found utility in it.. awesome, I hope you post a comment (good or bad) to say thinks.

iPhone tutorial app #5 – images meet the road

Writing code for another iPhone App.

Finally, an app that has moving parts. Things are starting to get interesting.

This next app is again, a View Application (single view). The tutorial indicates that we’ll just have to play some tricks to give the illusion of the changes.. image overlays as you will.

Now.. finally, some code has to be written, so here is the first block that is from the controllers main header file:


hello005ViewController.h

//
//  hello005ViewController.h
//  hello005
//
//  Created by David DeMartini on 10/3/10.
//  Copyright 2010 David DeMartini. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface hello005ViewController : UIViewController {
 IBOutlet UILabel *label;
 IBOutlet UIImageView *uiImageView;
}

// Tell the compiler about these properties of our little object-method pointers
//   nonatomic - let the Apple core code handle the mutability (dynamics) of object
//   retain    - tell compiler that we reserve the right to fuck up our own meory management
@property (nonatomic, retain) IBOutlet UILabel *label;
@property (nonatomic, retain) IBOutlet UIImageView *UIImageView;

// Inform compiler that a Button Action (IB) will be part of this application
- (IBAction)buttonPressed:(id)sendr;

@end

Next, the Implementation file must be written.

hello005ViewController.m

//
//  hello005ViewController.m
//  hello005
//
//  Created by David DeMartini on 10/3/10.
//  Copyright 2010 David DeMartini. All rights reserved.
//

#import "hello005ViewController.h"

@implementation hello005ViewController

// Command synthesis
@synthesize label, uiImageView;  // defined that which needs synthesis

- (IBAction)buttonPressed:(id)sendr {
 
//  This modifies the text in object pointed to by 'label' to this string
 label.text = @"The only thing better than a cute girl, is two!";

 // Defining a pointer to the physical Image file (UIImage)
 UIImage    *imageSource = [UIImage imageNamed: @"top.jpg"];
 // Setting the synthsized object image property to the pointer to image file
 uiImageView.image = imageSource;
}

- (void)didReceiveMemoryWarning {
 // Releases the view if it doesn't have a superview.
 [super didReceiveMemoryWarning];

 // Release any cached data, images, etc that aren't in use.
}

- (void)viewDidUnload {
 // Release any retained subviews of the main view.
 // e.g. self.myOutlet = nil;
}

- (void)dealloc {
 [super dealloc];
}

@end

Now that the primary parts of the code are in place, it’s time to assemble a UI. Adding the main text label (at the top – temporary text displayed for design purposes) and the big button that will cause stuff to execute.

Deep in the UI layout phase using the SDK User Interface Builder.

Shortly after this however, everything went sideways. It would appear there are more brain-dead errors in the book frustrating my progress. It is forcing me to read more and more of the Objective-C documentation than the book suggested I’d have to. But to fix the errors, I must first gain at least a minimum understanding of their nature.

About 5 hours of work. Most of it burned trying to get the last bit of it working… the image swap. Outside of that everything else worked great. With intent to use a fair bit of image swapping when I put the final first app out.. I’d better get a handle on this.


Update: 4-October-2010

After sleeping on it last night, I rebuilt the entire thing from the ground up again. This time going in phases from the initial background image to the label an the button, compiling and executing. That worked perfectly.

Next part I fired up the screen cast the Professor made of him stepping through the process. It then became quite clear (it was not in the book) that the overlay container does NOT reference the second (upper) image directly, but instead is used simply as it’s container. This (of course, being the smart guy I am) made sense the first time around, and I did (what I though) was exactly that. Created a view with not image. Regardless, I re-created my steps this morning, created the empty container, re-compiled and ran. WORKED! Except it looked like doo-doo because the upper level image was NOT properly sized, and the overlay effect did not work. The book (and the screen cast) made it seem like it would expand as required. IT DOES NOT.

iPhone simulator with icon for my 'CuteGirl' app.

So, I referenced the the image view to the top image so I could size and position it to create just the desired effect, then I removed the image association and re-compiled again. This time.. PERFECTION

And the icing on the cake is that it now has a custom icon image for the application. That was pretty simple too. Once I checked online and found that despite what the book said (image size 320×480 which made ZERO sense..) the icon image size should be 57 x 57 pixels and of the format .png (at least the book had the latter part right).


Geek Links:

  • iPhone & iPad Application Custom Icon Design Guidelines
  • iPhone tutorial app 4

    Oh.. now I can press a button and make text appear over an image! WOO..

    It took about 1 hour to get this working. Actually, let me re-phrase that, it took me an an hour to build and ‘test’ a version of this that refused to run. No errors appeared, it just ran and then exited without so much as whimper. Pounded around in the code trying to find the cause.

    In the end, I deleted the entire thing and started over from scratch. Following (what I thought) were the same steps, I re-built the app in about 5 minutes, hit SAVE -> RUN and viola!



    What it does:

  • Upon start up, a photo (from about 15 years ago) for a beer can, yet to be opened appears.
  • At the top of the can is a button labeled ‘Press Here’.
  • Pressing the button makes the text “Beer is Good!” appear below the can.
  • Then, it sits there, tasks completed, waiting to be terminated.

    Pretty cool huh? At least I know the steps for including images as a background. And this is great, since I know how to place an image (required for my soon-to-be-coded real app), how to make text appear (but I don’t be using a button) and.. really.. that’s about it.

    I’m 77 pages into the 300 page book, 4 apps constructed and soon.. things might actually get interesting.

  • iPhone App2, App3 & App4 compiled – this time in pure Objective-C

    App 2


    Well, here it is in amazing glory. The 2nd version of that good old programming stallwort, the “Hello World!” example application.

    Now this one took me a bit longer to code and implement, HOWEVER, it’s pure Objective-C, not the hybrid app type that I used in Application #1. App1 was interesting, and fast to build, but it relies upon some pretty big external libraries. Not a big deal for a low-intensity application like I’m building right now, but the QuickConnect based hybrid app I first built comes with that (I think is) is a pretty high price to pay (with a couple of hefty line items)

    1. Every time you start the application, I get an unwanted QuickConnect Family Application splash screen. NO THANKS! I’m pretty sure I could hack around it, buy why bother, for now?
    2. It won’t run from XCode! I can get it to start, but it won’t actually Do anything.
    3. The hybrid HTML based application’s style sheets are partially ignored, things like the background and text colors are not honored, BUT the font family is. Very strange
    4. It’s a MAJOR pain in the ass to debug when you create it in DashCode… ‘deploy it’. Have to monkey around with several files to fill the XCode (Objective C based) language into using files it did not expect to need… it’s all very hacky and more kludgy than I like.

    Honestly, with XCode view based building, I don’t think I need to mess around with the hybrid application model at all, at least for now. So.. the application that I built purly in HTML, CSS and JavaScript will be shelved for now. Instead I’m going to re-open my Objective C tutorials and work my way into the project I was working on originally.

    It might be a pain in the butt to learn Objective-C, but in the end, I benefit. Question is, do I have the time and will to see it all the way through. I believe so. But until such time as I have the first application built and deployed on my phone.. it’s sort of.. moot. No?


    App 3

    App3

    This one is not a View Based Application like number one, but this is what is called a Navigation Based Application.

    Now, ever the hacker, I went beyond the code changes to RootViewController.m suggested in the book, and also had to fix some GLARING errors in the text (did they not have an editor look at this??). Anhow, this is the code that I wrote for the cell builder. The enhancements allow line wrap, and I changed the default font size from 17 to 13.


    // Customize the appearance of table view cells.
    - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {

    static NSString *CellIdentifier = @"Cell";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
    if (cell == nil) {
    cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
    cell.textLabel.lineBreakMode = UILineBreakModeWordWrap;
    cell.textLabel.numberOfLines = 0;
    cell.textLabel.font = [UIFont fontWithName:@"Helvetica" size:13.0];
    }

    cell.textLabel.text = @"This is my second Objective-C application.\nDespite the tutorial having MASSIVE bugs, I got it to run!"; // Configure the cell.

    return cell;

    }

    I’m trying to decide if a View Based (winning so far) or a Navigation Based application will be the way I go for the Real Application. The Navigation Based app is a lot easier to get started with, and does not require that rather odd method of linking elements with the fishing line drag and connect method in the View Application.

    Still a lot of code to write before I have enough experience to make a solid choice.


    App 4

    App4 is a derivative work of App3, but this time by simply enabling this little block of code, I get an Edit button and the ‘Delete’ context, if I need it, for the items. Pretty slick. Apple really went out and did a nice job on this SDK…

    - (void)viewDidLoad {
    [super viewDidLoad];

    // Uncomment the following line to display an Edit button in the navigation bar for this view controller.
    self.navigationItem.rightBarButtonItem = self.editButtonItem;
    }

    Application 4 running in the iPhone simulator

    CIDR notation – Living in Net Block Hell

    CIDR… what is CIDR? No, it’s not something you drink. Although, given enough exposure to it, It’s something that makes me want to drink (hard) cider. Be that as it may, it’s an important part of my job, de-cidering, I mean, deciphering these cute little buggers.

    So.. just what does a typical CIDR notation IP block look like? Well, it looks like this:

    67.213.31.0/26

    Now, you might be asking yourself, what, why and who cares? So, to answer your questions:

    What:
    Well, it’s a CIDR block dumba**, that’s what we’re talking about here. Oh.. what does it mean you might really be asking me. It means: Classless Inter Domain Routing. Or, in layman’s terms, it’s like a sort of Internet Zip Code, a method of sub-organizing the massive worldwide IPv4 addressing system (which amounts to approximately 4,000,000,000 addressable ‘systems’, not counting those massive blocks that are set aside for private network use, such as the infamous 192.0.0.0/24.

    Why
    Well, there is a good question. In the early 90s it became apparent that the number of free IP addresses would be depleted. The total number of IPs was large enough then, but because of routing issues, they could only be used in blocks. Now, those that are even slightly in the know, know, (heheh) that that entire pool of IPs is projected to be exhausted in early 2011. Yeah… that’s right, NEXT YEAR! But, IPv4 and the new IPv6 that supersedes it is another discussion for another time. Right now, were talking about Cider!, uh CIDR! So, trying to get back on point, the use of these CIDR blocks was a way for routing tables (in those things they call routers, imagine that) to store and organize large pools of IPs, or small pools of IPs as one might see fit.

    Who Cares?
    Anyone that deals with internet IP infrastructure cares. Now, since it’s my business (what I’m paid to do) is watch the ENTIRE Internet to make sure that:

    • DNS (oh.. dont’ get me started) works for corporations large and small. And yes, DNS hijacking is real, it happens, but not only that sometimes they are corrupted accidentally, and people like me designed the software the keeps track of that.
    • I’m able to do other things with this data that I can’t talk about, period. So don’t ask.
    • And, last but certainly not least, it’s just how us geeks communicate. So be it.

    Now, why is it a pain in the ass? Well, simply, I need to accurately decode these CIDR blocks into IP ranges (what I do with them is a classified trade and operational secret, so don’t ask, I just need to do this). And to do so requires MATH!. Math… nothing wrong with Math, but it’s math that is to computationally intense for me to do it in my head. Primarily because it’s based on bits, 32 to be exact. Bits are those nasty little binary components of the real numbers the rest of you common mortals pretend you know what you are doing with.

    I’m not going to try to explain why routers care about CIDR, I’m only going to say ONE of the things I care about most, re: CIDR blocks is getting the actual (true) IP range values from that short-hand notation.

    So, let’s take the fictitious example I displayed before (67.213.31.0/26). I don’t know whom off the top of my head (I have databases to do that sort of stuff for me) that CIDR block might belong to (and it might belong to more than one organization), but let’s pretend that CIDR (the one I picked out of thin air) is relevant.

    First things first.. we need to know what the block notation of 26 means, so we’ll start there. This part is called the ‘Network Prefix’. It signifies the number of bits (from the left) that identify the starting point of that network block. In this case, the first 26 bits determine the NETWORK and the last 6 bits ( 32 – 26 = 6 ) the HOSTS that are within that NETWORK.

    So.. taking that number, 67.213.31.0 :

  • 01000011.11010101.00011111.00000000
  • and knowing we need the first 26 bits, which would be:

  • 01000011.11010101.00011111.00------
  • The starting address point is.. ta, da! 67.213.31.0
    uh.. OK.. so that’s not super illustrative.. but do the math anyway.

    OK.. next.. we know that we have a block of 6 bits to play with, starting at ‘0’. so the range is:
    .00000000 to .00111111

    Now.. doing that big of math we get (drum roll please…)

    0 (where we started in that net block) up to 63 (which is what 111111 binary means in base-10.

    THUS:

    The IP range calculation for this 67.213.31.0/26 is:

  • 67.213.31.067.213.31.63

    Now.. don’t you feel a little enlightened?

    Maybe next week, if I’m in a good mood, I’ll write a CIDR translator program and post it to my blog, but don’t hold your breath, unless you want to PayPal me a a $1000, then I’ll do it this weekend.

  • Corporation or LLC – that is the question.

    I’ve always been one that is not at all comfortable relying upon a single source of financial well being. Since the early 80’s in one form or another I’ve owned and operated a business.

    Early on I have a little Electronics sales business selling Cell Phones to the well-healed during it’s hayday. It was fantastic. Hardly work, get paid well, and live La Vita Loca.

    I’d take a number of odd jobs during that time, driving computer mag tapes around Silicon Valley, installing car audio systems, systems administrator for a large multi-national corporation, Y2K mitigation for a number of organizations (not the least strange of which was the California Department of Corrections).

    At any rate, as I said, I’m not one that’s comfortable with a single source of income, so I’ve been investigating business structures to determine what my next organization will look like.

    I have plenty of experience being the President and CEO of a corporation, having ran one from 2000 to 2006. The structure offers a lot of advantages, such as dividing income between corporate tax concerns and personal tax concerns. Corporations also have the advantage of having ownership interest in other organizations. But there are also some disadvantages, not the least of which is very strict requirements and regulations on annual meeting, IRS and state tax filings, additional book keeping to track basis and stock ownership (plus managing different classes of stock).

    I was really more of a burden than a blessing to myself, which is to a large degree why I terminated operation in 2006 and became a W-2 wage slave.

    Since that time a number of interesting ideas have popped into my head. One of which are some software product ideas for the iPhone.

    My intent at this point is to move forward on development of 2 concepts. One of which will have a pretty limited market, the other, I hope, to have a much wider market, and is a type of social networking application. The second of which I hope to see wide spread usage. The plan, is for the first app to fund development of the second. That is the plan.

    Before I cut my first line of code, I wanted to know what type of organization I wanted to create. I need to have my business licenses in place, before I complete the Apple Developers Contract. They are quite clear that it won’t be approved for any shoddily / hastily created pseudo-company.

    I’ve done some reason on the Secretary of State’s website, checked a few of the fee structures, and such, but my primary source of research on the business organization from has been from the book LLC or Corporation – How to Choose the Right Form for Your Business“. Author is Anthony Mancuso, Attorney.

    It’s not a long read, about 250 pages, which I spend the last 5 evenings digesting. It’s rather repetitive, which was a little frustrating for me, initially. However, having completed the book I can understand at least one reason for it’s repetitive nature. If anyone were to pick up the book and *not* read the entire thing (why would you do that, well, sometimes I’ve been guilty of poaching the parts of books I need without taking the time to digest the entire tome) they would still get the frame of reference required to get useful information on the topic of interest. I’d say, it’s a modern writing method for the more ADHD nature of our society. In the end, it’s worth dealing with the repetitiveness. It has it’s place.

    Another helpful part of this book is extensive use of examples. More than once I’d read the example 2-3 times to really grok the point, and that was very helpful. The last chapter is also dedicated to some ‘real-world-ish’ examples of business formation decision making. All in all, it was well worth the $25.00 price tag.

    So, what did I decide to do? Well, an LLC is the type that I’ve decided to select for a number of reasons, but the primary ones I’ll list here:

    • Simplicity of formation
    • Limited personal liability for company debt
    • Pass-through tax advantages (this sword cuts both ways though)
    • Fewer operational requirements (no board of directors, meetings, etc.)
    • Simpler tracking of each owners basis in the company

    So, with my new company name selected, and my form of business decided, it’s time to move forward with foundation of the company.

    You know I’ll be sure to post information on that once the State registration has been completed any my licenses granted, EIN number acquired, and finally the domain names registered.

    iPad sales hit 3 million units

    Apple says iPad sales hit 3 million. Wow.. that’s A LOT of people buying something that a lot of the geek cognisti and Windoze apologists said was an under-powered POS that any Windoze tablet (too bad none really exists, isn’t it?) would smoke.

    Sounds like the nay-sayers on this thing need to buy a clue.

    I don’t own one, but I’ve used them. They are VERY slick devices. The UI is wonderfully executed. Personally, I’m going to hold out for the 2nd generation one iPad. With 3 million sold already I think Apple can say they have a hit on their hands! 🙂

    Apple says iPad sales hit 3 million as shares climb

    Also of interest, is reading this article, about how once you go Apple, people tend to not go back to what they were using before:

    What makes Apple so sticky

    For a product that seemed to some ‘experts’ to not have a purpose, or any differentiating quality that would compel people to buy it, I find it amusing that they are having a hard time keeping up with the demand?