onsdag 25 maj 2011

DBColumn might not return what you expect

I found out that @DBColumn despite what the documentation says not always return an Array.
If there is only one entry inside the view you will get an string back.

Is will give you problem if you are using this as the source for an repeat control or somethign elese that is expecting an array.

This is how you fix the problem

function isArray(obj) {
return obj.constructor == Array;
}
var d;
d=@DbColumn("","MyData",1);
if(isArray(d)==false){
d=[d]
}
return d

Happy Coding

lördag 21 maj 2011

How to speed up internet using file hashes.

Someone have probably thought about this before, if so why doesn't the browsers have this ;-)

If we could use filehashes like DAOS to find if we have downloaded the exact same file before and the resource tag could have a filehash tag from the webserver. then we could get a much faster web.

i.e.
<link http://Dominoserver/database.nsf/mycss.css" rel="stylesheet" type="text/css" filehash="78AD782EA9292">

If the webbrowser found this file hash in the cache regardless of server the same resource could be used. Of course there is probably some security aspects in this but if it worked the web would be much faster.
We could even drop most of the cache aspects in the browsers because content without the filehash uses the old way of caching. But if filehash is found webbrowsers could always find if the same content exists locally, as soon as you change the content your users download the new content and never need to download content/resources they already have locally.

This is an idea nothing that todays webbrowsers or webservers support but perhaps in the future.

Update on post
There is a HTML tag called ETag that is apart of the http 1.1 spec, this adds a crc check of the content. Great news, didn't know about this but we still have the problem that we only want to load the same content once. Regardless of the server we have loaded the resource from.
To get a maximum utilization of the cache.


måndag 16 maj 2011

Runtime error in Internet Explorer

I found a strange error today I started to get "runtime" error in internet explorer. I investigated the problem and found that the following row was causing the problem.

document.getElementById("Body").innerHTML=tmpHTML;

the tmpHTML variable contains some valid HTML and the Body tag was a span tag.

When looking into the problem some more I found that it is an IE bug so when I changed the tag from span to div, everything worked again.

Hope that this might help someone else so you don't have to investigate alot.

torsdag 12 maj 2011

Chrome Os is here, get your self a nightly build

Google has released Chrome OS that will run all applications from the webbrowser.

I found this site that created nightly builds of chrome os in WMWare, Virtualbox and USB images.
Great if you want to try it on your machine. bothe the WMWare Player and Virtualbox can be runned for free on your machine.