February 2008
Monthly Archive
Sat 23 Feb 2008
Posted by trent under
JavascriptNo Comments
I’ve was playing around with mootools and threw together a quick little function to do a fade in, fade out rotation of “layers” which would be just an image rotation or whatever you want to rotate. Here’s the function:
function startGalleryRotation(selector,delay){
var i = 0;
var layers = $$(selector);
delay = (delay == undefined)? 6000:delay;
setInterval(function(){
layers[i].fade(’out’);
i = (i == layers.length-1)? 0 : i+1;
layers[i].fade(’in’);
},delay);
}
To kick off this mighty beast we would then call:
startGalleryRotation('#galleryRotation img',6000);
Of course you will need to wait until the dom has loaded. Ok, wasn’t much but thought I’d share!
Fri 22 Feb 2008
The plugin everyone has been waiting for: Impromtu 1.3!!! Sorry for dragging around for so long on this but its here a long with some awesome additions and bug fixes!! Whats different you ask?
- An option to focus a button by default
- An option for zIndex if you need to change it from the default
- If you click outside the prompt you will get a nice blinking effect on the prompt
- Escape key should now close the prompt without submitting the form
- $.prompt now returns a container with the fade and the prompt created
- Fixed a bug if the body was shorter than the window so was the fade
So all of these additions what did you take out? Just the container option. This option in my opinion was too buggy and not all that useful, so away it went. So there we have it, please give it a shot and remember, it doesn’t have any bugs, just undocumented “features”. Enjoy!
Get It Here!
Tue 19 Feb 2008
As of late I’ve been swamped with web work on the side(not to mention my 8-5 job). I’ve tried a couple times to get to know some common frameworks, specifically Django and Ruby on Rails. I love their concept and its hard to rank one better than the other because they both have their selling points. However, a few time’s I’ve found myself going back to regular old php because of the limitations.
What limitations you say?? They’re open source frameworks, change them!
Well quite frankly as most developers will tell you they just don’t have the time to sit down and figure out the source code just to add one little tweak. From my experience the part that gets me is for really light weight sites ROR seems a bit over kill, and Django is almost perfect for these little sites except that one thing you want the admin to treat differently(by the way if you haven’t tried Django’s admin it builds for you automatically you have to give it a shot, its breathtaking).
So what do I always end up doing? Going back to my old trusty aedCFC and aedPHP. No this isn’t a promotional post. These two projects I consider a middle step between a framework and manually coding it all yourself as they create a finished user admin for you with a little configuration. So here are my Pro’s and Con’s:
Framework Pro’s
- They handle most of your sql for you
- They provide a templating system to separate your presentation from your logic
- They provide consistency, so if you need to add something down the road you have no trouble
- Some provide an automatic Administration site to manage your models
- Automatically provide clean urls
- Ability to change database engines at any time
- Caching built in
Framework Con’s
- Hosting configuration for your framework(unless you have hosting preconfigured)
- Overkill on the amount of files needed for smaller sites
- Lack of flexibility without changing the framework itself(I need to create thumbnails on the fly when I upload images in the admin, now what?). I think this is a major drawback.
- Too much configuration for smaller sites
- If the framework doesn’t provide an admin solution then you must design one as well, what has the framework accomplished?
So there are quality points coming from both sides of the table, but how do I know if I’m waisting my time with Frameworks. I think it all boils down to a few things. Of course if you already know the framework inside and out and you have no issues setting up a new site with your framework you should stick with that. But for a newbie who has little framework experience its a tough decision. You really need something in the middle. Almost every client these days needs an Administration site, and I think this is more time consuming than the front end many times. What would I be looking for in a framework? Here are a few things that come to mind, most already use these but some don’t:
- MVC. Most frameworks use this.
- Does not mix client side with server side. (.Net) With the exception of an Administration site, everything else should be left up to the developer to make the site look and operate the way I want, not the framework.
- Administration, but highly configurable(more so than Django). Maybe I can assign an events class with methods onAdd(), onEdit(), onDelete() to each Model. Also more media options like creating duplicate images and resizing when I upload a photo.
- Fewer files and directories for the framework. Some frameworks I get lost in. ROR in my opinion has too much to forge through. Maybe store all this in the server installation? I do realize some of this is for portability.
- Plenty of Hosting providers
Ok OK, maybe I’m nit-picking a little, but what is out there? I’ve been on the search lately. Anyone have a framework that works well? I don’t mind if you’re promoting your own projects here, we’re all in the same boat I’m sure. So lets hear it. Which framework is worth while?
Fri 15 Feb 2008
Posted by trent under
Impromptu[2] Comments
Hello Impromtpu users. I’m sorry to say as of late I haven’t had time to produce regular updates and upgrades to Impromptu. My work outside of “javascript land” has kept me from doing so for the past few months. However that being said over the next few months I hope to play with it a little more. Here are a few of my additions/corrections to the plugin which I plan to address:
- If container option is body and body is smaller than the client viewing window, then use the client height width for the overlay. (this would need to recalculate upon window resize)
- An option for the focused submit button
- More accessible form. As of now the form is not a true form, so hitting enter doesn’t submit it. It would be nice to have this work for accessibility.
- Add a promptClose function. This would allow you to call this function to manually close the prompt at any time.
Again these are a few of my plans(most of which I’ve gathered from the community, Thank You for your responses). Also as always if you have any suggestions, fixes, or improvements please let me know!
Thu 14 Feb 2008
Posted by trent under
ProgrammingNo Comments
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:

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!
Tue 12 Feb 2008
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 :).
Thu 7 Feb 2008
Posted by trent under
PHP[2] Comments
Through the previous 4 parts of this tutorial we’ve created everything we need to download our MLS feed with RETS. Now we need to make one small change to our batch file, and execute it. We need to use an Advanced Query to retrieve only Active listings from our RETS provider. You may want to first read over the Batch File documentation. Remember in creating the Source I mentioned choosing Status as a searchable field?
Creating an Advanced Query For Active Listings
First we need to go into our /vieleRETS/batch_control_files directory with a file browser or ftp manager. Open to edit the file with the name of your Extract. According to this forum post we need to query L_Status=1_0,1_1 so the final product should resemble this:

