Ian Winter Ian Winter

CFMail and Gmail

Been looking a lot lately at various email related projects. One of the issues I noticed as part of this work is that if you send a mail with cfmail to a gmail account that only has a cfmailpart text/plain gmail won't render it.

If you send both, it works fine.

Plain
Strong HTML

So, if you're sending plain only, don't put it in a cfmailpart. Probably shouldn't have been in the first place, but, issue now solved.

CSS Fun

What does a website look back to front? Now you can see, add this CSS to your site a reload. Entirely pointless but quite amusing.

* {
	direction: rtl;
	unicode-bidi: bidi-override;
}

HTML Tag List

I need to strip our HTML tags, but not all of them, in ColdFusion so needed a CSV of HTML tags. Now, this is probably quite useless to most but someone but find it useful!

a,abbr,acronym,address,applet,area,b,base,basefont,bdo,big,blockquote,body,br,button,caption,center,cite,code,col,colgroup,,dd,del,dfn,dir,div,dl,dt,em,fieldset,font,form,frame,frameset,h1,h2,h3,h4,h5,h6,head,hr,html,i,iframe,img,input,ins,isinde,kbd,label,legend,li,link,map,menu,meta,noframes,noscript,object,ol,optgroup,option,p,param,pre,q,s,samp,script,select,small,span,strike,strong,style,sub,sup,table,tbody,td,textarea,tfoot,th,thead,title,tr,tt,u,ul,var

Aptana 1.0

I changed over to using Aptana from Eclipse a while ago now and haven't looked back. It works fine with CFEclipse, subclipse and also has the benefit of built in CSS/JS support and optional AIR, PHP and Rails plugins.

Anyway, they've just released version 1 and also a slightly more feature filled "Pro" version.

Prototype Validation using Ajax

I've been using the excellent Prototype validation over at <a href="http://tetlaw.id.au/view/javascript/really-easy-field-validation">dexagogo</a> but recently wanted to have a a feature so as when you type a username in a sign up form it fires a real time lookup to check the username availability. After a bit of Googling and some experimentation I came up with the following. Hopefully it'll save you some time. In this case the lookup is done via Coldfusion which encodes and returns JSON.

The form bit is pretty standard.

<div class="form-row">
	<div class="field-label"><label for="field1">Username</label>:</div>
	<div class="field-widget"><input name="field1" id="field1" class="text required validate-username" title="Enter yourusername." /></div>
</div>

The Javascript bit included on this page in an external JS file.

Validation.addAllThese([
    ['validate-username','Sorry, that username is already taken.',function(v,elm) {
        if(elm._ajaxValidating && elm._hasAjaxValidateResult) {
            elm._ajaxValidating = false;
            elm._hasAjaxValidateResult = false;
            return elm._ajaxValidateResult;
        }
        var sendRequest = function() {
            new Ajax.Request('/path/to/check/file?username='+v+'&r='+Math.random(),{
                onSuccess : function(response) {
                    elm._ajaxValidateResult = eval(response.responseText);
                    elm._hasAjaxValidateResult = true;
                    Validation.test('validate-username',elm);
                }
            });
            elm._ajaxValidating = true;
            return true;
        }
        return elm._ajaxValidating || Validation.get('IsEmpty').test(v) || sendRequest();
     }]	
]);

The Javascript bit in the page.

<script language="javascript" type="text/javascript">
	var valid_register = new Validation('register', {immediate:true,stopOnFirst:true,onSubmit:false});
</script>

The form is submitted with an Event.observe on the submit button I have as well.

And so concludes my first geekish post for a while, it feels strangely good!

Comma's Are Evil

Aside from the fact that CSS cross browser is often quite a fun exercise and we all know how lovely MSIE can be in it's quirks as indeed can Firefox, but, today I've leart that the comma is indeed evil.

The CSS file in question is quite large, a couple of hundred lines or so, in amungst it was a simple class:

#text p, { padding: 0; margin: 0; color: #ffffff; }

The issue was that the first paragraph tag in the text div had extra padding on the top whereas in IE it wasn't there. The comma should be an obvious spot but within the larger file I'd overlooked it. Ah well... back to the CSS grindstone!

XPath is my new friend

Doing something at work which involves me grabbing an XML feed from a third party provider on a daily basis then sticking it in a database so it can be reused as the feed only updates at midnight GMT.

Quite an easy task, cfhttp the file, loop over it, insert to the database. Well, this was made even easier by me discovering the entirely not new XPath (or here). Another quick google found a tutorial and after a quick play using xmlParse() and xmlSearch() in Coldfusion 7 my feed was filtered and inserted for reuse. It's been around for a while, but, if you're using CF7 and working with XML and haven't seen XPath I suggest you take a look.

Quite nice as well as I actually learned something today!

script.aculo.us 1.7.0

A new version of script.aculo.us has now been released. It includes the final version of prototype (1.5.0) and a new Morph effect amongst other bits and bobs.

Flickr Gamma

Just getting into using Flickr and have been busy uploading photos . Logged in last night however to find it's gone from beta to gamma status and with it got a whole load of changes.

The organiser is now full screen and non flash, it's been ajax'ed royally and to be honest not sure it's as nice to use. Other noticable changes are the drop down menus up the top which again I'm not sure about.

Time will tell as will user feedback, I'm sure I'll get use to it. Next on the list is playing with API to get photos inline on the site.

Google Web Toolkit

Another beta release from Google:

Google Web Toolkit (GWT) is a Java software development framework that makes writing AJAX applications like Google Maps and Gmail easy for developers who don't speak browser quirks as a second language. Writing dynamic web applications today is a tedious and error-prone process; you spend 90% of your time working around subtle incompatabilities between web browsers and platforms, and JavaScript's lack of modularity makes sharing, testing, and reusing AJAX components difficult and fragile.

Google Web Toolkit - Build AJAX apps in the Java language

More Entries

Powered by BlogCFC, 5.9.002. Contact Me

All comments, view, rants, raves and opinions are mine and mine alone.

del.icio.us Digg Flickr Last.fm LinkedIn Pownce Twitter YouTube