Wednesday, October 29, 2008

Adobe - Developer Center : Using Ajax to retrieve data from ColdFusion

Adobe - Developer Center : Using Ajax to retrieve data from ColdFusion

Adobe Platform Evangelist Adam Lehman demonstrates how easy it is to populate drop-down lists in a simple application with data from ColdFusion.

Monday, August 11, 2008

Navigating The Science (And Sociology) Of 'Traffic' : NPR

Navigating The Science (And Sociology) Of 'Traffic' : NPR

Vanderbilt's book Traffic: Why We Drive the Way We Do (and What It Says About Us) explores the sociology of driving — why roads are most congested on Saturdays, what percentage of traffic is drivers simply looking for parking, why new cars crash more often than old ones. The book is based on research and interviews with driving experts and traffic officials around the world.

Thursday, June 05, 2008

Dreamweaver CS3 bug?

working on some CSS and added
#header { background-color: ccc; }
to the style shee. looked OK when I refreshe the Design view in dreamweaver. previewed it in a browser. There was no background color. I checked to make sure the link paths were correct. I soon noticed I didn't have the # before the color value. D'oh!

Monday, February 11, 2008

I needed a refresher with RJS so I watched Peepcode’s screencast on RJS. I know it was not rails 2 so I decided to share what I changed to make it work with rails 2.

I used the SQL lite db for the demo. To set it up I created the rails project
rails rjs_demo

I used the scaffold to get it off the ground
script/generate scaffold Task name:string value:integer
And that will take care of the CRUD, routes and all that fun stuff.

You don’t need the dom_id plugin we can use the div_for

I’m just used the index.html.erb file instead of making a list file.

I added to the routes file
:collection => { :hello => :any }
To the map.resources :tasks line and the link now says
map.resources :tasks, :collection => { :hello => :any }

The link for the say hello
<%= link_to_remote "Say Hello", :url => hello_tasks_path %>
Instead of
<%= link_to_remote "Say Hello", :url => tasks_url(:action => 'hello') %>

In the tasks_controller.rb add a hello method.
def hello respond_to do |format| format.js end end

add into the views/tasks folder the file hello.js.rjs
page.alert "hello world!"

Partials.
For the tasks partial create the _task.html.erb file.
With rails 2 you can call a partial but using <%= render :partial => @tasks %>
and then in the task instead of using the dom_id you can use the div_for

Highlight me.
In routes file I added
:member => { :highlight => :post }
to the map.resources :tasks line. It should read
map.resources :tasks, :collection => { :hello => :any }, :member => { :highlight => :post }

that gives us the route
highlight_task POST /tasks/:id/highlight {:action=>"highlight", :controller=>"tasks"}

so the link is <%= link_to_remote "highlight me ", :url => highlight_task_path(task) %>

In the controller
def highlight @task = Task.find(params[:id]) respond_to do |format| format.js end end

And make the highlight.js.rjs file

the form.
you can use the remote_form_for
<%= error_messages_for :task %> <% remote_form_for(:task, :url => tasks_path, :html => {:id => "task_form"}) do |f| %> <p> <b>Name</b><br /> <%= f.text_field :name %> </p> <p> <b>Value</b><br /> <%= f.text_field :value %> </p> <p> <%= f.submit "Create" %> </p> <% end %>

And in the index.html.erb file call the partial
<%= render :partial => 'form' %>

Don't forget the add the format.js in the is @save section

Now make the create.js.rjs file
page.insert_html :bottom, 'tasks', :partial => @task page['task_form'].reset
When adding the super_special class I changed the link to
page.call "set_class_name", "task_#{@task.id}", 'super_special'
and it works

now destroy
In the destroy.js.rjs file
page.remove "task_#{@task.id}"
and add the format.js to the destroy method.
The destroy link will look like.
<%= link_to_remote "destroy", :url => task_path(task), :method => :delete, :confirm => "Do you want to delete '#{task.name}'?" %>

Replace.
_totals.js.rjs file I used this line
page.replace_html 'task_totals', @task_totals

The shared error file
create the shared folder and add an error.js.rjs file to it
the code it the same in the rjs file
in the tasks_controller in the condidtional andd this for an error
format.js { render :template => "shared/error.js.rjs" }
that will make the popup work.

These are my rough notes.

John

Tuesday, July 10, 2007

Trip to Erie PA
Amy and I went up to Erie on June 21st for Jeff Mattoe's funeral. It was very sad. He looked liked at anytime he would sit up and say "Boo." He suffered from a massive heart attack. John Dalton Works for Bruger Funeral Home. He went to the hospital to get jeff and preped him for the viewing.

-----------------------------------------