Save this file back to your server where it belongs. Now we’re ready to download our listings!(I know I know, its been long enough already…)
Executing the Batch File
If you’re on a remote server you will need to ssh into your server and into the vieleRETS directory. If you’re on a local machine just navigate via command prompt to that directory. If you read the documentation linked to above you know there are a few options while executing. But here goes nothing. I’ll use “My_Extract” as the name of your Extract, you should replace this with whatever you called yours. From the command line enter the command :
php -f ./run_interactive_job.php batch_control_files/My_Extract
With a little luck and a lot of time you are now downloading your listings. The only thing left is to schedule your download. I’ll leave this up to you as every hosting environment is different. Remember however when you set up your scheduled executer you will need to state the full directory path instead…
php -f /somedir/vieleRETS/run_interactive_job.php batch_control_files/My_Extract
Now go get a cup of coffee and relax after this stressful ordeal! You deserve it!
Wed 6 Feb 2008
Posted by trent under
PHP[14] Comments
Now we’re ready to create an Extract to link our Source to our Target. From the main menu go ahead and click Create from the Extract menu.
Creating an Extract
- Step one asks for the name, Source and Target. It would be a good idea to name it the same as your Source to keep up with it. Choose the cooresponding source and our target we created in the previous tutorial. Click Apply.
- The next step is for Batch Parameters. I kept the defaults except Batch_Size, set it to 100. This setting is really up to you. This is 10 by default but runs fine for me at 100. Clicked Apply.
- Step three in my case warns me my provider does not have a media server, which is fine since we will be downloading everything anyway. Click Apply.
- Step four ask about refreshing values. Set this to false. Click Apply.
- Step five is very important. Here is where you tell it which fields go to which database table columns. I generally place my mls number, class, type, status in the first few fields. Also it is a very good idea to write these down! As you create more Sources and Extracts you will want to keep the columns as similar as possible to search across all types of listings. (keep price in the same column so no matter if you’re searching Land or Condos, its always going to be in that column).
- Step six is the same thing but with the image table. You should be able to include all the fields, but keep these the same throughout all of your extracts.
Now we have our Extract. Our next step is to alter our batch file to retrieve listings with an Active Status only, and execute our batch via command line.
Wed 6 Feb 2008
Posted by trent under
PHP[2] Comments
Now we’re back out at the main menu where we can create, edit rename our Sources, Targets and Extracts. The next thing we need to do is create a Target(a local storage location). For this example we will set up a database(mysql to be specific, but any database should work equally as well). Before you proceed there is one thing you should do first.
Create Your Database Tables
Open up your database administrator(phpmyadmin, pgAdmin, etc..) and we will create two tables. One for our listings and one for the image names.
- listings table: Create a table “mls_listings” (you can call it whatever you wish). By default vieleRETS goes with exactly 24 fields, all varchar(255), named c1,c2,c3,…c23,c24 accordingly, but its been reported to work with any column names, so you may want to make them more descriptive.
- Images table: Create a table “mls_listings_images”. Same as before VieleRETS goes with 6 fields, all varchar(255), named c1,c2,c3,c4,c5,c6, but you may want to be a bit more descriptive.
Create Your Target
Now we’re ready to create the target within VieleRETS. Go ahead and choose the create option for Target.
- Step one is to create a Name for this Target. If you will have only one target Default should be fine. For Type choose Relational Database. Click Apply.
- Step two is the username, password routine. Enter these credintials and accept the defaults for all the others. Be sure Auto_Create is set to false. If it is set to true vieleRETS will recreate the tables every time you update. This is fine if you only have one Source going into this Target, but when there are multiple Sources going into the same table we do not want to drop the tables!
- The next step asks for your tables to add the listings to. Choose the tables we created earlier accordingly. Click Apply.
- Step four asks for the table columns of the listings table, make sure all are checked and click Apply.
- Step five asks for the table columns for the images table, make sure all are checked and click Apply.
- Step six asks for the image table key. Choose c1. Click Apply.
- Step seven asks where to save the images. This is completely up to you. But save them somewhere to be accessible by your web address ( www.mysite.com/mlsimages/ ) Click Apply.
We’re done with creating the Target! In the next step we will create an Extract to send all of our Sources to this Target.
Wed 6 Feb 2008
Posted by trent under
PHP1 Comment
Before starting I would like to be clear that we will be retrieving only entries with an Active status. The entire feed would be huge and frankly its just not needed. First off be sure you have downloaded and installed vieleRETS. The entire installation page boils down to just download it, unzip it, place it on your server, and execute the install.bat(Windows) or install.sh(Linux.. from the command line ./install.sh). Now we’re ready to begin, just navigate in your web browser to the vieleRETS/setup/ directory of your site.
Create Sources
You’ll notice on your landing page there are 3 categories like I mentioned in Part 1 or this series. We will be working within the Sources area for this part of the tutorial. For the most part we will accept defaults and enter necessary fields.
Click “Create” in the Sources menu.
- This first page is to enter the name of the source. Generally you could call it Residential, Commercial, etc..
- This second page is to enter your basic credentials and version. I only needed to enter RETS_SERVER_USERNAME, RETS_SERVER_PASSWORD, RETS_SERVER_URL, and Version. For the rest of this page I accepted defaults. Click Apply.
- The third page basically verifies your connection. If you don’t receive green success text you need to go back to the previous step.
- The fourth step is to define a Resource. Here I chose Property.
- Step five asks for the class. This is up to you which class you want to download. For now I’ll pretend we’re choosing Residential.
- Step six is simply auto detection and you shouldn’t have to do much but watch, wait, and cross your fingers. After the page loads at there very bottom you should have your results(hopefully success). Click Apply.
- Step seven is for Overriding Auto-Detection. I left the defaults alone and clicked Apply.
- Step eight is Important! Here you need to choose elements you might be querying the RETS server for. I chose the more obvious ones like mls number, class, type, etc, But as I stated at the top we are also going to retrieve listings where Status is Active. So we need to be sure and check Status from this list. Click Apply.
- Step nine is asking for the Agent Id. I chose the mls number. Click Apply.
- Step ten ask for you to pick date elements. This is up to you which ones you want to use as a date. Click Apply.
Thats it! You are now back at the menu page for this Source. All the options weren’t exactly obvious which ones are for you, but mostly the defaults work. Our next step will be creating a Target.
Next Page »