brandontreb.com Tips And Resources For Software Developers

Software Consultant Contracts: Fixed Bid VS Time And Materials

One of the most common questions I get from software consultants is whether or not to accept fixed bid contracts.  In this post, I’m hoping to shed some light on fixed bid vs. time and materials contracts and help you make the best decision for the project at hand.

Let’s start with some definitions to help you better understand what I am talking about.

A fixed bid contract is a contract where the developer and the client agree on a price and/or timeline up front for a particular contract.  If additional time is needed, there must be some sort of change order issued to and signed by the client.

Time and Materials contract is a contract where the developer and the client agree on an hourly rate for the development of a project.  While there should be some initial estimates up front, the developer is not locked into a certain number of total hours/dollars.  If more time is needed than stated in the original estimate, the developer has the freedom to continue as the client’s budget (and patience) permits.

Below, I’ll compare and contrast the pros and cons of both fixed bid and time and materials contracts.  Note, this is just from my experience and your experience might vary.  In fact, if it does, I’d love to hear about it in the comments.

Fixed Bid: Pros

  1. You can potentially make a lot more money.
    If you are a good estimator (or a bad one and the client accepts an overbid), then this is your chance to get paid whatever you want to get paid per hour.  If you bid 100 hours and get it done in 50, you have essentially doubled your rate.
  2. *It’s easier to manage the pipeline.
    *Generally, when you do a fixed bid contract (again assuming you are decent at estimations), fixing a contract allows you to plan out more contracts ahead of time.  Typically the fixed cost comes with a (roughly) fixed timeline.  This allows you to project future availability for yourself to work on other projects.
  3. You know what you are building up front.
    *If you have done your due diligence (gathering requirements, specking things out, etc…) there 
    should* be no surprises.  Everything is already laid out for you and if the client wants to change anything, it will require a change order.
  4. *You are selling value instead of time.
    *This is actually a hot topic lately.  Many will argue never to sell by the hour as so much more goes into your rate than just time (your knowlege, history, expertise, etc…) The client wants to pay your for a solution to their problem and that’s infinitely much more valueable than your time.
  5. *It’s sometimes easier to land contracts.
    *Some clients have a very specific budget.  If you can provide a solution to them inside of their budget, then the contract is yours every time.

Fixed Bid: Cons

  1. You can potentially lose a lot more money.
    There is a joke that goes something like this: There are only 2 hard problems in software development, knowing when to expire a cache and accurately estimating working.  Generally, the overzealous developer will error on the side of too few hours in order to ‘land the contract’ or ‘please the client’.  This usually results in the developer bidding 50 hours and realistically working the 100.
  2. Feature Creep.
    Clients WILL feature creep.  Feel free to tweet that or write it on your forehead.  It’s just a fact of life.  You, being the super nice developer that you are, will want to please the client and will say something like “it’s outside of scope, but I’ll make an exception”.  Before you know it, the app has pivoted and you are building things WAY outside the scope of the initial contract.
  3. Can I…? NO! Well, what about…? NO! Just This… NO, NO, NO!
    With a fixed bid contract, if you are an experienced developer, you will ALWAYS be telling the client NO.  If you are wondering why, see #2.  While feature creep creates a tension, so does not allowing the client to change course, if needed.
  4. *It’s sometimes harder to land contracts
    *If I take a fixed bid contract, I generally error on the side of overbidding.  This allows padding for things like QA, small changes, App Store submission, etc.  Given the high bid, your client might baulk at the contract and attempt to outsource to India himself, where he will eventually spend double.

####

Time And Materials: Pros

  1. *Your work is always compensated
    *Given that you are getting paid per hour, you can always count on a steady stream of revenue coming in.  This is very comforting to developers since you know you will always get paid the rate you want for the work you do.
  2. *Landing contracts can be easier
    *Clients don’t always know what they want up front and the idea of not committing to a certain dollar amount is sometimes comforting. It also gives them MUCH MORE freedom to make changes and pivot down the road.
  3. *It gives clients the freedom to prioritize features
    *This is one of the biggest selling points that clients appreciate when I sell a time and materials contract.  Given that my team follows a version of the agile development methodology, clients love that they have some insight as to how much each feature roughly costs.  They can see the estimates and translate that into cost.  If they feel a less important feature is too costly, they can prioritize the backlog to get more (less complex) features for the same price.
  4. *Less Risk
    *Since you are only selling the client your time, you don’t necessarily owe them anything except work.  Most of the time, time and materials contracts don’t even have an official scope of work attached.

Time And Materials: Cons

  1. *It doesn’t scale
    *You can never make more money than your time will allow. If you charge $100/hour and work 40 hours/week, then you can never make more than $4,000/week unless you work more.
  2. *You are a commodity
    *The client doesn’t so much look at you as someone who is providing them a solution as they do a “resource”.  You are perceived as less valuable and therefore could easily be replaced.
  3. *More Risk
    *I know this type of contract is listed as less of a risk above, but there is also some riskiness to it.  If you get in the weeds on a task or start introducing too many bugs, the client might feel that you are misleading them or incapable of performing and you risk getting released from the project.

Takeaways

While I have only scratched the surface in comparing these two types of contracts, I hope you have a better understanding about which route to pursue for you.  My advice is to not be too rigid stating “I’m only going to use contract type X forever” because each contract situation may vary.  Use your best judgement and make the decision that is best suited for each individual project and client.  At some point in the future, I will post a few tips for making this decision based on some factors, but that is for a later date.

Until then, happy consulting!

P.S. Make sure to sign up for the newsletter below to be notified about awesome posts like this in the future!

Software Development Consulting: Some Tips On Structuring Your Contracts

When I first started out as an independent software developer, one of things that stressed me out the most was how to structure contracts that I sent to clients.  Working for a consultancy in my previous work-life I had seen contracts before, however, I never really paid enough attention to them to know what type of content went into them.

After quite a bit of research, I found an invaluable resource.  Over at techrepublic.com, Chip Camden posted a beautifully crafted consulting contract template.  You can see the post and download the template here.  This post was a lifesaver.

Chip goes over EVERY single section of the contract and gives an explanation of why it’s there.  You can download the template and determine which sections you need for your business, based on his explanations.  It doesn’t get much easier than that.  Of course, I would still strongly suggest you fork over a couple hundred bucks and have a lawyer look over the contract before sending it off to clients.

How To Sign Contracts Online

Once you have your contract in place, you will need a way to get your clients to sign it.  You could go the old-fashioned way of scanning, both parties signing, and scanning again OR you could use an online signature service.  One that I use and highly recommend is RightSignature. I know those guys personally and have had a great experience with the service so far.

Here is my process:

This is what I have found works out well for my business.  #proTip: I have my assistant do this now 😉

  1. Complete the contract blanks in regards to rates or any other information you want the client to see before they sign the contract.
  2. Upload the contract template to Google Drive (optional).  Make sure your company info is completed and all of the other fields (dates, signatures, etc…) are blanked out.
  3. Once inside of your RightSignature account, you can connect to your Google Drive and import the document in.  You can also upload them directly from your computer if you don’t want to use Google Drive.
  4. RightSignature lets you put text fields and date boxes in the blanks and specify who is responsible for filling them out (you or the client).
  5. Finally, add the signature fields at the bottom and send off the document for signing.
  6. Once every party has filled out the needed information, the completed document is then sent to both parties via email.

Other Considerations

Often times, the client will have their own contracts for you to sign.  This isn’t necessarily a bad thing.  However, make sure that you read over it carefully and run it by your lawyer.  Don’t try to force your contract on a client that already has their own.  They will usually not be open to this, in my experience.

Make sure to have an ‘exit clause’ in your contract in case things go sour.  I seldom enter into fixed bid contracts so I usually have a clause where either party can cancel the contract with 7 days written notice.  This also makes the client feel at ease as they are not trapped with you in an event where their situation changes.

Finally, be willing to be flexible.  Sometimes clients might not like certain clauses in your contract.  Be willing to change things like delivery dates, invoice dates, invoice periods, rates, etc… on a client to client basis.  Obviously, use your best judgement here.

Conclusion

I hope that you have found this post useful and it saves you some time hunting down a contract template.  I am always open to suggestions so if you see anything else that works for you, I would love to hear about it via email or in the comments.

Please consider signing up for my email list to get killer posts like this one delivered to your inbox.

*Disclaimer: I am not a lawyer and do not claim to be giving any real legal advice.  I am simply stating how I do things with my business.  Make sure to consult with a lawyer before engaging in any contracts.

Being An Indie Software Developer And Signing NDAs

Very frequently, I receive emails that go something like this:

“Hey Brandon, I have a killer project idea. Do you want to work on it?  Please sign the NDA so we can talk.”

Early on when I first started consulting, I would have responded with something like “Sure send it over!” and signed the thing without hesitation.  As of late, I have changed my view on NDAs; at least in this type of situation.

For those that don’t know, an NDA (non disclosure agreement) is a contract that is intended to protect the intellectual property of the client.  They make a lot of sense, especially in the event that the deal goes sour.  Say a client has some great idea for how to better take selfies that is going to revolutionize the selfie game.  If he doesn’t get a developer to sign an NDA, the developer could potentially be free to discuss the idea with others, leaving the idea open to be stolen.

Why I Don’t Sign Preliminary NDAs

In the scenario I mentioned above, it would be very unwise of me to sign this NDA as I don’t have enough information about the product.  This puts me as a consultant at a huge risk.

Say for example I am working on a photo/video sharing app (I get roughly 1 request a week for some spin on Instagram). Now, say the incoming project is some variant on photo sharing. If I sign the NDA, it now now puts me in a conflict of interest with my existing project.

Even if I knew that the project was a photo/video sharing application up front, I still would not sign the NDA.  Much of the time (as mentioned above) clients want very similar applications.  If I went around signing every single NDA that came across our desks, I would be out of business after the first client.

When I Will Sign NDAs

Well, the first thing that I do is ask for clarification on the project and tell them my NDA policy.  I basically tell them that I am happy to sign the NDA if one of the following conditions are met:

  1. There is extremely proprietary information (you can’t land a big enterprise contract without first signing an NDA)
  2. We are ready for project kickoff and all parties are aware of any potential conflicts

In addition to that, if I am currently working on a project that is of similar type, it would be worthwhile to disclose that information to the potential new client (not the proprietary info, just that there is some overlap) so that they can choose whether or not to proceed.  Better to possibly lose the new client than end up in a crazy legal battle.

If the new client refuses to give you any more information, then they are not worth your time.  They will most likely be too challenging to work with down the road anyway.

NDAs Are Not Set In Stone

When you do finally decide to sign the NDA, know that it is not complete until you sign it. If you see something that you don’t like or want to add any additional clauses, feel free to propose those to the client.  Most clients will be very understanding.

That being said, it’s VERY IMPORTANT that you read all the way through an NDA and possibly run it by your lawyer before signing.

Suggestion If You Want Your NDA Signed

If you want a developer to sign your NDA, make sure to give him enough information about your project for him to make an educated decision.  If you just say “I want a photo sharing app” and expect an NDA signed, good luck.  Make sure that they know there is proprietary information involved and that you are doing something different that must be kept private.

An NDA is not required if you want to make say an “Instagram Clone For Puppies” or a “Miley Cyrus Flappy Bird Clone”.  Be sensitive to the uniqueness of your idea and decide if it really warrants an NDA.

Also note that developers are not out to steal your idea.  They get pitched hundreds of ideas and most of the time your idea falls into 3 categories anyway:

  1. It’s not unique
  2. There is a technical challenge and that’s why it hasn’t been done (I get pitched a lot of ‘Map a grocery store so that my list will navigate me around’ ideas)
  3. Your idea is so niche and so unique that the general audience won’t get it and it won’t be profitable anyway

I’m not saying that every idea falls into these categories. But a good majority do. Most of them fall under #1 and that’s not necessarily a bad thing.  Google fell into #1 and look where they are today.  Just keep these things in mind when requiring a signed NDAs before you will give out any info.

Conclusion

There has been quite a bit of discussion lately (especially on Hacker News) about whether or not to sign NDAs.  Most of the recent articles I have read are simply titled “I Will Not Sign Your NDA”.  I feel that NDAs have there place, but you should sign them only with extreme caution.  Examine each NDA on a case by case basis and determine how it will affect your business in the long run.

*Disclaimer: I am not a lawyer and do not claim to be giving any real legal advice.  I am simply stating how I do things.  Make sure to consult with a lawyer before engaging in any contracts.

Becoming A Software Consultant: My Backstory

I recently published a post about my first year of being an independent iPhone development consultant.  The feedback from my readers was incredible, however there was one important thread on Hacker News that I wanted to address.  The issues were:

One of my common hangups with these kind of posts is the lack of history as to what lead people to these consulting gigs. Where were you before, and how long were you there?

I found this to be a very valid point.  Far too often you see guys posting their end of the year profits from their consulting gigs and they make it sound extremely easy.  This can be dangerous as joe n00b might be so inspired that he quits his job and jumps right into the deep end without first preparing himself and assessing the risks involved.

That being said, I wanted to write a bit about my backstory and how it ultimately lead to my ability to strike it out on my own as a consultant.  I have read stories similar to mine and there are a few key points that seem to be common, which I will highlight as I go.

Circa Summer 2008 – Just Before Apple Releases The iPhone (not iOS) SDK 

In the summer of 2008, I was preparing to enter my senior year of college for Computer Science at UNM.  A quick note about CS in New Mexico.  There are TONS of government contractors (Sandia, Ultramain, Honeywell, Lockheed, etc.) in NM and college CS courses seem very much tailored to preparing students to head down this road towards one of these contractors.  This is where most of my buddies from college ultimately ended up.

So, like any good UNM CS student, I got a job at Intel hacking C# tools for their engineers to use during testing.  It was fine, but I knew I could not work in a cube forever.

Around that time, one of my buddies had the original iPhone and I was crazy jealous.  I think I had some silly Windows CE brick or a Palm Treo or something.  It was obvious that the iPhone was the “next big thing” and I took notice.  So I started developing web apps for the iPhone, as that was the primary way to get custom apps for the devices.  Apple even had a terrible (non mobile formatted) interface for exploring such web apps.

I built cool things like a Weight Watchers Point Calculator (my wife’s idea) and Minesweeper and to my surprise made a couple bucks a day on ads.  This really fueled my excitement.  Then, Apple announced the official SDK.

An Aventure In iCodeBlog And Other NDA Violations 

When Apple first released the SDK, the App Store didn’t exist yet.  All developers were forced under Apple’s NDA, stating that we weren’t able to discuss any aspect of the SDK on the web.  As you can imagine, this left very little resources available for learning how to actually do development.  There were no blogs, no books, and the only source of information was Apple’s documentation.  I saw this as a HUGE opportunity.

I very quickly registered the domain icodeblog.com and setup WordPress.  This led to my very first post in July of 2008. I had no idea what I was doing; it was my first blog ever, but I knew I would be able to learn more effectively if I was teaching others as I went along.

Being a Java developer, I was comfortable reading documentation so I dug right in to the iOS docs.  I spent all of my free time (the time that wasn’t spent with my wife) learning and blogging.  I was violating the NDA by discussing it on the web, but my page views were growing every day.  Other blogs started to sprout up but I soon had the most popular iOS development blog on the web.  I had over 10K RSS subscribers one month after my blog launch.

Things were really exciting, however, I had to start thinking about my future and how I was going to support my family.  Still being a bit narrow-minded with my career choices, I applied for a job at Lockheed Martin and got a position.  It was all set; I would graduate college in the spring and head to the “cube farm”.  Destined for a life of “here’s your input, give me this output”, TPS Reports, and other corporate stereotype jokes…

That’s when I got my first iOS programming job offer…

Enter RightSprite

As you can imagine, the popularity of iCodeBlog did not go unnoticed.  I received job inquiries quite often and one them happened to be from a guy who lived in Ireland named Jonathan.  He was a wealthy American entrepreneur who had added a mobile offering to his already successful rails consultancy called RightSprite.  However, he started his business by outsourcing to the Ukraine, which yielded fairly poor results.

So, in the winter of 2008 I received an email that they wanted to purchase iCodeBlog and give me a job replacing their outsourced team.  He also happened to have an employee in NM named Josh.  Josh and I met at a “hip” food place that I had never heard of and I was blown away that this was considered “business”.  Needless to say, I was excited.

So here I am, about to graduate with a perfect job lined up, and I get an offer like this.  I had no idea what to do.  The idea of working remote was foreign to me and had never even crossed my mind.  People can actually do that?  I can work in my pajamas??

So I decided to take a risk, sell him my blog, and accept the job offer.  I was terrified-especially when he told me that my first check was coming out of his personal bank account and that was why it was late.  Little did I know, this would be one of the best career decisions I could ever make…

Build, Hire, Repeat

I graduated from college and my career was in full swing.  I was the sole developer at a consultancy that had more mobile work than it knew what to do with.  My family had no idea what I did.  They though I was a drug dealer or something just as lucrative.  At one point, my grandma asked me, “When are you going to get a real job like your cousin Michael (he works for the city)”.  I could’t quite believe this was a legitimate job myself.

Things started to get very exciting.  Jonathan asked me to help hire our next employee.  Luckily, a guy by the name of Collin reached out to me and asked if he could guest blog on iCodeBlog.  A few tutorials later and we offered him a job.

RightsSprite continued to scale up and I helped hire quite a few new developers.  They eventually moved to a physical building in Portland, Oregon while I still worked remotely from NM.  The team continued to grow.

A Book Deal

Even though I didn’t own iCodeBlog anymore, I still contributed to it from time to time.  This lead to me being contacted by a few publishing companies with book offers.  A book offer?  It doesn’t sound that cool now, but in 2009, when there weren’t many iOS development books, it sounded incredible.

I decided to go with Manning Publishing and I updated their iPhone development book from web app-centric to SDK-centric.  It amazed me that I struggled to write four paragraph essays in high school but I was now writing a four hundred page book with ease.

The book did fairly well and sold around 10,000 copies.  Unfortunately, when you are an author of a tech book, that amounts to just about nothing in profit.  As you can imagine, I had little motivation to do the update the next year when Apple updated the SDK.

A New Sheriff In Town

Shortly after moving the offices to Portland, the owner sold the company and we had a new president and CEO.  He ran things a bit differently but ultimately things were cruising forward.  Our team continued to expand and eventually I hired our first Android developers.

In December of 2011, I was promoted to the Director of Mobile Engineering.  It was a fancy title and I was entirely proud to hand out business cards with that printed on them.  I had helped build the team up to around sixteen mobile developers and it was now my job to manage them, as well as work closely with sales to land larger contracts.

2012 was a great year of working on cool projects including the Food Network and Google Fiber TV.  I got to attend WWDC and spend a few weeks on Google’s campuses.

Things Get Shaken Up

Little did I know, there was some unrest in the company with the higher-up managers.  One day, there was a company memo that the three people who were higher ranked than myself had all left.  There were rumors as to why they left, but no one really had the true story.  This caused a stir in the company and a few more developers began to follow suit.

This, of course, led to some company restructuring which put me right at the top with one other team member.  I was now one of the highest paid people in the company and solely in charge of the entire mobile team.

I thought everything was perfect until one day in December of 2012, I received the following message when I logged into Gmail:

Your account has been suspended, please contact the administrator.

This made me considerably suspicious.  I knew there was a lot of restructuring in the recent history and I immediately wondered if I was next on the chopping block.  I was logged into Linked In at the time and noticed the company owner was the last person to view my profile.  “He suspects me of looking for other jobs and is checking up on me”, I thought.

That’s when I received a message on Skype from him.  It said:

Brandon, do you have time to talk?

My heart jumped into my throat.  I knew what was coming next.  He was soon up on video chat and proceeded to tell me that the company was undergoing some restructuring and my position has been eliminated.  “Eliminated?” I thought.  And then I asked him what that meant for me.  He repeated the sentence again, said thanks, and hung up.  That was it; I no longer had a job.

My “secure” job that I had been working at for four years disappeared in a matter of seconds with very little “real” explanation.  I was speechless.

Taking The Plunge

After getting “let go”, I took the rest of the day off and went out with my family (wife and two kids).  We were shocked, but I knew what I had to do.  It was what I had been dreaming of doing for quite some time.

Armed with the knowledge of the entire software pipeline-from sales, to development, to maintenance-I hit the ground running the very next day in search of my first contract.

I wrote this blog post documenting that very first month.

 

Takeaway

It has been a little over a year since I’ve had a “secure” job.  I put that word in quotes because I now believe the only way to have a secure career is to make one for yourself.  You could be let go at any time, for any reason.

I was very fortunate to have a first job that allowed me to learn the needed skills to do what I’m passionate about; building consumer facing apps that get used by thousands of people.  If you want to do the same, I would encourage you to find a job that lets you explore all of the aspects of consulting to find out if it’s right for you.

Sometimes I wonder why everyone is not a consultant.  It feels so free to be able to hack outside on a nice day or go sailing with my buddies on a random Wednesday.  But that’s just one side of the coin.  Other days, I wonder why I am even doing it.  I often wish I had a simple job with a well-defined task where once I got “off work”, I could go home and not think about it again until the next day but I don’t have that luxury.  There are real risks and stresses involved with working for yourself so I urge you to weigh them out before taking the plunge.

I have received so many good questions through my last few posts about consulting.  They have inspired me and I intend on taking this year to diligently blog about topics such as finding clients, health insurance, contracts, etc.

So please share and subscribe; I hope to help you on your journey to becoming free of your corporate chains.

This post is part of a series about becoming and independent software consultant.  I am participating in this series with my good friend Josh. You can read his take on this post here.

What I Learned In My First Year Of iOS Consulting

Wow, I can’t believe it has already been a full year since I struck it out on my own.  Last year, I published a post after my first month on doing contract iOS development.  Needless to say, I have grown and learned quite a bit over the past year and I wanted to share some of those experiences.

Income

While I won’t share exact numbers, I left my 6 figure/year job to pursue the indie/consulting life.  During the course of the year, I was able to amass 40% more income in 2013 than I had at my previous position.

In addition to that, I had the time to launch a couple iOS applications and thus upping my Apple income by about 20% this year.

Network Network Network

I would say spending time networking and meeting people is just as important as being able to write code if you want to be successful on your own.  Through out the year, I dedicated at least five to ten hours a week just meeting with people, talking on the phone, and making new connections.

Often times, I would get contract opportunities that I knew for sure that I wasn’t going to take; either because I didn’t love the project, or (more often than not) because I didn’t have the bandwidth to take them on.  However, rather than just writing the client back “I don’t have time“, I would take the call (or meeting in town), make the connection, and even listen to details about the contract.

My wife would tell me to stop wasting my time and that those hours would be better spent on project work that actually made money.  However, these contacts are arguably more valuable than the hours “lost”.  In many situations, I have reached out to those potential clients weeks or months later once I hired a new developer and was then able signed a contract.  If I had declined the meeting to begin with, they probably wouldn’t have been as inclined to work with me so readily.

Subcontractors

Subcontracting has been a mixed bag for me.  It seems to be the only (safe-ish) way to expand your business as a consultant, other than hiring full time developers.  So, if you want to be able to work less yourself (which is almost never the case) or increase your companies revenue, you need to hire out.  

Once I found the right people, subcontracting was a dream.  I was able to reach more clients, still deliver the same value in the work, and achieve the client’s goals, all while expanding my business.

The main challenge I have had is deciding whether to hire subcontractors from here in the states or “offshore”.  They both have their benefits and complications. Here are some I have found:

Benefits of hiring in the states:

  • Communication – Most of the time their timezones are close enough that one of you is not inconvenienced to communicate in real time.
  • Trust From Clients – Some clients still have some issues with “offshore”, especially because many of them have tried their hand at the ODesk lottery and have lost.  So, saying you have US based team members sometimes makes them more comfortable. It’s unfortunate, but I have seen it to be true in some cases.
  • Colleagues – Often times you already know or have worked with these guys since starting with acquaintances/friends is a good place to look for developers.

Complications hiring in the states

  • Cost – US devs are expensive.  Most of the time they have full time jobs and want to do consulting on the side.  So it is important that they get paid more to do contract work than their day job pays.
  • Colleagues – This is on the negative list as well because hiring people you know can get weird if things go awry.

Benefit of Offshore developers 

  • Cost – I put this here, however that doesn’t mean I hire “cheap” developers.  Honestly, if you are not paying a contractor well, you are either under paying him and should give him a raise OR he shouldn’t be working for you as he’s probably too junior.
  • Perspective – I have some incredible developers in other countries that have taught me quite a bit whether it’s about development, process, culture, or even my own code.  It’s a great opportunity to learn.

Problems with Offshore developers 

  • Location – Timezone issues can be a problem if you let them.  For example, I have a developer who lives in a completely different timezone than my own.  However, he does a fantastic job of being available when he is needed.  I have had other instances where it was very challenging to reach my developer in an event where I needed information on short notice.
  • Vetting Process – Finding developers is a little more tricky.  With devs in the states, you can just head to a local meet up or conference, but finding GOOD “offshore” devs is a little trickier.  I have lucked out a few times, but for the most part it’s a bit more work.  I would suggest spending a little of your own money to adequately search and vet each candidate.
  • Language – While doing iOS development, you may need your client and your developer to communicate with one another.  That being said, it’s vital to find a developer who you can understand and who can understand you in order to make communication possible.

Hiring An Assistant

Taking a page from Tim Ferris’ 4 Hour Work Week, I decided to hire an assistant.  Ferris suggests “virtual”, however, I have hired one locally (she’ll be proofreading this post 😉 ).  I think it’s one of the best decisions I have made as a business owner.  Here is just a short list of things she handles for me:

  • Contracts
  • Invoicing
  • Payments of contractors
  • Research
  • Phone calls
  • Personal issues (like returns, purchasing equipment, etc.)

Even if she saves me two hours per week, she has paid for herself, and believe me, she saves me much more than that.

Never Decline A Contract

I mentioned this earlier in the post, but I want to reiterate it here.  I seldom tell clients “no” and I really feel that it has worked out to my benefit.  At the very least, I hear them out and add them as a contact to keep in mind for the future.

What I generally do when I can’t take on a client is I will give them an estimate of when myself or a member of my team will be available.  That way, if they are okay with the timeline, I can keep the pipeline open.  If not, there is no harm done.  Also, if I hire another developer before the time I said I was available, sometimes the client will still have the need and I am able to fill it.

If I absolutely don’t have time or don’t want a particular contract, I will refer the client out to other dev shops.  I don’t look at this as competition, but rather opportunity as I would hope they would do the same for me one day.  As an added bonus, some of them have a referral fee so you can at least profit from pairing the client up.

Taxes

