jQuery

•September 30, 2009 • Leave a Comment

I picked up the book jQuery In Action, and I think I love this library!  Actually, I picked it up a while ago and I’m just getting around to writing about it.  I recently built a website for watching the building of the new arena in Pittsburgh (which is down now because the building is big enough to block the webcam), and I used jQuery to do some really nice fades for image thumbnails.  The only problem was, I was following pre-written instructions and did not know what was really going on.  It did, however, introduce me to the magic of jQuery!

CSS consistency across browsers

One of the best things about jQuery is that you can (almost always) just put a line of jQuery in my web page and it will work across all of the major browsers.  I have had some very small issues with this, but nothing major compared to the amount of code it takes in straight javascript to do the same thing.

There’s also the selectors.  If you know CSS, then you can use jQuery.  jQuery works by creating a wrapped set of elements and performing some tasks on each element in the wrapped set.  The book i read uses the term wrapped set, but if that term is confusing you can just think of it as a group of elements that matches the selector you chose to use.

Any CSS selector can be used to query the page and create this wrapped set.  It even allows for CSS3 selectors and a couple of jQuery-specific extended selectors.  For example, consider the child selector #formId > h1 that would select all h1 elements nested inside the element with the id #formId.  This is not supported in IE6, but with jQuery you can use it anyway:

$('#formId > h1').css('color','red');

Simplify, Simplify, Simplify

jQuery is just simple.  You only need to know the CSS selectors to get the maximum power from jQuery, not which browser supports which selectors, etc.  The javascript file is much neater and more readable.  Take this example of code that was used to put focus on the first input on a webpage:

function setFocusOnFirstLocationOfInputType(type){
var elementsInputs = document.getElementsByTagName("input");
for (i=0; i < elementsInputs.length; i++) {
if(elementsInputs[i].type == type){
elementsInputs[i].focus();
break;
}
}
}

and now consider the jQuery that does the same:

function setFocusOnFirstLocationOfInputType(type){
$("input[type="+type+"]:first").focus();
}

Extendable!

The jQuery core library does everything I’ve mentioned and a lot more, and it is small.  If you need more, there are a lot of plugins available that supply very complex features (made simple!) like accordian or sliding menus (jQueryUI plugin), or extended selectors with regular expressions.

Some links to additional info on the library:

market research is hard

•September 15, 2009 • Leave a Comment

I took up a new project at work recently which is semi-related to software.  We are building a new system, and now we expanding our marketing efforts.  My new job for the last couple of weeks was to perform a market study of a niche market in Pennsylvania (Muncipal authorities — but not even, it is a subset of the authorities I’m researching) and determine how we are going to attack it!

Typically being a software developer (I am doing marketing because I also have an MBA), I assumed I would be able to find a nice and tidy set of websites that I could quickly consolidate and tweak in order to serve my purpose of data collection.  However, after the first four hours of looking at authority websites that look like they were created in 1995 (one even has blinking text!), I realized that this was not as easy a solution as I thought.

I took a step back and spent a day looking for associations and group sites.  This was a pretty good path, I found one site that listed a couple of hundred PA authorities websites.  I went with it and, not thinking I guess, started down the list going to each one and writing down email addresses.  By the end of the day, I had all of 31.

I quickly (compared to the rest of the day) put together an email questionaire template and fed the names and emails into it via mail merge (in MS Word).  Also, quickly, I received 4 or 5 replies.  It only took about an hour for them to come in!  And they were useful!  I learned my first lesson.

Just about all replies from email marketing come within 24 hours

No science or official theory behind that, but that was it.  I received those responses and no more.  And more, it seems to fit what I have always heard about replies: about 3-5% response from marketing sent out.

I wised up and remembered that technology could save me.  If I thought of a program that would be slightly useful, i knew someone else would have already written it.  And they did.  I downloaded (bought) a program called “email grabber.”  I took the websites I found, fed them into email grabber, and set it free.  It downloaded 3500 emails for me in about 20 minutes.

After sorting through those and finding the ones that actually went to people, I fed them back through my mail merge template, and guess what…  I got back 95% of my replies by the next afternoon, again at around a 3-5% rate.  This isn’t easy!  Now I’m on to contacting more people by phone.

Firebug Lite!

•February 28, 2009 • 1 Comment

I found a new tool yesterday that I hope solves a lot of my issues!  Firebug Lite! If you are a developer, you are probably familiar with firebug for firefox already.  It is a great tool for debugging just about all aspects of a web page.

I work a lot with JSF pages created using Java Pure Faces, so I do a lot of my CSS tweaking after the fact.  We create web applications that will be used by just about anyone, and unfortunately, people still use IE6 (or IE at all).  Firebug Lite allows you to add a debugging tool very similar to the Firefox Firebug tool into any browser by simply adding a <script> tag like:

<script type='text/javascript' src='http://getfirebug.com/releases/lite/1.2/firebug-lite-compressed.js'></script>

This is great!  I just had an issue last week where I needed this, but I only discovered yesterday in a tweet on twitter (follow my tweets – @mpickell).  The tweet directed me to tutorial9 where there is a nice write-up.

I’m really looking forward to using this tool, but I have found some issues with already.  I haven’t seen these documented, and I am not sure if they are problems with my configuration, so I am interested if anyone else sees the same thing.

  • I wasn’t able to get firebug lite working in IE6, and the CSS window on the right hand side didn’t work for IE7.  These are probably my fault, because I tested them through IETester, and not real installs.
  • I also tested in a full, normal install of Opera and had some issues.
  • I still need to test Chrome and Safari, but i’ll post that when i do.

So this is a great tool to have available, and I’m sure upcoming revisions will fix the issues I saw.  It is going to make life a lot easier.

Been slow!

•February 9, 2009 • Leave a Comment

Sorry!  I’ve been creating the blog for B6 Systems at http://www.b6systems.com/blog!  Take a look!

Testing web pages in multiple browsers

•January 8, 2009 • Leave a Comment

Like most other people, I need to test my web designs on multiple browsers because of the inconsistencies between all of them regarding javascript and CSS.  Mainly CSS.  The worst offender, of course, is Internet Explorer, and I have been having a lot of trouble figuring out how to test the different versions.

MultipleIE

The first software I tried was MultipleIE.  This software worked great when i was set up with MultipleIE running IE 5, IE 5.5, and IE 6, and the normal Microsoft installation of IE 7.  After installing IE 8 b2, which required installing MultipleIE’s version of standalone IE 7, everything blew up.  IE 7 and below would no longer allow me to select any input text boxes.  IE 7 and IE 8 wouldn’t let me use combo boxes because of the pop-up blocker.

IE Tester

Since that stopped working and I could not find any information online, I tried another application called IE Tester.  I’m not sure how this one works, it seems to be encapsulated all within one application.  The install package is around 120 megs, so maybe all of the IE applications are in there.  I haven’t use it that long, but it seems pretty good.  It reflects all of the IE errors I expected my application to have based on what MultipleIE seemed to be telling me.

VM

I then went on and asked a very knowledgeable friend for his opinion, and his exact tweet was:

VMware ESXi server (free), and lots of VMs. The run MultipleIE/FF/Safari on those VMs with different versions of Java, Flash, etc

which would be the ideal solution since you could run dedicated versions of everything.  But the logistics seem like they would be a nightmare.

So my search goes on.  I am trying to determine how others do this.

update:

VM: I started using an application called VirtualBox (I found it here), owned by Sun now.  It seems to be a nice windows-based application that will allow me easy connect to my network and load a single browser.  I’m still testing, and i need to see how easy it is to clone the machine once I get a clean install.