September 5th, 2007
Even with today’s modern IDE’s and plethora of search tools (Spotlight, etc.), I still find myself occasionally dropping to a bash shell to look for something in an unknown file. In the past, I was a bit frustrated that my combination of find | xargs grep would bomb out on any files or directories that included a space. Today it dawned on me that there’s a simple workaround for this… Prefix and postfix each file with a quote via sed. The following example recipe will find the text textIAmSearchingFor in any .java file in the current tree.
Read the rest of this entry »
Posted in Unix | 1 Comment »
September 1st, 2007
I’ve finally taken the time to play around with Yahoo Pipes. I’ll probably do a few posts over the next couple of days on my findings, but I’ll get started with the basics on how to write a json web service in PHP that can be called from Pipes. The capability to call a web service from Pipes is a recently added addition by Yahoo that could prove to be very powerful.
There’s a good post and recipe for getting started over at echoditto labs. Unfortunately, my web host had two things that made this recipe a non-starter. First, they don’t allow compiling C++ extensions for PHP, as is required by the JSON PECL package. Second, they have PHP’s annoying little magic_quotes_gpc setting turned on.
Here’s a little recipe that may help you get started. You’ll need to first download the Services_JSON library — a proposed addition to PEAR that encodes and decodes JSON. The recipe below assumes that you use items as the input for the “Path to item list” prompt in Pipes. The recipe is simple and straightforward. It is the moral equivalent of Yahoo’s Java example — it simply appends ” (This text was added by the external Web Service)” to the title of each item in the feed. It provides one additional bit of functionality that may help you get started. It logs the decoded input value to pipes-log.txt. This will help give you an idea of what your input is.
Read the rest of this entry »
Posted in PHP, Web Services | No Comments »