I have found out that taxes are less fun when you are self-employed than when you are employed by a business.  Luckily my wife is MUCH better at money management than I am, so she set up a separate tax account where roughly 40% of our income would go.

One of the other good decisions I made besides hiring an assistant was hiring a CPA.  She has saved me countless hours and fees and is worth her weight in gold.

Hire a CPA from day one; you will never regret it.

Family

I know this is a “business” related post, but I have to mention this.  Having a wife and kids, I am very much a family man.  Working for myself has been such a blessing since I have been able to spend considerably more time with my family than when I was employed by someone else.

For example, if it’s a nice summer day and the family decides to head to the zoo, I can just go without asking a boss for time off or taking PTO.  I simply work in the evening or more hours the next day to recoup the time.  Personal time management is key to be able to have this kind of freedom.

Summary

Overall, 2013 was an incredible year.  While I did make mistakes (a ton), I gained so much knowledge and had a blast doing so.  Going solo isn’t for everyone (some days I wonder why everyone** isn’t** doing it, and others I wonder why I am), but it’s been one of the most exciting experiences of my life.

I look forward to what 2014 brings and seeing how I can continue to grow my consultancy.

Happy New Year and Happy Hacking!

The Top 5 Places To Find Good Software Developers/Contractors

One thing I am often asked is “Where can I find good developers/contractors/subcontractors?” While I have found talent many different ways, I wanted to share my top 5 with you.

This post should be useful to you if you have a project and are looking to find a developer OR are a developer looking to subcontract some of your work.  I am sharing these based solely on my experiences with them and hope you find value in this list.

1. Local Meetups

Local meet ups are the absolute best place in my opinion to find developers.  Almost every city in the nation has some sort of group meeting on a regular bases for a given focus of development.  You should have no problems finding a rails meetup group, iOS, Android, etc…

I would suggest finding out about such meetups in your area by Googling phrases such as “[your area] iOS meetup (sub iOS for rails, python, etc…).  I regularly attend a “Cocoa Heads” group full of incredibly smart and capable mobile developers all willing to work on projects.

These types of groups are always excited to have clients come in and pitch their ideas.  One piece of advice though, don’t go in to these groups and start with “I have a great idea and I will give you a percentage of the company in exchange for development”. They will stop listening immediately.

This one is going to require a bit of work and research on your part, but I will get you started.  Around the internet, there are a few of what I call “celebrity developers”.  These are generally guys who have made a name for themselves and who are established as experts in their space.

While many of them are not taking on contract work themselves, they may or may not have a mailing list of interested contractors.  One such person that does exactly this is Ray Wenderlich and I happen to receive emails on his contractor list.

Even if these developers don’t have lists, they generally have plenty of connections to point you in the right direction.  Like I said, this method isn’t easy, but it can definitely have one of the biggest payoffs in terms of quality developers.

3. Specialize Project Sites

As of late, quite a few interesting sites have been popping up that have solved a fundamental issue when it comes to pairing developers with projects. The problems are 1. it’s hard to find good developers and 2. it’s hard to find clients with realistic cost expectations. That’s why ODesk exists 😉

The first of these sites that I have found is OOOMF.  OOOMF is relatively new and you must be reviewed and accepted by their team in order to be a part of it.  It’s basically a private network for pairing developers with projects and it supports all different project types (mobile, web, design, etc…).

Project owners can put their project up with a relative budget and developers can “apply”.  The process then moves forward with communication between the client and the developers until a price and scope have been reached.

There is an additional overhead of 15% for using this service, but I think it’s well worth it.

Another one of these sites that is more mobile centric is http://apphappening.com.  This site is very new and I have only just begun to use it.  I should have a better review of them shortly.

4. Twitter and App.net

Twitter and app.net are definitely the preferred social network of serious developers.  I would steer clear of Facebook and Linked in as this is generally where the recruiters hang out. Your message will most likely get dismissed as spam.

I’d suggest searching Twitter/App.net for the keywords of your project (iOS developer, rails, etc…) and find the folks with a ton of follows and a very small following to follower ratio. You will know them right away.  Also, most of their blogs come up first in Google for many related keywords.

5. Developer Conferences

This one might cost you a bit of money, but is definitely well worth it.  There are conferences for every focus of software development and they occur all throughout the year.  These conferences generally have a HUGE percentage of professional developers who are just as eager to work on a project as you are to have them.

One of my favorite iOS conferences is 360iDev. It’s very indie-centric and offers an incredible community of iOS developers of all abilities.  If you are looking to get a mobile project done, I strongly urge you to attend.  While I can’t speak for conferences in other areas(web, etc..), I would really love some suggestions in the comments of this post if you are up for it!

6. Bonus – Right Here

Shameless plug time.  If you are looking for professional mobile app (iOS or Android), I have a team of developers and am always looking to work on new and exciting projects.  If you want to hear more about it head over to my Hire Us page or shoot me an email brandon @ pixegon [dot] com.

Conclusion

Whether you are a person/company looking to hire developers or a developer looking to hire contractors, I hope you have found this post useful.  Your feedback in the comments is greatly appreciated.  Best of luck with your search!

iPhone Programming Tutorial: Creating An Image Gallery Like Over – Part 2

Screen Shot 2013-08-09 at 8.36.42 PM

 

Welcome to the second part of my tutorial series “Creating An Image Gallery Like Over”.  In this part of the tutorial, you will learn how to actually display the photos in the UICollectionView as well as give the user the ability to take photos with their camera.

If you haven’t already done so, please go back and complete part 1.

1. Custom UICollectionViewCell

Start by creating a new subclass of UICollectionViewCell and naming it PhotoCell.  Now, open up PhotoCell.h and add the following code:

#import <AssetsLibrary/AssetsLibrary.h>
 
@interface PhotoCell : UICollectionViewCell
@property(nonatomic, strong) ALAsset *asset;
@end

Now, open PhotoCell.m and add the following code:

#import "PhotoCell.h"
 
@interface PhotoCell ()
// 1
@property(nonatomic, weak) IBOutlet UIImageView *photoImageView;
@end
 
@implementation PhotoCell
- (void) setAsset:(ALAsset *)asset
{
    // 2
    _asset = asset;
    self.photoImageView.image = [UIImage imageWithCGImage:[asset thumbnail]];
}
@end
  1. This is an IBOutlet to a UIImageView that we will create inside of the Storyboard
  2. We overwrite the setter method for the asset in order to convert the asset’s thumbnail into a UIImage and set it to the contents of the UIImageView

Now that we have the custom cell created, we need to hook it up and create the UIImageView inside of Storyboard.  Open MainStoryboard.storyboard and click on the default UICollectionViewCell inside of your UICollectionView.

It might be tricky to see the cell as it has a white background and blends in, but it’s there.

Screen Shot 2013-07-24 at 6.43.38 PM

Now, click on the Identity Inspector from the right side bar and change the class to PhotoCell.  This will inform interface builder that this object is of the type PhotoCell and let us hook up the photoImageView outlet.

Screen Shot 2013-07-24 at 6.46.35 PM

Next, open the size inspector, change the size to Custom, the width to 104 and the height to 104.  This will give us nice sized images, with a good amount of padding between them.

Screen Shot 2013-07-24 at 6.49.51 PM

The UICollectionView will overwrite these sizes, so we need to change it in one other location.  To ensure that the cells stay the correct size, click on the Collection View in left side bar and open it’s Size Inspector.  Then set the Cell Size width and height to 104.

Screen Shot 2013-07-24 at 7.07.14 PM

The final step here is to drag a UIImageView on to your cell (scaling it to fit the entire cell size), and hook up the IBOutlet to the photoImageView. Do this by control-click and dragging from Photo Cell to the ImageView and selecting photoImageView.

Screen Shot 2013-07-24 at 6.52.32 PM

If you build and run at this stage, nothing will be different.  That’s because we still need to tell the ViewController class about our new PhotoCell.  Open ViewController.m and import PhotoCell.h.

#import "PhotoCell.h"

Now, head down to the collectionView:cellForItemAtIndexPath method and replace the contents of it with the following code:

- (UICollectionViewCell *) collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
    PhotoCell *cell = (PhotoCell *)[collectionView dequeueReusableCellWithReuseIdentifier:@"PhotoCell" forIndexPath:indexPath];
 
    ALAsset *asset = self.assets[indexPath.row];
    cell.asset = asset;
    cell.backgroundColor = [UIColor redColor];
 
    return cell;
}

What’s changed here is, we are now telling the UICollectionView that the cell it’s returning is of the type PhotoCell. Also, we are fetching the ALAsset out of our array at each index and sending it to the cell so that it can display it’s thumbnail.

Build And Run!

Screen Shot 2013-07-24 at 7.10.39 PM

WhoohooYou should now see your photos populating the **UICollectionView. Congratulations! </p>

</strong>While, this is definitely cool, you might now be wondering “how do I select a photo?”.  Great question, and here is the solution.

2. Selecting Photos

Now that you have all of the groundwork in place, selecting photos from the collection could not be easier.  Open up ViewController.m and replace the collectionView:didSelectItemAtIndexPath method with the following code:

- (void) collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath
{
    ALAsset *asset = self.assets[indexPath.row];
    ALAssetRepresentation *defaultRep = [asset defaultRepresentation];
    UIImage *image = [UIImage imageWithCGImage:[defaultRep fullScreenImage] scale:[defaultRep scale] orientation:];
    // Do something with the image
}

This will get the selected asset and convert it to a UIImage. You are now free to use the UIImage how you want. Perhaps you create a protocol for this class and make a callback to a delegate OR maybe you add this to a UINavigationController stack and push a new view controller on to the stack containing this image. The sky is the limit!

If you look at the Over app and back to your image gallery that you just created, you will notice something is still missing.  What if the user wants to take a photo or access other albums?  This is where Over adds a bar across the top of the interface with 2 buttons that fall back to the “default” style of fetching images if the user wants to take a photo or access a different photo album.  Let’s build this out now.

3. Building The Interface To Take Photos And Access Albums

Start by setting up the IBActions for theses buttons.  Open ViewController.m and add the following empty methods:

#pragma mark - Actions
 
- (IBAction)takePhotoButtonTapped:(id)sender
{
 
}
 
- (IBAction)albumsButtonTapped:(id)sender
{
 
}

We don’t need to add the code yet since we still need to build the UI and hook up the IBOutlets. Now open MainStoryboard.storyboard and drag a UIView right on top of your UIView.

One issue you might run in to here is the view will want to become a subview of the collection view.  To combat this, drag the view outside of the collection view inside the left bar so the hierarchy will look like this:

Screen Shot 2013-07-25 at 12.35.06 PM

 

One other “gotcha” is, you must ensure that the view is positioned below the collection view in this list, otherwise it won’t show above it on screen.

Now, let’s manually size and position the view as Interface Building will make things hard on us if we want to position it over our collection view.

Select the view and open the Size Inspector. Set the values as follows:

Screen Shot 2013-07-25 at 12.44.23 PM

 

Again, remember this positioning is optimized for the iPhone 5. So make sure you are testing with that simulator or you won’t see this bar.

After this, the bar still won’t be visible inside of Interface Builder.  We need to set the background color to black with some transparency.  Open the Attributes Inspector and click on the background color.  Then set the color to black with 80% opacity:

Screen Shot 2013-07-25 at 12.40.13 PM

 

You should now see the bar positioned on the screen like this:

Screen Shot 2013-07-25 at 12.41.54 PM

 

Now drag a UIButton on to the view you just created. There are a few things that must be done to style the button:

  1. Position it at 0,0
  2. Set the width to 160px and the height to 70x
  3. Change the type to custom
  4. Change the text to “Take Photo”
  5. Change the font to “Helvetica Neue Condensed Black” size 20
  6. Set the text color to white

When you have completed these steps, the button should look like this:

Screen Shot 2013-07-25 at 12.47.26 PM

 

Now, hook up the IBAction by opening the Connections Inspector and dragging from Touch Up Inside to the View Controller object and selecting takePhotoButtonTapped:

Finally, duplicate this button (copy and paste), rename the title to “Albums”, move it next to the “Take Photo” button and hook its Touch Up Inside to albumsButtonTapped:

The final Interface should look like this:

Screen Shot 2013-07-25 at 12.51.25 PM

 

Go ahead and do a Build and Run and this stage and marvel at your interface development prowess!

4. Actually Taking Photos And Accessing Albums

The final step for this tutorial is to implement the code to bring up the camera as well as bring up the photo albums.  Let’s start with the camera.  Open ViewController.m and add the following code to the takePhotosButtonTapped: method:

- (IBAction)takePhotoButtonTapped:(id)sender
{
    if (([UIImagePickerController isSourceTypeAvailable:
          UIImagePickerControllerSourceTypeCamera] == NO))
        return; // 1
 
    // 2
    UIImagePickerController *mediaUI = [[UIImagePickerController alloc] init];
    mediaUI.sourceType = UIImagePickerControllerSourceTypeCamera;
    mediaUI.allowsEditing = NO;
    mediaUI.delegate = self;
    // 3
    [self presentViewController:mediaUI animated:YES completion:nil];
}
  1. Makes sure that the photo library is available.  If the user declines photo access, this will be the case.
  2. Create the UIImagePickerController and set its source type to UIImagePickerControllerSourceTypeCamera.  This lets the media picker know to use the camera and not the image library.
  3. Finally, present the view controller modally

The method to bring up the photo albums is almost identical to the method above.  Add the following code to the albumsButtonTapped: method.

- (IBAction)albumsButtonTapped:(id)sender
{
    if (([UIImagePickerController isSourceTypeAvailable:
          UIImagePickerControllerSourceTypePhotoLibrary] == NO))
        return;
 
    UIImagePickerController *mediaUI = [[UIImagePickerController alloc] init];
    mediaUI.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;    
    mediaUI.allowsEditing = NO;
    mediaUI.delegate = self;
    [self presentViewController:mediaUI animated:YES completion:nil];
}

As I said before, this method is almost identical with the only difference being, we are using UIImagePickerControllerSourceTypePhotoLibrary to open up the photo albums.

Build and Run and tap the “Take Photo” button. Make sure you are testing on the device at this stage or nothing will happen since the simulator doesn’t have a camera.  You can however test the “Albums” button assuming you have some photos in your photo library.

Now that you are able to pick a photo, you need to be able to access the photo that was selected or taken.  To do this implement the following delegate method for UIImagePickerController.

#pragma mark - image picker delegate
 
- (void) imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
    UIImage *image = (UIImage *) [info objectForKey:
                                          UIImagePickerControllerOriginalImage];    
    [self dismissViewControllerAnimated:YES completion:^{
        // Do something with the image
    }];
}

This method fetches the selected (or taken) image and stores. It then dismisses the camera or photo albums allowing you to do whatever is needed with the image.

5. Next Steps

By now, you should have learned how to use the ALAssets library to interact with a user’s photos and use them to build a custom interface. You also learned how to use a UICollectionView to display a grid of photos.

With this knowledge in hand, you should now be able to make much more interesting photo selection interfaces than the default one Apple has to offer.  Other apps like Google+ and Instagram both have very slick photo pickers and I hope this tutorial has your gears going thinking about other interesting photo selection interfaces.

You can download the source from this tutorial on GitHub

Feel free to leave a comment if you have any questions. Happy Hacking!

 

iPhone Programming Tutorial: Creating An Image Gallery Like Over – Part 1

Screen Shot 2013-08-09 at 8.36.42 PM

 

Recently, I have had to build an app (download link) that required the user to choose a photo from their photo library.  Rather than just throwing up a UIImagePickerController like many apps, I decided to add a little bit of style.  Being inspired by Over’s ultra simplistic (and beautiful) photo selection interface, I decided to fancy things up a bit.

For this tutorial, I will start with a Fresh iOS6 View-Based application that uses Storyboards and ARC. Also note that I will be optimizing for the iPhone 5 resolution.  You are free to make the tweaks necessary to deploy on the iPhone 4 and 4S.

 

Here is a breakdown of what we will cover in this part:

  1. Creating a UICollectionView inside of Storyboard
  2. Using the ALAssetsLibrary to fetch photos from the user’s Camera Roll
  3. Displaying the ALAssets inside of the UICollectionView

1. Preparing The IBOutlets

Start by opening up ViewController.m **and replacing the **@interface declaration at the top with the following code:

@interface ViewController ()<UICollectionViewDataSource, UICollectionViewDelegate, UICollectionViewDelegateFlowLayout>
@property(nonatomic, weak) IBOutlet UICollectionView *collectionView;
@end

This will declare the IBOutlet needed to hook up the main UICollectionView that we will be using to display the user’s photos.  I have also set up our class to be a UICollectionViewDataSource, UICollectionViewDelegate, and UICollectionViewDelegateFlowLayout. This is necessary when interfacing with the UICollectionView.

2. Setting Up The UICollectionView In Storyboard

Open up MainStoryboard.storyboard and drag a UICollectionView on to your view ensuring that it stretches the entire screen.

Screen Shot 2013-07-21 at 8.44.02 PM

Then, Control-Click and drag from the UICollectionView to your ViewController Object and set it as the delegate and datasource.

Screen Shot 2013-07-21 at 8.41.29 PM

Finally, Control-Click and drag from View Controller to Collection View and selected collectionView to make the IBOutlet connection.

Screen Shot 2013-07-21 at 8.45.05 PM

Now, we need to give a Cell Identifier to the UICollectionViewCell so that we can reference it in code.  Click on the default cell inside of the UICollectionView and open the Attributes Inspector. For the Identifier type in PhotoCell. The cell might be a little tricky to see as its background color is clear, but it’s there. Simply click in the top left corner of the UICollectionView.

Screen Shot 2013-07-21 at 9.13.08 PM

Now that the UICollectionView has been set up, it’s time to fetch the photos from the user’s photo library.

If you are using the simulator, make sure to populate the Photo Gallery with images from the web. Simply open up a browser, do a Google Image Search, and click and hold on various images. You should have an option from the menu that pops up to save the images to your camera roll.

Finally, open up the Photos app on the simulator to initialize the Assets Library.

3. Fetching ALAssets (user photos) From The ALAssets Library

In order to interface with the user’s photo library, we must first import the AssetsLibrary.framework framework.  To do this, click on your project in the sidebar, select the Target, then click Build Phases, expand the Link Binary With Libraries section and click the button.  Do a search for Assset and then double click on AssetsLibrary.framework.

Screen Shot 2013-07-21 at 8.57.37 PM

It should now be added to your project and ready to use.  Now that it has been linked, we must import it into the ViewController.m file.  Open up ViewController.m and add the following import to the top of the file:

#import <AssetsLibrary/AssetsLibrary.h>

Before we can fetch the user’s photos, we need to set up an NSArray to put them in.  Add the following line within the @interface declaration at the top.

@property(nonatomic, strong) NSArray *assets;

Now, add the following method to your class:

+ (ALAssetsLibrary *)defaultAssetsLibrary
{
    static dispatch_once_t pred = ;
    static ALAssetsLibrary *library = nil;
    dispatch_once(&pred, ^{
        library = [[ALAssetsLibrary alloc] init];
    });
    return library;
}

This is a static method that creates a static instance to the ALAssetsLibrary.  The reason this is needed is, when we enumerate the ALAssets in the next method, it seems that the assets get released immediately and otherwise wouldn’t be able to be used in the rest of the application. I will explain this a little more in a moment.

Head over to viewDidLoad and add the following code:

- (void)viewDidLoad
{
    [super viewDidLoad];
 
    _assets = [@[] mutableCopy];
    __block NSMutableArray *tmpAssets = [@[] mutableCopy];
    // 1
    ALAssetsLibrary *assetsLibrary = [ViewController defaultAssetsLibrary];
    // 2
    [assetsLibrary enumerateGroupsWithTypes:ALAssetsGroupAll usingBlock:^(ALAssetsGroup *group, BOOL *stop) {
        [group enumerateAssetsUsingBlock:^(ALAsset *result, NSUInteger index, BOOL *stop) {
            if(result)
            {
                // 3
                [tmpAssets addObject:result];
            }
        }];
 
        // 4
        //NSSortDescriptor *sort = [NSSortDescriptor sortDescriptorWithKey:@"date" ascending:NO];
        //self.assets = [tmpAssets sortedArrayUsingDescriptors:@[sort]];
        self.assets = tmpAssets;
 
        // 5
        [self.collectionView reloadData];
    } failureBlock:^(NSError *error) {
        NSLog(@"Error loading images %@", error);
    }];
}
  1. Grab our static instance of the ALAssetsLibrary
  2. Enumerate through all of the ALAssets (photos) in the user’s Asset Groups (Folders)
  3. Enumerate each folder and add it’s ALAssets to the temporary array
  4. Sort the assets list by date (this won’t work yet, but I will show you how to fix later). For now this code is commented out and the Assets will be sorted however they come out.
  5. Reload the UICollectionView (this won’t work yet as we haven’t set up the delegate methods)

Now that we have an NSArray populated with ALAssets, let’s set up the delegate methods for the UICollectionView in order to populate it with data.

4. Populating the UICollectionView With Data

UICollectionView functions much like a UITableView having delegate and datasource methods.  Add the following methods to your ViewController class to populate the view.

#pragma mark - collection view data source
 
- (NSInteger) collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section
{
    return self.assets.count;
}
 
- (UICollectionViewCell *) collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath
{
    UICollectionViewCell *cell = (UICollectionViewCell *)[collectionView dequeueReusableCellWithReuseIdentifier:@"PhotoCell" forIndexPath:indexPath];
 
    ALAsset *asset = self.assets[indexPath.row];
    //cell.asset = asset;
    cell.backgroundColor = [UIColor redColor];
 
    return cell;
}
 
- (CGFloat) collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout minimumLineSpacingForSectionAtIndex:(NSInteger)section
{
    return 4;
}
 
- (CGFloat) collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout minimumInteritemSpacingForSectionAtIndex:(NSInteger)section
{
    return 1;
}

This code should be fairly straight forward if you have ever worked with a UITableView.  The only lines to note are where ‘cell.asset = asset’ is commented out and we set the cell’s background color to red.  We will uncomment that line when we create a custom cell to display the image (for now it won’t).  I have also set the background color to red so that you can see that the number of cells is actually corresponding to the number of photos in the camera roll.

Build and Run!

Let’s take a break to do a build and run to see what happens.  If you have hooked everything up correctly, you should see a black screen with red squares on it with a count equalling the number of photos in the user’s library.

Screen Shot 2013-07-21 at 9.26.07 PM

Not too exciting, however it shows that we are displaying a number of cells corresponding to the number of photos in the user’s asset library.  At least it’s showing that you have done something.  The next step is to create a custom UICollectionViewCell that actually displays the photos, which we will do next time.

5. Next Time

That’s all for today.  In a ploy to get you to come back to my site (and subscribe to my RSS feed), I have chosen to break this post up into two parts.  

Luckily for you, I wrote the above message a while ago. Click the link below to go to part 2!

iPhone Programming Tutorial: Creating An Image Gallery Like Over – Part 2

Stay tuned!

Back To My Roots

I wrote my very first blog post back in July of 2008 when I start iCodeBlog.com.  I started the blog because I saw a huge need for iOS development tutorials on the web and really wanted to help others as I progressed in my development.

Well, quite a bit has changed since then.  I have written books, spoken at conferences, and built and shipped over 40 iOS applications.  Since selling iCodeblog in 2009, I have really let my passion for blogging fizzle.  For the first 2 years of the iCode sale, I wasn’t allowed to write tutorials on any other site.  This was very discouraging.

Over the years, I have guest blogged iOS tutorials on several sites including mobile.tutsplus.com and raywenderlich.com.  This has been pretty hit or miss for me.

As of recent, I have become an independent iOS developer and have been solving quite a few hard problems and coming up with some interesting solutions on projects that I have been a part of.  I now want to share some of those solutions with the iOS community in the form of tutorial blog posts.  These come in all shapes in sizes from cool UIKit hacks to building simple backend services.

So, when I say that I want to “get back to my roots”, I really want to start consistently blogging again and educating other developers using the knowledge I have gained over the years.  So stick around, subscribe, follow me, and please don’t hesitate to suggest tutorial ideas.

Happy hacking…

Tools of The Trade: What Tools I Use For iOS Consulting

Welcome Hacker News! There’s some discussion happening in the comments; but, as always, the better conversation is on the article page on Hacker News itself.

Since going Indie, I am constantly asked about what software tools I use to facilitate the process. People are always curious about invoicing, time tracking, ticket management, etc…

The purpose of this post is two fold. First, I want to educate others on some of the cool tools I have found that have helped me out tremndously. The other is, I would hope that veterans in the space could give their two cents as to some better tools (or better use of the current one’s). Either way, I’d love to hear from you.

1. Tools For Finding Contracts

This is perhaps the area where I am most asked about. Well, the secret is, looking for contracts isn’t that much different than looking for a job. You just need to know what to look for. Here are the few major sources where I have found sucess in finding good contracts.

  • Linked In Jobs I love Linked In. I have found it to be the most valuable tool for job searches and connecting to date. I love that it will suggest jobs/contracts to you based on your profile and experience. Another great thing about Linked In is contract search can become passive if you are actively connecting and posting. Once your name starts flowing out there (assuming you have the exp), people will just start offering you contracts.
  • Authentic Jobs I like this site a lot. Their interface is much cleaner than some of the other job search sites and while they had fewer contracts available, they were generally of a higher quality. In fact, I found the current contract that I’m working on here.
  • Simply Hired Although this site generally offlinks to other sites, I found it to be a good aggrigator of what’s out there.
  • Good Ol Google This seems like a job, but as I mentioned in my last post, it’s pretty easy to type “[:field_name] contract work” and come up with a pretty good list.

2. Tools For Managing Clients/Billing

As a new contractor, the concept of billing can seem a bit scary. You don’t want to look like a n00b, but you also don’t want to spend a lot of money. That’s where FreshBooks comes in.

I started using FreshBooks from day one and could not be happier with their service. Here are some of the pros:

  • Free for up to 3 clients. It says 30 day trial, but that’s just if you want more than 3 clients. So it’s perfect for when you are starting out.
  • Manage multiple projects for mulitiple clients with multiple tasks (‘nuff said)
  • Mobile app. You haven’t lived until you have sent an invoice from your smartphone. You feel super businessy. For an added bonus, send it from the gym, or your sailboat.
  • It handles sending invoices via mail or email automatically and reports back to you when the client has seen the invoice.

Again, FreshBooks is awesome! I can’t recommend it enough.

3. Tools For Ticket Management

This one is tricky, because every client is going to want to work differently. Here are the few I have expereinced thus far.

  • Pivotal Tracker This one is my favorite. It’s a very easy to use tool to help facilitate development in an agile environment. Even if you are not running the full scrum process, it’s still a valuable tool to simply track your progress. Your clients will appreciate it.
  • Basecamp You knew I was going to say this one. It’s an obvious choice because it’s obvioulsy a solid tool. I think it’s very valuable when you have a distributed team and need a central way to communicate.

Even if your client doesn’t use a tracker, I’d suggest you use one. It helps you to keep organized and get a better feel for how long certain tasks take (which you will need to know in future scoping).

I dont’ have a very long list here because I hate most tracking software. If you have some to add here, I would love to hear about them in the comments.

4. Tools For Software Development

I am an iOS and rails developer, so this section may or may not be applicable to you. Again, I put this out there to let you know what I am using and would love to hear what you are using.

iOS

  • XCode (duh)
  • CocoaPods – If you don’t use CocoaPods, you are doing it wrong. They are what gems are to rails and really help you manage 3rd party libraries.
  • GitHub – For verison control and code distribution amoung the team. (again, you know this already).

Rails

  • Sublime Text I was big on TextMate for a while, but now I use Sublime Text full time. It has some solid plugins and can do a smart autocomplete for any file type.
  • Heroku Deploying rails to production sucks. Heroku makes this process easy.

5. Tools For Communication

Working in a distributed team can be hard at first. Especially staying connected. Here are the major forms of communication that I use.

  • Skype Although Skype has totally gone down hill since the MS takeover, it’s still a free service that most clients will use. I’d suggest if you don’t have a Skype account, you get one before job searching.
  • Google Voice This service allows you to forward a number directly on your cell phone. It also has some nicities like screening your calls, voicemail, free calls, etc… It’s good to give out your Google voice number instead of your cell to clients as well as possible girl/boyfriends in case things go sour.
  • Google Hangout Skype falls short in one area (which happens to be their business model). If you have more than 2 people on a call, they must all have a premium account to do video chat or screenshare. Google Hangout gives you all of these features for free with up to 10 people as of this writing.
  • Standard social networks (Twitter, Linked In, G+) (duh)

Conclusion

Well, this post is already getting a bit out of control. I could go on and on. If I have obviously omitted a large section, please feel free to troll me in the comments and I will certainly add it.

I hope this has been able to provide you with some value, and I would love to hear your thoughts.

What I Learned In My First Month Being A Contract iOS Developer

tl;dr Present yourself to potential clients as if you have already made it. Don’t be scared, the work it out there. Freelancing FTW!1!

In the first week of December, I got a rather unfortunate (and unexpected) call from the CEO of the company I was working for. The gist of it was “we are reorganizing, and have decided to cut your position. Effective Immediately”. At this point, I was the Director Of Mobile Engineering and was making a very decent salary. While I was planning on leaving to go freelance at some point, I hadn’t dreamed it would be this sudden.

Well, it turns out that CEO did me one of the biggest favors of my life. He forced me to go indie. I probably would have flailed there for at least another year before even considering moving on.

I want to share a few things (good and bad) about what I have learned in the past month and how I will never (willingly) work for a company again.

Panic Sets In

I had been working at the aforementioned company for the past 4 years. In fact, it was my first job out of college. So, you can imagine how scary and stressful it was going from a steady paycheck to nothing in the blink of an eye. What’s ironic about this is, many people I have talked to since going indie have told me that they wish they could do it too, but really like the “security” of their corporate job.

At first, I freaked out a little and took the day off (I was “let go” in the morning). But, the very next day I hit the ground running in search of a contract.

Contracts, Contracts Everywhere

Much to my surprise, there are contracting opportunities everywhere. Again, I had to leave the company so soon, I hadn’t had time to research this myself beforehand. A simple Google search of “[your field] contract work” should reveal plenty (assuming your field is some sort of software. I can’t speak for other industries). I even started applying for salaried jobs as a contractor. You would be surprised how many companies are open to it.

This was immediately comforting.

Talk The Talk

My first few days of looking for a contract were pretty interesting. Being that I had just been let go, I felt this intense pressure to land a contract right away. This definitely came through in how I related to the recruiters and people I spoke with. My good friend Scott Caruso sat down with me and gave me some of the most important advice I would hear for dealing with potential clients.

  1. You are looking for the “right opportunity”. If you are considering freelance, you obviously feel you are an expert (or close to) in your field and that definitely has value. Don’t settle for crappy contracts at crappy rates just because you need the money. You will hate life.

  2. Spam! During my first week, I would contact one or two people and they said they would get back to me. Well, I didn’t want to possibly have to tell them no later, so I would politely not communicate with anyone else until I heard back. That was dumb.
    Finding contracts is like shopping at Goodwill. It’s mostly crap, but if you go through enough of the crap, you will find a gem.

  3. Leverage your existing contacts. This should be obvious. I was holding off on this early on as I didn’t want to sound lame. However, these are the people you can show a little desperation to as they are (or should be) your friends. That being said, someone always knows someone else that needs some work done. If I hadn’t done this, I for sure would have violated #1.

  4. You are a scarce resource (at least present yourself that way): Once I started telling recruiters that I was talking to tons of others and am planning on making a deal this week, I started getting a flood of them calling me back.

The Bad

  1. Everything you do starts to get a price tag. The other day, I asked my wife to make me a sandwichh. She told me to make it myself, and I politely informed her that the 15 minutes spent doing that would cost us $25 so it had better be the best sandwhich I have ever made.
I am not sure if this feeling ever goes away (if you are a veteran freelance, I&#8217;d love to hear your thoughts).
  1. It’s a little scary knowing you don’t have a paycheck in X months (X being your current contract length). This was the most frightening thing at first. Now, it seems like an exciting challenge.

  2. Tendency to overwork: Since you now have money++ and can make more just by adding hours, you will be drawn to work more. I have talked to many others who end up leaving freelance because of burnout from working too much. Sure you made $30K in 2 weeks, but you are hating life.

Summary

So far my journey as an independent iOS developer has been incredible. I am loving every minute of it and I encourage anyone interested in it to do the same. I don’t think it’s for the n00b or the non-self starter. This post I found on Hacker News has a brilliant step by step tutorial on moving in this direction.

I hope you have enjoyed yet another post on freelancing.

Thanks for reading!

5 Third Party iOS Libraries I Have Found Useful Lately

As I mature as a developer, I try to rely on other people’s code more an more. Why build something from scratch when a solution already exists that you can fit in your project. In Pocket MUD Pro, I used 13 3rd party libraries and am using quite a bit more in the project that I’m currently working on. I figured that I would share some of the libraries that I have been using so that it might save you some time in the future.

1. CocoaAsyncSocket

Link: https://github.com/robbiehanson/CocoaAsyncSocket

Many of my applications involve TCP or UDP networking. There is a lot of boiler plate code involved in every networked application, and CocoaAsyncSocket solves much of that for you.

2. Appirater

Link: http://github.com/arashpayan/appirater/

Screenshot

Hopefully, you have heard of this one or a similar library by now. It’s very challenging to get users to want to review your applications, let alone give you a positive review. AppiRater allows you to prompt a user to rate your application based on either number of launches or “significant events” which you specify.

3. Zip Archive

Link: http://code.google.com/p/ziparchive/

I try to ship small applications that download assets upon launch. A good way to send these assets over the wire is to zip them up and stick them on your server. I have written an article about this on iCodeBlog.

4. Quick Dialog

**Link: ** https://github.com/escoz/QuickDialog

Creating forms in iOS is pretty painful. It usually involves custom table cells and a lot of delegate nonsense. QuickDialog takes away some of this pain and allows you to easily create iOS forms. You can even design them using JSON.

QuickDialog Screenshot

5. TSMiniWebBrowser

Link: https://github.com/tonisalae/TSMiniWebBrowser

Often times, you want a quick and dirty browser in your application. I generally use it to point to in-app documentation or take the user to a page after tapping on a link. It’s quick and easy.

Screenshot

I hope you find some value in this list. I’d love to hear about the libraries you use frequently.

Happy Coding!

How To Become An Indie Game Developer

What programmer doesn’t want to be an indie game developer? A great article with tons of tips to help you on your way.

[Article Link]

My Number One Feature Request For iOS 6

Fix the Snooze button! I have no idea how this UI component got to Apple’s review team and they were like ”Yep, that looks beautiful! Ship it!”. If Apple changes the snooze button and slaps a 6 on iOS, I will be happy. If not, more rants to follow. Stay tuned….

If There Was Ever A Time To Submit A Show HN Article, It’s Right Now

Earlier today a post titled ”I Try to Up Vote Every ‘Show HN’ Post and You Should Too” made it to the top of HN.  It basically talked about people posting “Show HN” posts are putting themselves out there and the least we can do is give them an up vote.  Well, people are listening and as of this posting, there are currently 15 Show HN posts in the top 30.  That’s incredible.

So, if you have recently created something cool.  Head over to HN’s submission page and add your link making sure to add “Show HN” in the title.  You might get some great traffic/feedback out of it.

Lua Scripting The UI For Pocket MUD Pro

I have just updated my MUD client [Pocket MUD Pro] to be a universal library. It was surprisingly easy to add the iPad support as most of the application was comprised of UITableViews.

The main “MUD” view was the most challenging part as it contains a couple UIWebViews, UIButons, and a UITextField. However, I chose to do something I feel is pretty cool.

Scripting The UI With Lua

If I haven’t said it enough, I love lua. Especially in the context of scripting within other applications. Pocket MUD Pro already has complete lua support in triggers in aliases, so I figured I might as well apply that same logic to the UI.

Pocket MUD Pro has 3 core sections for the UI not counting the text input field. The main view (UIWebview), the prompt view (UIWebview), and the button bar (custom UIView).

One of the core challenges I faced on the iPhone, was resizing/reorienting all of these views on orientation change as well as when the keyboard was visible and when it wasn’t. To be honest, I spent most of my cycles getting this part right. On the iPad, I decided to things a little differently which improved the speed of my development overall and paved the way for future updates that will allow user-scripted UIs.

The UI Script

I want to start by showing you the lua code that is used to script the UI by default.

–MUD 
mudFrame = Frame:new("mud_frame") 
mudFrame.type = FrameTypeMUD
mudFrame.portraitFrame = {0,0,768,931}
mudFrame.portraitFrameKeyboard = {0,0,768,667}
mudFrame.landscapeFrame = {0,0,1024,675}
mudFrame.landscapeFrameKeyboard = {0,0,1024,323}
createFrame(mudFrame)

What’s happening here is, I have created a Frame class that has some properties (type, name, etc…) and injected it into the global lua space for use inside of the UIScripts. Then when the interface gets drawn, I reference the UI script for each of the MUD servers and use it to render the interface.

One interesting thing here is, I set the frames for each of the possible layout scenarios. Portrait, Landscape, with and without the keyboard. That way, when the keyboard hides/dismisses or the user rotates the device, I just reference the this script again and re-render the frame accordingly. This could have been achieved with auto-resizing masks however, it gets much more complex and things get tricky when you want to have a dynamic number of windows.

I follow this exact pattern for the button frames and the prompt frames. As you might have guessed, in a future release, I will open this script area up to MUDders and give the user the ability to script the interface however they would like. Some examples might be:

  • Dedicated map window
  • Dedicated chat window
  • Customized movement buttons
  • Customized backgrounds/borders/themes
  • Custom health/status/mana

Given this powerful UI Scripting style, a user will be able to create complex interfaces such as the one below from inside the app:

I still have a ways to go with exposing various functionalities via my custom lua bridge. But things seem to be moving along quite smoothly.

If you want to learn how I was able to bridge lua into my application, consider checking out my talk on lua scripting at 360iDev 2012 later this year!

Happy Coding!

Jailbreak iOS 5.1.1 With Absinthe 2.0 + More Watch Dev Coming

The GreenPois0n team has just announced Absinthe 2.0 allowing users of all iDevices (except Apple TV 3) to jailbreak iOS 5.1.1. This is especially good news for me as I can now continue development on my jailbroken app for the inPulse watch, iOS notifier

[Link URL]

Join Me At 360iDev 2012

I mentioned this on Twitter last week, so I might as well post it here to make it more official. My talk Making Your Games More Dynamic With Lua Scripting was accepted for 360iDev 2012! This will be my first official speaking engagement and I could not be more excited/nervous.

The Talk

I have had a huge interest in lua for some time now, especially as it applies to scripting games. In my last project, Pocket MUD Pro, I even embedded lua 5.1 and created my own bridge in order to allow players to fully script the gameplay. This got me very excited for the future as it was so easy to get lua up and running.

My talk will cover the basics of setting lua up in your own iOS projects. I will be using a simple tile based RPG (written in Cocos2D) for the demo and will demonstrate how you might use lua to script the behaviors of the NPCs as well as dynamically add new ones to the game. This opens up a whole world of possibility as you can now ship code over the wire and modify your game content without ever submitting an update to Apple.

It appears my talk has some pretty steep competition in its timeslot. There are two other incredible talks going on at the same time, so I’m starting to campaign for it now :)

Please comment on this post if you plan on attending 360iDev. I would love to connect with you.

[360 iDev Schedule]

Incredible List Of Popular Indie iOS/Android/Steam Titles On Sale

We believe that developers should have the freedom to price their games how they like, without interference from the online stores that sell the games. Why? Because it allows us to promote our games more freely, as we are doing here! We rely on the ability to promote our games for our livelihood and control over pricing is an important tool for this purpose.

Because We May is doing something very incredible here. They are a website to help you promote your game by listing it on sale. Any developer can submit their game(s) as long as they put it on sale for the given duration (May 24-June 1). There are currently some amazing games on sale including Osmos, Super Brothers, World Of Goo HD, and more.

[Games Link]

[Submission Link]

Why Facebook IS People

This is a very well written article detailing some of the inner workings of Facebook and why its business is YOU.  

I wonder when a distributed, self-hosted solution (like Diaspora</a>) will become popular.  Have you tried Diaspora or others?
</div>

The guide to implementing 2D platformers

http://higherorderfun.com/blog/2012/05/20/the-guide-to-implementing-2d-platformers/

An incredible guide detailing many of the tricks/design patterns used in 2D platformers.  Although there isn’t much code to look at, the higher level ideas detailed in the article are invaluable.

Pocket MUD Pro Is Now Universal + Promo Codes

I have just updated Pocket MUD Pro to support the iPad! In celebration, it’s on sale for $1.99 (down from $2.99).

Also, here are 10 promo codes for anyone who wants a free copy. Please comment on which code you take so others know which one’s are available.

9E3TF4XRLW97
RA6KFNTT9NEY
KN936MALLH7A
TLPMPXNTMMLL
RL7JNYFL4F7X
3RPAWMFTYY6F
4JYYJFH7HLKR
7XWETP3YP7JT
PN7XERXHH7ME
9R4NYX669FMJ
</p>

MetaWatch Announces iOS Support – Still Can’t Compete With Pebble

For those of you who have followed my blog for a while, you know that I am a huge geek for smart watches. I had the first version of what is now the Pebble (inPulse) and even hacked a jailbroken iOS app to interface with it.

MetaWatch has been around for quite some time now and looks *ok *, however their latest update appears to be completely in response to Allerta’s announcement/success of Pebble.

“We are delighted to be the first company to ship a Bluetooth 4.0 smartwatch compatible with both iPhone and Android platforms”

What is really concerning is the fact they they don’t mention anything related to how they are achieving iOS notifications. Pebble has been very upfront in stating that they are planning on leveraging ifttt.com to deliver complex notifications such as Twitter and Facebook. It leads me to believe they haven’t quite sorted everything out and are jumping to a press release in order to ride the smartwatch train.

I have a Pebble coming in August and intend on sharing my experiences as well as code. Perhaps I might scoop up one of these as well and write a comparison post.
[Article Link]

Great Introduction To Lua

(click the post title)

I have been using lua in my iOS applications for some time now. This tutorial provides a great introduction to a scripting language that most developers are very curious about. I really suggest spending a few minutes checking it out.

Why you Should Check Out Unity

A while back, my buddy seantron showed me some of his 3D games he’d been working on including this one. My initial reaction was “how the heck did he get the chopps to do that?”. While, Sean is an incredible developer with a ton of creativity, doing things like loading models, texture mapping, or even basic 3D projects are flippin hard.

A while back I tried my hand at 3D and made sort of a basic Minecraft style game from scratch using OpenGL ES. Let me tell you, it was brutal (and I have been coding for almost 10 years). This project took me a week or so to ramp up, get basic cubes and textures going and a simple first person view.

Enter Unity

Sean had mentioned to me that he used this 3D engine called Unity to create his games. While I had tried XNA, I had never heard of Unity and figured it was similar (basically a framework with some convenience methods for loading models, mapping, etc…). Boy was I wrong…

Unity 3D is more than just an engine. It is an application that allows even the most novice of developers to create beautiful, rich, 3D games. I’m serious. Check out this demo below of an app I made in unity in about 3 hours using this tutorial. The crazy part is, I wrote almost no code. Much of the interactions and game were developed using drag and drop and free assets.

Link to my awesome game

Getting Started

I was very reluctant to learn Unity at first as the interface appears to be a bit daunting. However, once you check out a few tutorials, it becomes second nature. Here are a few places to get started:

InfinitAmmo’s Unity 3D tutorial series – This was where I first began. He does a great job at going over the basics of Unity while keeping things interesting.

Getting Started With Unity on Active Tuts+ – This is where I made the game you checked out above. Take an hour and do the first in the series, you will be very surprised with the outcome.

Unity 3D tutorials – Unity has a wealth of information and demo projects on their website. They come with the source and comprehensive PDFs detailing various aspects of each of their demo games.

After completing at least the top two series’, you should have enough knowledge to begin hacking on a game of your own. I know that I do :)

Conclusion

I hope this has been enlightening and I really urge you to check out Unity.

Happing Coding!

Unity 3D’s Website

This post is part of iDevBlogADay, a group of indie iOS development blogs featuring two posts per day. You can keep up with iDevBlogADay through the web site, RSS feed, or Twitter.

I Suck At Blogging (Lately)

OK, so the title isn’t entirely true (I have maintained quite a few blogs in my day). But, one thing is for sure, I have sucked at blogging lately. So much so, I just had to think hard about having to bold lately using markdown in the previous sentence #meta.

Burnout

I was blogging very consistently for the Envato Network on their Mobile Tuts Plus as well as on iCodeBlog and here. Eventually, I got burnt out and gave up blogging on every blog (for the month).

What happened was, I was blogging to make money (Envato pays $250/post!) and no longer for fun. This sucks and I was missing deadlines and writing crappy content which needed much revision.

New Plan

Write here only (for fun!) and infrequently on icode if time permits as I can do that during work time 😉 That being said, expect to see more content here for better or worse. Once a week is the new goal.

Shutup

That’s what you are saying to me. I hate these “Sorry I haven’t been around in a while. I promise to post more” posts that are usually the last posts on a blog for like 5 years just as much as you do. Let’s hope that’s not the case here. You will just have to trust me and subscribe.

Also, I have a sweet new theme from Jekyll Bootstrap.

Pocket MUD Pro Released + Promo Codes

I am very proud to announce a brand new version of my Pocket MUD Pro application for iPhone. I have been working very hard to make a perfect MUD client that is suitable for hardcore mud players, visually impaired mud players, and casual mud players.

Here are some of the features:

  • Support for all orientations
  • Full ANSI color support
  • Dedicated prompt
  • Zoomable Text View
  • Perfect rendering of MUD text (check out the maps)
  • Very fast
  • Hides Telnet codes from the user (unlike every other MUD client)
  • Autoconnect on startup
  • List of MUDS
  • Favorite List
  • Unlimited Command history
  • Quickly cycle through command history
  • Triggers using the lua scripting language
  • Text Command Alias
  • Lua scripted aliases
  • Timer Support
  • Background support. Stay connected for up to 10 minutes after you close the application.
  • Support for multiple commands separated by semicolons
  • Comes packed with a list of some of the most popular muds
  • In-App Documentation of triggers and aliases
  • Ability to play sounds when triggers fire
  • Ability to gag extraneous text, which is extremely helpful for visually impaired players.

Promo Codes

  • PXYTRKLTWL46
  • KTXAAMYNYXPP
  • 443433YNJX4E
  • 9K99KJWRXNYT
  • W44YHPHLRFMT
  • 4HYHLEFXYYN7
  • 4HK74JLMMHAA
  • KX6XJ79TLWFP
  • 437YTX9KLEN9
  • 7YAMYF4EYALF

Please leave a comment here if you use a code to notify others that it’s been taken

Download it here

I’d love to hear what you guys think about the app.

Happy MUDding!

Vim For iOS Is Incredible

I used to be an Emacs guy and would battle to the death on the war between Vim and Emacs. It wasn’t until a coworker of mine sat down and really showed me just how cool/simple/powerful Vim can be. Just using Vim is a new adventure every day and has really improved my productivity. I now use it to code, blog, and even jot down quick notes.

Last week, I saw on Hacker News a link announcing Vim has been ported to iOS. I have spent a week or so with it and can honestly say the port is almost perfect!

It has most of the major Vim features and commands including:

  • Automatic indentation
  • Visual mode (block operations)
  • Language-aware syntax highlighting
  • Integrated scripting language that lets you extend functionalities
  • Macros recording and playback
  • Markers management (to quickly move around the edited file)
  • Multiple clipboards

You even have access to the config file to remap keys and define your own custom macros.

