Blog

  • Google doesn’t like Word Press Pages

    I put my hCard in my “About Codebelay Blog” pages, and noticed that doing a search on hcard-barce which is the DOM ID for my hCard returned 1 result. That one result was wrong.

    I checked my logs for any signs that Google hit page_id=2 and to my surprise, Google didn’t crawl that page at all. In fact none of the major search engines except for PDF Bot hit it.

    Is there a way to make my Word Press page with page_id in the URL more visible to search engines?

  • Automated Functional Testing with Selenium IDE

    Are you a web developer that gets tired of typing the same thing over and over when you’re coding forms? Look no further than Selenium IDE. It’s a firefox extension that you can download, and that allows you to do automated, functional testing.

    screenshot of selenium IDE

    You simply let Selenium record what you are typing and your mouseclicks, and then save what you clicked and typed as a test file. You can play back that test file as many times as you need to get that pesky bug fixed. Now you can troll the WoW forums with all the time you saved.

    Another tool to look out for is functional testing from the command-line using symfony’s functional testing tools. Unlike Selenium, you won’t need to open the browser. Currently symfony’s functional tester doesn’t work with sessions yet.

    From the Perl camp, there’s also WWW::Mechanize, but it won’t work with testing Ajax functionality.

  • The Friday Five for August 22nd, 2008

    Here are 5 links worth checking out before you head out the door:

    1. Tara Hunt blogs about Ma.gnolia going open source. This blog post provides a link to the git repository and google group.
    2. The Outside Lands Music Festival has a great line up!
    3. Another victim is claimed by the blue screen of death.
    4. The latest on the Chinese Gold Medalist age controversy.
    5. 37signals shares with us the Hollywood Launch method for launching a web app. Just pretend your web app is to be marketed like a block buster movie.

    Have a great weekend!

  • The Rails Console Makes Test Object Creation and Debugging Easy

    I really like how the Rails console solves the problems of test object creation and debugging.

    Usually, a web developer will push code to the webserver and hit shift-reload on the web browser. With the Rails console, you can avoid all that shift-reload madness.

    If I wanted to create 10000 blog posts for testing, I could do something like this:

    script/console
    10000.times
    { |i| Post.create(:title => “post number: ” + i.to_s, :body => “autogen Booyah!”) }

    Through the console I can also do debugging pretty easily:

    >> p = Post.find 888

    And get this as output:

    => #

    A lot of problems in Rails are just solved by running script/console and checking the values of certain variables that are pretty hard to get at through a web browser.

    There is pretty much no limit to what can be done through the Rails console. Konstantin Gredeskoul, web developer and songwriter, has found a way to load session data through the console.

  • Remember the Milk: An Off-line Capable Todo List with SMS Capability

    Do you do a “Note to Self” more than once a day and just wished that you could send one using SMS? I’ve been using that feature a lot with Remember the Milk which has now replaced Basecamp for my todo list.

    • I created an entry named “Todo” on my cell phone
    • When required I send an SMS to Todo.
    • When I get home and log in my to-do item shows up on my Remember the Milk Page.

    I never forgot anything that I’ve SMS’d to Remember the Milk.

    picture of Remember The Milk

    What’s also super cool is how you can edit your To-do items off-line because Remember The Milk uses Google Gears.

  • Installing Swift in symfony 1.1 — The missing manual

    There’s one little gotcha with installing Swift in symfony 1.1. The directions are correct but do not mention how to get around the error that outputs:


    Fatal error: Class ‘Swift_Connection_SMTP’ not found

    The solution is quite simple and involves creating an autoload.yml file in your project’s config directory. Here it is:

    autoload:
      swift_mailer_classes:
        name: swift classes
        ext:  .php
        path: %SF_PLUGINS_DIR%/swift
        recursive: on
    
    

    What I really like about Swift is how you can use your gmail account to send messages.

  • Mephisto: Blogging Software on Rails

    Blogging software should meet four important criteria:
    1) Easy import from a pre-existing piece of blogging software we’re not happy with.
    2) Spam filtering protection in comments
    3) Make it easy to add web analytics javascript tracking without deleting it during each upgrade.
    4) Should make it easy to not look like Mephisto blogging software or WordPress or like generic blogging software.

    Mephisto screenshot

    Mephisto meets all four criteria.

    Plus it leverages the advantages of Rails in that out of the box you can deploy to development, test and production environments. Also it integrates with no mess into shopify or any other Rails project that you might be working.

    Hats off to Rick Olson(Development) and Justin Palmer(UI/Design) for making Mephisto along with “a bunch of other cool people.”

  • Installing sfGuardPlugin in symfony 1.1 — A Guide for the Perplexed

    Like the verbally creative barfly, who is a dead ringer for a 21+ Juno, that you picked up during last call on a Friday night, symfony 1.1 starts to grow on you. Nevermind your friends, who found Erlang in some higher-scale, hipster, hippy hang out. They tell you it’s time to leave symfony 1.1. You’re perversely drawn to this framework and don’t mind racking up the future therapy bills.

    God is dead, and so everything is permitted, unless you can install something like symfony 1.1’s sfGuardPlugin to add logins and login protection to web pages. Like the initiation rites into the Eleusinian mysteries or the Freemasons, not everything is articulated on how to do the install. But below, for the first time, it is.

    Note: I use psymfony as an alias which really just means ‘php symfony’.

    • psymfony generate:app backend

    Now you can start following the guide written on the symfony website. Below is just from my shell’s history log:

    • psymfony plugin:install sfGuardPlugin
    • psymfony propel:build-model
    • psymfony propel:build-sql
    • psymfony propel:insert-sql — this didn’t work for me so I ended up just doing: mysql -uusername -p < data/sql/plugins.sfGuardPlugin.lib.model.schema.sql
    • follow the instructions in the guide above for fixtures
    • psymfony propel:data-load frontend
    • psymfony propel:data-load backend
    • vim apps/frontend/config/settings.yml
    • vim apps/backend/config/settings.yml
    • psymfony cc

    But you’re not done yet. Are you running into a propel connection error? Then you might have to edit some yaml files based on this blog post.

    In my case, I ended up having to edit config/databases.yaml by adding the following below:

       propel:
         class:          sfPropelDatabase
         param:
           phptype: mysql
           host: localhost
           database: dev_starster
           username: writes
           password: some_wicked_sick_password
           dsn:          mysql://writes@localhost/dev_starster
           datasource: propel
    

    Are we out of the woods yet?

    Unfortunately, symfony 1.1 has a signout bug, where sessions are not entirely cleared. Thanks to this blog post, I was able to hack something together.

    In apps/yourapp/modules/sfGuardAuth/actions/actions.class.php write:

    public function executeSignout()
    {
    if (sfConfig::get('sf_environment') != 'test')
    {
    session_destroy();
    session_write_close();
    session_regenerate_id();
    }
    parent::executeSignout();
    }

    You might have to link the sf_guard_user table to an account table, if you want the account table to do the authorization instead. If so edit apps/modulename/config/app.yml by adding something that looks like this:

      sf_guard_plugin:
        algorithm_callable: md5
        success_signin_url: @homepage
        profile_class: sfGuardUserProfile
        profile_field_name: account_id
        check_password_callable: [Account, checkPassword]
    

    In the lib/model/Account.php you should add code that looks like this:

      public static function checkPassword($username, $password) {
      	$c = new Criteria();
      	$c->add(AccountPeer::EMAIL, $username);
      	$c->add(AccountPeer::PASSWORD, md5($password));
      	$rac = AccountPeer::doSelect($c);
      	//print_r($rac) ; die();
      	if ($rac == TRUE) {
      		return TRUE;
      	} else {
      		return FALSE;
      	}
      }
    

    Here is a list of links that made getting the plugin working possible:

  • sfValidatorCompare Is Now sfValidatorSchemaCompare

    I’ve been running into other folks that have been having trouble with symfony 1.1 on Twitter. One common stumbling block is sfValidatorSchemaCompare.

    I’m just gonna paste code here, because I’m now a week behind schedule working with symfony 1.1 because I didn’t pad time for having to read a good chunk of the source of symfony 1.1:

    <?php
    
        $this->validatorSchema->setPostValidator(new sfValidatorAnd(array(
    	  new sfValidatorSchemaCompare('email', '==', 'email_confirm',
    		    array(),
    		    array('invalid' => 'The email adresses must match')
    		  ),
    	  new sfValidatorSchemaCompare('password', '==', 'password_confirm',
    		    array(),
    		    array('invalid' => 'The passwords must match')
    		  ),
    	    )));
    
    ?>
    

    Anyway it’s been cool getting props for posting code like the above. 😀

    Good luck!

  • Does Core Developer Think Symfony 1.1 Alienates PHP Developers?

    Have you ever coded in a framework and then woke up one day to find that all your code broke when you upgraded? That’s exactly what happened when symfony 1.1 was released without backwards compatibility. A core symfony developer, François Zaninotto, shares his thoughts about the non-launch of symfony 1.1.

    A couple key phrases, that he uses to describe the symfony core developers attitude to us mortals, are pretty disturbing:

    • If you just used symfony for one project, and left if afterwards because it lacked some feature that you needed, then you don’t deserve to be informed that this new release does have this feature.
    • Symfony 1.1 is so good, that it should not be left in everybody’s hands. Think of it as a forbidden manuscript of the middle ages, that only a few copyists ever read and got a fair picture of.
    • …there is no “First Project tutorial” at all for symfony 1.1.

    Caveat: Do not use symfony 1.1 unless you want to pour through source code.

    Problem: You’re working on symfony 1.1 and it doesn’t work as advertised.

    Solution: You have to pad your estimates on symfony based projects by at least a hundredfold. A form that should have taken me no more than an hour at Dogster ended up taking 4 days! Read this blog for important symfony 1.1 updates.

    So does François think that PHP developers are being alienated? It’s strongly suggested through his use of irony, and analogy of symfony to a medieval text, but does he say abandon symfony?

    Not at all. Rather his frustration noted in a follow up blog post has to do with the fact that he cares a great deal about symfony. If you were thinking about leaving symfony, François is enough reason to stay.