Programming


Creating the Cron Job

We’ve now created all the parts to our MLS system, but we often need one more finishing touch, a scheduled job to keep our listings up to date. To do so we first need to uncomment a couple lines in each batch file we created. Uncomment “UPDATE_BCF” and “UPDATE_ONLY” so it looks like the following:

RETS Batch Update

Now we have two options. You can create a cron job for each individual batch, or we can create a very simple shell script to kick them all off one after another. Then we only need to create one cron job to execute that shell script. Here’s what your shell script(or bat for Windows) should resemble(just create a file name retscronjob.sh):

#!/bin/sh
#
# execute this to update all feeds to database with cron job
#

cd /PathToVieleRETS/vieleRETS

php -q ./run_interactive_job.php batch_control_files/MyBatch
echo Updated MyBatch

php -q ./run_interactive_job.php batch_control_files/AnotherBatch
echo Updated AnotherBatch

Be sure to replace PathToVieleRETS and MyBatch respectively. Now our only cron job will be to execute this script: /pathToCronJob/retscronjob.sh. There you have it, a 6 step tutorial to completely handle all of your RETS MLS needs from retrieving the feed to creating a scheduled download!

Please pardon the mess of the site here lately.  Over the next week or so I will be doing a little makeover to the site.  I will do my best not to break anything in the process!  Any suggestions or logo designs are happily accepted although please don’t be offended if I don’t use it :).

Being a curious mind kills a developer with a timeline.  This is half of my everyday battle.  The other half is the financial situation to afford many tools we all love(Photoshop, ColdFusion, Apple).  So we’re stuck with a small budget but need to perform at our best.  This is why I love Open Source software.  My question to other developers is this: What low budget solutions get you through the day creating a website from design to database and everywhere in between?

First off I have to say my current development computer is running Ubuntu and couldn’t be happier with that.  My editors are Komodo Edit and gEdit.  I will use CFeclipse when doing ColdFusion, but thats normally my 8-5 job.  Since I’m not a stand out designer I use strong CSS and fewer images, but Gimp does most of my image work.  I look to possibly buy Fireworks though as soon as I’m able.(I want to learn Photoshop, but I’m more comfortable with Fireworks).  For databases I depend on MySQL, but since they were recently purchased by Sun, I am now exploring Postgres since I’ve always heard great things about them and I’ve been learning Django which also recommends Postgres.

Programming languages is never set in stone.  Although very fluent in ColdFusion, I can’t afford a license, and no Open Source CF solution is up to par just yet so I have been doing most of my work with PHP.  Django looks promising with the exception that a lot of their framework is changing(new forms), and server set up can be a booger.  For javascript I like them all!  jQuery, Mootools, Prototype, etc.. they all have their uses.

So a quick recap:

  • Ubuntu
  • Komoto Edit/Gedit
  • Gimp
  • MySQL/Postgres 
  • PHP/Django

Again these are my “at home” tools on a limited budget.  What tools get you through the day?

With Sun’s recent purchase of MySQL, is it to one’s best interest to move to one of the other leaders of open source databases? It could be too early to tell. With so many people dependent on MySQL its hard to believe anything will change, after all Java still is a pretty cheap commodity. I have already begun exploring other options, not saying I would abandon them but I’ve always had a good feeling about Postgres, and now might be a time to give it a spin. I’ve also used SQLite recently and that is a nice portable solution for light weight tasks(especially if you will be developing on one server and moving to another server). As of now I am keeping my eyes open but being a curious mind I am always trying new things. Only time will tell!

I rarely use sqlite, but I have to say it is a pretty handy database that in my opinion works very well.  Last time I used it I was on windows, but this go ’round I was using Ubuntu.  I was searching for a nice admin tool and none seemed to suite me as I needed to edit an SQLite 2 file but its always nice to be up to date and administer SQLite 3.  I found none better than to use the same windows program with Wine.  SQLite Administrator seems to me to be a pretty complete tool.  Here’s a screenshot of it running through Wine:

SQLite Administrator

Of course this isn’t as pretty as on Windows, but hey, I’m not going for looks here!  I do realize there are SQLite tools out there like this for Linux,  but there were requirements to compile and install them, and well, I think we’re getting a little too old for requirements with Linux.  Its almost easier to install Windows applications with Wine.  I guess this is the one place proprietary software has a slight advantage…  Any one aware of any other database administration tools out there for Linux/Ubuntu for various databases that exceed the standard tools(other than MySQL Query Browser and PGAdmin)?

Many may not know(I just recently learned) about using regular expressions within SQL statements. Instead of using substring functions and such, we can create a clean little regular expression(Oracle):

SELECT zip FROM zipcode WHERE REGEXP_LIKE(zip, '[^[:digit:]]’)

Keep in mind however that just like SQL syntax varies for each database(MySQL, Oracle, Postgres, etc.) so does the regular expression techniques. The following are a couple links to help you get started.

Unfortunately a little research shows SQLite does not natively support this. It sounds like dangerous waters to begin with, but if you know you won’t be switching database engines often the benefits can be rewarding!

I was waiting on the day when jQuery would have a plotting plugin. Wait no longer! Flot is now on the scene. With the easy jQuery syntax I’m sure it will win the hearts of plotting programmers everywhere:

$.plot($("#placeholder"), data, options);

Now I just need to find somewhere to use it!

Not sure if many people have discovered that you can actually submit forms with a blank action attribute. What this will do is submit to the same page(url variables and all). This is very useful if you’re a copy paste coder or need the flexibility of renaming files and not screwing up the action attribute. It appears to work great with Firefox, IE6-7, Safari, and Opera. W3 does state that the action attribute is required, but does not say the attribute can’t be blank(W3 on Forms). My html has also been passing validation testing so I take that as fair game! For those unclear here is what I mean:

<form action="" method="post">
....
<button type="submit" name="submitbtn"
value="1>Submit</button>
</form>

So see, sometimes slackness can actually help out!

Nearly every website these days have columns. Since we have grown out of the old table days and into this new era of CSS we tend to over think certain things like how to create two columns side by side which can vary in height, but still appear to be the same height. The solution is so simple its rediculous. We start out with a left column and a right column(could be three columns.. this will work just as easily, but I’ll keep it simple), two div’s floating side by side via float:right; or float:left;. Next we add a left border to the right column, which is the same width and color as the left:

border-left: solid 150px #aaaaaa;

This will shove your right column out of line, but no worries, step three we slide it right back into place. With a negative left margin on the right column we can literally slide the right column back up under the left column:

margin-left: -150px;

So basically we added two lines of code to the independent columns, now it never matters which one is taller, they fill in for each other. A simple Example.

It almost time.  I will be releasing the next version of jQuery Impromptu soon!  (Probably Sunday or Monday)  Among the next additions will be the following:

  • “Smart” iframe to cover elements that bleed through the fade(ie6, flash, applets)
  • “loadComplete” as a function to execute when the prompt has finished loading(after entrance effects)
  • A few CSS fixes for a few bugs.  This will go into the documentation for the CSS templates
  • Possibly using a form within the prompt to make it more “proper” and submitting easier
  • An option to focus a button by default

Thanks to everyone who has helped out so far on making Impromptu so great!  Please don’t hesitate to suggest something.  Keep in mind though, I want to do my best not to require any extra plugins and to keep everything as backwards compatible as possible so everyone has little trouble upgrading.  I look forward to hearing ideas!

« Previous PageNext Page »