It's Majax
"Any sufficiently advanced technology is indistinguishable from magic." - Arthur C. Clarke
  • Projects and Tools
  • GitHub Projects
  • Talks
  • Contact Me
  • What is Software?

Weirdness of Symfony forms

July 25, 2010 jmather Open Source, Programming No Comments code smells, symfony

Just a quick bit that I'm sure I will revisit later, but that I wanted to get out there sooner...

When embedded forms are saved, if you want to hook into the form save for the embedded form, use the saveEmbededForms function as save or doSave is never called on the embedded form.

The embedded form has it's saveEmbeddedForms function called, and then $form->getObject()->save().

I need to get in touch with the Symfony devs and see if we can't get some clarification on this setup in 2.0, as this "smells" wrong, but maybe it is just me.

Improved Symfony Widgets

July 24, 2010 jmather Business, Open Source, Programming No Comments javascript, jquery, symfony, widgets

One of the biggest problems with any user interface is ensuring the forms and controls are simple and straight forward to use. While Symfony comes with a great many of widgets that you can use in your forms, some of the most common ones are not as user friendly as one would hope.

Over the next week or two I will be releasing (and posting about) a number of symfony widgets that I've powered up with a little (or in some cases, a lot) of javascript. The first step, though, will be a plugin that adds jQuery and jQuery UI into your Symfony stack.

jQuery Status Box Plugin

July 24, 2010 jmather Open Source, Programming No Comments demo, jquery, oss

I have added my jQuery Status Box Plugin to the site. There is a version for jQuery UI 1.7.x and one for jQuery UI 1.8.x. I hope you find it useful!

Update: I added a live example!

Taking control of your future

July 21, 2010 jmather Business, Life 2 Comments business, life, management, productivity

Quite a while back, SEO blog SEO 2.0 had a post entitled "Hey Freelancer: Are You a Worker or an Entrepreneur?" which really made me think.

Back when I was freelancing as my sole source of income, I was so caught up in being a worker, that I didn't even realize I wasn't working towards being an entrepreneur. This article woke me up a bit... too bad it was many months too late! 🙂

So how about the rest of you out there? Are you worker bees, or are you entrepreneurs?

Contextually relevant search results

July 21, 2010 jmather Programming No Comments programming, user experience

A while back, Kyle Baley of CodeBetter.com wrote an article named "The search interface, or "How to find people"" where he discussed the vast array of interesting questions that come up when considering how to make your search results as relevant and useful as possible.

When he mentioned that his database did not support LIKE, I offered another method within Kyle's comment board. However I had a bit more of detail I wanted to go into, but didn't have the time to expound then.

Basically, I think many of Kyle's ideas are spot on, however, the best result may be to simply code a number of queries in, and provide them as fall-back options. Here's an example in PHP, my preferred language, especially for examples:

$query = $_REQUEST['query'];
 
$max_results = 10;
 
$results = array();
 
$queries = array(
  "SELECT * FROM contacts WHERE last_name = '?'",
  "SELECT * FROM contacts WHERE LEFT(last_name, ".strlen($query).") = '?'",
  "SELECT * FROM contacts WHERE first_name = '?'",
  "SELECT * FROM contacts WHERE LEFT(first_name, ".strlen($query).") = '?'",
);
 
foreach($queries as $sql)
{
  $results = array_merge($results, fetch_all($sql, $query));
  if (count($results) > $max_results)
    break;
}

$query = $_REQUEST['query']; $max_results = 10; $results = array(); $queries = array( "SELECT * FROM contacts WHERE last_name = '?'", "SELECT * FROM contacts WHERE LEFT(last_name, ".strlen($query).") = '?'", "SELECT * FROM contacts WHERE first_name = '?'", "SELECT * FROM contacts WHERE LEFT(first_name, ".strlen($query).") = '?'", ); foreach($queries as $sql) { $results = array_merge($results, fetch_all($sql, $query)); if (count($results) > $max_results) break; }

This way, you can return the ones you feel would be most relevant first, but then make sure you can provide for some of the edge cases as well.

«‹ 14 15 16 17

About Jacob Mather

I have been developing websites professionally for over 10 years. I like to help solve complex problems, and have a knack for break down sophisticated systems into simple functional pieces. I advocate strongly about the value of community, and really love talking about how to be a better developer.

Recent Posts

  • Introduction to building a programming language – Open West 2015
  • Testing Browser JavaScript Completely – Open West 2015
  • Give Your Engineers Wings, not Anchors: Building Tools for the Cloud – Open West 2015
  • Managing technical debt extraction within a large code base
  • The why of the thing

Recent Comments

  1. Edwin on How to fix the heck out of your Brother Control Center in OS X!
  2. fredrik on How to fix the heck out of your Brother Control Center in OS X!
  3. Michael Adams on How to fix the heck out of your Brother Control Center in OS X!
  4. Yined on Much more Eggs than Bacon: A Development Environment Cookbook – Code PaLOUsa 2014
  5. Samir on Building your first Selenium test with PHPUnit

Categories

  • Business
  • Code Snippets
  • Design
  • Life
  • Open Source
  • OS X
  • Patterns
  • PHP
  • Programming
  • Responsive
  • San Francisco PHP
  • Silex
  • Symfony
  • Symfony2
  • Testing
  • Tutorials

Archives

  • May 2015
  • November 2014
  • June 2014
  • March 2014
  • February 2014
  • November 2013
  • October 2013
  • August 2013
  • May 2013
  • March 2013
  • February 2013
  • January 2013
  • December 2012
  • November 2012
  • October 2012
  • September 2012
  • August 2012
  • July 2012
  • June 2012
  • April 2012
  • March 2012
  • February 2012
  • August 2011
  • April 2011
  • March 2011
  • January 2011
  • November 2010
  • October 2010
  • July 2010

↑

© It's Majax 2025
Powered by WordPress • Themify WordPress Themes