Monday, May 4, 2009

Attach multiple functions to events

Attach multiple functions to events

Attach multiple functions to events

The function that need to place some wear on page:

function addEvent(obj, evType, fn)
if (obj.addEventListener)
obj.addEventListener(evType, fn, false);
return true;
else if (obj.attachEvent)
var r = obj.attachEvent("on"+evType, fn);
return r;
return false;

Sample to call the function:

addEvent(window, 'load', functionName);

.NET Internationalization with databa...

NET Internationalization with database resource provider and custom cultures

.NET Internationalization with database resource provider and custom cultures

Database storage is a popular option for Web-application resources, for a number of reasons. You can probably guess, at some point with a site that has thousands of pages and multiple-thousand resource entries, using assembly resources might not be ideal. It will add to run-time memory usage, not to mention the increased number of assemblies loaded into the application domain. Both of these results can have a negative impact on performance for extremely large sites, making the latency of a database call worthwhile. Database resources might also provide a more flexible and manageable environment for the localization process, for reducing duplicates, for intricate caching options, and for storing possibly larger blocks of content. Lastly, allocating resources to a database makes it possible to support more complicated hierarchies of translated content, where customers or departments might have customized versions of the text that is then also localized.

PS: Articles with information about:
Hooking meta:Resource parsing in ASP.NET 2.0? by Rick Strahl
Extending the ASP.NET 2.0 Resource-Provider Model by Michèle Leroux Bustamante
.NET Internationalization: Using Custom Cultures

Small things about .NET

Small things about .NET

Small things about .NET

Sometimes I need to build string from strings array spparated by any simbol, so I found this sample:

string[] strArr = {"1","2","3"};
string output = "";

for(int i = 0; i < strArr.Leght;)
output += strArr[i] + ((strArr.Leght > ++i) ? "," : "");

Result: 1,2,3

Checking site status

Checking site status

Checking site status

For this blog I need the image that link to my private web site, but my web site not all time on line so I write javascript that show if my web site on line, and if no so write "My site off line.." become image.

<a id="myWebsiteImgLink" href="">

<img src="" onerror="OnErrorLoadImage(this);"/>



function OnErrorLoadImage(img)


    document.getElementById('myWebsiteImgLink').href = '#';

    document.getElementById('myWebsiteImgLink').innerHTML = '<strong>My Web Site is Offline Now.</strong>';




Sunday, May 3, 2009

Create site with Blogger as CMS and P...

Create site

Create site with Blogger as CMS and Picasa as Photoalbum

One day I decide to create my personal site: . I didn't want something difficult. I was need site with simple CMS manager and with photo album. Also I wanted to practice in using Mootools library with Google API. So I decide use Blogger as site holder and CMS manager, Google Pages as javascript and images holder and Picasa as album manager. A structure of the site you can see on following diagram.


I have google account. If you have google account you can use it for registration on, and  So in blogger I created blog per page on my site. A main page blog I used to entring point to my site. Also I customized XML template of the blog. I changed the layout of page according to my design, and deleted all old content of XML. In additional I added to header, links to javascript and CSS files.
So the base of my site was created.
I started javascript coding. The structure of content you can see on following diagram.

When user pressed on button in menu bar, I started loading content from blogger according to the button. 
You can see the script that do it at:

The following script is loading all post of blog in Json format.



var script = document.createElement('script');

var src = ''+






     src += '&orderby='+this.options.orderBy;


script.setAttribute('src', src);

script.setAttribute('id', 'blogJsonScript_' + this._blogId);

script.setAttribute('type', 'text/javascript');




After loading the script call to function that run by Json objects and fill content holder with content.

A script that loading albums from Picasa look different but concept is same: