brandontreb.com Tips And Resources For Software Consultants

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.