Archive for the ‘Web Development’ Category

Get Yahoo Weather with SimplePie

Wednesday, July 25th, 2007
Posted in Web Development · Tags: , , ,

SimplePie is a new PHP library made to make parsing RSS feeds easy and fun. Yes I said fun, because its very easy and the docs are well written. RSS is more than just news, it can be images, video and podcasts. Mash up the data however you want, I’ve seen some innovative and unique things done so far. They also offer sample code on making a site like popurls/Original Signal.

Figure I’d share some code I used with SimplePie and a Yahoo Weather RSS feed. I can’t post it all on the homepage as its really long. It does transform and output the data nicely (not any CSS styling but I do calculate the wind direction and some other things). Please note that Yahoo only permits you to use their Weather RSS feed on non-commercial sites.

(more…)

OpenLaszlo vs Adobe Flex

Thursday, July 5th, 2007
Posted in Web Development · Tags: ,

I watched a screencast of OpenLaszlo and a screencast of Adobe Flex.

From what I got here are some quick comparisons:

OpenLaszlo

  • Write your app one time and have it work in Flash and/or JavaScript. Both versions of it will look the same and function the same (with animations).
  • Your apps can be compiled on the server (via a Java Servlet) or precompiled offline and uploaded.
  • Backwards compatible with Flash 7 and 8

Adobe Flex

  • Users need Flash Player 9.
  • Has an awesome IDE for building the app (although don’t expect it to be free or the trial verison to last forever).

If there is one reason Flash took off like it did years ago, it’s because of the ease of builiding stuff in it. Applets should have probably done what Flash did, but they were slow to load up, involved tons of code and programming. With Flash, lots of people didn’t have to know how to code, they could simple build their graphics, drag and drop, make simple animations and add some ActionScript. Although I remember Sun mentioning they are looking into ways to get Java to work for RIA for the web more easily and Microsoft entered the arena with their Silverlight.

Web Development Guidelines

Saturday, June 9th, 2007
Posted in Web Development

Here are some Web Development and Design Guidelines (rules) that we use at work

Usability & Design

  • Consider ad positions before laying out Web pages instead of making it an afterthought.
  • Design ads for clickthrough performance, and without overloading with information.
  • Use favicons
  • Make navigation clear and self explanatory
  • Make pages scannable
  • Use brief language
  • Avoid text instructions whenever possible, but don’t make the user “figure it out” himself.
  • Establish value proposition/make benefit clear
  • Establish clear first read
  • Use reverse titles (Music - Amazon.com)
  • Optimize images for faster downloads
  • Make site design cohesive throughout the site
  • Survey and design for audience
  • Optimize page layout for 1024X768 or 800X600 depending on audience
  • Avoid text centering (most of the time)
  • Avoid text underlining except for hyperlinks (most of the time)
  • Publish SWF settings at Flash 6 (or Flash 7)
  • Always define image alt tags
  • Use ABBR tags
  • Use TITLE for icons

Development

  • Use CSS to define content over style
  • Avoid inline styles
  • Avoid inline scripting
  • Use noscript when possible to display something when JavaScript is turned off
  • Favor CSS layout over JavaScript or images
  • Favor CSS layout over tables whenever practical
  • Consider page load time
  • Create a CSS printer-friendly stylesheet
  • Comment code sensisbly
  • W3C validate XHTML/CSS
  • Cross browser/platform test all pages

Search Engine Optimization

  • Consider SEO as a consideration in branding/naming conventions
  • Use breadcrumbs whenever possible
  • Define image alt tags
  • Always define description/keyword meta tags
  • Use descriptive, dynamic title tags
  • Use h1 - h6 tags for headings or titles whenever possible
  • Remember JavaScript and Flash make links and content “invisible” to spiders
  • Site navigation should always rendered in HTML text (most of the time)
  • Use a site map even on smallest sites to aid in SEO
  • Use dynamic header meta tags
  • Do not use meta-refreshes
  • Use “spider-simulator” software to test how much of the site is indexable.
  • If the site starts or is driven by JavaScript or Flash, duplicate the link in pure html text elsewhere.

In House Systems

  • Stay up to date on new trends (new tips are on the web everyday)
  • Use standardized procedures whenever possible
  • have a naming convention and folder organization convention
  • Communicate effectively.

Security

  • Don’t trust any user input
  • Don’t rely on client side validation only (test with JavaScript disabled)
  • Require email validation (reduces spam)
  • Prevent maxlength on serverside also
  • It’s better to allow only what is necessary, than to try to think of everything you need to block
  • Parse any HTML or any other possible code injections or database injections in any forms
  • Use POST rather than GET

Handling Checkboxes, Radio Buttons and Select Options in jQuery

Wednesday, May 30th, 2007
Posted in Web Development · Tags:

I figured I’d share how I’ve dealt with some form elements in jQuery. Sometimes you have to look at the docs a few times before you get what you can do, so I think these examples might help someone out there.

Here is how you can handle a change in a dropdown (SELECT tag with an ID that is “layer_image”):

$("#layer_image").change(function()
{
switch ($(this).val())
{
case '0':
$("#radar_image").hide();
break;
default:
$("#radar_image").show();
}
});

Granted I could of used toggle() to do the same thing I figured it was better to show an example using the switch statement.

Here is an example of handling a checkbox (INPUT tag with an name attribute of “option_linkwindow”):

$("input[@name='option_linkwindow']").click(
function()
{
if ($("input[@name='option_linkwindow']").is(":checked"))
$(".feed/ul>li/a").attr("target","_blank");
else
$(".feed/ul>li/a").attr("target","_self");
$(this).blur();
}
);

Here is another example of handling a checkbox (INPUT tag with a name attribute of “option_summary”):

$("#option_summary").change(
function()
{
$("//li/p").toggle();
$("li[p:hidden]").removeClass("expanded");
$("li[p:visible]").addClass("expanded");
$(this).blur();
}
);

And now an example of handling the following radio buttons:

<input type="radio" name="option_layout" value="0" checked="checked" />
<input type="radio" name="option_layout" value="1" />

And now the jQuery code for handling them:

$("input[@name='option_layout']").change(
function()
{
if ($("input[@name='option_layout']:checked").val())
$(".group").toggleClass("group_vert");
else
$(".group").toggleClass("group_vert");
$(this).blur();
}
);