CodeIgniter US State Helper
August 11, 2011
I’m working on a project today and building a credit card checkout form for what seems like the 1,000th time. It occurred to me that a US State Helper would save me from having to 1) look up all of the states every time, and 2) dump them into an array and build out functions for easy conversions and validation. I figure this may help some people out there, so enjoy!
If you are using the Spark, install as usual. Otherwise, the helper file (helpers/state_helper.php) will need to be moved into your ‘application/helpers’ project directory.
No configuration involved. Just load the helper as your would any other helper.
<?php // Spark $this->load->spark('state-helper/1.0.0'); // Or, Helper file $this->load->helper('state'); ?>
There are currently four helper functions available to simplify dealing with US states in CodeIgniter.
- state_array() — Returns an array of US state names where the array’s keys are the corresponding two-letter abbreviation.
- state_dropdown($name [, $selected [, $id [, $class]]]) — Returns the HTML for a <select> dropdown where the <option> values are the states’ two-letter abbreviations and the displayed values are the full state names.
- $name — The name to be placed on the <select> element.
- $selected (optional) — The particular state’s two-letter abbreviation to be set as the default.
- $id (optional) — ID attribute to be placed in the <select> tag.
- $class (optional) — Class attribute to be placed in the <select> tag.
- abbr_to_name() — Converts state’s two-letter abbreviations into their full state name.
- name_to_abbr() — Converts full state names into their respective two-letter abbreviations.
- is_valid_state() — Checking function to see that the provided full state name OR two-letter abbreviation is valid. Returns boolean TRUE or FALSE.
Why I Quit Gowalla
April 26, 2011
Let me start by saying that I deeply respect the team at Gowalla and actually envy their fun work environment and exceptional level of talent. This post is to address the service they’re building, not the folks behind it.
Up until today, I had been a member of Gowalla for something like a year. I was immediately drawn to the service because of its ability to locate me, find the business I was present at and commit a check in. The iPhone and web interfaces are simple and beautifully constructed.
I quickly invited most of my friends who proceeded to sign up, making the experience even more entertaining. I checked in everywhere I went, from gas stations to my polling place. I took pictures, reported issues, and even gave feedback on the Gowalla GetSatisfaction page. I would consider myself to have been an active member of Gowalla.
Unfortunately, that was the peak of my experience and it was a slow downhill from there. There are several key places where I feel Gowalla is lacking and keeping themselves from being sustainable for the long run.
I’m not sure I ever really understood what the driving force was behind me wanting to check-in everywhere I went. Most of the time the actual check-in was the end of the road. Phone away and on with other things. I liked being on the Leaderboard at the few places I checked into regularly, but that wasn’t permanent or overly hard to attain.
Locations, check-ins, and items need some incentive behind them (whether physical or virtual) to really be interesting after the newness wears off. There are plenty of ways to implement incentives, but I don’t think anyone (Gowalla, Foursquare, etc.) has really gotten it right.
One of the first things I noticed when joining Gowalla was that basically none of my friends were on it yet which seemed reasonable since it’s a newer start-up and isn’t widely adopted. I invited quite a few people and even gave several friends a face-to-face walkthrough on why they should check it out (sidenote: shouldn’t there be a pin for accepted referrals).
Having a few people I knew well on the site made it much more interesting, but it never became more than, “Oh, he’s at Taco Bell again?!” or “I guess he just made it to work”. There is no sense of community and tends to feel more like a “people tracker” than networking medium.
In an effort to build community and interact more with the service, I added most of the people I follow on Twitter as friends on Gowalla. It quickly became obvious, however, that doing that is less than desirable.
I found I’m not all that interested in people’s check-ins when they live 2,000+ miles away. I’m also not interested in places I’ve never heard of or have no plans to visit. Most of the time I just turned off their Push Notifications, but then I had to ask myself what was the point of following them in the first place?
Almost any time I met with someone for lunch or coffee, I made sure to get my check-in settled before jumping into conversation. It didn’t take long to realize how this was a totally ridiculous practice. Why was I de-prioritizing my friends and family so that I could let the world know where I was?
The same question could easily be asked of Twitter, Facebook, and SMS, but the reason I am OK using those is because I feel like there is a community of people (see “Community” above) on the other end with which I’m sharing my life and continuing to grow our relationships. That’s not so much the case for me with Gowalla.
Checking in to find that you’ve received a new item is definitely fun. I also really liked exchanging items at a location and tracking the history of where they’ve been. So, now what?
I can see collecting items and putting them in my archive as a goal. Most of the time, however, I just dropped them somewhere for someone else to pick up. I never felt satisfied with item collection alone being the end goal of my Gowalla experience. I liked finding new locations and becoming the creator, but what’s the incentive? Eventually, I earned a pin or two for creating Spots, but is that it? I never once looked to see what pins other people had earned. Pretty consistently I found myself needing more direction on what to do next. What’s the next achievement? What am I getting out of this? What do you want from me, Gowalla? If the service can be whittled down to sharing where I’m located, I’ll elect to simplify and just add my location to a Tweet.
This post is in no way meant to flame Gowalla or the great people that work there. I just need more from the service to justify continuing to invest my time in it. I think there are loads of opportunities (of which I’m sure they are working on some of them), but for now I value simplicity and privacy just a bit more.
Making the iPad into a “Laptop Killer”
April 18, 2011
I’ve been using my iPad 2 for just over a month. I pulled the trigger and bought it with the expectation of using it primarily for reading (Twitter, RSS, Instapaper, Bible, Kindle). While that is mostly true to this point, I find myself wanting to use it for more. I find myself wanting it to replace my MacBook Pro, but can’t quite pull the trigger. Here’s why:
The Inability to “Create”
I’m not looking to edit Photoshop files and, frankly, I don’t even want to edit videos with the new iMovie app. Those things should be done on a computer with a mouse and keyboard, but I feel there are a few significant barriers blocking the transition from consumer to creator on the iPad.
As I mentioned in my last post, it’s not possible to do something as simple as add an attachment to an email within the Mail app. That’s just not acceptable from a device that would replace my laptop.
Let’s be honest, there is no printing support for the iPad.
I know there’s AirPrint, but should I have to buy an HP printer? I already have a Brother printer that I love. I understand that Apple doesn’t want to mess with the thousands of different printer drivers out there (Trust me, I used to be a Linux-only guy), but isn’t that just a bit of a cop out?
There are also printing apps in the App Store. I haven’t tried them myself, but the reviews are very mixed. I have to believe it’s a bit of a kludge if it may require me to install software of my desktop computer to make it work.
I don’t print a ton even with my desktop or laptop, but when I need to it’s usually for a good reason and I need it now (concert tickets, receipts, meeting notes).
No Personal Storage Area / Home Folder
I would like to have a home folder that serves as a place for file storage. There are currently various apps that facilitate that storage (both locally and in the cloud) like Photos, Dropbox, Evernote, and GoodReader, but why not natively?
Common Data Storage Area
I’d like to have an area where I can dump a file and not require an Internet connection to access it. This folder would also serve as a common storage area where other apps could source files (much like Twitter and the Photo Library do now). For example, I’d like to download an image from a website and upload it to Twitter or send a stored Word document to someone through Skype.
Replace the USB Drive
When I plug in my iPad to a computer, it should mount like a USB drive. Loading or unloading the iPad should be as simple as drag and drop…no iTunes required, please.
This would allow a person to work on the file at their desk, load it up on the iPad at the end of the day, compose an email on the train ride home and send it off as an attachment. That easily matches the convenience of a laptop.
Although not at the top of my list, the iPad should have user accounts. Here are some cases where it would be nice:
- Perhaps my wife doesn’t want her apps arranged in the same manner as I do. Maybe she doesn’t want an app to show up on her screens at all. My wife uses the iPad entirely differently than I do.
- Two different people usually have different email accounts and mingling the two gets messy and confusing. I’d prefer separate instances of Mail.
- Maybe I don’t want to get work emails over the weekend, and likewise don’t want to be distracted at work with Push notifications from Word with Friends that remind me of the slaying Chris Bowler is administering.
- I’d like to play Angry Birds and beat all the levels myself, but am forced to share with our friends 5 year old who is giving me a run for my money.
- All apps with personalized logins require using shared accounts or logging out and back in each time a new person uses the iPad. Way too much hassle!
Is Apple telling me that my wife and I both need our own iPads? Perhaps. At their current price point I can get three or four iPads for the price of one MacBook, but then of course I’d have to buy all the apps twice. “They’re only $0.99,” you say. Unfortunately, that doesn’t hold much weight with the guy that will make a U-turn for the gas across the street that’s 1 cent cheaper per gallon.
The bottom line is that I really enjoy the iPad and it’s great for most of what I do. I feel like for Apple to take it to the next level and rightly deserve the label of the “go between” device it has to function somewhat more like a laptop and slightly less like a smartphone.
I’d really enjoy hearing your thoughts and responses on Twitter. Hit me up @gstjohn.
Sending Email Attachments in iOS
April 15, 2011
The bottom line is it’s not possible. At least natively.
I discovered this unfortunate circumstance this morning as I was trying to reply to an email with a screenshot from my iPad. I could have sent it from Photos, but that would have required me to write a new email and the recipients weren’t in my address book. I would also prefer to keep the screenshot associated with the original email for context. No such luck, though.
What about sending non-photo attachments (like a document)? Also, not possible. There is an app called GoodReader that (among other things) will allow you to send files as email attachments, but no such functionality is built into iOS. Do I really want another app to enable such a simple process? And for $4.99?
I love my iPad for 101 reasons, but how can we really call the iPad a “go between” device or “laptop killer” if it can’t natively do something as simple as send an email attachment. I think this discovery just reinforces for me even further that the iPad is a consumption device and isn’t suited for creation/productivity.