Archive for the ‘Technologies’ Category

Accessing content for non-active languages with qTranslate

Thursday, January 14th, 2010

I’ve recently been working on a new site for a large Jewish philanthropic organization, developing a (very) custom WordPress theme for their site– when it came to coming up with a way to handle bilingual English/Hebrew content, we tried a few WordPress plugins before settling on Qian Qin’s qTranslate, which has been wonderful– great user interface, easy for the client to grasp, easy to work with.  The one problem I encountered way that there is no easy way to reach across languages for content, which was necessary for one section of the site where English content needed to appear alongside Hebrew content.  Without any further ado, here’s the snippet of code I came up with to get at both languages– you are left with $p_title and $p_body which are both arrays, and you need to make sure to substitute your language in for Hebrew, and your language 2 letter code in for iw on line 3:

$enddelim = '<!--:-->';
 $englishdelim = '<!--:en-->';
 $hebrewdelim = '<!--:iw-->';

 $getpost = get_posts('post_type=page&include='.$post->ID);
 foreach($getpost as $p2) :
 setup_postdata($p2);
 $both_titles = 'blah'.$p2->post_title;
 $both_bodies = 'blah'.$p2->post_content;
 endforeach;

 if(strpos($both_titles, $englishdelim)) :
 $pt1 = explode($englishdelim, $both_titles);
 $pt2 = explode($enddelim, $pt1[1]);
 $p_title['english'] = $pt2[0];
 endif;

 if(strpos($both_titles, $hebrewdelim)) :
 $pt1 = explode($hebrewdelim, $both_titles);
 $pt2 = explode($enddelim, $pt1[1]);
 $p_title['hebrew'] = $pt2[0];
 endif;

 if(strpos($both_bodies, $englishdelim)) :
 $pt1 = explode($englishdelim, $both_bodies);
 $pt2 = explode($enddelim, $pt1[1]);
 $p_body['english'] = $pt2[0];
 endif;

 if(strpos($both_bodies, $hebrewdelim)) :
 $pt1 = explode($hebrewdelim, $both_bodies);
 $pt2 = explode($enddelim, $pt1[1]);
 $p_body['hebrew'] = $pt2[0];
 endif;

Remember the Milk Email Scripts

Sunday, April 12th, 2009

I know I’ve been promising these for a while, but here are the three PHP scripts that make up my PHP -> Email integration.  I’m still working on converting this to a full multi-user system.  You can see I already started with the conversion on the schedule dispatch email.  Full scripts after the jump!

(more…)

Another successful site launch!

Sunday, April 12th, 2009

SureShotPhoto.netThis weekend, we launched Becky’s new photo blog, http://sureshotphoto.net/.  This was a quick launch, and Becky hasn’t started posting yet, but we got the gorgeous slideshow of her photos going, and man oh man, does it look good.

The WordPress theme is from http://graphpaperpress.com/.  We are big, big fans of WordPress for a lot of simple to moderately complex sites (like this one you’re on right now).  Wordpress allows a lot of flexibility and customizability, and a well developed CMS backend.

What are the upsides of developing with WordPress?

  1. Quick development.  With WordPress you’re building your site on top of a solid base that takes care of a lot of the basic stuff, which means less testing is necessary, and less new code is necessary.
  2. Less expensive.  This ties into number 1– as it takes less time for us to develop your site on top of Wordpress, you pay less.
  3. Easily extensible.  Because WordPress has such a large user base, there are thousands of extensions available.

(more…)

RTM PHP Class and Peek Projects

Tuesday, April 7th, 2009

Well, I’ve been making good progress on the PHP Class for RTM, and I hope to have it available within the week (if all goes according to plan).  I’m also thinking about making a “notes” style email app (primarily for use with the peek)…. This would be really straightforward… you email in notes, it logs them, and you can recall them (and maybe search?).  With push email on to the peek, this could be pretty cool, but I’d need to figure out a fast trigger mechanism.  My current RTM script uses a regular cronjob to do everything, but for something where you’re actually interacting via email, we need to be faster.  I’m thinking I’ll need to use procmail, which will be new for me, but I’m up for a challenge.

