daily minutia on Twitter

  • via @BikeCrave: A tribute to cycling legend Laurent Fignon who lost his battle with cancer. http://bit.ly/apec9n. What a legend. 2 days ago
  • Classy. I just hand-poured washer fluid on my car with the wipers going because shit is broke. 2 days ago
  • RT @jvaleski: New Blog Post: "Exits; You're Doing it Right" - http://bit.ly/dmaSvK (Nice post, & I could not agree more with your examples.) 2 days ago
  • @CaroDonahue Happy Birthday! As a convenient gift, you should keep my Spiritual Gangster T-shirt. You are a much better wearer of it than I. 2 days ago
  • Could not have had a better morning. Why, you ask? Because @jmalan dropped off some lemon blueberry scones. Thanks love! They were great. 2 days ago
  • More updates...

I'm Ingrid Alongi, a developer in Boulder, Colorado. I'm a co-founder at Quick Left, a Web Engineering company. I used to be a software engineer at Gnip where API integration and social media data were my world. Prior to that, at OneRiot, I wrote web applications using Java/Wicket/CSS. I've got experience with CodeIgniter for PHP, but mostly use Zend with Doctrine when it comes to PHP. Got some JQuery too.

I've been in the web development/interactive agency world for almost 10 years, with most of my experience in building database-driven web applications (PHP, ColdFusion) for consumer facing clients (e-commerce, email marketing, advertising, cms, etc.). Lots of strategy, lots of driving traffic back the web site types of stuff. Oh, and managing an amazing team of developers.

I'm an electronic music snob, ex national level cyclist, I play violin and cello, and have an MA in Women's Studies. You can contact me at ialongi at yahoo . com. Or, mosey on over to the Quick Left blog to see what I'm up to.

Recursion in PHP

December 7, 2008, 2:21pm by electromute

Well, I’ve been a bad blogger lately, lots of awesome stuff going in in the world of Ingrid. I’m now working at Gnip. I’ve gotten the chance to do some really cool stuff there, having a great time for sure!

In any case, here’s a little snippet of something I wrote. In Computer Science, recursion is a major conceptual hurdle to get through. Once you master it in school, you sadly may or may not ever see it again. Well, I was fortunate enough to need the beauty of recursion recently.

Say you are trying to calculate the date of the first Sunday in September of 2008. You know that the first day of September is September 1st. The following recursive function in PHP will take the parameters and return the day part of the date. For instance,

// find the first Sunday in September of 2008
// Note that the day of the week in PHP for Sunday is 0.

echo addDay(“9″, “1″, “2008″, “0″);

This will return 7; the first Sunday in September of 2008 is, indeed, September 7, 2008. Here is the function:

function addDay($m, $d, $y, $dbase){
   $tmpDate = mktime(0, 0, 0, $m, $d, $y);
   if (date(“w”, $tmpDate) != $dbase){
     return addDay($m, $d + 1, $y, $dbase);
   } else {
     return $d;
   }
}

Tags: ,

   Read More »




Help in Isolation: How I Finished my First WordPress Plugin

September 12, 2008, 3:20pm by electromute

Or “How I finished my first WordPress plugin without being a total n00b”

One common issue when you are working with a new technology or api for the first time is figuring out the best practices and snags. Sure, once you have been writing code for over 10 years, you can pretty much hang in any language. However, it doesn’t mean what you are going to write is any good. The biggest problem is that engineers tend to re-invent the wheel. My friend Tobias and I were having a conversation about this when he mentioned this book “Dreaming in Code” which illustrates this issue very well.

I recently wrote my first WordPress plugin for Me.dium. It’s not released in the wild yet, but I have it here on my blog (on the right, under the MyBlogLog widget). I pull in an RSS feed of Me.dium’s hot search terms. The feed is cached in order to reduce load on Me.dium’s servers. You can also configure the number of terms to show as well as whether or not to show the descriptions. The plugin itself is very simple, but the value I got was in the process of writing it.

So, how did I write a solid PHP plugin in a room full of Java Engineers who may not even know what WordPress is? I decided to work as collaboratively as possible, even in isolation. I tried to keep to my motto–If you have to force it or it’s too hard, you are doing something wrong.

First I set out to ask some experts. I sent an email out to some WordPress hot shots asking how to approach certain problems from a strategic perspective. How is it best to store settings? What level of configuration is too much to ask for users?

Not everyone answered my email, but Alex King did. He saved me hours of research work by letting me know about the settings table (duh!).

I went on a hike with some buddies, including Alex from Gnip who helped me consider the best time to parse and store my xml. My tunnel vision was so focused on storing the data that I couldn’t see that there was a better way to store it. My original plan for storage seems completely absurd now–what was I thinking? More hours of work saved with a simple conversation.

I also posed my question on seesmic:


WordPress Plugin developers out there

Anyway, the point is I had a ton of fun and the process ended up being quite collaborative, even though I was working somewhat in isolation. I am happy to write a more technical blog post as per my usual, but wanted to share this higher level thought process.

ps. Special thanks to Jud for pointing out that there was NOT a for loop bug in my Windows PHP install, but that I was missing a $ in the middle comparator. SRSLY!

Tags: , , ,

   Read More »




Using helpers in CodeIgniter

August 21, 2008, 7:28pm by electromute

I’ve been using CodeIgniter now for a new project I’m working on called Giftola. CodeIgniter is an MVC framework for PHP. I like CodeIgniter because it’s very lightweight, yet it offers some pre-built functionality to deal with some of the tedium (like form validation) of web development.

I’ve used other PHP frameworks in the past, and I find the way CI organizes files to be very intuitive and things are easy to find.

One problem with using frameworks is that often developers don’t actually utilize all of the features of the framework, often reinventing the wheel. In this post, I’m going to go over a very simple, but useful feature of CI, helpers.

Helpers are functions that are stored in a central location in the CI framework, and then utilized anywhere in the application. I’m going to demonstrate a simple helper I wrote called timestamp. Timestamp formats a date time string for SQL insertion. This helper allows me to ensure consistency across my entire application.

Here’s how they work.

CI has its own helper functions, which are located in:

/system/helpers

You can add your own helper functions to the following location:

/system/application/helpers

Your file must be named in the form: helpername_helper.php. In my case, I’m going to create a file called:

timestamp_helper.php

where I’ll write a very simple function:

<?php
if ( ! defined(‘BASEPATH’)) exit(‘No direct script access allowed’);

function timestamp(){
return date(“Y-m-d H:i:s”);
}
?>

I use this function most often in my Models, so I’ll load it up here. In this case, I have an event model, where I’ll use the helper quite a bit. So, I’ll load it in the constructor.

<?php
class Event_model extends Model {

function Event_model()
{
parent::Model();
$this->load->helper(‘timestamp’);
}

}

?>

Finally, when I want to grab a timestamp, I simply call the function:

$data = timestamp();

A pretty simple example, but hopefully it will get you thinking on how to consolidate functionality that you use often into the helpers structure.

Tags: , , ,

   Read More »