JoshuaIsaac.com

Reading entries written in the programming section

Drupal Search Files and Search Content – September 24th, 2008

PDFtoText

  • Reference: http://en.wikipedia.org/wiki/Pdftotext
  • Reference: http://www.foolabs.com/xpdf/download.html (Precompiled binaries)
  • Download: ftp://ftp.foolabs.com/pub/xpdf/xpdf-3.02pl2-linux.tar.gz

catdoc, xls2csv, catppt

  • Reference: http://ftp.wagner.pp.ru/~vitus/software/catdoc/
  • Download: http://ftp.wagner.pp.ru/pub/catdoc/catdoc-0.94.2.tar.gz

unrtf

  • http://www.gnu.org/software/unrtf/unrtf.html
  • http://www.gnu.org/software/unrtf/unrtf-0.20.5.tar.gz

cat

  • Reference: http://www.oreillynet.com/linux/cmd/cmd.csp?path=c/cat
  • Download: Not necessary comes installed with Apache

How-to Un-TAR and Un-GZip Files From the Command Line – September 20th, 2008

Note: This article assumes that you have SSH access to a LAMP installation and are familiar or comfortable using the command line.

The command line is a tool that self taught developers often spend much energy avoiding as they first start to learn server side and database languages such as MySQL and PHP. At first I was extremely intimidated by the Terminal window and skipped out on a lot of tutorials that told me to log into my server via SSH, based only on the SSH factor.

As I started to get more comfortable with the basics of the PHP and MySQL, I also became more interested in harnessing the power of the command line and learning how these things depend on a greater stack of code.

I started out with a few simple VIM editor commands, editing php.ini and .htaccess files directly on the server. Once I started to branch out a little more I found out that instead of downloading large frameworks such as Drupal or ZendFramework and then having to upload them back onto the server (which can often take 30-60 minutes), I could do a quick wget http://ftp.drupal.org/files/projects/drupal-6.4.tar.gz followed by a quick tar -xvzf drupal-6.4.tar.gz. Bam! There it is no waiting, no download and upload.

TAR a file/folder(Foldername: drupal)
Example: tar cvf .tar
Usage: tar cvf drupal.tar drupal/

UNTAR a file/folder(Foldername: drupal)
Example: tar xvf .tar
Usage: tar xvf drupal.tar

GZIP a file/folder(Foldername: drupal.tar)
Example: gzip
Usage: gzip drupal.tar

UNTAR & UNGZIP
tar -xvzf

What week of the month is it? – September 12th, 2008

I’ve been toiling over the course of the week with a date problem in an email subscription list for a client.

Scenario:
I would like for any site user to have the ability to subscribe to any taxonomy of the site and receive an email based on the users personal preference of frequency. They would have the option to receive an instant update everytime a post is made to their subscribed-to taxonomy(s) or they could receive the digest email daily, weekly or monthly. Lastly, I would like to be able to control when the daily, weekly or monthly emails are sent. I would like to be able to choose the week of the month (if applicable), day (if applicable), hour, and minute (quarter hours).

Everything is pretty straight-forward and pretty generic as far as email management or “ListServ” style solutions go. My only hang up has been figuring out which is the first Tuesday or the second Wednesday or the fourth Friday of the month.

After much searching and hours of trial and error I came acrossed this post which gave the below solution. It takes the current day and returns which week of the month it is in.

<?php 
 
/**
 * A brilliant one-liner, considering most of the solutions I've seen have been a minimum of 10-20 lines of code.
 */
 $week = date('W') - date('W',strtotime(date('Y-m-01'))) + 1;
 
 
/**
 * While the line above is short and to the point, the code below is a verbose example of how one could utilize the one-liner in a real world situation.
 */
 
 
 class WeekNumber {
 
   private $DateString, $Day, $DayName, $MonthName, $Number, $Week;
 
  /**
   * Adds a suffix to a number (1-5)
   *
   * @return $DateString
   */
   final function Display() {
     $DayName = date('l');
     $MonthName = date('F');
 
     $DateString = "Today is the " . $this->_get_week_number() . " " . $DayName . " in " . $MonthName;
 
     return $DateString;
   }
 
  /**
   * Adds a suffix to a number (1-5)
   *
   * @return $Day
   */
   private function _add_suffix($Number) {   
     switch($Number) {
       case "1":
         $Day = "1st";
         break;
 
       case "2":
         $Day = "2nd";
         break;
 
       case "3":
         $Day = "3rd";
         break;
 
       case "4":
         $Day = "4th";
         break;
 
       case "5":
         $Day = "5th";
         break;
     }
 
     return $Day;
   }
 
 
  /**
   * Return the week number of the current week day
   *
   * @return $Week
   */
   private function _get_week_number() {
     /** Here's our one liner **/
     $Week = date('W') - date('W',strtotime(date('Y-m-01'))) + 1;
     $Week = $this->_add_suffix($Week);
     return $Week;
   }
 
 }
 
 $WeekNumber = new WeekNumber();
 print $WeekNumber->Display();
 
?>

Objective-C and Cocoa Ported to the Web – September 5th, 2008

The Heads of State Redesign Site – August 30th, 2008

I was looking for sites that utilized the Javascript History/BackButton library SWFAddress, because the studio I work at was looking into similar solutions for a site we were working on EcoDrivingUSA. While searching I noticed that The Heads of State used it and had just released their newest web site redesign.

I’ve been a fan of The Heads of State since I saw there first entires PRINT and HOW. If you’re unfamiliar with them they’re an amazing two man studio formed by Jason Kernevich and Dustin Summers with offices in Brooklyn, NY and Seattle, WA that is probably best known for their poster work.

Panic releases Coda 1.5 – August 26th, 2008

I’m so excited I just received an email from Panic. Coda 1.5 is now avaiable! YES!

Let’s do a quick feature run-down:

  • With the new version comes an amazing update that our Textmate-using, rival, developer friends have had for some time now. “Fully integrated source control with Subversion.”
  • Mixed-mode syntax highlighting (Javascript embedded in HTML)
  • Significant performance increases (Leopard only)
  • Search across multiple files locally
  • User customizable books
  • More AppleScript support
  • Web Preview now previews local PHP files
Check out the full release notes here.

How to make money online – August 15th, 2008

<div><a href='http://www.omnisio.com'>Share and annotate your videos</a> with Omnisio!</div> <p>

David Heinemeier Hansson

David Heinemeier Hansson speaks at a Y-Combinator meeting on “How to make money online”

Rapid Prototyping with 960px – August 12th, 2008

A list of thoughts on the use of grid systems to layout and prototype web sites and web applications based on a 960px base.

Design Element Gallery – August 8th, 2008

This I’m definitely into. A really simple, really nice website, that has a nicely organized and growing collection of all types of web design elements.

It’s the little things make a design great

Applications for the Mac Web Developer – August 8th, 2008

Over at Rawkes, is posted an article listing “8 Killer Web Development Apps…”. A really fantastic write up, I especially endorse using Coda. I would say aside from the 8 listed, I would add only two, Transmit and Versions.

Transmit is, in my opinion, the best FTP application for Mac OS X around, you can sync it with Mobile .ME, save out droplets, use the simple dropbox widget or interface with Amazon’s S3 service.

Verisons is a beta application that beautifully interfaces with Subversion so you don’t have to spend quite as much time in Terminal (if that’s what you prefer). Although the price range or official release date has not been set yet, the Versions team has been escpecially generous with the ever extending beta application.

Check out all of the applications over on Rawkes

Also make sure you try out Transmit

If you use Subversion (SVN), and haven’t downloaded the Versions beta, do so now