Saturday, May 31, 2008

SociaLink at Last

We quietly posted SociaLink -- a social bookmarking extension for Dreamweaver -- on the website last night. This continues our Web 2.0 theme in our extensions for Dreamweaver. We've got RSS ReplayRSS DreamFeeder, and now SociaLink

I've got lots to say about SociaLink, but that will begin on Monday with Press Releases and so forth. Its just nice to finally get it onto the website. Honestly, there's lots of new products in the pipeline and the next 6 months will see updates and intros probably on the order of 1 a month. There's also a new website and new tech support system cooking in there somewhere.

Anyhow I just wanted to post a quick note saying Hello SociaLink. I hope you use and enjoy the software.

Tuesday, May 27, 2008

No Coding Tip This Week

Hello Readers

Thanks for reading the blog. Sorry to say that I'm not posting a
coding tip this week. Its new product season and we're trying to get
a new product out before the end of this week. Kinda important
because I'm giving a talk about it at the Spring Break conference
next week. So I'm coding like mad this week (and writing
documentation and building new web pages and updating the ecommerce
system and the serial number generation system). I'll bring more
tasty code chunks next week.

Also, 3 weeks into new product Emilia -- all reviews are positive. :-)

Look at the pretty baby!

Monday, May 19, 2008

Showing Attributes with For Each

So I have been working further with my development frameset and adding attributes to the object that I am building to control social bookmarking on a web page. There are over 24 different attributes and I may have to add more. I'd like to see what they all are when I run a test and I'd like the flexibility to see any new ones I add without having to add new code to the testbed.

As it turns out, its not actually that hard to do with current JavaScript (though early versions of JavaScript didn't support this).

I have added a DIV block to the page called "showattrs" and that's where I'm going to drop the output of this little script.
<div id="showattrs"></div>

Then I've written a simple function that accepts an object as its parameter and uses the for each loop to go through the elements within the object.

function showattrs(theObject) {
var out="<pre>"
for (var attr in theObject) {
out+=attr+":"+ theObject[attr]+"\n"
}
out+="</pre>"

var block = document.getElementById("showattrs")
block.innerHTML=out
}

This works with objects or associative arrays -- which are essentially the same thing in JavaScript. Now I just call this function after I make my changes and update my display.
showattrs(sclSociaLink)

I added the pre tag to it to make the text monospaced just because its my preference for codey stuff.

Now, I know its called a for each loop, but the word "each" doesn't actually show up when coding this (it does in some other languages). The line
for (var attr in theObject)
can be read as
for each attr in theObject
I think its important to be able to read code in english. It helps to clarify thinking and makes debugging much easier. By the way, if you don't already know, var is just for making the variable attr a local variable.

So this will show all the attributes and in some browsers it will also show the code to any methods you have defined for your object. In all browsers it shows them in order of definition. So as a rule I define my methods after my attributes. This makes sure that I will see the attributes first, and then the methods.

Also, this is a cool spelling error capture. How often have you typed object.attrivute instead of object.attribute. It just happens. Well if you have done this you will now notice that attrivute is within the list. I just copy it (copy so I don't mistype again) and the do a global search on my code to find where I made my mistake.

Happy coding.

Monday, May 12, 2008

Spring Break Session: How to Make Social Bookmarking Work for Your Website

Here's some more information about the session I am giving on June 3 at the Spring Break Conference in Ohio.

Session Title:
How to Make Social Bookmarking Work for Your Website

Session Description:
Social Bookmarking is a useful tool for getting the right kind of traffic to your website. Web users can share links pointing to your pages along with descriptions and evaluations of the content. It's that meta-information that helps drive people interested in your content to your pages. And the extra links are great for SEO (search engine optimization). In this session we will discuss these advantages and more along with a review of tools (from code to push-button simple) to help you get the job done.

Development Frameset

So I've been working on a JavaScript tool that will control the linking and display of an element on a web page. The content will be generated by the script and will naturally be dependent on parameters passed and properties of objects. And just like any script its got to be tested in lots of web browsers.

Eventually I'll be using document.write to place the content onto the page, but while developing the page I change the innerHTML of a div within the page. That also means that when I change the settings I can regenerate the block and see if everything is working. Now some people might ask why not just stick with innerHTML instead of document.write, but this approach will allow me to have no impact on the layout if JavaScript is disabled and to have multiple of these elements within a page if needed. Some coders might think document.write is antiquated, but I believe in using the right tool for the job, even if they are a little well-worn.

<div id="show"></div>

var block = document.getElementById("show")
block.innerHTML=generatedElements

Now as I am working on this I want to be able to change the attributes of the object that controls the display. One easy way to do this is to add controls. I could add them to the same document, but then my test document becomes less reflective of the documents that will hold the code in the end. Also, my test document has to meet some requirements -- for example, it has to be a template-based document -- and I didn't want to mess that up.

So what I did was make a frameset with controls on the left frame and my test document on the right. Now I can enter exactly the parameters that I want to test and see the results immediately.
What makes this a little slicker is that I named each form element that controls an attribute "atr_XXXX" where "XXXX" is the name of the attribute to be modified within the object. Now I simply cycle through the form's elements and modify the object's attribute with that name (I use eval to make is simpler). And because its in another frame I have to poke at it with parent.rightFrame. I think it works really well.



function Update() {
if (parent) {
var l=document.theform.elements.length
for (var i=0; i<l; i++) {
if (document.theform.elements[i].name) {
if (document.theform.elements[i].name.substring(0,4)=="atr_") {
var out='parent.rightFrame.sclSociaLink.'
out+=document.theform.elements[i].name.substring(4,
document.theform.elements[i].name.length)
out+="="+document.theform.elements[i].value
eval(out)
}
}
}
parent.rightFrame.showTestbed()
}
}




Sunday, May 11, 2008

RSS DreamFeeder in use at Lawrence Livermore National Lab

So how cool is this -- it makes me miss my Naval Research Lab days.

I spent a few hours this week helping Bob Hirschfeld, Sr. Public Information Officer at LLNL Public Affairs. The main website at Los Alamos has a really nice set of RSS tools that are database driven. Bob was excited by that, but had a static website at Lawrence Livermore so he couldn't make that work for his site. That's exactly why he needed RSS DreamFeeder.

He configured RSS DreamFeeder himself, using his template and the Content Sampler tool and managed to get the feed working with a minimum of fuss. Simply selecting the text he wanted and sampling it. He had a bit of a problem processing the feed, but with a quick tweak and some direction (and his reading my article on webreference) everything was up and running in no time.

Its a good feeling to help folks make their website better with a tool that I made. 

Check out his feed here



Wednesday, May 7, 2008

Speaking at Spring Break Conference at Ohio University on Tuesday June 3

Dave Hannum and I spoke yesterday and I'm putting together an outline for a talk on Social Bookmarking. This will be my second year speaking at this conference.

Take a look at http://www.sbconference.com/2008/ for more information. I'll also put up some information about the talk here as well. Hope to see you there.

spring <br/> conference 2008
Tuesday June 3 2008 at
Ohio University in Athens, OH

Thursday, May 1, 2008

Welcome Emilia Katherine

At 12:41 pm on Thursday May 1 a beautiful little new person entered my
life.