daily minutia on Twitter

  • http://twitpic.com/mr4a - Someone had a little fun with the monkey display. 8 mins ago
  • @storytlr There was a combination of Twitter downtime and and a Gnip upgrade over the last 36 hours. You should be ok now. DM me for help. 47 mins ago
  • Yay! They just replaced the broken anntenae on the marble snail on Pearl Street. I grew up playing on those animals. 1 hr ago
  • Enjoying lunch conversation with my coworkers and taking advantage of the gorgeous weather in Boulder. 2 hrs ago
  • @joshlarson I believe it is true that your nose is the only part of your body that continues to grow your entire life. 5 hrs ago
  • More updates...

I'm Ingrid Alongi, a developer in Boulder, Colorado. I'm currently a software engineer at Gnip. My world is now all about API integration. Diving into Google's data visualization API now. Previously, at OneRiot, I wrote web applications using Java/Wicket/CSS. I've also got a side project where I use CodeIgniter for PHP and absolutely love it. Diving into JQuery next.

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 develoers.

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.

Using ListView in Wicket

October 26, 2008, 10:31am by electromute

I’ve been spending a lot of time on Wicket lately for some exciting things that will be coming soon from Me.dium.  One cool trick I started using the ListView. If you’ve come from PHP or any other web language, you know the drill– display query data from the database on a web page.

Here’s a simple implementation of the ListView to help you get started. I’m going to take a list of employees and output them to the screen. This tutorial assumes you know the basics of how Wicket works. This is the portion where we’re adding components to the display piece.

EmployeesPage.java

(…)
List employees = new ArrayList();
//Now I’ll grab the output of the query and populate the ArrayList
try {
  employees = service.getAllEmployees();
}
catch (ServiceException e) {
  //write your handler here
}

//Now I’ll populate the ListView with the query results
add(new ListView(”employeesRptr”, employees) {
  private static final long serialVersionUID = 1L;

  @Override
  protected void populateItem(ListItem item) {
   User employee = (User) item.getModelObject();

   // image display
   item.add(new StaticImage(”profilePic”, new Model(employee.getPicture())));

   // name display
   StringBuilder name = new StringBuilder();
   name.append(employee.getFirstName());
   name.append(” “);
   name.append(employee.getLastName());
   item.add(new Label(”profileName”, name.toString()));

   // location display
   item.add(new Label(”profileLocation”, employee.getLocation()));
  }
});

Now for the display:

EmployeesPage.html

<span wicket:id=”employeesRptr”>

<img wicket:id=”profilePic” border=”0″ />
<p class=”name” wicket:id=”profileName”>Joe Schmo</p>
<p class=”location” wicket:id=”profileLocation”>location</p>

</span>

Enjoy!

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 »