Jeffrey J. Matteo Loving Husband and Father Jeffrey J. Matteo, 40, of Erie, died unexpectedly at Hamot Medical Center on Monday, June 18, 2007. Born in Erie on June 24, 1966, he was a son of Jeffrey J. Matteo and Barbara Graham Matteo, both of Erie. Jeffrey was the Detail Manager at Car Care II on W. Eighth St. in Millcreek. Jeffrey was an avid fan of the Dallas Cowboys and Chicago Cubs. He enjoyed playing golf and belonged to a dart league at Lombardo’s Tavern on W. 21st St. In addition to his parents, Jeffrey is survived by his loving wife, Carla Nemenz Matteo; two adoring children, Dominic and Anthony Matteo; two brothers, Michael and Daniel Matteo, wife Star; two nieces, Kara and Samantha Matteo; one nephew, Corey Matteo; a grandmother, Caroline Graham, all of Erie; two uncles, his Godfather, James Graham, of Shreveport, La., and David Graham of Erie; an aunt, Linda Chase, of Erie; and many loving friends. Friends are invited to call at the Brugger Home for Funerals, 1595 W. 38th St. at Greengarden Blvd. on Thursday from 2 p.m. to 5 p.m. and 7p.m. to 9 p.m., and may attend a prayer service there on Friday at 9:15 a.m. followed by a Mass of Christian Burial at Our Lady of Peace Church at 10 a.m. Burial to follow. In lieu of flowers, memorials are suggested to the Jeffery J. Matteo Memorial Fund, c/o NW Savings Bank, Kmart Plaza West, 2863 W. 26th St., Erie, PA 16506. Condolences at bruggerfuneralhomes .com. Sign the guestbook at www.GoErie.com/obits.
Published in the Erie Times-News on 6/20/2007.

----------
http://www.legacy.com/ErieTimesNews/GB/GuestbookView.aspx?PersonId=89282122

Tuesday, June 12, 2007

Anchoring an Image to the Bottom Right Corner of a Flash File.

I need to dynamically load images into flash but the width and height could very but the image needed to stay in the lower right corner. With the help of the Help in flash this is what I came up with.

--------------------------------------------

this.createEmptyMovieClip("container", 0);
var image_mcl:MovieClipLoader = new MovieClipLoader();
var mclListener:Object = new Object();
mclListener.onLoadInit = function(target_mc:MovieClip) {
trace(target_mc._name+" = "+target_mc._width+" X "+target_mc._height+" pixels");
trace("stage width " + Stage.width + " stage height " + Stage.height );
image_mc._x = Stage.width - target_mc._width;
image_mc._y = Stage.height - target_mc._height;
};

image_mcl.addListener(mclListener);

image_mcl.loadClip("http://rcm-images.amazon.com/images/I/11I4WKohKxL._SL110_.jpg", container);

--------------------------------------------


Now I know the example loads a hard coded image so it's not dynamic but this is in addition to an earlier post

Wednesday, April 25, 2007

Developing a flash piece to read an XML doc and then randomly show images.

We have an XML document that has names of people and the associated image for that person. The structure is

people
+ person
++ name
++ picture
+ person
+ person
++ name
++ picture
+ person
people


We'll load the document into flash.
Then we'll loop through each person node and extract the name and picture values.
We push those values into a two dimensional array.
After we have inserted all the values into the array we'll get the length of the array.
We'll take that value and pass it into a random number generator.
We'll generate a number no greater that the array length minus one. (if there five people we need a number between zero and four since arrays start numbering at zero and if we returned five we would get an error.)
Then we'll take that number and use it to get a person from the array.

So if we have five people in the XML document we will generate a number ranging from zero through four
If we return the number three we get the fourth person in the XML document.

So we Just edit the XML document to add or remove people and never have to touch the flash source code to make changes.

Wednesday, December 13, 2006

A CMS In Ruby on Rails

I am starting to build a rails app for a content management system. I think this will be a little different than the ones I've seen. Meaning this will be used to manage various types of content not just update/manage web pages. Ok so that's old school CMS
I will be thinking out loud on this so we'll see if this holds true to my original thoughts.
I want to be able to create content, as in write an article about something. and that something might have a attachment to it. example, write about a white paper or some code and attach a zip file. Maybe I just want to upload an image/pdf. A message board?
It will have security on it. That is the part I am working on first.

Wednesday, May 03, 2006

Technology Review: Emerging Technologies and their Impact

Technology Review: Emerging Technologies and their Impact: "The Times Emulates Print on the Web

Microsoft and The New York Times have unveiled software that preserves the print edition's design online."

Something else to design for. Wee.