There are a few features that would make this better on mobile however:

  1. Dropbox Support – Currently you must use iTunes to work with Vim documents on mobile. There needs to be an easier way to share these.
  2. Keyboard bar – Since you have to switch modes so frequently and there are some keys you type often ( “:” ), it would be nice to have quick access to these.
  3. Plugin support – This is an Apple limitation :(
  4. NERDTree – The file browser that’s built in doesn’t work too well.

With Vim mobile, you can now look even more nerdy on your iPhone 😉

Download Vim For iOS

Fluid For Mac

As of OSX Lion, I have started to seriously loathe some of the build-it Mac apps (such as Mail, and iCal). While I previously had no issues with them, they now seem to be very clunky and crash quite often. Being a developer, I thought “why don’t I write an app that wraps web apps for you so you basically get “native web apps” that have icons and are launchable?”.

After a quick Google search, I realized this already exists!. The app is called Fluid and it does an incredible job of what I described above and more.

Here are the feature highlights.

  • Create a “native” Mac app for any web app
  • Custom icon for each “native” app you create
  • Full screen mode
  • User scripps. These are my favorite. They allow you to update the badge count based on information in the browser. See below for a sample user script.

Sample User Script For Twitter

<code class=’javascript’>(function () {
        if (window.fluid) {
            setInterval(function updateBadge() {
                var counts = /\d+/.exec(document.title);
                if (counts && counts[0] > 0) {
                    window.fluid.dockBadge = counts[0] > 99 ? ‘99+’ : counts[0];
                } else {
                    window.fluid.dockBadge = ”;
                }
            }, 2000);
        }
    })();</code>

Source

Fluid is free with some minimal features, but I urge you to drop the $4.99 to gain full screen mode and user scripts. It’s well worth it. I am not affiliated with them in any way, just a happy customer.

Download Fluid

Amazon – A Terrible Solution To A Huge Problem

tl;dr; Don’t buy a Kindle Fire for your kid until they resolve the parental control issues. Wifi password protection is their current solution, and it sucks.

Like many parents, I thought it would be a good idea to get a tablet device for my son so that he could play some educational games and watch some Netflix (in moderation of course). After doing quite a bit of research, I settled on the Kindle Fire. Before the Apple fanboys give me crap, know that I am one, I have an iPad, it’s too expensive for my son.

Honestly, I really love the fire. I think it has the least terrible Android interface of any of the devices. It’s intuitive and my 3 year old was able to grasp navigation right away. In addition to navigation, he quickly figured out how to acquire new content (apps, video, children’s books) thanks to Amazon’s “One-Click Ordering”. Obviously, Amazon thought the process they use on the web transfered well to a tablet device and was not willing to compromise on that. That’s neither here nor there. You can find plenty of posts about user’s complaining about the initial lack of parental controls.

The Update

Shortly after receiving some pretty rough reviews for their interface, Amazon rolled out their first update which brought us to 6.2.1. In addition to fixing some of there terribly choppy UI, they rolled out their “fix” for the lack of parental controls.

I noticed a new security setting that I had hoped would allow the device to require a password for content purchase, but it turns out the setting is to password protect enabling wifi.

Password protect enabling wifi? Really?

This is laughable at best. What a worthless feature. I could not figure out why anyone would ever want that. And then I had a conversation with “tech support”.

Their “Solution” Confirmed

After seeing an email from Amazon the other day showing my purchase for $17.99 for Team Umizoomi Season 1 (whatever the crap that is), which obviously my son purchased, I set out to chat with customer support. The conversation went something like this:

Me: Refund!? No parental controls!

Outsourced Guy: Enable Wifi Password = protection!

Me: No, watch Netflix! Browse Web! Stupid Solution

Outsourced Guy: Yes Netflix Need Wifi. Did I solve your problem?

Me: ?

Outsourced Guy: Phone Number. Call Video Support

So there you have it. Amazon actually pushes this as their solution to the lack of parental controls. My suspicions were confirmed by Outsourced Guy.

Conclusion

It’s sad that a huge company such as Amazon feels that their process is more important than listening to their customers. Although their devices have been selling like fire (badum ch!), they need to address such gaping issues if they are to maintain their edge in the “affordable” tablet space. Especially as the younger generations start embracing the technology.

Why I Went Back To Jekyll – Also Rackspace Sucks

Recently, I was pretty humbled when a post of mine titled WordPress To Jekyll And Back Again made it to the front page of Hacker News. I was a little down on Jekyll for the reasons listed in that post and was feeling pretty good about my WordPress install.

At the time, I was running my own virtual instance on Rackspace cloud hosting (we’ll get to this momentarily). I also had all of the caching and optimization plugins installed and welcomed the Hacker News traffic.

As you can imagine, the influx of HN traffic crashed the server multiple times and I was (with good reason) mocked in the comments (“must be because he’s ‘back to WordPress’”). So, I asked for advice and further “beefed up” my setup switching from Apache to Nginx, upping the ram, and switching caching plugins. WordPress is a beast and hard to optimize. That’s not even the kicker as to why I switched away.

A Call From Rackspace…

About a month ago, I realized my blog was down. I figured that it might have been that I was featured somewhere else which was crashing it (again I was rolling my eyes at WordPress). But then, I got a call and email from a very helpful Rackspace employee. The email went like this:

Despite the very best efforts of or our Engineering and Datacenter Operations Teams, unfortunately the host machine that your cloud server ‘Websites’ resides on was not able to be recovered. At this point, we are looking at complete data loss.

and… Rackspace, in this poorly phrased email, was basically like. “Well, sucks to be you, hope you had a backup!”. Well, I admit this is partially my fault for not having a backup as I am a bit of a n00b when it comes to server admin, but I had been hosting for years on (don’t judge me) GoDaddy before that and a couple years on Rackspace. I had no idea that hosting companies didn’t have backups of their own. It would seem that this might be crucial to their business.

Needless to say, I lost everything including a jewelry site that I ran (not many sales), an iPhone leaderboard site (not very popular), 2 of my buddies WordPress blogs, and my current WordPress blog.

Jekyll To The Rescue

I was pretty angry at Rackspace and myself for never making a backup, but then it hit me that most of my posts had been converted to Jekyll and were backed up in a github repository. I was able to restore my blog within a few minutes (now hosted on GitHub) and recover the WordPress posts from the Feedburner cache of my site.

As for my buddies’ sites… I feel for them :(

New List Of Why Jekyll Is Awesome

  • Automatically backed up – This is huge. If not for switching to Jekyll at one point, I would have lost years worth of content. If you have every tried to back up WordPress, it’s a huge frackin pain since the database dump usually gets HUGE.
  • Free To Host – I’m not sure why I was so stubborn about doing my own hosting. I am now hosting on GitHub and it couldn’t be more stable and fast.
  • Mobile Blogging – This was my largest gripe about Jekyll. I was jealous that I couldn’t blog from my iPhone like WordPress users. Well, I have found a pretty decent solution (tutorial to follow), which involves a combo of Prompt, Screen, and Vim.
  • Content Oriented – WordPress makes it super easy to dump tons of images into your posts. While blogging with Jekyll (inside of Vim in my case), it’s a little bit more of a pain to add your own images. That being said you must be choosy forcing you to focus more on the content and less on using visual crutches.
  • Blog Anywhere – This was another limitation I was placing on Jekyll in my last post. However, I just wasn’t using Jekyll to its full potential. I was building my site locally and rsyncing it up to my server. This process was a little tedious and discouraged me from writing many new posts. Now, hosting with github, posting is as simple as a quick push to the repo.
  • Ninja Fast – This one should be obvious.

Conclusion

I am quite happy blogging with Jekyll. As far as I’m concerned there is no reason to ever host my own blog again (as long as Github doesn’t ditch pages 😉 ). Also, if you currently have stuff on Rackspace, go make a backup now (or ditch them altogether). Thanks for reading and look out for my next post about mobile blogging with Jekyll.

Happy Blogging!

New Year – New Theme: Focus On The Content

As you may have noticed, my blog has a new (much cleaner) theme. For 2012, my blogging goals are to focus much more on content rather than flashy visuals.

I have also minimized my set up to save blogging costs (I now blog for FREE) and to simplify things greatly. Here is my new setup:

  • Jekyll as my “blog engine”
  • The WPTypo WordPress Theme I ported this to Jekyll
  • GitHub for hosting (it’s free).
  • Vim – I’m using this as my “blog editor”. There are some incredible plugins that I am using to help facilitate blogging using Jekyll (post on how I do this to follow)

That’s about it. I am now free from server costs and my blog is always backed up and easily accessible.

2011 has been a very successful year in terms of blogging for me. In addition to writing here and on iCodeBlog, I have recently started blogging for Mobile Tuts + on the Envato Network. You can check out my 7 part game series on creating a caterpillar game using Cocos2D here.

I can’t wait to start posting some great content in this new year. Given my new setup, I literally have to adhere to the title of this post as blogging in VIM doesn’t really lend itself to visuals ;).

Happy New Year and Happy Hacking in 2012!

SVProgressHUD Is Quickly Becoming My Favorite iOS Library

From the first time I saw this effect in the Tweetie (now Twitter for iPhone), I was crazy about it. I had written my own hacks to make something close, but it was always terrible. Within the past few months, I have been using a perfect/elegant solution to this problem called SVProgressHUD.</p>

Using this in your project is as easy as calling:

// showing
[SVProgressHUD showWithStatus:@"Logging in…"];
// hiding
[SVProgressHUD dismiss];

Clone SVProgressHUD On Github

Tether Your iPhone Without Jailbreaking (Or Paying For It)

With all of the buzz around the iTether App, I figured I’d offer a more permanent solution since Apple will surely yank this soon

Last year, a developer published his code for an http SOCKS proxy called iProxy. This will give your iPhone the ability to create a SOCKS server in which your laptop can connect to via the Bonjur protocol.

Once connect, all of your computer’s http traffic will be routed through the server on your iPhone essentially giving you free tethering. Since this isn’t using the iPhone’s built-in tethering method, I’d assume At&t could not detect it*. After looking at the code, it becomes pretty obvious how the SOCKS proxy works and makes me kick myself that I didn’t write it (or find this code sooner).

The setup is a little complex, but you only need to do it once. I would love to hear in the comments if any of you has had some experience with this. I will also share my own as soon as I can get it installed later today.

Download the project over at github.

Happy Coding!

*This has not been verified by me

Caterpillar 1.1 Released

I have just released the update to my Centipede clone called Caterpillar. For those of you who don’t know, I am doing a 6 part series on how to create this game over at MobileTuts+.</p>

This update adds some interesting functionality on which I will be blogging about in the near future.

I have added iAds to my cocos2D project and when the iAds fail to serve (which is about 75% of the time), I replace them with Admob ads. This was achieved by creating a new Admob ad view inside of the bannerView:didFailToReceiveAdWithError: delegate method.

I will either post a full tutorial about doing this Here or on Mobile Tuts. Either way, I’ll keep you posted.

Also, be sure to download the game, test it out, and lemme know if you have suggestions. Version 1.1 addressed quite a few issues from feedback (namely poor controls).

Happy coding!

WordPress Plugin For iOS Developers And Bloggers

This plugin looks to be super useful for people wanting to blog about iOS apps. It even supports the affiliate urls.

In any post or page, insert the following shortcode: [ios-app id=”1234”] (where “1234″ is your application’s App Store ID).
You can also specify a download link like this: [ios-app id=”1234” download_url=”http://www.yourlinktrackerurl.com”]

Download The Plugin Here

Voices That Matter Conference: Highlights

This past weekend, I attended the voices that matter conference as a sponsor for a new product my team is working called MaaSive. We had an absolute blast at the conference and I learned quite a bit from all of the speakers.

Here were a few of my favorite parts:

Keynote by Graeme Devine

For those of you who don’t know Graeme is a legend in the game development industry. He was responsible for titles such as Quake 3, 7th guest, and Halo Wars. His presentation entitled “Social Gaming is Dead” was spot on. In it Graeme talked about how game developers have become less focused on the quality of games and more focused on “how do I make a profit?”. A statement that has stuck out to me is:

“Be generous with fun. We are mean with it!”

Basically, we are charging our users for fun or making them do real work (see Farmville) in order to obtain it. His message was “stop it, make something fun, and dont’t focus on profit”. Otherwise you are doomed.

Follow Graeme on Twitter

Moving To 3D by Mike Daily

Mike is a good friend of mine and I look forward to hanging out with him at the conference each year. His talk was all about showing the developers how easy it actually is to create a 3D game without the use of a game engine. Mike’s demo (show below) was an absolutely incredible space shooter where you used the gyroscope to maneuver around.

Mike will be posting a series on his blog in the near future about how to make his game using GLKit in the near future.

VTM Game Prototype from Michael Daley on Vimeo.

Follow Mike on Twitter

Storyboarding by Erica Sadun

Erica is an OG (original gangster) when it comes to iOS development. She has been in the space since way before the first SDK was published (in fact she had a jailbroken dev book almost ready to go). Her current book, The iPhone Developer’s Cookbook is a beast containing almost 900 pages!!!

Her talk showed how easy it is to use storyboarding and just how powerful the technique can be.

Follow Erica on Twitter

Conclusion

It should be obvious from this post, that the VTM conference was incredible to say the least. If you didn’t attend, I strongly urge you to check out their next one. Hopefully you will get to blog about my talk at it (assuming I get my crap together).

Happy Coding!

Caterpillar-HD Now In The App Store: Tutorial Series To Follow

I have just released the update to my Centipede clone called Caterpillar. For those of you who don’t know, I am doing a 6 part series on how to create this game over at MobileTuts+.

This update adds some interesting functionality on which I will be blogging about in the near future.

I have added iAds to my cocos2D project and when the iAds fail to serve (which is about 75% of the time), I replace them with Admob ads. This was achieved by creating a new Admob ad view inside of the bannerView:didFailToReceiveAdWithError: delegate method.

I will either post a full tutorial about doing this Here or on Mobile Tuts. Either way, I’ll keep you posted.

Also, be sure to download the game, test it out, and lemme know if you have suggestions. Version 1.1 addressed quite a few issues from feedback (namely poor controls).

Happy coding!

WordPress To Jekyll And Back Again

Earlier this year, I jumped ship on WordPress and moved to Jekyll after reading this post on Hacker News. I wanted to be 1337! I wanted to ditch the whale that was WordPress.

Well, it was quite a run, but in the end I decided to revert back to WordPress. Although Jekyll is much faster than WordPress, here were my issues:

Build Times

As my post count grew, so did the time to compile my jekyll site. Jekyll is a static site builder, so naturally it has to rebuild your site any time anything changes. With my blog containing hundreds of posts, my site build times started getting into minutes. I simply don’t want to wait forever to publish a post.

Since it took so long to build my site, it discouraged me from posting. I would only write posts on my specified #iDevBlogADay days, rather than just posting quick info posts.

Too Many Dependancies

Jekyll is a beast to install, especially if you want to support some of the fancier plugins like syntax highlighting. This limited my blogging to only my machines. I couldn’t blog from anywhere anymore. I could have installed Jekyll on my server, but that just seems like a hassle, also see my first point about build times.

No Mobile App

I like to blog on the go, and with Jekyll I just couldn’t find an elegant solution to blog from my iPhone or iPad. I found myself trying to come up with hackish solutions and write custom scripps, but in the end it just wasn’t worth it.

I can now use Markdown with WordPress

I fell in love with Jekyll because I could write in markdown. With this plugin, I can now do just that with WordPress. It stores the Markdown in a separate meta field and generates the post_content html upon publishing the post. So, I’m not married to the plugin in case I decide to ditch it.

I have also hid the disgusting “Visual Editor” that WordPress is unfortunate enough to ship with. This makes my writing experience much more pleasant.

The Future

While Jekyll was a fun experiment, I think I will stick with WordPress for now.

geekCred–;

What’s Your Cruising Speed?

Earlier this year, I launched an application called Smart Lockscreen Creator. It was a pretty simple app that allowed you to add dynamic data (such as weather) to your wallpaper and save it back out to your camera roll. The idea is to improve the functionality of the user’s lockscreen. It did very well on launch (and even made it to #1 in the Israel App Store). At the peak, I was selling about 600 copies per day.

Well, the honeymoon period is over and sales have slowed down quite a bit, however they have completely stabilized around what I’m calling the “cruising speed”. So, what’s my speed? On an average day, I will sell between 10-15 copies of the application per day. This is with no additional marketing, I’m not on any top 500 pages, and honestly I haven’t done much to the application at all. The app even has ~2 star rating. Not because it sucks, but because people don’t read the description and assume it will constantly update their lockscreen.

I have asked a few developers and this seems to be a fairly common cruising speed. So, now I’m asking you.

What’s YOUR cruising speed?

Do you think updating the application will affect this speed?

What dictates the speed?

I’d love to hear your responses in the comments.

This post is part of iDevBlogADay, a group of indie iOS development blogs featuring two posts per day. You can keep up with iDevBlogADay through the web site, RSS feed, or Twitter.

Join Me At The Voices That Matter iOS Conference

In November, I will be attending the Voices That Matter iOS Developers conference. It will be my third time attending, and I can’t recommend it enough. One major change from this year however is, I will be attending as a sponsor. A new company/project (currently in private alpha) will be participating as a sponsor at the conference.

We intend to have a table set up with multiple computers and devices so you can check out our product first hand. Bleh, that sounds kind of spammy. But, we have been working on something incredibly killer and I can’t wait to share it with all of you.

If YOU are planning on attending the conference, please comment on this post, write me on Twitter, or email me. I’d love to set up a one on one time to give you the full demo.

Also, I’m sure many of you already have a discount code, but if not, I have a pretty sweet promo code for $100!

BSTBLOG

Enter that at checkout. Combining that with the “Early Bird Pricing”, you save $300! Not a bad deal.

So, if you do end up coming (you are crazy not to), please communicate with me. At least to say hi, you don’t have to here my super awesome sales spiel if you don’t want to…

Happy Coding!

This post is part of iDevBlogADay, a group of indie iOS development blogs featuring two posts per day. You can keep up with iDevBlogADay through the web site, RSS feed, or Twitter.

Beginning Jailbroken iOS Development – Your First Tweak

This is the 3rd installment of my jailbroken iOS development series. If you haven’t already, make sure you read the following tutorials to get up to speed.

Today I’m going to show you how to patch any internal Apple method that you want. In this demo, we are going to hook into the init method of Springboard and show a UIAlertView upon starting your phone up. It’s not the coolest of applications, but the design pattern and concepts used can be applied to patching any other internal method of any class.

Getting Set Up

In order to create a tweak, you must interface with Saurik’s libsubstrate.dylib dynamic library. This might come packaged with theos, but if not, you need to download a fresh copy. One can be found on this very spammy site. Download libsubstrate.dylib

Once you have downloaded it, copy it to the folder /opt/theos/lib. This is the folder where you will copy any other dynamic libraries that you might need to use in your application.

The iOS Headers

Most likely, theos came with the iOS headers that you need. If not, you need to obtain them by doing a header dump on the device OR Googling around for them. I suggest the latter as someone else has surely done the work for you. Once you have these headers, you need to put them in the folder /opt/theos/include. For this example you should have a folder in there called Springboard containing all of the Springboard headers.

Creating The Project

The process for creating the project is simple. I’m going to assume that you already have all of your environment variables in place that we discussed in the last tutorial. If not, you will get errors.

Open the console, cd into the directory where you want to create your application and type the following command to create a new Tweak application.

<code class=’bash’>$THEOS/bin/nic.pl</code>

Now, when prompted select the number 5 for a tweak. Next, you will enter all of the information about your project. The resulting output should look like this:

<code class=’bash’>NIC 1.0 - New Instance Creator
——————————
  [1.] iphone/application
  [2.] iphone/library
  [3.] iphone/preference_bundle
  [4.] iphone/tool
  [5.] iphone/tweak
Choose a Template (required): 5
Project Name (required): WelcomeWagon 
Package Name [com.yourcompany.welcomewagon]:                 
Author/Maintainer Name [Brandon Trebitowski]: 
MobileSubstrate Bundle filter [com.apple.springboard]: 
Instantiating iphone/tweak in welcomewagon/…
Done.</code>

The Tweaks File

Once your project has been created, you can open in up in your favorite editor. I prefer TextMate. Theos creates a file for you called Tweak.xm. This is a special file that will run through theos’s preprocessor in order to hook into the classes and methods that you specify. So, rather than us having to write tons of boilerplate/crazy hook code, Theos does that all for us with a nice interface.

By default, EVERYTHING in that file is commented out. It took me longer than I care to admit to figure that out when I created my first Jailbroken iOS app.

The Preprocessor commands

There are a few commands that you need to know in order to hook into a class:

%hook and %end

<code class=’objc’>%hook Springboard
// overwrite methods here
%end</code>

The first command is called %hook followed by the name of the class you are hooking in to. You choose the methods to overwrite within the context of %hook className and %end. In the above code, we are saying that we want to hook into some methods in the SpringBoard class.

%orig

When inside a method, the %orig command will call the original method. You can even pass arguments to the command like this %orig(arg1,arg2). One thing to note is, if you don’t call %orig, the original method will never be called. So, if you hook SpringBoard’s init command and fail to call %orig, SpringBoard will never start and your phone will be unusable until you delete your app via ssh.

Hooking Into Springboard

Open up Tweak.xm and add the following code. Don’t worry, I will explain it afterwards.

<code class=’objc’>#import <SpringBoard/SpringBoard.h>

%hook SpringBoard

-(void)applicationDidFinishLaunching:(id)application {
    %orig;
    
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Welcome" 
        message:@"Welcome to your iPhone Brandon!" 
        delegate:nil 
        cancelButtonTitle:@"Thanks" 
        otherButtonTitles:nil];
    [alert show];
    [alert release];
}

%end</code>

OK, so what’s going on here. First, we import the Springboard.h header. This will allow us access to springboard. Next, we tell the preprocessor to hook into the Springboard class.

The method that we are overriding here is the applicationDidFinishLaunching: method. This will of course fire right when SpringBoard starts up. Notice that we make the %orig call. If we omit this, our phone would never boot up properly as SpringBoard needs it’s initialization method.

Finally, we just throw up a UIAlertView. Again, not too exciting, but you get the point.

Adding Additional Frameworks

If you were to type build to build this project at this point you would see an error like this:

<code class=’bash’>Tweak.xm: In function ‘objc_object* $_ungrouped$SpringBoard$init(SpringBoard*, objc_selector*)’:
Tweak.xm:6: error: declaration of ‘objc_object* self’ shadows a parameter</code>

This is because we depend on the UIKit framework to show alerts. In order to tell theos that we want to link in UIKit, we must create an addition to the Makefile. Add the following line to your Makefile.

<code class=’bash’>WelcomeWagon_FRAMEWORKS = UIKit</code>

This will ensure that UIKit gets linked in.

Building, Packaging, And Installing

In the terminal, cd into your project’s directory. At this point, you can type make to simply build your project. Theos has provided a nice way to automatically install your library on your device. In order for it to work you must have the THEOS_DEVICE_IP environment variable set to your iPhone/iPod’s IP address. This is explained in the previous tutorial.

In the terminal type:

<code class=’bash’>make install</code>

This will build your tweak and install it on your device. When prompted to enter your password, the default is “alpine”. Also, make sure that SSH is installed on your device.

After installation, your device will respring and you will be greeted with your custom message like this:

Jailbroken App Development

Conclusion

You should now have a basic understand of how to patch any method inside of iOS. With this knowledge, you can customize ANYTHING that you don’t like about the device. If you have any questions or comments, feel free to leave them in the comments section of this post.

You can download the source code for this tutorial here.

Happy Jailbreaking!

This post is part of iDevBlogADay, a group of indie iOS development blogs featuring two posts per day. You can keep up with iDevBlogADay through the web site, RSS feed, or Twitter.

10 Great Pixel Art Tutorial And Free Resource Sites For Your Games

I don’t usually create “list” posts, however I wanted to share a grouping of resources I have been collecting over the past few months. As you may have noticed, I’m a bit of a Pixel Art fanatic and wanted to share with you the tutorials that helped to get me started as well as some sites offering some high quality free pixel art.

Keep in mind that some of these sites have similar content, however they all take a slightly different approach in teaching. I found it very helpful to read each of the tutorials and learn from different points of view.

1. Gas 13 – Isometric Pixel Art Tutorial

Pixel House

link

This was my very first pixel art tutorial. I was amazed at how quickly I was able to make a really professional looking pixel art building. I highly recommend all of the tutorials on this guy’s site. Some of them however can be quite complex.

2. Derek Yu – The Pixel Tutorial

Wrestler

link

This was another site that I stumbled upon early on in my pixel art quest. Derek provides a nice story telling approach to teaching the in’s and out’s of pixel art. I really appreciated his tutorial on lines.

3. Mini Wizard Studios – What is ‘Isometric’ pixel art

Sample pixel art

link

This guy offers another dead simple intro to pixel art. Most of it is just explanation, however his examples are quite good. He shows examples of Backgrounds, Characters, objects, tiles, as well as a ton of different UI elements and icons. It’s a great place to go for some inspiration.

4. Hub Pages – How To Start With Pixel Art

Victorian House

link

Again, another great site for the pixel art n00b. This tutorial goes over all of the basics of line, cubes, and texturing. It also links out to other great pixel art tutorials for creating various objects such as a bed, table, and lamp.

5. Bio Rust – Isometric Pixel Art

Pixel Sphere

link

This tutorial is a bit rushed however it provides a great overview for creating other basic shapes besides a cube. In addition to lines and cubes, it demonstrates pyramids, cylinders, and spheres.

6. Oceans Dream – Pixel Art Tutorials

Pixel Character

link

This is the most comprehensive site for pixel art tutorials. While many of them aren’t for the faint of heart, there is some fantastic content here. This site has everything from tips and tricks, to character creation, to breakdowns of existing games. I could spend hours on this site.

7. Pixel Character Tutorial – NekoSoraYagami on Deviant Art

Pixel Character

link

This is a nice in depth tutorial for creating a custom character from start to finish. They start out with a base character (plain, nude, genderless) and turn it into their own creation. Very well written and very fun to follow.

8. City Creator

City Creator

link

The City creator is not so much a tutorial as it is a resource for creating gorgeous pixel cities. It has a nice interface and a huge selection of buildings, objects, roads, signs, and trees to go into your city. I am not sure what their license is on the generated cities, however I didn’t see any clause about not reusing the graphics in your own projects.

9. Has Graphics

Pixel level

link

Has graphics provides tons of free game graphics mostly geared towards tiled games. So, if you are hacking an old school RPG or platformer, I would definitely check out this site.

10. VX Resource Planet

Pixel characters

link

This is the Motherload. I have saved the best for last. This a wordpress blog that contains TONS of free pixel art and tilesets for use in your games. They have endless spritesheets and beautiful tiles that would enable anyone to have a very professional looking game. If you visit one site from this list, visit this one.

Conclusion

If you have any resources of your own, please paste them in the comments. My readers and myself would be very interested in them.

Happy Coding!

This post is part of iDevBlogADay, a group of indie iOS development blogs featuring two posts per day. You can keep up with iDevBlogADay through the web site, RSS feed, or Twitter.

Cocos2D Tutorial – Dynamically Coloring Sprites

Custom Bitizens

Have you ever seen a game (such as Tiny Tower) that contains similar sprites that only vary by certain attributes (coloring, shading, accessories, etc…)? I would often wonder how long it would take the artists to create each permutation of these sprites. After discovering that you can call a method on a CCSprite called setColor, I realized how most of this customization is done in code.

This tutorial will be a continuation of my last post about creating your own Bitizen in Photoshop. So, if you don’t already have a Bitizen character to work with, I suggest you follow that tutorial OR download my template here.

White Out

As I mentioned above, we are going to be using the setColor method of CCSprite to dynamically color each part of our Bitizen. The way it works is each pixel’s color is multiplied by the value passed into setColor giving it a “tint”. So, pixels that are all white will be fully tinted and pixels that are all black will have no change.

So, our first goal is to create an “all white” version of our Bitizen. Don’t worry about shading for now, I will cover that in a moment. I just started with our Bitizen as a base and created new layers for each of the “white” components.

You should end up with 5 new layers:

  • white-head
  • white-skin
  • white-hair
  • white-pants
  • white-shoes

For each layer, trace over the corresponding colored layer. For the “white-skin” layer, make sure to trace over the hands as well as the face. This will ensure that your Bitizen’s color is consistent. When you are done, your Bitizen should look something like this:

White Bitizen

Looks pretty bland… The next step is to add our shading. We will be using only black with varying alpha in order to achieve the desired shading. So, make sure to play with it a bit and get the shading to your liking. Add a new shading layer for each component (or simply draw on top of the current layer with the black pencil).

Your bitizen should look something like this after doing all of the shading:

Shaded Bitzen

Chop It Up

The final thing we need to do with our graphic is chop up the pieces so that they can be individually colored. Convert each of the white-* layers to Smart Objects, copy them to a new document, and save them. You should end up with 5 .png files (head.png,skin.png,hair.png,pants.png,shoes.png).

I increased the size of my Bitizen by 4 before doing this step. You might consider increasing their size as well. Remember that the size increase you choose will change some of the values when we recreate the Bitizen in Cocos2D. So, if you want to follow along, make sure your Bitizen is 60×100 before exporting the various parts.

One thing to note is we are going to bring these into Cocos2D as 5 different sprites. There are some optimizations that you could do using sprite sheets, however I want to make things as clear as possible. So, we are going the long way.

You can download my completed white bitizen here.

Rebuilding The Bitizen In Cocos2D

Once you have imported the 5 Bitizen image files into Cocos2D, you need to reconstruct them in code. This involves adding each sprite to the layer.

Here is the code to display the skin/head+hands in our layer. As a note, I simply created a new Cocos2D project and am using the retina only mode for my display using [director enableRetinaDisplay:YES]. The offsets will change quite a bit if you are choosing to support non-retina.

<code class=’objc’>int spriteX = 240;
int spriteY = 160;

CCSprite *skin = [CCSprite spriteWithFile:@"skin.png"];
[skin setPosition:ccp(spriteX, spriteY)];
[self addChild:skin];</code>

This will draw our white(shaded) head on the screen. That’s pretty boring so let’s draw the rest of the body. Update your code to look like the following:

<code class=’objc’>int spriteX = 240;
int spriteY = 160;

CCSprite *skin = [CCSprite spriteWithFile:@"skin.png"];
[skin setPosition:ccp(spriteX, spriteY)];
[self addChild:skin];

int hairOffset = 11;

CCSprite *hair = [CCSprite spriteWithFile:@"hair.png"];
[hair setPosition:ccp(spriteX, spriteY+hairOffset)];
[self addChild:hair];

int shirtYOffset = -9;
int shirtXOffset = 1;

CCSprite *shirt = [CCSprite spriteWithFile:@"shirt.png"];
[shirt setPosition:ccp(spriteX + shirtXOffset, spriteY+shirtYOffset)];
[self addChild:shirt];

int pantsYOffset = -15;
int pantsXOffset = 1;

CCSprite *pants = [CCSprite spriteWithFile:@"pants.png"];
[pants setPosition:ccp(spriteX + pantsXOffset, spriteY+pantsYOffset)];
[self addChild:pants];

int shoesYOffset = -17;
int shoesXOffset = 1;

CCSprite *shoes = [CCSprite spriteWithFile:@"shoes.png"];
[shoes setPosition:ccp(spriteX + shoesXOffset, spriteY+shoesYOffset)];
[self addChild:shoes];</code>

Now, you should see the lonely ghost of a Bitizen standing in the center of your screen.

Ghost Bitizen

Still boring… Time to spice him up with some color.

Tinting Cocos2D Sprites

As I mentioned before, tinting Cocos2D sprites is very simple. I would recommend keeping all sprites that you wish to tint a shade of white/gray otherwise some crazy things will happen.

The setColor method takes an array of integers from 0-255. This array contains 3 numbers (1st for red, 2nd for green, 3rd for blue). For example, we can pass all Red to the setColor method by sending it {255,0,0}.

Let’s start by tinting our Bitizen’s shirt a random color. Change the code that displays the shirt to look like this:

<code class=’objc’>CCSprite *shirt = [CCSprite spriteWithFile:@"shirt.png"];
[shirt setPosition:ccp(spriteX + shirtXOffset, spriteY+shirtYOffset)];
ccColor3B shirtColor = {arc4random() % 255,arc4random() % 255,arc4random() % 255};
[shirt setColor:shirtColor];
[self addChild:shirt];</code>

Now, every time you run the application, the Bitizen should have a different shirt color. You can apply this principle to each of your sprites to completely customize your Bitizen.

What if you only want to limit certain colors? (you ask). Well, that’s a great question. I solved this by creating an array of ccColor3Bs. Basically an array of arrays. And then I index into this array and set the color accordingly. Here is an example of setting a random skin color to avoid having blue people (unless maybe you are making Smurfs).

<code class=’objc’>ccColor3B skinColors[] = { 
    {247,224,194},
    {255,232,214},
    {136,119,82},
    {245,232,205},
    {144,110,38}
};
CCSprite *skin = [CCSprite spriteWithFile:@"skin.png"];
[skin setPosition:ccp(spriteX, spriteY)];
ccColor3B skinColor = skinColors[arc4random() % 5];
[skin setColor:skinColor];
[self addChild:skin];</code>

I have an array of 5 different arrays and randomly index into it using skinColors[arc4random() % 5]. This will give me a random color within my skin color group.

After running this through a loop and adding random colors to some of the other sprites, I ended up creating the image you see at the top of this post.

Conclusion

I hope that this tutorial has found you well and I have demystified the magic that is dynamic sprites. You may download the source code for this tutorial (include the code to generate the screenshot above) here.

If you have any questions or comments, please feel free to leave them in the comments section of this post. Also, make sure you subscribe to my RSS feed for more great tutorials!

Happy Coding!

This post is part of iDevBlogADay, a group of indie iOS development blogs featuring two posts per day. You can keep up with iDevBlogADay through the web site, RSS feed, or Twitter.

Pixel Art Character Tutorial – Creating And Customizing A Bitizen

This will be a continuation of my last pixel art tutorial about configuring Photoshop for Pixel Art. For the past month or so, both my wife an I have been pretty addicted to this amazing game called Tiny Tower created by Nimble Bits. The biggest draw for me to this game isn’t the fact that it has great simulation style game mechanics, it’s the fact that it was created using Pixel Art.

As I mentioned in my other post, I have a serious passion for pixel art and have been doing everything I can to learn about it and improve my skills. One great thing about it is, anyone can do it. You don’t have to be this amazing artist to be able to create interesting pixel art.

Getting Started

They say that imitation is the best form of flattery, so we are going to flatter the heck out of the Nimble Bits guys are learn how to make our own Bitizen characters from Tiny Tower. I have found that a good starting place for learning pixel art (or anything really), is to start with something that already exists, copy it, then modify it. Once you do that a few times and get comfortable, then you should have the confidence to branch out into creating your own artwork.

When creating a game (or complex piece of pixel artwork) that involves a ton of different characters, it will save a ton of time and energy if you create a “base character”. What I mean by “base character” is one that is very bland and plain. Something that is easily customizable. So, that’s what this tutorial is about, we are going to create a bland white guy for Tiny Tower.

One thing I want to point out before we start is, I have lowered the resolution of the character a bit and am not putting in as much detail as the Nimble Bits team. This is just for simplicity’s sake in order to get my point across and make things easier on you.

New Document

Start out by creating a 15x25px document. I know, it’s very small, but we don’t need much. Make sure you have Photoshop configured for pixel art. At this point, I’d suggest creating all of the layers for your bitizen. Why use layers? you might ask. Great question. Well, in order to quickly modify our base character, we want to have a separate layer for each of his features/body parts. So, create the following layers.

  • Head
  • Mouth
  • Hair
  • Eyes
  • Shirt
  • Pants
  • Feet
  • Arms

Now, you can confidently modify any part of your Bitizen without the risk of destroying the rest. As I reference each part below, make sure you switch to the correct layer when drawing.

Creating The Head

The head is perhaps the most complicated part of the Bitizen due to its odd shape and shading. The shape is due to the fact that the Bitizen is always looking in the forward direction.

Start with a skin tone color (I have used #f7e0c2) and create a 10 x 6 rectangle in the center of your view like this:

Bitizen head

Now, that the base head is in place, it’s time to draw the chin and neck. With the same color, indent one pixel in on the bottom and draw straight across. Finally, indent 3 more pixels in, and draw 4 pixels across. This is what your head should look like at this point.

Head and Chin

Shading

Shading with pixel art is simply a matter of drawing with a darker shade of your main color. With the color chooser in PS and the skin tone still selected, drag the color down to a slightly darker shade and lowlight a 1 pixel line on the right side of the face. In our example the Bitizen is looking to his right, so his left will be shaded.

Then, add some more shading as you see necessary. If you look at mine, I have used a bit of shading to extend the head a little bit.

Head Shading

Hair, Mouth And Eyes

The mouth and eyes are very simple with our Bitizens. The eyes are just single black pixels and the mouth is just a 4 pixel line using a darker shade of the skin tone.

Hair can be whatever you like. I have chosen a very simple hairstyle that you see quite often in the game with a simple shade of brown. I have also applied the same shading technique to the hair that I did to the face and neck. When you are finished, it should really start looking like a person.

Hair and eyes

Creating The Body, Legs and Feet

For the body, start with 6 x 5 rectangle set to the color that you want to make the shirt. I chose #63cfea. For the pants, simply draw a solid line. Finally, the feet are just two 2px lines spread apart by two more pixels. If you notice in the game, to animate the movement of these guys, they simply alternate between this position and a centered 4px line. It just goes to show you how much things can be simplified when you use pixel art.

Body and legs

To finish up our Bitizen, we add single pixel dots for hands and a couple pixels for arms. After that, we add a collar and some simple shading.

Here is what the completed Bitizen looks like:

Completed Bitizen

Conclusion

The one thing to remember when creating pixel art for game is to keep it simple. Simplify everything. Take for example the Toy Story characters I made at the top of this post. They are very simplistic yet you recognize who they are right away. My 2.5 year old son was yelling “Woody! Buzz!” the entire time I was creating them. I think this is one of the largest challenges; sticking to “less is more”.

There are some other fun things we can do to customize these guys. We can even do it in code! Next time, I will show you how to take a “base character” and customize its colors using Cocos 2D. This can save you even more time and energy when trying to make dynamic characters for your game.

If you are feeling lazy and want to simply download my bitizen base, click the following link:

Download my bitizen.psd template

On a final note, don’t just copy these guys for YOUR game! I know it might seem tempting to give em a different shirt and plop them in your super rad fart machine RPG, but these guys are the product of the hard work of the guys at Nimble Bits.

If you have any questions or tips, please feel free to leave them in the comments.

I would also LOVE to see some of the custom bitizens you guys come up with. Please link to them in the comments if you end up creating some.

Happy Coding!

This post is part of iDevBlogADay, a group of indie iOS development blogs featuring two posts per day. You can keep up with iDevBlogADay through the web site, RSS feed, or Twitter.

Configuring Photoshop For Pixel Art

First things first. My wife and I had welcomed a new baby boy into the world on Monday so you guys are going to have to see the obligatory “dad” pics.

Here they are

Jack

Jack

Ok, now that’s past us, let’s chat about pixel art. I have always been a HUGE fan of pixel art both in games and as a form of art. As an aspiring game developer (games coming soon 😉 ), I found pixel art a great fit for me. Not only is is aesthetically pleasing, it also allows developers to create “better” art than developer art. All it takes is a little patience.

Today, I’m going to share with you how I have configured Photoshop to create some pixel art and eventually show you how to make your own Bitizens from Tiny Tower in a follow up post.

Some of you might argue that Photoshop is not the way to go and that there are better tools for Pixel art. I have tried quite a few and keep coming back to PS because of some of it’s great features (shapes, layering, masks, gradients, noise filters, etc…). We can use a lot of these tools to our advantage when creating pixel art, PS just needs to be set up correctly.

Just a heads up before I start, I’m using Adobe Photoshop CS3 for Mac.

Change The Way Photoshop Scales Images

First, we need to change the way PS scales images. This is useful for when you are ready to export your sprites for production. By default, PS uses a Bicubic algorithm when you want to enlarge an image. This generally produces a very blurry effect. It’s quite useful in many cases, but terrible for pixel art. Here, we need to tell PS to use a “Nearest Neighbor” scaling algorithm. This will preserver all of our edges without PS mucking with the blending.

To change this setting, navigate to Photoshop->Preferences->General

Nearest Neighbor

The only setting you need to modify is “Image Interpolation”. Make sure to change it to “Nearest Neighbor”.

Enabling A Grid

When creating pixel art, it is very useful to have a grid in place in order to determine where to place your next pixel. Without it, you are just blindly placing them. To turn on and configure a grid in PS, navigate to Photoshop->Preferences->Guides, Grid, Slices & Count…

1px gridlines

Make sure to set Gridline every to 1 and Subdivisions to 1. This will create a 1px grid on for you to use as a guide.

Once you have configured the grid, click on View->Show->Grid to display it. You might have to do this for every document.

Configuring the Pencil Tool

When creating pixel art in PS, the pencil tool is your best friend. You will use it ~95% of the time when drawing. We need to make sure that the pencil draws single pixel dots without any interpolation. With the pencil tool selected, click the dropdown next to brush, tap the arrow and then select basic brushes. When prompted to replace current brushes, click OK.

Basic Brushes

Next, select the 1 px brush (it should be in the top left). Most of the time, you will want to draw with single pixels.

1 px brush

Creating A New Document

Deciding on a document size can be tricky. You generally want to create your document as small as possible to avoid having to do more work than you need. The size depends on how “pixellated” you want your art to look after scaling. Basically, using the scaling we chose above (nearest neighbor), the “pixels” will just increase in size.

Here is a blown up view of our 15×25 image that we will use in the next tutorial to create a Bitizen from Tiny Tower.

New Document

Since the zoom level isn’t too high, we are seeing grid slices every 2 pixels rather than 1. As you zoom, you will see the grid size increasing.

Multiple Zoom Levels In View

One cool trick with PS is, it allows you to have multiple windows of the same document open. The reason this is handy is you can see various zoom levels for your artwork all at once. While drawing each pixel zoomed in, you can see the result in the desired resolution. This helps out dramatically when you are trying to fine tune your work.

To do this, go to Window->Arrange->New Window for [projectname.psd] Now you can control the zoom level of each window individually.

In the next post, I will go over how to make these Bitizens as well as some tips for customization as an example for creating dynamic characters. We will also go over some of the basic techniques that were used.

If you have any comments, questions, or Photoshop Pixel Art Tips, please feel free to post them in the comments.

Happy coding!

This post is part of iDevBlogADay, a group of indie iOS development blogs featuring two posts per day. You can keep up with iDevBlogADay through the web site, RSS feed, or Twitter.

Announcing iOS 4 In Action + Free Chapter!

Wow, I can’t believe it has been over a year since the release of my book iPhone And iPad In Action. Since then, we have sold over 6,000 copies and have just have released in numerous languages!

As with all iOS (tech books really), my book was almost outdated the moment it hit the shelves due to Apple’s constant SDK release cycle. My book ended with “here is what’s coming in iOS 4…”, and didn’t hit the shelves until after iOS 4 was released.

I was asked last year by Manning Publishing to write the 3rd version of the book to include all of the 4.0 SDK changes. Due to some huge changes in my life, I was unable to accept and they had to find the 4th author to work on the book.

Earlier this month, Jocelyn Harrington released the 3rd version of the book titled “iOS 4 In Action”. Here is a bit about this version from their site.

Written for Xcode 4, iOS 4 in Action guides you from setting up your development environment,
through coding your first app, all the way to selling in the App Store. Work through sample
applications including a chat client, a video game, an interactive map, background audio,
and more as you explore the iOS 4 SDK.

Here are some highlights about what’s inside.

  • Full coverage of iOS SDK 4.3
  • Mastering Xcode 4
  • Multitasking for iPhone and iPad
  • Game Center, iAd, and AirPrint
  • Local and push notification
  • Implementing in-app purchasing

This is a significant update and I’m really excited to get my copies in the mail. As soon as I do so, I’ll do a couple giveaways on my blog. Make sure you stick around or subscribe to the RSS feed so you don’t miss it!

Freebie

Manning is allowing anyone to download the full Chapter 21 on multitasking now for free! Go grab your copy!

Happy Coding!

This post is part of iDevBlogADay, a group of indie iOS development blogs featuring two posts per day. You can keep up with iDevBlogADay through the web site, RSS feed, or Twitter.

Autonomous Steering Behaviors In Corona SDK Games

Wow, it’s already been 5 months since I was last blogging for #iDevBlogADay. The time has flown by!

Recently, I have been dabbling with [Corona SDK][1] and have been getting really excited about the possibilities. For those of you who don’t know, Corona SDK is a multi platform game engine that allows you to write your code in Lua and deploy on iOS and Android devices.

Today I want to chat with you about Autonomous Steering Behaviors and show you how I have implemented a few of them in a small game that I’m working on.

Here is a short demo video of what we will be creating


Boids Demo from Brandon Trebitowski on Vimeo.

</center>

What Are Autonomous Steering Behaviors

The name does sound pretty fancy. At the core they are just behaviors that define how a character interacts with the world around them in a life-like manner. Some of the main behaviors include wandering, path following, flocking, pursing and evading. The theory and algorithms for all of these behaviors and more can be found in a paper published by Craig Reynolds in the 80’s called Steering Behaviors For Autonomous Characters.

While I admit I didn’t quite read all of it, the paper contains some incredible gems in terms of making your character AI seem much more life like.

There are plenty of examples (especially in games) where these behaviors come in handy. Perhaps the easiest behavior to implement is wander. Say for example you have an NPC (non player character) that walks around a village. The wander algorithm is a perfect fit to make it seem like that NPC is actually “thinking” about where he’s going and keeps your animations looking smooth.

The seek and evade is another interesting algorithm. Often times in our games, we want enemies to chase after us without it seeming like they have the exact shortest path to use. It adds a bit of randomness and makes your enemies seem much more realistic.

How Can I Use Them In My Corona SDK Game?

After doing a bit of research, I found this incredible site by daniel shiffman that detailed some of the algorithms using processing. This at least took the words from the paper and made them in to some code. I really suggest that you read up on that page to get a solid understanding of what we are doing here. Rather than simply regurgitating what Daniel wrote, I’m going to focus on showing you how his code can be ported for use in your Corona SDK games.

The first challenge was, the code relies heavily on using 2D vectors. Now, I didn’t see a nice built-in way to do this in Corona or Lua for that matter. So I decided to roll my own Vector2D class. For those Corona SDK veterans reading this, feel free to blast me in the comments if I’m reinventing the wheel with this and just failed to fully read the documentation. Otherwise, enjoy this Vector2D class!

Here is the link to the gist containing that file.

Here is a short snippet of that class just to add to the aesthetics of this post:

<code class=’lua’>function Vector2D:new(x, y)  – The constructor
  local object = { x = x, y = y }
  setmetatable(object, { __index = Vector2D })  – Inheritance
  return object
end

function Vector2D:normalize()
    local temp
    temp = self:magnitude()
    if temp > 0 then
        self.x = self.x / temp
        self.y = self.y / temp
    end
end

function Vector2D:dot(vec)
    return self.x * vec.x + self.y * vec.y
end</code>

Basically it’s a lua “object” that has an x and y with some helper methods for doing vector math. The lower case methods act on the current self object and the upper case methods act as static class level methods meant to return a new vector. The file is a little sloppy but it gets the job done.

Creating A Boid

In the paper, an autonomous character is called a Boid. There are basically 2 actions that we need to implement that are needed in most of the behaviors. They are steer and seek. Steer is the basis for all of the autonomous behaviors. Given a Vector2D as the target, it will return a new Vector2D for the boid’s acceleration in the direction of the target. We simply wrap this call in the seek method. Now, any behavior can call seek in order to direct the boid towards a target.

Here is a link to our Boid on github

A snippet of the wander function

<code class=’lua’>function Boid:wander()
    local wanderR = 16.0
    local wanderD = 60.0
    local change  = 0.5

    local negChange = math.random(2)
    local randomNum = math.random() * change
    if negChange == 2 then
        self.wanderTheta = self.wanderTheta - randomNum
    else 
        self.wanderTheta = self.wanderTheta + randomNum
    end 

    local circleLoc = self.vel:copy()

    circleLoc:normalize() 
    circleLoc:mult(wanderD)
    circleLoc:add(self.loc)

    local circleOffset = Vector2D:new(wanderR*math.cos(self.wanderTheta), 
        wanderR*math.sin(self.wanderTheta))
    local target = circleLoc:copy()
    target:add(circleOffset)

    self.acc:add(self:steer(target))
end</code>

What I have done is taken the code from Daniel Shiffman’s processing project and ported it directly to lua. As of right now, I have only implemented wander, however you can see how easy it is to implement other behaviors using the same techniques. Since Daniel has processing code for each of them, it’s a simple matter of making them work in your lua class.

The way wander works is, it picks random points on a circle to steer towards. These random points only vary by a fraction of a radian (defined by the change variable above) from the current steer point. The larger the change value is, the more your boid will appear jittery. This value must be tweaked to fit the wander style for your game. Based on my testing, .5 seems to generate a pretty smooth wander path.

Putting It All Together

In your own code you might want to build directly on top of my boid class or subclass it for each boid type. In the following example, I’m going to show you how to simply run our boid class and watch some dots wander around (hang on to your hats).

Here is a link to main.lua on github, but I have also pasted it here so we can talk about it.

<code class=’lua’>local Boid = require(‘Boid’)

– Define some limiting constants
MAX_FORCE = 1.75
MAX_SPEED = 2.0

local wanderers = {}

function animate(event) 
    for i=1,#wanderers do
        local wanderer = wanderers[i]
        wanderer:wander()
        wanderer:run()
    end
end

function Main()
    math.randomseed( os.time() )
    
    for i=1,10 do
        local loc = Vector2D:new(display.contentWidth / 2,display.contentWidth / 2)
        local wanderer = Boid:new(loc,MAX_FORCE,MAX_SPEED)
        table.insert(wanderers,wanderer)
    end
    
    Runtime:addEventListener( "enterFrame", animate );
end

Main()</code>

Here we declare an array of wanderers. In the Main() method we initialize each one, insert them into the array, and add a hook to call our animate method for each frame. Inside of the animate method, we simply tell each wanderer to wander and then run itself. The boid class will take care of the rest.

One thing to note is, the boids are unaware of each other at this time. That requires a cohesion method. I have it written and might post it up at a later time; I just want to keep things simple for now. Please feel free to ask me questions in the comments or write me on Twitter.

You can download or fork the full source for this project here.

Happy Coding!

This post is part of iDevBlogADay, a group of indie iOS development blogs featuring two posts per day. You can keep up with iDevBlogADay through the web site, RSS feed, or Twitter.

[1]: http://www.anscamobile.com/corona/

Check Out AutoCorrector + Promo Codes!

So, this blog post might sound like a lame press release, but I actually do want to talk about a cool app some buddies of mine created. Just read it in a cheesy used car salesman voice and it will be a lot less more enjoyable.

The Problem

Have you ever tried to type shorthand text to a friend and it come out completely wrong? For example: AFK -> AFT, AKA -> Aja. Or maybe your friend has an uncommon nickname that auto corrects to something hilarious…

Enter AutoCorrector

@cruffenach , @matt_tuzzolo , and @damian_r just released an app for the iPhone called AutoCorrector! It’s an app that allows you add words to your iPhone’s auto correct dictionary. Once added, the iPhone will stop pestering you to auto correct uncommon/shorthand words that you frequently type.

How It Works

Adding words directly to the dictionary would be against the Apple SDK terms of use as it would require your app to run outside of it’s “sandbox”. However, clever @cruffenach realized that when you add comma separated words to a contact’s nickname in the address book, they get added automatically to the iPhone’s dictionary.

This actually makes a lot of sense when you think about it. If you have a friend with a nickname, chances are you will want to address that person at some point by that nickname. It would get very annoying if you iPhone tried to autocorrect you every time you tried to type that friend’s name.

Auto corrector simply uses the AddressBook framework to maintain a contact with a nickname containing a list of words you have added. When you add a new word, it simply updates this contact.

Why Use Auto Corrector?

Sure you could just do this manually, however it’s a pain and requires too many steps (6 taps vs. 2 taps for AC). Also, auto corrector provides a beautiful interface for entering and managing words you have added.

Word Packs!
Bundled with AC, comes the SMS shorthand word pack with 116 words ready to install instantly. In the near future, the guys plan on creating a ton more word packs as well as provide a portal for community packs.

I’m pretty excited about this app and really think it has a good future.

Download it here

What do you think? Would/did you buy it?

Edit
Here are some promo codes!

4YMPYNFJEWNE
MY6FTY49M4F6
H9KYWH9J4YPY
XW4EXHM67R34
AR6JN3RJYFE6

Beginning Jailbroken iOS Development – Building And Deployment

Welcome to the next installment of my jailbroken iOS development series. If you haven’t already done so, read my previous post to get up to speed.

Beginning Jailbroken iOS Development – Getting The Tools

Now that your environment has been set up, it’s time to start hacking your project, building, and deploying it. This tutorial will be fairly quick and will just demonstrate how to build a .deb file and install it on your device. This will not cover creating a Cydia repository for public access (this is for a later tutorial).

Introduction

Start by creating a simple project. Refer to the previous tutorial to determine how to do this. I will use the example of the #1 iphone/application and will be calling it fooProject.

<code class=’bash’>$/opt/theos/bin/nic.pl
NIC 1.0 - New Instance Creator
——————————
  [1.] iphone/application
  [2.] iphone/library
  [3.] iphone/preference_bundle
  [4.] iphone/tool
  [5.] iphone/tweak
Choose a Template (required): 1
Project Name (required): fooProject
Package Name [com.yourcompany.fooproject]:    
Author/Maintainer Name [Brandon Trebitowski]: 
Instantiating iphone/application in fooproject/…
Done.</code>

This will create a new directory for our project with the following files.

  1. control: Contains information about your application/tweak. This is the info you see when you install something from Cydia (name, author, version, etc…)
  2. [applicationName]Application.mm: This is essentially your appDelegate file. It creates a window, adds your RootViewController and displays it.
  3. main.m : Same main file that you would use in an iPhone project. Just initializes your [applicationName]Application.mm file on launch.
  4. Makefile: contains the necessary build commands to compile your project. I’ll go over this in detail in a bit
  5. Resources: This folder contains your info.plist and is also where you can place all of your images
  6. RootViewController.h/mm: A simple view controller

The Makefile

theos provides some great tools that simplify the build process as much as possible. I know some of you might shudder at the sound of a Makefile, but trust me, it’s very painless.

Let’s first take a look at the anatomy of the Makefile that was generated.

<code class=’bash’>include theos/makefiles/common.mk</code>

This line simply tells theos to include the common make commands in your build script to save you some work.

<code class=’bash’>APPLICATION_NAME = fooProject</code>

The name of the application we are building. The Makefile will use this constant to do a number of things under the hood. Don’t modify this unless your application changes names.

<code class=’bash’>[applicationName]_FILES = main.m fooProjectApplication.mm RootViewController.mm</code>

This is the meat of the Makefile. It’s the list of m (or mm in this case) files that need to be compiled. *Note: you do not add your .h files here. So, whenever you add a new .m file to the project, make sure to append it to this list or it won’t get built.

<code class=’bash’>[applicationName]_FRAMEWORKS = UIKit Foundation QuartzCore AudioToolbox CoreGraphics</code>

This line is not included by default, but is needed if you want to use ANY frameworks; be them Apple’s or h4x0red ones.

<code class=’bash’>include $(THEOS_MAKE_PATH)/application.mk</code>

More defaults to help theos build your project.

Setting up Your Environment

Do you remember in the last tutorial that we had to set an environment variable in order to use theos? Well, we need to set a couple more to build and deploy.

Here are the 3 that you MUST have.

<code class=’bash’>export THEOS=/opt/theos/
export SDKVERSION=4.3
export THEOS_DEVICE_IP=192.168.1.122</code>

The first line, you should have already done. Otherwise you would not have been able to run the nic tool above. The second defines your current SDK version. This will tell theos where to look for your frameworks and whatnot. (ex If you only have 4.2 installed, set this to 4.2). Finally, the last line, tells theos the ip address of your device.

Once theos does the package install, it will sftp the package to your device for installation. One thing to note here is your iPhone MUST be on the same network as the computer you are developing on.

If you don’t know your device’s ip address, it’s in the SBSettings menu. If you don’t have SBSettings, go download it from Cydia and think about why you would have a jailbroken device without this app installed…

 

Building The Project

Building is just as easy as running the make command inside of your project’s root directory.

Here is an example of building my fooProject app using the command:

make.

<code class=’bash’>$ make
Making all for application fooProject…
 Compiling main.m…
 Compiling fooProjectApplication.mm…
 Compiling RootViewController.mm…
 Linking application fooProject…
 Stripping fooProject…
 Signing fooProject…</code>

If your project contains errors, they will be flushed out here. Also, theos treats warnings as errors (as should you) 😉 . So, if you have any warnings you won’t be able to build.

When you are ready to distribute your application, you must build a .deb package. Luckily, theos does this for us with a simple command:

make package.

<code class=’bash’>make package
Making all for application fooProject…
make[2]: Nothing to be done for ‘internal-application-compile’.
Making stage for application fooProject…
 Copying resource directories into the application wrapper…
dpkg-deb: building package ‘com.yourcompany.fooproject’ in ‘/Users/brandontreb/Desktop/fooproject/com.yourcompany.fooproject_0.0.1-1_iphoneos-arm.deb’.</code>

You should now see a file like com.yourcompany.fooproject_0.0.1-1_iphoneos-arm.deb in your project’s root directory. One great feature of theos is it handles versioning automatically. So subsequent builds will increment the build number. If you change your version in the info.plist file, it will start the build counter over (2-1, 2-2, etc…).

At this point, you could sftp this file to your device and run:

<code class=’bash’>dpkg -i com.yourcompany.fooproject_0.0.1-1_iphoneos-arm.deb</code>

as root to test the installation. However, that is quite a bit of a pain. Luckily, theos will do all of this for you by simply using the command:

make package install

<code class=’bash’>$ make package install
Making all for application fooProject…
make[2]: Nothing to be done for `internal-application-compile’.
Making stage for application fooProject…
 Copying resource directories into the application wrapper…
dpkg-deb: building package ‘com.yourcompany.fooproject’ in ‘/Users/brandontreb/Desktop/fooproject/com.yourcompany.fooproject_0.0.1-3_iphoneos-arm.deb’.
install.copyFile "/Users/brandontreb/Desktop/fooproject/com.yourcompany.fooproject_0.0.1-3_iphoneos-arm.deb" "com.yourcompany.fooproject_0.0.1-3_iphoneos-arm.deb"
root@192.168.1.122’s password: 
com.yourcompany.fooproject_0.0.1-3_iphoneos-arm.deb                                                                                                                                                                                                                              100% 4434     4.3KB/s   00:00    
install.exec "dpkg -i com.yourcompany.fooproject_0.0.1-3_iphoneos-arm.deb"
root@192.168.1.122’s password: 
Selecting previously deselected package com.yourcompany.fooproject.
(Reading database … 2006 files and directories currently installed.)
Unpacking com.yourcompany.fooproject (from com.yourcompany.fooproject_0.0.1-3_iphoneos-arm.deb) …
Setting up com.yourcompany.fooproject (0.0.1-3) …</code>

You will have to enter your password several times during the process. The default is alpine.

After this has been run, you will need to restart (or respring) your iPhone. Respringing takes a simple button tap if you have SBSettings installed (have you installed it yet?).

Conclusion

You now have all of the tools needed to start hacking your very first jailbroken iOS application. In the next tutorial, we are going to learn about MobileSubstrate hacks and how to overwrite Apple functionality. I will give a basic example of how to display an alert message every time your device boots up.

Until next time, happy hacking!

Half Off iPhone And Android Books From Manning Publishing Today

Last year I wrote the second edition of [iPhone and iPad In Action][1]. It was published by [Manning Publishing][2] and today they are offering half off all of their mobile software development books!

Simply use the code:

dotd0414

when you check out at [manning.com][3] for a half price discount on the following titles:

My Journey To Create The inPulseNotifier For Jailbroken iPhones – Part 2

This post is a continuation from my previous post found here.

A MobileSubstrate Tweak?

After I completed a basic app that allowed me to send various notification types from my iPhone to my inPulse watch, I quickly realized that this would not work if I wanted to hook into the iPhone’s notification system. A Google search revealed to me that I had to make MobileSubstrate hack to overwrite the default notification functionally.

** What the heck is Mobile Substrate? **

Here is the description according to iPhoneDevWiki.net.

MobileSubstrate is the de facto framework that allows 3rd-party developers to provide run-time
patches (“MobileSubstrate extensions”) to system functions, similar to Application Enhancer on
the OS X. MobileSubstrate consists of 3 major components: MobileHooker, MobileLoader and safe mode.

Basically, it allows you to “hook” into any method of any class on the iPhone. I will talk in a later tutorial about how to see what methods are available. Here is a sample for hooking into the CFShow() method:

<code class=’objc’>static void (*original_CFShow)(CFTypeRef obj);  // a function pointer to store the original CFShow().
void replaced_CFShow(CFTypeRef obj) {           // our replacement of CFShow().
  printf("Calling original CFShow(%p)…", obj);
  original_CFShow(obj);                         // calls the original CFShow.
  printf(" done.\n");
}
…
// hook CFShow to our own implementation.
MSHookFunction(CFShow, replaced_CFShow, &original_CFShow);
// From now on any call to CFShow will pass through replaced_CFShow first.
…
CFShow(CFSTR("test"));</code>

Yeah… this looks pretty intense. Luckily, I found a super helpful tool that greatly simplifies this process called theos. Check out my tutorial on getting started with theos.

What lead me to theos was the incredible work of Peter Hajas. He wrote and open sourced his fantastic notifications app called Mobile Notifier. Without it, I would have been dead in the water. After chatting downloading his code and nagging him on Twitter, he pointed me to theos.

Working With theos

As I mentioned in my tutorial, theos is a great tool to aid in the development of a Mobile Substrate Tweak. Instead of the complexities above to hook into the functionality of classes, you simply do something like this:

<code class=’objc’>%hook SpringBoard

-(void)applicationDidFinishLaunching:(id)application
{    
    %orig;

    INPreferenceManager *preferenceManager = [[[INPreferenceManager alloc] init] autorelease];
    BOOL enabled = [[preferenceManager.preferences valueForKey:@"inpulseEnabled"] boolValue];
    if(enabled) {
        manager = [[INAlertManager alloc] init];
        [manager connectToWatch];
    }
}

- (void) dealloc {
    [manager release];
    manager = nil;
    %orig;
}

%end;</code>

This is a simple hook that allows me to overwrite the functionality of Springboard’s applicationDidFinishLaunching method. DHowett (creator of theos), has done a brilliant job giving devs quite a few commands like %orig (which calls the original method) and %hook (starts a hook).

The reason this works is, the file you code in (called Tweaks.xm) gets run through a preprocessor called Logos (which he also wrote). It replaces these simple commands with the complex stuff you see above before compiling your project. Using this technique, you can hook into anything. I will have a tutorial on this in the very near future, so make sure you subscribe to my RSS feed if you haven’t already.

Copy And Paste

OK, so I copied some of Peter’s code (he’s well cited in the source and I kept his license in the headers too). He had already solved the problem of capturing most of the iPhone’s notifications and this is precisely what I needed. So I Frankensteined my code and his to create the first version of inPulseNotifier.

This current version supports SMS, Push Notifications, Local Notifications, and Calendar Notifications.

Deployment

Even though I open sourced the code for the app, I couldn’t possibly expect users to build the code themselves and install it on their devices. So I had to learn about setting up my own Cydia repository.

A Cydia repository allows users to browse your applications/tweaks through the Cydia application created by Saurik. This is the method of choice for deploying jailbroken iPhone applications.

Saurik has a very detailed tutorial on creating a Cydia repository here.

(In case you are wondering, my Cydia repo is hosted at http://brandontreb.com/cydia )

OK, How Do I Install It?

Great question I assume you might ask. I have written a tutorial about installing it on your iPhone here.

Plans For The Future

Well, at the moment development has slowed as I prepare for a few changes in my life. However, in the coming months, I intend on doing the following updates.

  1. Remove the dependency on Insomnia for preventing the phone from sleeping. I have found a version of their source that I can integrate into my own code.
  2. Add support for phone calls
  3. Add support for emails
  4. Create an SBSettings toggle to allow rapid enabling/disabling
  5. Auto-reconnect after disconnecting from the watch

Conclusion

Hacking for the inPulse watch has been a new and exciting experience. The team over there has really created something special and I can’t wait to see what the future holds for them (hopefully a touchscreen).

I’d love to hear your thoughts in the comments. And stay tuned for some jailbroken dev tutorials based on my experiences.

Happy Coding!

My Journey To Create The inPulseNotifier For Jailbroken iPhones – Part 1

Many of you may have seen my tweets or blog posts regarding my development of a native iOS interface for the inPulse Watch. I just wanted to share a bit with you about the development process and talk about my updates moving forward.

What is the inPulse Watch?

For those of you who don’t know, the inPulse watch is a programmable wristwatch with a bluetooth controller. It can run a single app at a time on top of it’s firmware that is installed on the watch via a bluetooth interface with your computer. People have written all sorts of apps from analog clocks to roguelikes and Connway’s Game of Life. Check out http://inpulsewatch.com/watchapps.asp to see the latest apps.





&nbsp

</p>

It Begins

After waiting about 10 days for my watch (yeah it’s a long waiting period since they have seen quite a bit of recent success), it finally came in the mail. Enthusiastically, I opened it up and followed their getting started guide. Within a few minutes I was running some of the sample applications in the forums.

No iOS Support?

One of the coolest features of the watch is the ability to have your smartphone notifications show up on it. You are able to read SMS, Email, Calendar, etc… for a wide variety of Blackberry and Android phones.

After digging around a bit, I was disappointed to see that there was limited (no) iPhone support. They had some old file that used BTStack at some point to communicate a simple canned message to the iPhone. No documentation, no support, nada.

Building The App

As I had no experience developing for a jailbroken iPhone, I had no idea how to even compile this sample app. So, I used the Google machine and found the Google repository for BTStack (the bluetooth library of choice for jailbroken iOS apps). I was able to download the source and build a sample application that basically connected my iPhone to a bluetooth device.

Well, this got me started. So I did what any curious developer would do and started plugging crap in. I replaced the sample file that was packaged with BTStack with a slightly modified version of inPulse’s sample iPhone file. Sure enough, I was able to build and install it.

We Have Connection

After figuring out how to hardcode my watch’s address into the source, I was able to determine that the iPhone had actually connected to the watch. I monitored the packets and threw up an alert view (No NSLogging available at this point) when a connection was made.

So, now that we are connected, let’s trying sending the sample message…fail! I couldn’t even send the time.

At this point, I decided to move the code I had written into a sample iPhone project so that I could do attached debugging. This showed me that the packets were arriving on the watch since I received an ack packet back. So, the watch sees the messages, but doesn’t consider them notifications.

Time to hit the docs


Knowing that the packets were received gave me quite a bit of hope. I figured that I must have had the protocol incorrect. So, I dug into the inPulse protocol document which outlined what the packet structures should look like. My C skills aren’t the strongest so I had to look up quite a few things.

Sure enough, they had upped the version number of their protocol by 1 and mine was outdated. So, I updated what I could and gave it another shot…fail.

No messages were displaying. At this point I was ready to give up. I read online somewhere that the BT implementation on the watch was not supported by inPulse and felt dead in the water. So I took a break for a couple days.

When I came back to it, I was tapping through my watch and noticed that the calendar appointments had some data in them on the watch. Could it be? Did my notifications arrive? (I was trying to send SMS notifications). So I dug into the docs again…

We have a message!!!

Sure enough, I had some fields declared as * uint16_t * when they should have been * uint8_t * . My headers were the wrong size!!! All of a sudden I was able to send every type of notification to the watch and have it displayed.

It was now time to build out an actual application for release to inPulse. The next hurdle would be hooking into the iPhone’s messaging system and forwarding along the messages. Now the real iPhone hacking begins.

This post is continued here

Beginning Jailbroken iOS Development – Getting The Tools

Developing for jailbroken is actually quite similar to regular iOS development with one addition. More Power! oh oh oh (said in a Tim Taylor voice (sorry for non-Americans that don’t get the reference)). With your device jailbroken, you have the ability to hook in to pretty much every class that Apple writes allowing you quite a bit of control over the iPhone’s functionality.

In today’s tutorial, I will simply be discussing the best way to get up and running with the tools necessary to write a jailbroken iPhone app. We will not be doing any coding, however this tutorial will be necessary for all posts going forward.

Theos

There are many ways to go about writing a jailbroken iOS app. Most of them are quite complex. @DHowett has come up with a brilliant tool called theos which drastically simplifies the process. My tutorial will pretty much be a regurgitation of his tutorial found here with some added cheesy jokes.

Theos is a command line utility that essentially generates a template for creating applications, libraries, preference bundles, tools, and mobile substrate hacks. These cover 99% of the jailbroken apps that you are likely to create.

One thing to note is DHowett talks about doing jailbroken iOS development on both Mac and Linux; my tutorials will be Mac-only.

Step 1: Install the iOS SDK

You will first need to install the official iOS SDK.

http://developer.apple.com/devcenter/ios/index.action

You can register for a free account and download the latest SDK. Once installed reboot your Mac and come back here. I’ll wait…

Step 2: Setting Up The Environment Variables

Start by deciding on a good location to install theos. The suggested location is /opt/theos. The only issue with doing it here is you will need to have administrator permissions as well as have to enter your password when updating files. For teaching purposes, I am going to assume you will install it here too.

Open the terminal and type:

<code class=’bash’>export THEOS=/opt/theos</code>

What we are doing is setting an environment variable. You can always see if this variable is set by typing echo $THEOS in the command line. It will need to be (re)set every time you reopen the terminal to develop a jailbroken app.

Step 3: Getting theos

DHowett uses subversion for version control on theos, so you need to make sure and have it installed. If you followed step one above, it should have been installed by default. We will be checking out theos into the THEOS directory specified in step 2.

In the terminal type:

<code class=’bash’>svn co http://svn.howett.net/svn/theos/trunk $THEOS</code>

You most likely will be asked for your password. You should now see the /opt/theos directory created with theos installed.

Step 4: Getting ldid

We now need to install the ldid tool. ldid is a tool written by Saurik (if you don’t know who he is, stop reading now). Basically, it simulates the signing process for the iPhone, allowing you to install your jailbroken apps/hacks on an actual device.

You can find this tool in many places, however DHowett has generously hosted it for us on his dropbox account.

Now, I had a tricky time getting this to download directly to my /opt/theos folder. So, I downloaded it to my desktop and then moved it in to /opt/theos/bin/ldid

<code class=’bash’>curl -s http://dl.dropbox.com/u/3157793/ldid > ~/Desktop/ldid
chmod +x ~/Desktop/ldid
mv ~/Desktop/ldid $THEOS/bin/ldid</code>

Alternatively, if you can get it to work properly, do it like DHowett suggests and download it directly into place.

<code class=’bash’>curl -s http://dl.dropbox.com/u/3157793/ldid > $THEOS/bin/ldid; chmod +x $THEOS/bin/ldid</code>

Step 5: Install dpkg

Dpkg is a tool to bundle up your app into a Debian package for distribution in a Cydia repository. You can install it through Macports.

<code class=’bash’>sudo port install dpkg</code>

Step 6: Creating A New Project

theos uses a tool called nic (new instance creator) to create a new project. Simply run nic by typing:

<code class=’bash’>$THEOS/bin/nic.pl</code>

and it starts the new instance creator. Here is a sample of making a jailbroken application.

<code class=’bash’>brandon-trebitowskis-macbook-pro:Desktop brandontreb$ $THEOS/bin/nic.pl
NIC 1.0 - New Instance Creator
——————————
  [1.] iphone/application
  [2.] iphone/library
  [3.] iphone/preference_bundle
  [4.] iphone/tool
  [5.] iphone/tweak
Choose a Template (required): 1
Project Name (required): FartLight
Package Name [com.yourcompany.fartlight]: com.brandontreb.fartlight
Author/Maintainer Name [Brandon Trebitowski]: 
Instantiating iphone/application in fartlight/…
Done.</code>

This will create a new folder with a basic template called fartlight (killer project, I know). In addition to the usual files it will contain a Makefile (for building the application) and a control file (information about the application when it’s in a Cydia repository).

This should now give you the basis for creating a jailbroken application/tweak/hack. In the next tutorial we will go over building, signing, and deployment. For now, you can check out the project I created with nic called inPulseNotifier. It’s a combination of a tweak (5) and a preference bundle (3) for the app settings.

Feel free to ask me a question in the comments and check out #theos on IRC.

Update Check out the next tutorial in this series here.

Happy coding!

Jailbroken iPhone Development – Would You Be Into It?

As of recent I have had a ton of interest in doing development for Jailbroken iPhones. I love the power, being able to hack anything on the device. It opens up a whole new world of possibilities.

My most current project (inPulseNotifier) is a Mobile Substrate hack which allows the iPhone to interface with an inPulse watch. It uses BTStack and boots up during the init method of your springboard. I will do a full writeup on this in the near future, but basically it forwards all of your phone’s notifications (SMS, Local, Push, Calendar) to your watch!

Serious Lack Of Resources

InPulseNotifier was a blast to create, however I found it incredibly challenging to find many resources about doing jailbroken development. I finally found theos which was a total lifesaver. Also, I had the code for mobileNotifier to follow along with.

IRC (yeah I’m a true hacker ;)) was also huge help, but there simply aren’t enough tutorials/examples on the web related to jailbroken iPhone dev. My guesses are either 1. it’s quite hard, 2. there’s not enough <font color”green”>$$$</font> in it, or 3. jailbreakers like to stay “underground”.

I haven’t quite figured it out, but I was curious what YOU thought about it as I’m considering doing some jailbroken iOS development tutorials on my blog. Please let me know in the comments. Are you down to “Hack the planet”?

Officially Running On Jekyll

Well, I have finally made the switch from WordPress to Jekyll and couldn’t be happier. Here are some of the bonuses I have seen thus far.

  1. SPEED: Just click around on my site. It is screaming fast now.
  2. Resources: Checking top on my server reveals that I have a TON of extra resources (which makes sense since Jekyll sites are way more lightweight).
  3. Ease of blogging: Ok, WordPress was pretty easy too, however, I was really starting to get sick of the post interface. I switch to Tumblr at some point simply for it’s minimalist interface. WordPress’ is gross and TinyMCE (the WYSIWG editor) is terrible. I love writing in TextMate!
  4. Offline publishing. I can write my posts anywhere since they are just .md (markdown) files. Check out Daring Fireball’s great writeup on this.
  5. Portability: Have you have tried to move your WordPress site? Yeah, it’s about as fun as chewing on tin foil with metal fillings.
  6. Focus on content: WordPress has quite a bit of focus on using rich media in your posts which tends to take away from the content if you are not careful. There is something about writing in a text editor that makes you forget about images/video/etc… unless it’s totally needed. So don’t be surprised if my posts aren’t as “rich”. (Hopefully they will be more clever :) )

I really urge you to see for yourself what it’s like blogging with Jekyll. I will do a writeup on my conversion process in the near future to help aid others in the switch. Until then, you can google around and find tons of great resources.

Considering Leaving WordPress For Jekyll

So, after my 6 year relationship with WordPress, I have been having some strong feelings for another (blog engine). Jekyll does everything that I want my wordpress to do.

  1. Not suck at security
  2. Not be bloated
  3. Not have a sucky post editor
  4. Expense – I have a few blogs hosted on Rackspace and my bill has gotten pretty pricey. I’m hoping to host my Jekyll site on App Engine for frizzle (free).

That’s about it. In case you live in a box (which most of us do since most houses are relatively square) and haven’t hear of it, Jekyll is a new blogging engine written in Ruby. Simply put, you write posts, run a command and it spits out static pages. You just upload these pages to your server (how old skool right?) Now you no longer have a dependancies on any server side language, fancy server configs, etc…

Jekyll has no(minimal) features, no comments, track backs etc… and no built-in SEO. It doesn’t even have an admin (since you are serving up static content). Sounds like a blast right? I’ll blog a bit about it as I make the migration and you will see, it’s going to be great!

I just finished reading this post from Hacker News, which was pretty much the nail in the coffin.

Huge Update To Smart Lockscreen Creator + Promo Codes

I have just updated Smart Lockscreen Creator and am giving away 10 copies!

Download It Here

I know you probably aren’t reading this as you race to see if any of the promos aren’t taken but…

Here is what’s new:

Misc

  • Added ability to generate a new image on startup. Just turn Auto-Start on in the settings

Weather

  • Toggle Fahrenheit and Celsius
  • Added missing weather images
  • Updated weather icons
  • Improved performance and stability of retrieving weather

Customization

  • Customize separator color and height
  • Customize which day of the week to highlight for a calendar
  • Ability to customize the background color of each widget

Minor Bug Fixes

The Promo Codes

METL6KNXW6TL
TWFHLKT7RYWK
J6JXJ7JPNJRN
XLP9FF9RAEA9
L74ATPTYXJ4F
A6KJPTLWE97P
HNWP6L7F6JW9
XEHNFKJPMR6Y
MFH3MNHKXF3A
FENRH4M9PAEA

Please leave a 5 star review :)

Download It Here

Free App Idea: Drop Tunes

Perhaps this already exists, if so, please link me to it.

The idea
Drop music into your Dropbox folder on your computer. Then open up the app which presents you with an iPod like interface for this music.

The genius
What’s great about it is, you have all of you music on your iPhone without using up disk space. Of course you may need to upgrade your Dropbox account to something greater than 2GBs to see any real value.

Smart Lockscreen Creator Released + Promo Codes

My latest iOS app, Smart Lockscreen Creator has just released on iPhone for $.99.

Download It Here

The Idea

Currently your lockscreen on your iOS device is nothing more than a pretty watch with a background. Jailbreakers have solved this issue with an incredible application called intelliscreen, which adds lots of interesting information to it. However, you and I are Apple fanboys and won’t violate our precious iPhones with jailbreaking. Enter Smart Lockscreen Creator.

Smart Lockscreen Creator allows you to build a completely custom (and smart) lockscreen image within the application. You then set this image as your lockscreen background. The following items are currently supported by the app.

  • Current weather, condition, high and low for any city/region in the World
  • Weekly forecast for any city/region in the World
  • Monthly calendar
  • Custom text
  • Blank space (useful when customizing the look of your lockscreen)
  • Line separator
  • Many more in the works!

Here are some promo codes. If you fail to grab one and have some interest in reviewing the app on your site, I would be happy to email you one.

FMP9LRW4FP99
MH7XHH3FLH4P
JH9E47JXP9KA
RYRAPRARPAJ3
4FKKW6LN7W9J
If you have any suggestion for lockscreen “widgets”, don’t hesitate to post them here.
Please give some review love as well 😉

Albuquerque Marathon Training

Well, I have finally decided to put my money where my mouth is when it comes to fitness and train up for a half marathon! The marathon I’m training for is the Albuquerque Half Marathon on Saturday, April 16th at 8 am (that logo is such an eyesore).

Two months seems like a relatively short time to prepare, especially for my first “real” run, however I am just aiming to finish rather than being competitive. Right now, I am running about 3-4 miles per day with a longer day of ~5 miles. As the weeks pass, I intend on upping that to ~5 miles/day with a longer run at about 10 miles.

If any of you are training for something similar, I would love any advice, feedback, criticism, encouragement, stories, etc… that you have. Just post em in the comments.

Also, for those of you who are on nike+, please befriend me. My username is (you guessed it) brandontreb.

I’m very excited about this goal and will be blogging along the way (amidst my other coding related posts of course).

It’s a long road ahead 😉

Tweet Press 3.2 Update – Sidebar Widget

I have recently had an overwhelming number of requests for a sidebar widget that displays your recent Tweetpress photos. Well, it’s finally here! The update was actually quite trivial to make. If I had known how simple it would be, I would have made it months ago.

Make sure you update to the latest version: tweetpress 3.2

How to use it
In the WordPress admin, click on Appearance and the Widgets from the sidebar menu. If your theme supports widgets (which is should), you will see a Tweetpress widget in the available widgets list.

Next drag that widget into the sidebar area and modify the settings.

You can configure the title of the widget as well as the number of photos to be displayed. Please comment here or shoot me an email if you experience any issues with it. I’m also open to suggestions.

It’s Elementary My Dear Watson

IBM's Watson on Jeopardy

Last night marked the beginning of the IBM Jeopardy challenge. For those of you who don’t know, IBM has been working for some time on a system (named Watson) that has overcome some amazing challenges. The goal: to build an entirely self-contained system that can beat the World’s best Jeopardy players.

Now, I’m not going to give you a rundown on it as I’m sure that you can (or have already) read it on a website far more popular than mine. I just wanted to publicly geek out for a second…

I was watching the episode of Jeopardy with my wife, and at first glance she was like “duh, of course a computer could win at Jeopardy”. This made me realize that to a non engineer, this seems like a trivial task since computers are magical Facebook boxes.

Now me on the other hand, I was giddy to the point of almost wetting myself. Seeing how far we have come in AI development and language processing is absolutely incredible.

I for one, will be glued to my tv tonight to watch Watson’s next round of Jeopardy.

Case Of The Mondays

Mondays…

The other day, I was faced with an interesting programming challenge and wanted to share my solution. I just submitted a pretty interesting app to the app store that does a number of things (more details soon). Among those things is the ability to generate a calendar.

The Problem

Generating the calendar was the easy part, however when displayed, I wanted it to highlight every Monday of the month. This turned out to be a bit trickier than I imagined.

Really the main challenge here was to determine which day contained the first Monday of the month. After that, we just loop incrementing by 7 and are done.

Looking At The Date Helpers

Looking at what I had to work with in NSDate, NSCalendar, and NSDateComponents, I really found only 2 things that could help me. From NSDateComponents, I could figure out the current day (numeric) and the current day of the week (numeric). Knowing this information was very important.

The Solution

Having the current day and day of the week allowed me to find the date of the Monday on the current week. This was the first challenge as demonstrated below. Assume weekdayComponents is the NSDateComponents generated from the current date.

<code class=’objc’>NSInteger weekday = [weekdayComponents weekday];
NSInteger day         = [weekdayComponents day];

// First, find how many days we are from Monday
int daysAwayFromMonday = weekday - 2;

// Now resolve the monday of this week
int mondayThisWeek = day - daysAwayFromMonday;

// Check if monday this week falls in last month
if(mondayThisWeek <= 0) {
    mondayThisWeek = day + (7 - daysAwayFromMonday);
}</code>

mondayThisWeek will now contain the day number of the Monday of the current week. If that Monday falls on the previous month, mondayThisWeek will be negative. Line 12 resolves that by carrying it into next week.

Finally, we just loop subtracting 7 from that Monday until mondayThisWeek is less than 7 to get the first Monday of the month.

<code class=’objc’>while(mondayThisWeek > 7) {
    mondayThisWeek -= 7;
}</code>

And there you have it. mondayThisWeek (improperly named at this point) will contain the day number of the first Monday for the current month.

So, this was quite a round-a-bout way to find this value. If you have a better solution, please feel free to trash on mine in the comments 😉 .

Farewell (For Now) iDevBlogADay

Hey guys,

I wanted to thank everyone for letting me be a part of the iDevBlogADay community. You guys have been super supportive and I really appreciate all of the commenting, retweeting, and upvoting of my iDevBlogADay articles.

I have found myself in a position with life (work + family) where I may no longer be able to consistently write a post per week. So, after 2 months of writing, it is time for me to pass the torch to the next blogger on the list.

I will still continue to blog (and continue my Twitter For Mac Series), so I really encourage you to subscribe to my RSS feed (or Twitter feed).

Thanks again and Happy Coding!

AppBlogger: A Tool For iOS App Developers And Bloggers

Imagine that you have just found the coolest app in the world and just can’t wait to tell all of your followers about it. So, you head to the admin panel of your blogging engine (hopefully WordPress) and begin to write your review. Now, you want to insert some screenshots, icons, descriptions, app store links, etc… So, what do you do? You head on over to Bing and type in google.com. Next, you search your app name and hopefully find the iTunes URL so that you can slowly grab some information about the app. #Fail

Dum duh dum duh (trumpet noises)!

Enter AppBlogger. AppBlogger is a little tool that I have been working on that uses “Instant Search” technology (jquery fanciness) to allow you to instantly search the app store and quickly get the information you need.

How Does It Work? (you say)

As you start typing, AppBlogger makes an asynchronous request to the iTunes web service and pulls a list of applications that match your search terms. This list is presented as a bunch of icons. You will then click on one of these icons to pull of the details page of that application.

The details page (see above screenshot) then contains everything you need to write a stellar blog post about that application. It provides text fields (for easy copy and paste) with icon URLs, download URL, and screenshot URLs.

I have some plans to integrate this in the near future with my Link Share tool to auto generate shortened URLs that contain your affiliate code (so you can make $). If you have any other suggestions for it, I would love to hear them.

I know many of you are heartbroken and were expecting the next iteration of my Twitter Client For Mac series. I want you to know, you are not forgotten and I will continue the series next Thursday. So Stay Tuned!

Check out AppBlogger!

This post is part of iDevBlogADay, a group of indie iOS development blogs featuring two posts per day. You can keep up with iDevBlogADay through the web site, RSS feed, or Twitter.

Image Manipulation: Retrieving And Updating Pixel Values For A UIImage

Grayscale Jobs

With the recent success of cool photo manipulation apps such as Camera+ and Instagram, it got me wondering. How do these photo apps modify the pixel data of the image.

After doing a bit of research on the subject, I found countless posts on Stack Overflow and the Developer forums about various methods to get and set the pixel values of a UIImage. Most of them unanswered or partially answered. I tested out many solutions and banged my head on my computer into the whee hours of the morning with no success. Every solution I tried seemed to completely destroy the image.

It wasn’t until this morning, I had an “aha” moment, changed one line of code and was able to produce a grayscale version of a UIImage.

Having the ability to get and set pixel values of a UIImage is super important if you want to create a photo related app that has “Filters”. Once you know the basics, you can apply your ninja math skillz to implement cool filter algorithms on the pixels. Below, I will show you onc such algorithm for converting an image to grayscale (it’s not that clever).

I should note, that a good majority of my code comes from Olie’s solution on this Stack Overflow post. His example simply returns and array of UIColor objects for a given image. Mine will modify those colors and write them back to a UIImage.

Converting A UIImage Into A Pixel Array

Here is the first part of our grayscale method. It is creating a char array from a global UIImage property named workingImage.

<code class=’objc’>- (IBAction) grayscale:(id) sender {
    CGContextRef ctx;
    CGImageRef imageRef = [self.workingImage CGImage];
    NSUInteger width = CGImageGetWidth(imageRef);
    NSUInteger height = CGImageGetHeight(imageRef);
    CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
    unsigned char *rawData = malloc(height * width * 4);
    NSUInteger bytesPerPixel = 4;
    NSUInteger bytesPerRow = bytesPerPixel * width;
    NSUInteger bitsPerComponent = 8;
    CGContextRef context = CGBitmapContextCreate(rawData, width, height,
    bitsPerComponent, bytesPerRow, colorSpace,
    kCGImageAlphaPremultipliedLast | kCGBitmapByteOrder32Big);
    CGColorSpaceRelease(colorSpace);

    CGContextDrawImage(context, CGRectMake(0, 0, width, height), imageRef);
    CGContextRelease(context);
    .
    .
    .</code>

This is a lot of Core Graphics fanciness that isn’t super important to understand. It’s just getting the RGBA values from the image and writing them into the rawData char array. There are 4 bytes per pixel (red, green, blue, alpha), so this array contains 4 * height * width elements.

Modifying The Pixels of a UIImage

Here is where the magic happens. You can replace this code with the logic necessary to apply the filter you are making. Another clever way to approach this would be to pass this code in as a block into the method (I’ll leave that as an exercise for the reader :)).

<code class=’objc’>.
.
.
    int byteIndex = 0;
    for (int ii = 0 ; ii < width * height ; ++ii)
    {
    int outputColor = (rawData[byteIndex] + rawData[byteIndex+1] +
        rawData[byteIndex+2]) / 3;

    rawData[byteIndex] = (char) (outputColor);
    rawData[byteIndex+1] = (char) (outputColor);
    rawData[byteIndex+2] = (char) (outputColor);

        byteIndex += 4;
    }

.
.
.</code>

The first part is pretty straight forward, we have a for loop that goes from 0 to width * height. We index into the rawData array using a counter that we increment by 4 each time (remember 4 bytes per pixel). As you can imagine, the first pixel (rawData[byteIndex]) represents the red pixel, then green for +1, blue for +2, and finally alpha for +3. Note that the alpha byte is last because kCGImageAlphaPremultipliedLast flag above.

In order to do grayscale, we simple set all of the color values to the average color value. So, for example the color [218,232,244] (which is the light blue color of the WordPress editor’s toolbar) would be converted to [231,231,231] which is a fairly light gray color.

The most important step that everyone in the forums seemed to miss was casting the new value to a char. Remember we are using a char array, setting ints as values will generally screw up your image. (This was my “aha” moment that I mentioned above)

Writing The Pixels Back To a UIImage

The final step is to write the pixel data back to a UIImage. Again, I borrowed some of this code from somewhere else and unfortunately lost the link. If I find it, I will update the post.

<code class=’objc’>.
.
.
    ctx = CGBitmapContextCreate(rawData,
        CGImageGetWidth( imageRef ),
        CGImageGetHeight( imageRef ),
        8,
        CGImageGetBytesPerRow( imageRef ),
        CGImageGetColorSpace( imageRef ),
        kCGImageAlphaPremultipliedLast ); 

    imageRef = CGBitmapContextCreateImage (ctx);
    UIImage* rawImage = [UIImage imageWithCGImage:imageRef];  

    CGContextRelease(ctx);  

    self.workingImage = rawImage;  

    free(rawData);
}</code>

All we are doing here is creating a new Bitmap Context, writing it to our CGImageRef and constructing a new UIImage from that CGImageRef. Finally, we just update our workingImage with the modified one. Fancy, I know…

Now, much of this code is to work with my example (download below), but it could easily be tweaked to fit within your super awesome photo app. If you have any questions or comments PLEASE leave them here or send them to me on Twitter (but probably leave them here 😉 ).

Download The Sample Source Project

  • Note on the sample code: Before you give me crap about doing this in the main thread, I know. Don’t do these operation on the main thread. The example is meant to be quick and dirty and by no means is ready for production. Enjoy!

This post is part of iDevBlogADay, a group of indie iOS development blogs featuring two posts per day. You can keep up with iDevBlogADay through the web site, RSS feed, or Twitter.

[Pi]mp Wallpaper

Found on Reddit

What Does Your Workspace Look Like?

I am always very fascinated with the workspaces of others and frequently check out Lifehacker’s posts on their featured workspaces. So, for this iDevBlogADay post, I thought I would keep it short and simple with a request. I want to see (and I’m sure others do too) photos of YOUR workspaces (especially those of you with standing desks).

Seeing someone’s work area is especially inspring to me, I love seeing where others create and what they surround themselves with for inspiration and motivation.

So, I’ll start by sharing a photo of my current workspace. This is where the magic happens…

Within my workspace, you will find:

  • Macbook Pro
  • 24” Apple LED Display
  • iPad with Kensington Keyboard Case
  • Logitec Speakers
  • “Just Like Jesus” Daily Devotional
  • Embark (Target Brand) Fitness Ball
  • Apple wireless keyboard and Magic Mouse
  • Bonsai Tree (coming soon :) )

So there you have, this is my workspace. Please post a link to your workspace photos or email them to brandontreb [at] gmail [dot] com and I will append them to this post. I can’t wait!

Update: Here are some workspaces submitted by readers so far:

Submitted by Roaming Gamer

Submitted by Wayne D

Submitted by dwsjoquist

Submitted by zzelladonatella

Submitted by beninati

This post is part of iDevBlogADay, a group of indie iOS development blogs featuring two posts per day. You can keep up with iDevBlogADay through the web site, RSS feed, or Twitter.

Free App Per Day Service

As many of you may know, I created a site called Fresh Apps. This site started as sort of a Digg for developer submitted iPhone apps. Since then, we have added plenty of new features and have grown a community of over 10,000 iPhone users.

Recently, I have noticed a few services sprout up that basically have a schedule of apps that shift from paid to free for a given day. The most notable being Free App A Day.

After doing some research, sites such as these are charging a significant amount of money (I have heard up to $10,000) for a 1 day feature.

So, I was curious, given our user base, what do you (fellow iOS) developers think of FreshApps offering a similar service? If we did offer a similar service, here are some questions I have (and would love your feedback).

  1. How would you change existing services? What new features would you like to see? what features are worthless?
  2. How much would you pay for such a feature?
  3. Would you be interested in having your app featured the first month for a minimal cost ($1 or so)?
  4. Would you use an iPhone app that lists the upcoming paid to free apps?

Thank you all so much for your feedback. I’m just in the brainstorming time of this, but I will totally keep you up to date if anything comes of it.

New Year, New Blog Theme

I seem to change my WordPress theme more often than I change my socks. I just tend to get very bored with my blog aesthetics. Not to mention, I will always find someone out there with a cooler blog theme than mine.

After setting up a blog site for the pastor of my church (http://brownbishop.com), I fell in love with the Standard WordPress Theme. Not only is the theme absolutely beautiful out of the box, it’s also a theme framework giving you TONS of configuration options including custom layouts, social network integration, and analytics integration. I have seen quite a few amazing blogs built on top of the Standard Theme framework that all look incredible but completely different.

So, I urge you to check it out, It’s kind of pricey ($50), but well worth worth it in my opinion.

Cloud Storage Wallpaper

Source: http://simpledesktops.com/

This is my current desktop image. I thought is was pretty sweet so I’ll share it with you all.

Merry Christmas!

Changing Your Life In 2011

For this blog post, I decided to take a small break from my Twitter Client for Mac tutorial series and discuss something a little more useful 😉 . I felt that a fitness post would be most appropriate around this time of year as all of our “Geek Guts” begin expanding.

My Fitness Story

It’s December 23rd and as we gear up for Christmas, we are also compiling our New Year’s resolutions. And I’m sure that on most people’s (especially us computer geeks) lists is something related to weight and a healthy lifestyle. So, I wanted to discuss a little bit about how I made fitness a priority in 2010 and how you can too in 2011.

I began my fitness journey at the beginning of 2010 where I weighed in at 185 lbs and had 19% body fat. Now, I am in not way saying that I was a thick dude. I have been blessed with a stellar metabolism, but I definitely didn’t look “in shape”. More importantly I didn’t have a clue about living a healthy life style. Being a geek, I sat for hours at my desk every day, eating quick foods and drinking soda.

One night, I saw a commercial for the fitness program P90X and was actually very intrigued. Don’t worry, I’m not including any affiliate links or things of that sort, so please don’t think I’m trying to sell you on something. Needless to say, I went on YouTube to find out just how legit this program was. After some browsing, I was quite impressed and inspired. It seemed that after 3 short months (seriously no time), people had changed their entire life around in terms of health and fitness.

So, I did what any geek would do and took a visit to the Bay and acquired a copy from some Pirates. After checking out the program for a week or so, I was hooked and decided to go legit and purchase a copy. Within 3 months, I began to absolutely LOVE exercising, in fact I became a little addicted to it :/ . I learned how to track what foods I was intaking as well as replaced much of the crappy liquids I was drinking with water.

After completion of the program, I was down to 163lbs with a 12% body fat and have been exercising since. I’m not posting photos because I feel that would be in bad taste. Check out others on YouTube.

Getting Started

Now, this is a really lengthy intro (kind of sounds spammy too, sorry), but the point is, it’s not hard to get into a healthy routine. I have talked to tons of people about my “transformation” (I hate this term), and almost every person asks me how I got started. Everyone either feels that it’s too late for them, or they will start ‘tomorrow’. So, here is a formula for you lazy geeks (I can call you that because that’s what I was last year :))

  1. Grab a copy of P90X. Again, I’m not a P90X salesmen, Pirate a copy if you have to. Just get one! If you want to buy it, it’s about the cost of 3 months of the gym, which coincidentally is the length of the program (90 days) $120
  2. Buy a resistance band – These are everywhere (target, walmart, big 5, etc…) – $20
  3. Buy a pull-up bar – $30
  4. Quit stalling – Start this Monday and let me know how it goes :)

Now, this is just the beginning. The biggest problem with diets/fitness programs/etc is people don’t look at them as a lifestyle change, they see them as temporary. People say crap like “I want to be XYZlbs or fit into a size J”. Don’t do that! Sure these are nice goals to have, but DONT MAKE THEM THE REASON YOU EXERCISE AND EAT HEALTHY. If you do, you are just setting yourself up to fail. Exercise and don’t eat crap because you want to be healthy. Do it because you are sick of being tired and lethargic all the time.

I don’t have time to exercise

Of course you would say that… I did too. That’s why I love P90X. It’s only 1 hour a day and within that hour, you are told exactly what to do. I always felt that to exercise, I had to spend hours in the gym, running, lifting, blah blah… No, one hour a day. I spend that reading Reddit. Get up an hour earlier, go to bed an hour later. Stop eating on your lunch break and exercise then. You can always eat at your desk when you get back.

Staying Motivated

So, you have decided that 2011 is going to be your year; you are going to get in shape. Here are a few tips to help you stay motivated.

  1. Learn, learn, learn – Just as you spend time learning about new programming languages, or reading about yet another tablet device. Learn about new things to eat, new exercises to try, new goals. Whatever, just maintain the excitement by learning new things.
  2. Get others involved – This generally comes naturally. When others see you getting into shape, they will most likely want to join. This can be a great motivator, especially when you are feeling burnt out. Get a workout buddy to go to the gym, run, do P90x, etc… with.
  3. Find healthy things to consume that don’t suck – This is a huge challenge for people starting out. They think that they have to eat celery and chicken breasts all day. This is one thing I love about p90x. It comes with an incredibly (and delicious) diet plan including recipes. In a future post, I’m going to write about a stellar protein smoothie that I have every day.
  4. Get the crap out of your house – I’m serious, you won’t miss it. Cookies, Soda, Doughnuts, whatever…
  5. If you want soda, drink a soda – A can of soda is roughly 120 calories, this isn’t terrible. But don’t make it a habbit. Limit yourself and throw away your effin Big Gulp cup!
  6. Eat before you leave your house – this is huge. If you are hungry and you are out, what do you do? You go scoop up a McFeeces from McDonalds… Instead, eat some lunch meat or whatever before you go run those errands.
  7. Eat frequently with smaller portions – I told my dad that I eat about 5-7 times a day, and he responded with “you’re going to get fat doing that” Contrary to popular belief, it is far better for you to eat more frequent, smaller meals. This is tricky when you spend the day in the office. You have to somewhat plan your day in terms of food. Bring stuff to snack on such as nuts, popcorn, protein bars, and beef jerkey.
  8. Share your success – Blog, Tweet, Facebook, Youtube. Whatever it is, tell people about it. Others will surely praise you for this, and you will most likely motivate them. Plus, it will hold you accountable.
  9. Get a good water bottle and take it everywhere – Water is a tricky thing. It’s so hard to remember to drink enough. I have found that if I have water in front of me, I will always sip on it, especially when I’m sitting at my desk all day.

To wrap this up, I’m not trying to sell you on P90X or any other fitness program. I just feel that it will be a killer start and give you all of the tools needed to launch into a healthier, more fit 2011. Also, you will start seeing results very quickly.

Conclusion and Resources

I hope you have enjoyed this post and I would LOVE to answer questions as well as point to more resources. I have linked all of the referenced resources below for you to check out.

This post is part of iDevBlogADay, a group of indie iOS development blogs featuring two posts per day. You can keep up with iDevBlogADay through the web site, RSS feed, or Twitter.

Does He Have A Memory Leak?

My wife has this interesting problem of having vivid dreams about whatever she was last watching/discussing before bed. Last night, I was explaining to her all about memory leaks as I had a discussion with a coworker earlier in the day about them. She was curious, so I gave her a very simple explanation in which she could understand.

Later in the night (about 3 am), my son woke up screaming. He must have had a bad dream or something; so, I went in there, put him down and went back to bed. My wife rolls over, looks me straight in the eye and says in a groggy voice “Does he have a memory leak?”

I laughed so hard it woke her up. I then appropriately responded with “I have to go take a memory leak”.

Pocket MUD Update Approved

Wow, in record time (2 business days!), Apple approved the update to my iPhone app Pocket Mud. For those of you who don’t know, Pocket MUD is my FREE MUD client for the iPhone.

Here is whats included in the update:

  • Added support for Landscape!
  • Auto-reconnect on reopen
  • Multiple actions for triggers (just separate the actions with commas)
  • Added ability to play sounds when a trigger fires (please send sound suggestions to brandontreb@gmail.com)

The app is free, so please check it out and leave some (positive) feedback! :)

Download on iTunes

Advertising Now Available

Current Public Site Stats

I am now offering advertising in the sidebar for the killer price of $10. I felt that the Google Adsense ads looked super spammy and this is a much cleaner way to handle things.

So please give me a hand with these server costs, show off your sweet apps/site, and purchase an ad on the blog.

Either click the Advertise Here button on the side or click this link http://bit.ly/gMYepc

Thank you so much for your support!

That’s It! I Quit Programming.

Because I could never make something this cool/impressive:

YouTube – Introducing Word Lens.

Link: Minecraft Like Rendering Experiments in OpenGL 4 – Codeflow

I found this article while browsing reddit and was blown away. I have been a little mystified at the potential algorithms used by notch to render the terrain in Minecraft.

This provides a killer explanation of some interesting algorithms that can be used to generate such worlds. It also contains the source code that you can download and play with.

Minecraft Like Rendering Experiments in OpenGL 4 – Codeflow.

Creating A Twitter Client For OSX – Part 1

With the upcoming release of the Mac App Store, I can only imagine another gold rush is upon us. Clever Indie developers making money hand over fist while the store as well as developers find their identities. With that being said, I feel that there is a serious lack of interesting (maintained) Twitter clients for OSX. I say “maintained” because Tweetie for OSX is just fantastic, however Twitter said they don’t have any plans for it at this time. So, I want to provide devs with the tools to create an amazing Twitter client for the Mac that I will want to use :)

Quite some time ago, I began (and never completed) a series on writing a Twitter client for OSX. It was very well received by the development community, however once Twitter switched over to OAUTH, I became too lazy to update it :( . So, I figured a tutorial series for #iDevBlogADay would be the perfect opportunity to complete it.

So we are going to start from the ground up. In today’s tutorial, we are going walk through getting the initial resources and setting up Twitter to authenticate our application. We will also post a basic tweet.

Setting Up Twitter

In order for your application to interface with Twitter, you must register it with them over at http://developer.twitter.com.

  1. Go to http://developer.twitter.com and sign up if needed
  2. Click on Your Apps
  3. Click Register A New App and fill out all of the information about your client
  4. You’re all set!

Getting Necessary Resources

I spent a bit of time researching the various options for handling OAUTH and all of the fun stuff that goes along with Twitter integration and found that MGTwitterEngine was the least painful to implement. I say least painful because it has a few quirks of it’s own along with not having the best documentation in the world.

So after battling for a bit to get the thing compiled, I have figured out the setup process :). You could also read Matt’s installation instructions, but I will regurgitate them here a little differently and hopefully be more clear. So here it is:

  1. Make sure you have git installed. If not, download it for OSX here.
  2. cd to the directory that you want to clone the files to
  3. Clone the MGTwitterEngine repository. Type:
    $ git clone git://github.com/mattgemmell/MGTwitterEngine.git
  4. cd into the MGTwitterEngine folder (we will install the dependancies at this level)
  5. Now install the dependancies (TouchJSON and OAUTHConsumer). Note: There is an option to use yajl (yet another json library), but I found it a pain to integrate, so we will just throw it out.
    $ git clone git://github.com/schwa/TouchJSON.git
    $ git clone git://github.com/ctshryock/oauthconsumer.git

Altogether, this is the order of commands you should have:

<code class=’bash’>$ cd ~/Desktop
$ git clone git://github.com/mattgemmell/MGTwitterEngine.git
$ cd MGTwitterEngine
$ git clone git://github.com/schwa/TouchJSON.git
$ git clone git://github.com/ctshryock/oauthconsumer.git</code>

Building MGTwitterEngine (What a freakin pain)

I find it interesting that this project is riddled with errors directly upon download. So much work went into it, yet it’s so challenging to get working.

Now open up MGTwitterEngine.xcodeproj. You will notice that there are quite a few missing files (they show in red). That’s fine. DELETE THEM ALL…

  1. Delete the yajl group with everything in it
  2. Delete the Twitter YAJL Parsers group and everything in it
  3. Delete OAToken_KeychainExtensions.m and OAToken_KeychainExtensions.h (they are not used)
  4. Delete CJSONDataSerializer.h and CJSONDataSerializer.m
  5. Delete CSerializedJSONData.h and CSerializedJSONData.m
  6. Click the arrow on the OAuthConsumer group and you will notice that the Crypto is missing. We still need this group, but it’s in the wrong place. Delete this group and then open up your MGTwitterEngine folder in Finder. Navigate to MGTwitterEngine->oauthconsumer. Drag the Crypto folder into your project.
  7. We need to change the C Language Dialect to C99. To do this right click on MGTwitterEngine in XCode and click Get Info. Scroll down to C Language Dialect and click the drop down changing it to C99
  8. Finally, we need to tell MGTwitterEngine that we want to use TouchJSON instead of yajl. To do this open up MGTwitterEngineGlobalHeader.h and set TOUCHJSON_AVAILABLE to 1.
  9. If you still have any hair left at this point, click Build and Run to and check out the output in the Console
  10. If you don’t feel like jumping through all of these hoops you can download my MGTwitterEngine project with all of this fun stuff completed. Download it here.

Testing MGTwitterEngine

For today’s tutorial, we will just be displaying our timeline and updating our status using the demo file provided by MGTwitterEngine. In the next tutorial, we will actually be integrating the engine into a new project. So, open up AppController.m in the Demo group. Matt has given us some nice variables to fill in, in order to make this thing work. Let’s update to applicationDidFinishLaunching method to look like the code below:

<code class=’objc’>- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
        // Put your Twitter username and password here:
        NSString *username = @"brandontreb";
    NSString *consumerKey = @"aKKEsJHTDNsv4xVlMHmMqw";
    NSString *consumerSecret = @"oldpeoplenakedcriscotwister";

        // Create a TwitterEngine and set our login details.
        twitterEngine = [[MGTwitterEngine alloc] initWithDelegate:self];
    [twitterEngine setUsesSecureConnection:NO];
    [twitterEngine setConsumerKey:consumerKey secret:consumerSecret];
    [twitterEngine setUsername:username];

    token = [[OAToken alloc] initWithKey:@"16369316-GgqA00WO0poCAj0XAFhJYDDRthVvWMxTnVyKdfWa1"
                                  secret:@"StrongEnoughForAManButMadeForAWoman"];
    [twitterEngine setAccessToken:token];
    [twitterEngine getHomeTimelineSinceID:0 startingAtPage:0 count:20];
}</code>

So obviously I changed my consumer secret and Access Token Secret. You will need to fill this out with your information. Here is how to obtain them.

Consumer Key & Consumer Secret

When logged into http://developer.twitter.com/apps/ , click on the application that you created in the first step:

Scroll down and you should see the Consumer Key and the Consumer Secret.

Access Token & Access Token Secret

In the right column, you should see a link titled “My Access Token”. Click on it.

Now you should see YOUR Access Token and Access Token Secret

Have Fun!

After you copy the tokens, keys, and secrets into the app, you should be able start making calls to Twitter using the engine. Build and run the application at this point and watch your home timeline get output to the console. One thing I want to point out is we are displaying an NSDictionary. That means MGTwitterEngine did all of the parsing for us (using TouchJSON), which is super rad.

One more thing to try for fun is to update your status. It will even show that you updated it from YOUR application on Twitter. Add the following line and run it again.

<code class=’objc’>[twitterEngine sendUpdate:@"@brandontreb is a code gangster!  Check out his #iDevBlogADay post on making your own Twitter client here http://bit.ly/gGrZvI"];</code>

Well, that does it for today. Join me next week when I will show you how to move the engine into your own project and we will begin displaying tweets in a basic table view.

Happy Coding!

Click Here To Go To Part 2

—-

</p>

This post is part of iDevBlogADay, a group of indie iOS development blogs featuring two posts per day. You can keep up with iDevBlogADay through the web site, RSS feed, or Twitter.

</p>



</p>

Promoting Your Other Apps Within Your Apps

First off, Happy Thanksgiving to my American readers. And a happy Thursday to everyone else. I’m sitting here on Thursday morning drinking coffee and eating Sticky Buns (kind of like gooey doughnuts). It’s been a hectic week of family and travel, so please forgive me if this is not the most verbose post.

Showing your other applications within each of your applications (wow, the word application is starting to lose meaning) can have a tremendous impact on your sales. It’s a great way to promote your other apps for free and will give them much more exposure across a wider audience. Moving all of the promotion logic out to the web allows you to dynamically add and remove apps from the view without updating your apps in the store.

[Insert Cool Graph Backing This Statement Up Here] //I’m not that cool yet :(

We have seen this in many popular apps. Here is a screenshot from an iDevBlogADay veteran Owen Goss promoting his other applications from inside of LandFormer.

We are going to learn how to make something similar and I will provide you with a web template as well as the view controller to load it.

Download The Template

So, I’m sure there are a million more “elegant” ways to display your apps, but I went for super simple. So, 1337 web dev idevblogadayers, please go easy on me in the comments. Download the code below and look in the Web folder.

Download The Code Files Here

Here is a screenshot of what the template will look like:

It will also work in portrait mode.

Upload The Template Files To Your Web Server And Replace My Sample Data

If you have your own website (which you probably should 😉 ), upload the template files to a subdirectory. If not, or you don’t want to waste bandwidth on it, you can always host the files on Dropbox.

Next, upload your icons (the template auto rounds the corners so you can just use the one’s bundled with your app) and replace my sample images with yours.

Finally, replace the URL’s with the URLs to your applications. You can also add/remove table cells to match the number of applications you are promoting.

Add The Promotion Code To Your iPhone App

Look in the iPhone folder from the unzipped file you downloaded above and copy the following 3 files into your project:

  • PromotionViewController.m
  • PromotionViewController.h
  • PromotionViewController.xib

Check the box to copy them into your project folder when prompted.

We will now take a look at how to display the promotion view when a button is clicked.

<code class=’objc’>- (IBAction) moreAppsTouched:(id) sender {
    PromotionViewController *controller = [[PromotionViewController alloc]
        initWithNibName:@"PromotionViewController"
        bundle:[NSBundle mainBundle]];
    controller.promotionAddress = @"http://brandontreb.com/apps/idevblogaday/promotion.html";
    [self presentModalViewController:controller animated:YES];
    [controller release];
}</code>

Make sure you set controller.promotionAddress to the web address of your promotion.html file.

And there you have it! When the user tapps on a button it will display our promotion view modally and will load up your promo page. I have provided a sample application that pulls up the promotion view when a button has been clicked.

Download The Sample App Here

If you have any questions or comments, feel free to leave them in the comments.

Happy Coding!

—-

</p>

This post is part of iDevBlogADay, a group of indie iOS development blogs featuring two posts per day. You can keep up with iDevBlogADay through the web site, RSS feed, or Twitter.

</p>



</p>

XCode Tips And Shortcuts To Improve Your Workflow

Intro

This is my first #iDevBlogADay post and I wanted to give a quick intro before jumping in. My name is Brandon Trebitowski and I’m a software developer and author from Albuquerque, New Mexico. I graduated from the University of New Mexico in 2008 with a bachelors degree in computer science. For the past 2 years, I have been writing mobile applications (primarily for the iPhone) for ELC Technologies.

I also started http://icodeblog.com and currently write on it about once a month.

A Post On XCode Shortcuts?

Well, I’m sure by now, you have seen countless infographics and “cheat sheets” chock full of XCode shortcuts, tips, etc… These can be great resources, however, if you are anything like me, you see these, tweet the link, and move on never looking at them again. The only difference between these and the XCode key-bindings menu IMHO is a fancy background. So, I thought I would share some of the most important shortcuts that I have adopted to really improve my workflow. We spend so much time inside of XCode, it is worth the time to learn some of these.

Build Commands

By now, I would hope that you don’t click the “Build and Go/Debug” with your mouse whenever you want to run your application. If you do, no worries, here are some of the build quick keys.

**⌘ return – **This builds and launches the application in debug mode.
**shift ⌘ return **– Kills the running application in the simulator.
**shift ⌘ k – **Cleans the build target.
**shift ⌘ a – **Build and Analyze. This is quite possible the most important command to learn. This invokes the static analyzer to help spot memory issues in your code. Run this as early and often as possible.

My general workflow after writing a bit of code is to kill the last run, clean, analyze (hopefully not spend time on memory issues), and then build and debug. These 4 commands in sequence are much faster than searching out the menu items for each of those commands.

File Management and Navigation

Navigating around files is one of the most common tasks you will perform in XCode. It is really to your advantage to speed things up.

option ⌘ ↑ – This quickly switches between your .h and .m file.
**⌘ ↑ – **Move to the top of the file
**⌘ ↓ – **Move to the bottom of the file
**shift ⌘ d – **This was recently showed to my by @cruffenach and it has drastically sped up my workflow. This is the command for “Open Quickly”. It brings up a small window with a search box at the top. Typing in the box instantly searches your project and allows you to quickly open up files by pressing return on the selected file. I can’t believe I had been using XCode for so long before I found out about this command.

Binding Your Own Quick Keys

Some commands simply don’t have quick keys. For example, I constantly use the Edit -> Sort -> By Name command to sort my source files alphabetically. By default, you must click through all of the menus and select the command to get it to work. However, XCode (like most OSX applications) will allow you to define your own quick keys and here’s how.

  1. Open up the XCode Preferences
  2. Click on the Key Bindings tab
  3. Navigate to the command that you want to bind keys for. (hint: they are organized the same way they in the top menu)
  4. Once you have found the command, double click in the Key column
  5. Press the keys that you wish to bind (I bound option shift ⌘ s for sorting)
  6. If there are any conflicts, XCode will let you know. Otherwise, press apply and you’re good to go.

Wrap Up

Well, this concludes my relatively short first post for #idevblogaday. If you have any shortcuts of your own that you can’t live without, please share them in the comments. I’m always up to improve my workflow.

Thank you to everyone (especially @mysterycoconut) for allowing me to be a part of this community and I look forward to sharing my knowledge and experiences with you.

Happy Coding!

—-

</p>

This post is part of iDevBlogADay, a group of indie iOS development blogs featuring two posts per day. You can keep up with iDevBlogADay through the web site, RSS feed, or Twitter.

</p>



</p>

Core Data QuickTip: Inverse Relationships

One thing I always wondered about Core Data is why the compiler would warn you if you didn’t specify the inverse relationship. After reading through Apple’s docs, they essentially say its to make your database more robust by reinforcing those relationships. Plus, you never know when you may have one thing and need to get to the other.

After working on a project with an Enormous Core Data database, I found one very useful thing about inverses. When you specify one side of the relationship, core data automatically hooks up the other. Allow me to explain in code.

Let’s say we have a person object with many pets…

<code class=’objc’>Person *john = [[Person alloc] init];
Pet *pet = [[Pet alloc] init];

// Add the one to many relationship from john to pets
[john addPetObject:pet];

// Add the inverse relationship
[pet setPerson:john];</code>

So, I was doing this in all of my code and then forgot to one time. However, to my surprise, everything still worked. Why, because once you set up one of the relationships, Core Data automatically handles the other. So, the above code is redundant and could just as easily have been.

<code class=’objc’>[john addPetObject:pet];</code>

OR

<code class=’objc’>[pet setPerson:john];</code>

and both directions of the relationship would have been established.

Not super exciting, but I found it to be pretty handy and also saved me quite a bit of extra code.

Happy Coding!

RE: Android Developer Income Report

This article was a very interesting with some insight into the Android Market. Basically, this indie Android developer has published 6 free applications and is making more than $1,000.00 per month off of advertisements.

None of my apps has been ever promoted in Top of Android Market

I am providing only free apps (mostly due of Android Market limitations)

Even if I would be able to sell apps I would not use it as main income source… (I believe that you still can make more from ads…)

via Android Developer Income Report.

I think there is an interesting experiment here. I am going to attempt this. Making super simple novelty apps (very low barrier to entry) that are free with ad support. I know this just further convolutes the crap that is the Android Market, but it would be fun to test.

If I actually end up doing this, I will publish some results here.

What not to do in life | TKs weblog

Here is a great article about some advice given to a 22 year old starting his life journey. These points are applicable to anyone, but found them especially applicable to software developers in general.

http://www.tawheedkader.com/2010/11/what-not-to-do-in-life/

Here are a few that I particularly enjoyed

Do not ever work

Picasso used to paint all the time, Henry Moore sculpt the whole day. Others would have thought they were working themselves to death. They actually were reenergizing and reinvigorating themselves. Do what you enjoy doing. Do not ever work.

Do not go into any competition

Quality has no competition. Only mediocrity has competition. If you do what you do at the highest quality you have no competition. Quality creates a moat around yourself.

What this says to me is “Love what you are doing, and don’t make crap!”. These are super wise points that we often overlook. Take for example the iTunes App Store. 300,000 apps where ~ 290,000 of them are total crap. People just writing apps for the sake of making money and not truly enjoying what they are doing.

If you are competing on crap, you are always going to lose.

Tweetpress Plugin Updated

I have just posted an update to my plugin Tweetpress! In case you don’t know, Tweetpress is a plugin I created that allows you to post images to your WordPress blog from mobile Twitter clients instead of a 3rd party service like Twitpic. Here is what’s new in this version.

  • Revert back to WordPress login by default
  • Custom CSS
  • Updated so that the thumbs don’t get a size of 0px when used with SEO images plugin
  • Bug fixes
  • Revert back to WordPress login by default* Custom CSS* Updated so that the thumbs don’t get a size of 0px when used with SEO images plugin* Bug fixes
This update really focused on authentication, I have also updated the about pages for installing the plugin as well as configuring your Twitter client. Here are the important links.
Download Tweetpress from WordPress.org
Tweetpress setup
Twittelator setup
Twitter for iPhone setup

Ludum Dare Competition: Week 2 Update

So another week has gone by and I have made quite a bit of progress, here are the additions since I last posted.

  • Texturing
  • Lighting
  • Skybox
  • Better Terrain generation
  • Environment Fog
  • Basic navigation

So judging by the screenshot, you might really be thinking that I’m working on Minecraft for the iPhone (I used textures that someone created for Minecraft). While this isn’t my intention, it is starting to look like my engine would be perfect for a simple port. Perhaps, I may consider creating something inspired by Minecraft in the future. For now, I will be sticking to my current game idea which I call Cube Hive.

As I continue to update this blog, the game idea will become more and more apparent but basically I want to create a game similar to this on the iPhone in a cube environment.

Anyway, here is a screenshot of where I’m at:

Oh, and BTW doing Fog in OpenGL ES is crazy easy. Here is the code (thanks to Mike Daley of 71 Squared for showing me this)

<code class=’objc’>GLfloat fogColor[] = {1.0f, 1.0f, 1.0f, 1.0f};
    glFogf(GL_FOG_MODE, GL_LINEAR);
    glFogfv(GL_FOG_COLOR, fogColor);
    glFogf(GL_FOG_DENSITY, 0.5f);
    glHint(GL_FOG_HINT, GL_DONT_CARE);
    glFogf(GL_FOG_START, 10);
    glFogf(GL_FOG_END, 20);
    glEnable(GL_FOG);</code>

That’s it! Such a great effect with so little effort.

Anyway, I don’t foresee my game being completed by the end of this month for the Ludum Dare competition. However, I have been working on a killer MUD client for the iPhone that I will most likely submit. I feel that current solutions are clunky, ugly, and unintuitive (sorry if you are a reader and a dev of one of these :/).

I should have some screenshots up soon.

I would love to hear thoughts/opinions of doing a Minecraft inspired game as well?

Calculator Creator Released + Promo Codes

I have recently been developing an iPhone app in my free time called Calculator Creator. This application has been an idea of mine for quite some time and I finally found the time to complete it. Here is the complete description of the app.

The last calculation app you will need to buy!

With Calculator Creator, you are easily able to build your own “Calculators” as long as you know their equations. The process couldn’t be easier.

Simply:

1. Name your calculator (ex Cost Per Square Foot)
2. Add the fields involved (ex Cost, Square Foot)
3. Create the equation (ex Cost/Square Foot)
4. Use the calculator whenever you like

Why purchase a unit conversion application for more, when you could have EVERY unit conversion in one clean application.

Calculator Creator also comes packed with over 20 sample calculators including:

– Unit Conversions
– Mortgage Payments Calculator
– Temperature Conversions
– Tip Calculators
– and more!

If you are reading this and want a free copy of my Calculator Creator, try using one of the promo codes below. Also, please consider leaving me an iTunes review (especially if you are getting the app for free! :))

I would love to hear suggestions for future improvements and features.

Download Calculator Creator on iTunes

PROMO CODES
LRREPTP3E64Y
L6RPN9KYHLFR
9P3YETKR4XTW
H4HF4R4L9K7L
KTRAJYF4M97L
M34ALYRTHJRY
MMFFM7LRJTAP
A3WYL4EKF797
T93FK4479AWX
RHWWJEKNE3AM

PoV’s Challenge: Week 1

After a week of studying my butt off with OpenGL ES, I have finally started work on my game engine for my Pov’s Challenge game.

As you can tell from the screenshot below, I have been playing entirely too much Minecraft and have cube art on the brain.

It’s not much right now, but I do have a basic cube rendering engine that takes in a level file and renders the environment. Here is a screenshot of a very simple level.

It’s not looking super killer at the moment, but I have yet to do fancier lighting or any texture mapping.

Ohh My Game Idea You Ask?

Well, without going into too much detail, it’s pretty much an epic battle of mass proportion set in a 3D cube environment (hint: it’s not iMinecraft ;)).

I will give more details as I go about the month and near the completion of my game.

Also, in case you are interested, here is what the level file looks like for the generated environment.

GG,GG,GG,G,GG,GG,GG
GG,G,G,G,G,G,GG
GG,G,G,G,G,G,GG
GG,G,G,G,G,G,GG
G,G,G,GG,G,G,G
GG,G,G,G,G,G,GG
GG,G,G,G,G,G,GG
GG,G,G,G,G,G,GG
GG,GG,GG,G,GG,GG,GG

The number of G’s that appear represent the height at that location.

The current roadmap is:

  • Texturing & Lighting
  • Collision Detection / Navigation
  • Gameplay & Audio
  • AI
  • Menus / Title / Pause (secret sauce ingredients)

By next week, I should have some sort of level editor and some basic skinning going on.

Hopefully I can finish this sucker by the end of the month. Its’s been an intense journey learning openGL from scratch in 7 days and I know that I still have quite a ways to go. Again, if you are participating in this challenge, link me to your development blog in the comments.

Happy coding!

Game Dev Challenge + OpenGL ES Resource List

The other day, I was reading Ludum Dare and saw a very interesting post. It was a call to action for all game developers to get serious and actually put something out there. Here is a link to the post:

PoV’s Challenge: Make a game, sell 1 copy

The idea is for would-be indie game developers to create a game in the month of October and sell at least one copy. There are no judges, it’s not a competition with anyone other than yourself. According to PoV from Ludum Dare:

Think of this as a race (or a Nanowrimo for games+business). Have something new for sale and in a store by the end of October. And if you can sell a copy (or sign a licensing deal, or earn $1 in ad revenue), you win.

I have been attempting to learn OpenGL since my early days of programming 10 years ago and it has never stuck. I figured this would be a perfect opportunity to really buckle down and learn it. Recently, I have stumbled upon some really great **OpenGL ES resources and tutorials **that have really made things “click” for me. I wanted to share them in this post.

1. OpenGL ES From The Ground Up

URL: http://iphonedevelopment.blogspot.com/2009/05/opengl-es-from-ground-up-table-of.html

This is a blog created by Apress author Jeff Lamarche. Jeff has been blogging about opengl es for quite some time and probably has one of the best opengl series out there. His tutorials are aimed at the absolute beginner and he takes a very nice approach to teaching OpenGL ES.

The link above will take you to his table of contents of tutorials. Where you can read up on his articles ranging from drawing basic triangles to importing 3D models from Blender.
_

2. Simon Maurice iPhone OpenGL ES

URL: http://www.cocoachina.com/wiki/index.php?title=Category:Simon_Maurice_iPhone_OpenGL_ES

This is an incredible 20 part series that was translated from Chinese to English and posted on the CocoaChina Wiki. These articles take a slightly different approach, while still doing a great job of teaching you OpenGL ES.

The articles are well written and quite comprehensive. It is obvious that the approach isn’t quite as professional as Jeff Lamarche’s blog, however this series goes a lot more in depth and will teach you more complex concepts such as handling touch and moving in 3D.

3. NeHe OpenGL Tutorials

URL : http://nehe.gamedev.net/lesson.asp?index=01

These are oldies but goodies. The NeHe tutorials have been around for years and years. In fact, I attempted to understand them in my early days of coding when I declared every method as static in Java so I didn’t have to instantiate the class to call it (fail). Either way, these tutorials are a staple in the Open GL community.

Although they are not written for ES, they still provide some solid OpenGL concepts. I would strongly suggest reading these after you have read through the other 2. There are some limitation of OpenGL ES (like not supporting GL_QUADS), that will quickly confuse you if you try to write the Nehe tutorials on the iPhone.

One killer thing about the first link I mentioned is, Jeff Lamarche actually ported the first 6 Nehe tutorials to the iPhone and they can be found on the page I linked to.

I will be studying these resources carefully over the coming month. I intend to take the plunge and developer a simple OpenGL ES game in the month of October and sell 1 copy.

So, please join me! If you decide to do this and are journaling your progress, link your blog in the comments. I would love to follow it. I will be doing the same here.

Happy Coding!

This Pretty Much Sums It Up

Source

App Store (Link Share) Affiliate Link Generator

A while back, I wrote a post called ”Money You Might Be Missing Out On” where I discussed the Linkshare API. Well, I took it upon myself to create a simple tool that I have been using in my blog posts to quickly generate affiliate iTunes links for iPhone apps. Here is a screenshot of the app.

The generator is quite simple and perfect for bloggers that are discussing apps. Here is how it works.

  1. Sign up for LinkShare (if you haven’t already done so)
  2. Go to http://brandontreb.com/apps/linkshare/
  3. Enter your LinkShare Token. You get this in the Web Services section if the LinkShare site when you sign up.
  4. Select a merchant. By default, I have already populated it with Apple iTunes. Linkshare supports thousands of affiliate programs, so you can click other if you are using it for something else besides the app store.
  5. Enter the App Store URL of the application that you wish to get an affiliate link for. (ex http://itunes.apple.com/us/app/hundred-pushups/id301174591?mt=8)
  6. Click submit

Now, it will interface with the LinkShare API and produce an affiliate link for your account.

I hope you find this tool as useful as I do.

Great WordPress Plugin To Connect Your WordPress Blog To Your Tumblr

Ok, so maybe this is stupid, reposting your own content in multiple areas. As far as SEO goes, it may not be the best idea. However, I really love Tumblr and I really love WordPress. I can’t seem to part with either yet I don’t quite have the time for both.

I put out a quick tweet earlier today (and this is why I flippin love Twitter), asking if anyone knew of a good way to connect WordPress to Twitter. Here are the popular options.

  1. Use Tumblr’s feed importer (suggested by @abrahamvegh). This option requires you to enter your blog’s RSS feed. Tumblr then scans your RSS feed every so often and pulls the new posts. I didn’t care too much for this approach because it’s not instantaneous. I added my feed and it told me that it would refresh in about an hour. After an hour it still didn’t pull my WordPress posts and had a status of queued.
  2. There are quite a few Tumblr WordPress plugins out there. I have tried a few and have seen no success. Until one of my twitter followers (**@TheSilber) **suggested that I use tumblrize. Tumblrize is a great plugin that worked perfectly right out of the box. It was easy to set up and boasts quite a few options.”Tumblrize posts to Tumblr whenever you hit the “publish” button. It uses Tumblr’s simple API to keep posts in sync; when you edit your WordPress post, it updates your Tumblr post.”

I would highly recommend option 2 if you are planning on syncing your WordPress blog with your Tumblr.

Download Tumblr.ize Here

Would love to hear about some other interesting solutions. Feel free to post them in the comments.

SEO: Works Every Time

So I received an internal email at work the other day about how we could SEO our company website (http://elctech.com). Here was my suggestion:

“Just put up a few <h1> tags that state (in this order) Rails, Coding, Consulting, Porn, Free Porn, Porn on Rails, Viagra, iPhone, development, hot chicks, elc.

Guaranteed hits!”

Genius right? So after a while, a fellow employee (@maxmurphy) suggested we implement this rails solution:

<code class=’ruby’>["Rails", "Coding", "Consulting", "Porn", "Free Porn", "Porn on Rails", "Viagra",
"iPhone", "development", "hot chicks", "elc"].each do |seo|
  "#{seo} \n ELC ROCKS #{seo}"
end</code>

Perfect!

Feel free to steal this and you too can be an SEO Guru!

6 Traits Of A Successful Developer

I really enjoyed this article on traits of developers.

http://www.turnleafdesign.com/6-traits-of-successful-developers

In my experience, developers tend to become arrogant and totally ignore #1 (see Windows Devs). I feel that this is the most important trait of all.

“For a developer to be successful over any period of time a continued commitment to learning is absolutely vital. The field is too large, too quickly changing, and too in depth for any developer to ever “know it all.” Luckily there are a lot of resources a developer can use to learn; books, co-workers, classes, blogs, among many others.”

Great HTML5 Infographic

This info graphic just about sums it up in terms of what is HTML, and why we should care. It includes browser readyness, various API support, comparison of competition, and more. Check it out.

Technology + Fitness = <3 :: 3 Apps That Will Keep Even The Laziest Geek In Shape

If you are reading this post you are most likely a geek. It’s true, otherwise if you were a reader of my blog and not a geek, you would be very confused ;).

Well, being a fellow geek, I am prone to the same sort of problems as you when it comes to fitness. As geeks we sit in our chairs and more often than not end up looking like this. (sad face)

Ok ok, that photo is a little cliché, but you get my point. This prolonged sitting along with a lazy (Mountain Dew + Cheetos ) diet leads to this stereotypic geek look.

The Solution

Dun duh dun duh (those were trumpet sounds in case you didn’t know). Well, we all love technology (duh), so why not combine it with some basic fitness and fight the stereotype. With sweet gadgets (like the iPhone :)), we now have some incredible tools that almost make a game out of exercise.

Here are 3 iPhone apps that I use on a daily basis to keep me in peak, geek, 1337 shape.

#1 100 Pushups

I stumbled upon this gem of an app when I started seeing my buddy @oodelali ‘s Twitter feed displaying the following.

160 Pushups! Gangster right? Intrigued, I asked him about the app. After a brief synopsis, I was sold. Here is the rundown of this app (per its app store description).

“If you’re serious about increasing your strength, follow this six week training program and you’ll soon be on your way to completing 100 consecutive push ups!”

Basically, this app utilizes interval training where you exercise 3 times per week for about 10 minutes. After 6 weeks of this, the app claims you will be able to do 100 consecutive pushups! Here is a screenshot so you can see what I’m talking about.

So far, I’m on week 4 and am doing a total of 94 pushups (not consecutive yet).

**Don’t have an iPhone (sad face), you can still benefit from this app by using their web interface at **http://hundredpushups.com/.

The developer of this app has a whole suit of these including 200 Sit-ups, 200 Squats, and Twenty Chin Ups.

#2 Run Keeper Pro

Run Keeper Pro is a stellar app that has both paid and free versions. It uses the GPS to map our your run and gives you feedback on elevation, pace, distance, and location. I use this app every single day when I go for runs.

One killer feature of this app is its ability to sync with the web at RunKeeper.com. Here you are able to track more statistics about your runs, create paths, and get more social.

The interface is both beautiful and intuitive. (Aesthetics are super important to me. You could have the most functional app in the world and I won’t use it if it looks like feces).

When I first started running, I could barely make it to the end of my street, and with this app, I am now running over 10 miles per week!

#3 iFitness

So, this app is for the geek that might actually go to they gym (you mean like…leave…the house). Or if you are really a hobbit, have a home gym. iFiness allows you to track all aspects of a workout. It will track what exercises you do, on what day, with how many reps for how long.

With these killer features, it’s easy to create a fully customized workout and track it the way you want.

“But Brandon, I have never been to the gym and don’t know how to use the weights/machines because I’m level 75 in WOW.” Well, iFitiness has got you covered! For every workout they have in the system, they provide full graphics or videos on how to perform each one. So if you are unsure about how to do anything, just take a quick peak at your phone, jump on the machine, get jacked, and the ladies (or dudes if you are a lady reading this) will be flocking from all over.

Another great feature of this app is that it has built in workout plans to suite your lifestyle. So weather or not you want to build muscle or you just want to lose that gut you have been working on, they have a plan for you. Whoa, I am starting to sound like a P90X commercial, time to pump the breaks.

Take Away

To wrap up, I feel that staying healthy and fit is very important. You have to make it a part of your lifestyle and these few tools are a great way to get a jump on it. Feel free to post comments, questions, or grammar corrections (expected bc we are all the grammar police) in the comments.

WordPress For iPhone/iPad NSXMLParserErrorDomain Error 64 Resolved

If you have a WordPress blog and an iPhone/iPad, then you most likely have the WordPress for iOS app. If you don’t, you should.

Over the past couple of days, I have been receiving the following error when trying to add my blog to the iPhone app.

After scouring the internet, I found that this could be the result of a few issues.

  • Special characters in a post body that are not supported by NSXMLParser
  • Special characters in a comment
  • Invalid post or comment RSS
  • An error in a theme/plugin file

For me, this turned out to be an issue with the comments RSS feed. I loaded it up in the browser and long behold, even the browser threw an error. But what could be causing this? Turns out, I had left a space in a plugin that I created. This caused a space to be output at the beginning of the comments XML, causing it to error. Notice the space between ?> and <?php below. (Face Palm)

After removing the space from this plugin, I loaded up WordPress for iPhone and it added my blog without a problem.

So, the take away from this is don’t output spaces when you create a plugin.

I hope this post has proven useful for you, I can’t imagine that I’m the only person with this issue 😉

Feedburner Anywhere Plugin Updated

I have updated my WordPress plugin Feedburner Anywhere. In case you are unfamiliar with it, it’s a plugin that allows you to output your Feedburner subscriber count anywhere on your blog.

**The Problem: **Since Google took over Feedburner, I feel that it has been quite unreliable. A few times a week, Feedburner would return 0 for your subscriber count. This was an issue with the plugin. If the return value was 0 when the plugin pulled and cached the feedburner data, you would look like you had no subscribers.

The Fix: I am now caching the values returned from Feedburner. If for any reason Feedburner returns a 0 subscriber count, the last known value (greater than 0) is used instead.

Download the updated plugin here

If you have any other suggestions for the plugin, please let me know.

Simple Office Fitness: Replace Your Office Chair With An Exercise Ball

When I was in Portland this past month, I saw that many people in my work’s office were sitting on large exercise balls instead of office chairs. Curious, I researched the benefits and decided to purchase one for my home office. The benefits include:

  • Improved posture – sitting on the ball forces you to sit up straight of you won’t be very comfortable
  • Constant movement – Sitting for long periods of time can be bad for you, even when you exercise. Check out this recent study that was discussed on the New York Times. When you use an exercise ball for a chair, you are constantly repositioning yourself and are combatting this issue.
  • Getting Jacked! – having a ball for a chair has encouraged me to exercise during my down time. Code is compiling…bang out some crunches. I will now do ~ 300 crunches per day while waiting for various tasks to complete.
  • They are cheap – Most exercise balls range from $15-$25. Check out Amazon for some deals. I recently purchased one at Target on sale for $9.
  • It’s fun – Need a break? Just bounce a bit on the ball 😉

While I’m not saying to completely replace your office chair with an exercise ball (you will end up switching back an fourth a bit), it is a great way to stay in shape and enforce good posture while at work.

Test Version of TweetPress 3.0

So WordPress 3.0 has broken Tweetpress for many people. If you are daring, willing to help, and experiencing issues with Tweetpress, please download the 3.0 test build of Tweetpress and install it on your WordPress blog.

Here are your next steps after installation:

  1. Make sure you add your Twitter username and Password to the Tweetpress settings in your wp-admin and save it
  2. Attempt to post a photo to Twitter using Twitter for iPhone
  3. If it works, you win, let me know, if not do this:
    1. go back to the tweetpress admin in wp-admin
    2. click the log link at the very bottom
    3. copy the text and email it to brandontreb [at] gmail [dot] com with the subject “Tweetpress Log”

This will really help me troubleshoot the issues that everyone has been having.

Thanks!

Download Tweetpress Test Build 3.0