I needed an action to monitor for posts being published, unpublished or updated after they were already published in my WordPress plugin. I discovered Post_Status_Transitions and specifically the transtion_post_status action that is called for every change to a post’s status. I then check if either the $old_status or the $new_status variables are ‘publish‘ and then I know the article is either being published or being unpublished.
An important note when you are implementing the transition_post_status action
When you call add_action, you need to modify the $accepted_args parameter. The default value is 1, it needs to be changed to 3.
The action transition_post_status (as defined at http://codex.wordpress.org/Post_Status_Transitions) sends three parameters, $new_status, $old_status, $post.
If you only write add_action('transition_post_status', 'my_function'), the default number of parameters that are sent to my_function is 1 so you will only get the $new_status parameter and the other two params won’t be sent.
The correct syntax to add a transition_post_status action is: add_action('transition_post_status', 'my_function', 10, 3); my_function will then be called with all three parameters ($new_status, $old_status, $post).
Some good reference posts if you’re working with this action:
Tags: Uncategorized
When attempting to share an application after archiving in XCode4, I kept getting an error message, “The operation couldn’t be completed. No such file or directory.” It appears that there was a similar issue in XCode3 that could be resolved by turning on “Generate Debug Symbols” but that did not resolve the issue for me at all.
Resolution: After clicking Share… in the Archives section of the Organizer, click on the identity dropdown. Do not allow it to use the Automatic Profile Selection, instead manually choose the correct profile to sign your archive.

If you manually select the identity to sign your application, you shouldn’t get the error message and you should be able to successfully save and share your application.
Tags: iPhone Development · iPhone SDK
October 29th, 2009 · 7 Comments
I recently upgraded from Zend Studio 6 to the Zend Studio 7.1 beta. During the upgrade, all of my .svn folders showed up in the file browser (who would ever want to see their .svn folders in the file browser…).
To remove these svn folders from your project, right click on the project > Build Path > Configure Inclusion / Exclusion Filters…
Click “Add…” next to the “Exclusion patterns:” box. Add the rule “**/.svn/”. The “**/” will make it a recursive rule. Click Finish and your annoying .svn folders should now be hidden in the file browser.
Tags: PHP · PHP Development
October 23rd, 2009 · 1 Comment
If you are attempting to connect to a samba (smb) share and you are denied, there’s a high probability your user account hasn’t been granted access to the samba server yet. To grant a user access use the smbpasswd command line tool.
- SSH to the samba server
- Log in as root
smbpasswd -a username
- Enter password (twice) – no characters will appear on the screen
Interesting note: if you aren’t logged in as root, the smbpasswd command line tool can be used to change you samba password.
Tags: linux
Yesterday (May 5th, 2009), I gave a presentation at the Seattle iPhone App Developers and Designers Meetup titled, “Advanced iPhone Web Development.” This presentation focused on the unique capabilities available in WebKit on the iPhone and on possibilities for utilizing UIWebViews inside of your native applications.
You can download a pdf version of the presentation here: Advanced iPhone Web Development ![[PDF]](http://joshschumacher.com/images/pdf.png)
Tags: CSS · iPhone Development · iPhone SDK · Javascript · Mobile Development · Web 2.0
March 18th, 2009 · 1 Comment
Thinking back three years ago, I was starting to play around with developing web applications for mobile devices. The hot device of the time was the Palm Treo. The default browser that came with the Treo, Blazer, really sucks. It was rough trying to write pages that worked perfectly in Blazer. Sure, simple, basic HTML rendered just fine but I had a background in developing for the traditional desktop web experience and I wanted to write awesome sites utilizing CSS and Javascript. I wanted to write an AJAX application for mobile devices. It would be icing on the cake if I could get it to work on lower end devices as well, but that seemed pretty pie in the sky at the time.
Webkit will be the future rendering engine of the mobile web (at least I hope it is). It’s an amazing, full featured engine with bleeding edge web standards implementations of HTML 5 and CSS 3. Webkit has been getting some great traction lately with some amazing devices implementing it as their default browser engine, Android, Palm Pre and of course the iPhone (and iPod Touch) have all fully embraced Webkit. I want to see that list get a lot longer; I hope to start seeing Webkit on lower end mobile devices.
What makes Webkit so awesome? How about CSS effects, blazing fast javascript execution (especially in their new Nitro engine in Safari 4), HTML offline support – including offline data storage and support for offline cache manifests, CSS gradients, CSS border radius and border images, CSS transforms, and a lot more. On the iPhone, it now even has custom events to pass down gesture events to the DOM. You can now do most things you could once only dream of doing in flash in straight HTML, CSS and Javascript on small devices stored in someone’s pocket.
The future of mobile web applications are social, location aware, providing a tailored experience based on user preferences. Future mobile web applications will morph based on user behavior. The will provide a graphically rich experience with beautiful design elements enhancing every aspect of the application.
Tags: iPhone Development · Mobile Development · Web 2.0
February 19th, 2009 · 7 Comments
It seems like a pretty simple, common thing you would want to do in objective-c right? All applications have an Info.plist (or a different plist file as defined in your "Info.plist File" property of your build target). I've been pretty frustrated with the quality of google search results when trying to figure out how to do more or less mundane things with the iPhone SDK. I'm going to start writting posts, especially when I have a hard time trying to find what I was looking for in search results.
Here's the quick and dirty: I have a game that we're building here at Treemo Labs, Tic A Tac Poker. We're working on getting a lite version out the door. I wanted to read a custom value out of the Info.plist to tell if it's the lite version or not. I couldn't figure out how to read a simple value from the default property list file. Here's some sample code to get the bundleIdentifier, bundle version and custom values from your Info.plist
CODE:
-
// Create a new NSBundle pointer
-
NSBundle* mainBundle;
-
-
// The Info.plist is considered the mainBundle.
-
mainBundle = [NSBundle mainBundle];
-
-
// Reads the value of the custom key I added to the Info.plist
-
[mainBundle objectForInfoDictionaryKey:@"myCustomKey"]
-
-
// Another handy thing I had to search around for a little
-
// Get the value for the "Bundle version" from the Info.plist
-
[mainBundle objectForInfoDictionaryKey:@"CFBundleVersion"]
-
-
// Need the bundle identifier? (probably something like com.mycorp.product)
-
[mainBundle bundleIdentifier]
For more information about the NSBundle, view the NSBundle Reference Documentation.
To see an alphabetical list of the standard keys you can use in an information property list file, along with a brief description and the platforms to which they apply (Mac OS X or iPhone) check out the Property List Key Reference.
Tags: iPhone Development · iPhone SDK · Objective-C
Important: This presentation was created in December of 2006, the information most likely is out of date. I am posting this in response to the demand from slideshare.
During my senior year at Western Washington University, for a final project in my Management 495 class, I did group presentation, performing a strategic analysis of Google and the positioning in the search engine market. I posted this slideshow to slideshare and received an incredible amount of comments and messages asking for the presentation. The presentation currently has over 25,000 views and over 100 favorites.
Like I said in the disclaimer, this slideshow is a year and a half old so a lot of the information is out dated. Also, looking back at the slideshow, there are some formatting issues that I would resolve if I had to go back and do it again. The presentation, was put together using Apple's Keynote software. This was a group presentation so I was not the only contributer. The other contributers were: Charity Thomas, Frieder Mack and Jennifer Bell.
You can download a pdf version of the presentation here: Google Strategic Analysis Presentation
(December 2006)
Tags: Web 2.0
During the process of designing our API at Treemo, one of the first major design implementation hurdles we had to overcome was how to standardize a way to define what data in an object was "exportable" and can later be transformed into XML. The solution that I came up with defines a Node and a NodeCollection object.
When deciding what the data structure should look like, I wrote some pseudo XML that we need to be able to model.
XML:
-
<channel>
-
<owner name="testuser" email="test@test.com" />
-
<list name="foo">
-
<item id="123">
-
<files>
-
<image href="http://foo.bar.com" />
-
<3gp href="http://3gp.foo.bar.com" />
-
</files>
-
</item>
-
</list>
-
</channel>
A Node has a (string) $type, (mixed) $attributes and (NodeCollection) $children. Using the above XML as a reference, our root node (let's call it $root) would have $type = 'channel' and no attributes. You would then add two nodes to the NodeCollection $children, owner and list. Owner would have $attributes of array('name'=>'testuser', 'email'=>'test@test.com') and $children would be an empty NodeCollection.
The biggest design decision made about NodeCollection was that NodeCollection implements Iterator. By implementing Iterator, you can later foreach over $children and it can loop through the elements with no problem. Implementing Iterator is a pretty cool design pattern - I'll have to write a post about it in the near future. The ability to foreach over $children helps tremendously when writing ExportNodeToXml.
Wrapping up, pseudo code to export and object to a Node that can later be transformed to XML would look like this:
PHP:
-
class Channel implements iExportable {
-
public function toExportable() {
-
$root = new Node('channel');
-
$root->
children->
addNode(new Node
('list',
array('name'=>
'testuser',
'email'=>
'test@test.com'));
-
$root->
children->
addNode(new Node
('list',
array('id'=>
'123'));
-
$root->children->getNode(2)->children->addNode(new Node('files')));
-
$root->
children->
getNode(2)->
children->
getNode(1)->
children->
addNode('image',
array('href'=>
'http://foo.bar.com'));
-
$root->
children->
getNode(2)->
children->
getNode(1)->
children->
addNode('3gp',
array('href'=>
'http://3gp.foo.bar.com'));
-
}
-
}
Tags: PHP · XML
For the majority of my life, my dad worked for a public radio station in Spokane, KPBX, so I've always had an affinity for public radio. Since moving to the Seattle area and spending a lot of time in my car commuting to and from work (usually about 35 min - 1 hour each way) I've been listening to a lot of radio. When I first started commuting, I listened to a lot of commercial radio but I find that stuff gets really old, really fast. I can only listen to Umbrella by Rihanna so many times before my head wants to explode.
Recently, I've rediscovered my love for public radio. With the trio of eclectic music from KEXP 90.9, dance and techno from C89.5 and local, national and international news from KUOW 94.9 I can always find something good to listen to. Not only am I aurally satisfied, listening to public radio often seems to put me in a civically minded mood - encouraging me to soaking up as much information and culture as my brain can handle.
On another note, I haven't posted in a while - after graduating, I started at a company called Ascentium. They are an interactive technical marketing and consulting firm. I worked there as a web developer for about 2.5 months and then I decided I wasn't really being challenged enough and I missed writing PHP a lot. So I left to start working at a startup that I had looked at during my initial job search right after graduating, Treemo.
I've been at Treemo since the middle of June and I'm loving it. We have some really cool stuff coming down the pipe in the near future. Right now, I'm working on writing an API - very exciting work. Now that I'm working back in the PHP biz, I'm going to start writing about developing PHP again. Stay tuned.
Tags: Life