I’m taking this weekend “off” which means I’m going to sit in my PJ’s and geek out all weekend.  Maybe this project will get some attention.

Are there any email-based apps you’d like to see?  Let me know!  And don’t forget to follow us on Twitter!

What I work on

Friday, April 3rd, 2009

apple_-_apple_macbook_air_18ghz_ssd_39

I’m always interested in what setups other people use, so I thought I’d give you guys a peek at how I work…

MacBook Air

As a developer, I’m pretty demanding when it comes to my computers.  I type hard and fast, I run a ton of programs simultaneously, and I work from just about everywhere.  Not just my desk or my couch or my bed, but from coffee shops, airports, the library, with clients, in cars, on trains…

For the last three years I’ve worked on a trusty 15″ MacBook Pro which had been a great machine, although with its quirks.  It made a number of trips to the repair shop, but never left me in a pinch.  Finally, this winder, I decided it was time to upgrade, and picked up a MacBook Air, with which I have been nothing but impressed.  I opted for the solid state drive, so there is no spinning drive, and this machine is sweet.  Fast, tiny, and light.  And I haven’t missed having an internal CD/DVD drive for a second!  The backlit keyboard is a major improvement over the MacBook Pro, and it’s great to type on, too.

The MacBook Air gets an A+ from me! (more…)

Building an eMail interface for Remember the Milk using PHP

Friday, March 6th, 2009

UPDATE: Scripts are available here: http://hotchkissconsulting.net/177/remember-the-milk-email-scripts/

rtmSo, in accordance with my plan to switch client communication from phone to email, I have decided that, instead of a Cell Phone, I will carry a Peek with me.  While it has been a rocky road so far, I trust that the people at Peek have some good updates coming down the pipeline, so I’m going to stick it out for a couple months and see how I like it.

The thing about the Peek is that it’s eMail only.  And I really do mean only.  No calculator, no games, no web browser, and no calendar.  For me, that just won’t do– I am an avid fan of Remember the Milk.  I keep it in my OS X dashboard and on my desktop email screen (I use GFYD, Google For Your Domain).  Having my RTM to go is a must.

Currently, RTM offers a couple email-based options.  You can email in new tasks, you can receive a list of your tasks for the day every morning via email, and you can receive an email reminder before a task is due.  This is a good start, but there are some problems:

1) With the daily schedule emails, you can only see what’s going on that day, you can’t see your entire schedule.  This information is crucial for setting appointments.

2) Reminder emails don’t have the task name in the subject line, meaning you have to open the email to see what you’re supposed to do.

3) You can’t do anything with the tasks– no marking them completed or postponing, you have to do this from the computer.

So, I wrote my own email interface, and will go over it and include my source files so you, too, can build your own (if you’ve got some PHP know-how).  If there’s enough interest, I will build a standalone, hosted solution for everyone of every skill level. (more…)

Why I am a big fan of Yahoo Pipes

Wednesday, December 17th, 2008

yahoo-pipes-edit-by-robin-good-4651
AKA – why do it the hard way when you can do it the easy way?

So, I know it’s been around for a fairly long time, but I’m a busy guy, so I’m just getting around to it.  But, in under 20 minutes with pipes,  I was able to throw together a “pipe” that will sort through the USGS’s mountain of data and tell me what the current flow of the Animas river through Durango, Colorado is.

There’s just no way to sort through data by hand this quickly.  Pipes makes it easy to aggregate information.  Now that’s web 3.0 for you.

By the way, here’s the PHP code I used to fetch the flow.  Feel free to throw this code into your own site to show the current flow. Go go yahoo pipes!

$response = file_get_contents('http://pipes.yahoo.com/pipes/pipe.run?_id=augM3IDI3RGi4U7B1L3fcQ&_render=php');
$phpobj = unserialize($response);
$cfs = $phpobj['value']['items']['0']['description'];

Powered by Olark