-
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.
- SPEED: Just click around on my site. It is screaming fast now.
- 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).
- 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!
- Offline publishing. I can write my posts anywhere since they are just .md (markdown) files. Check out Daring Fireball’s great writeup on this.
- Portability: Have you have tried to move your WordPress site? Yeah, it’s about as fun as chewing on tin foil with metal fillings.
- 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.
- Not suck at security
- Not be bloated
- Not have a sucky post editor
- 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!
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 starreview -
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.
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.
-
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).
- How would you change existing services? What new features would you like to see? what features are worthless?
- How much would you pay for such a feature?
- Would you be interested in having your app featured the first month for a minimal cost ($1 or so)?
- 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.
-
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 :))
- 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
- Buy a resistance band – These are everywhere (target, walmart, big 5, etc…) – $20
- Buy a pull-up bar – $30
- 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.
- 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.
- 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.
- 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.
- Get the crap out of your house – I’m serious, you won’t miss it. Cookies, Soda, Doughnuts, whatever…
- 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!
- 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.
- 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.
- 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.
- 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!
-
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.
-
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.
- Go to http://developer.twitter.com and sign up if needed
- Click on Your Apps
- Click Register A New App and fill out all of the information about your client
- 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:
- Make sure you have git installed. If not, download it for OSX here.
- cd to the directory that you want to clone the files to
- 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…
- Delete the yajl group with everything in it
- Delete the Twitter YAJL Parsers group and everything in it
- Delete OAToken_KeychainExtensions.m and OAToken_KeychainExtensions.h (they are not used)
- Delete CJSONDataSerializer.h and CJSONDataSerializer.m
- Delete CSerializedJSONData.h and CSerializedJSONData.m
- 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.
- 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!
—-
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.
-
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.
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.
If you have any questions or comments, feel free to leave 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.
-
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.
- Open up the XCode Preferences
- Click on the Key Bindings tab
- Navigate to the command that you want to bind keys for. (hint: they are organized the same way they in the top menu)
- Once you have found the command, double click in the Key column
- Press the keys that you wish to bind (I bound option shift ⌘ s for sorting)
- 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!
—-
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.
-
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!
subscribe via RSS