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
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 · Javascript · Mobile Development · Web 2.0 · iPhone Development · iPhone SDK
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: Mobile Development · Web 2.0 · iPhone Development
February 19th, 2009 · 1 Comment
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: Objective-C · iPhone Development · iPhone SDK
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
I was enlightened the day I discovered array_filter. You may find yourself with an array of values and you want to delete some of those values from the array. There is no 'delete element from array' function built into php but you can use an even more powerful function, array_filter.
Let's look at a simple example. I have an array containing values, some are numeric, some might not be. I only want my array to contain the valid numeric entries and I want to delete the other values. PHP has a helper function we are going to be utilizing, is_numeric.
PHP:
-
$data =
array(42,
"foo",
96,
"",
100.
96,
"php");
-
-
// Filter each value of $data through the function is_numeric
-
-
-
// Re-key the array so the keys are sequential and numeric (starting at 0)
-
-
-
// Print out the new, filtered data
-
The output from above is:
Array
(
[0] => 42
[1] => 96
[2] => 100.96
)
Pretty handy function. Notice how I ran my data through the function array_values, before that function was run, the keys were (0,2,4).
Another example with a user defined function. I have defined a collection of tags and I want my tag collection to only contain tags that match the criteria the user has requested.
PHP:
-
$tagCollection =
array("AJAX",
"Analytics",
"CSS",
"Javascript",
"JoshSchumacher.com",
"PHP",
"Prototype",
"Web 2.0");
-
-
// Custom function used to filter the $tagCollection based on query sent to page
-
function strTagMatch($val)
-
{
-
$query =
isset($_REQUEST['Tags']) ?
$_REQUEST['Tags'] :
'';
-
return (stripos($val, $query) !== false);
-
}
-
-
Voila! Deleting elements from an array has never been easier.
For more information, see the php documentation on array_filter.
Tags: PHP
When developing a site, I visit it a lot - OK Josh, that was an obvious. Point is, I was tired of tracking my visits to sites that I maintain. I really care about tracking significant users and how they navigate the site and what pages they find valuable but I don't care about my hits.
I put together a quick page that I can navigate to that will install a cookie for the browser. I can then check for the cookie in my standard header include so the Google Analytics tracking code isn't sent to the browser.
The code to set the cookie (and make sure it's installed correctly)
PHP:
-
-
-
if(isset($_COOKIE['hideAnalytics']) &&
$_COOKIE['hideAnalytics'] ==
'true')
-
{
-
print "Cookie installed";
-
}
Similar (but inverse) code is then inserted in my header
PHP:
-
<? if(!
isset($_COOKIE['hideAnalytics']) ||
$_COOKIE['hideAnalytics'] !=
'true') { ?>
-
ANALYTICS TRACKING CODE
-
<? } ?>
Analytics is a great tool and it's going to be even more useful now that I won't be tracking my own hits.
Tags: Analytics · Javascript · PHP