Tuesday, April 17, 2007

Back from Korea

Well.. I'm back from South-Korea. It was a wonderful trip, and I was fortunate enough to meet quite a number of Korean people. I even met a fellow JS/Ajax programmer :)

I was happily surprised over how many cute korean girls there were, especially in Seoul.

We traveled around in Korea, to Gyongju to look at temples, to Busan to party, and to one of the biggest stalagmite (probably not the right word) caves in Asia. In Seoul, we visited the former royal palace and the Korean War Memorial/Museum (the most impressive museum I've been to).

In Busan, we were denied access to a club with the ironic name New York, on grounds that they didn't allow foreigners that night. Understandably, they probably have problems with drunken foreigners getting into fights and such, but denying all foreigners access would be categorized as racism in Europe. On an upnote, I got to buy a bottle of Corona for a chewing-gum. I don't know if it was a communication error between me and the bartender, or that she was drunk (I was myself in the process of getting shitfaced). Anyway, she said it was ok, when I asked if I should pay.. :)

We also visited the Aquarium in Busan, where they had many exotic fish.

In Gyongju, we were shanghaied into a booking-club, after a meal at a Korean restaurant. It was really uncomfortable (mostly because the employees were too focused on making us have a good time). Fortunately we had no trouble getting away.

The same night, we went to a really relaxing club called Juliet. Beautiful waitresses, and good beer.. :D

On partying, I found Seoul to be my favourite party-place. Mostly because I felt Koreans were more open to foreigners there.

<<Some pics from the trip>>

Tuesday, March 27, 2007

Going offline for a while


I'll be in Seoul ( South Korea, for the geographically challenged ) on holiday from 29.03.07 - 15.04.07.

Maybe I'll post a photo or two, if I randomly drop by an Internet Café.

Tuesday, March 20, 2007

(mis?)Using $$ReturnGeneralError as a shortcut for search

Lets the users search like this:
http://example.holidays.no/index.nsf/tokyo
Everything in regard to Tokyo

http://example.holidays.no/index.nsf/hotels/tokyo
Hotels in tokyo

http://example.holidays.no/index.nsf/restaurants/sushi
Restaurants that serve sushi


In the HTTP Head Content of $$ReturnGeneralError, add a little JavaScript to extract what is typed after the path to the database (application if you're using N8 beta ;) ).

"<script>
var db='"+@WebDbName+"';
var loc=document.location.href;
var viewToSearchIn = '($People)'; //if not specified
var newloc;

//if searchview->error, return general error

if(loc.toLowerCase().indexOf('searchview')==-1){
var query=loc.split(db)[1].replace('/','');
if(query.indexOf('/')!=-1){
viewToSearchIn = query.split('/')[0];
var tmpquery = query.split('/')[1];
newloc=loc.replace(query,viewToSearchIn+'?searchview&query='+tmpquery);
}
else{
newloc=loc.replace(query,viewToSearchIn+'?searchview&query='+query);
}

query=query.replace(/s/g,'+and+');//replace whitespace with +and+

//avoid the back-button pointing to the erroneous url
document.location.replace(newloc);
}
</script>"

Above I'm using a view called ($People), to search in. You can pass the "query" to whatever you want.

Demo application
You have to create the full-text index on the db yourself to searh on the web.

This is the same as Jake's FakeNames.nsf, but I changed the $$ReturnGeneralError form.

Tested URLs:
http://yourdomain.com/fakenames.nsf/tommy
Searches in the default view, ($People)

http://localhost/fakenames.nsf/peoplecat/abigail
Searches in the peoplecat view

http://localhost/fakenames.nsf/holidays/aus*
Searches in the holidays view

With the last view, you can also write: http://localhost/fakenames.nsf/holidays/austria
which opens the austria document (sorted view).

You can of course take this even further, with per-application mapping-documents for particular searches.

Saturday, March 17, 2007

Simple way to check if a Domino Server is online

This is a small one, but I thought it was a nice example how nice and powerful events in JavaScript are.

The images (<img> tag) on the web has an onerror-event that fires if the image in the src is either an invalid image, or the image is not found (404). Every Domino server has an icons-folder. The most used icon/image is ecblank.gif, which Notes uses in many nasty ways on the web.

To check if a notes-server is online, you simply make an image tag with src=http://serverdomain.com/icons/ecblank.gif
onerror, change some text, pop an alertbox up etc.

In my simple demo, I add a css class to a a div, and replace() innerHTML with a status.

Demo (view source to see how it is done)

If you want to automate the testing of online-status on your company's servers, you can use the Windows API's UrlDownloadToFile ( example ) to download ecblank.gif. OnError - log error, send mail etc.

Sunday, March 11, 2007

Bookmarklet to animate the clouds on Twitter.com


Opera/FF:
javascript:(function(){_c=0;d_=document; d_.styleSheets[0].insertRule("div, h1{opacity:0.7}",2);d_.body.style.backgroundRepeat="repeat-x"; setInterval(function(){ d_.body.style.backgroundPosition=(_c++)+"px top"; },40);})()

IE:
javascript:(function(){_c=0; d_=document;d_.styleSheets[0].addRule("div","filter:alpha(opacity=70)}",2); d_.body.style.backgroundRepeat="repeat-x";setInterval(function(){ d_.body.style.backgroundPosition=(_c++)+"px top";},40);})()


Test it out on http://www.twitter.com

It makes the content partly transparent, and the clouds flow towards the right.

The reason that I made this useless bookmarklet is that I liked the clouds when they were positionary, but I wanted to see how they looked moving about.

The animation is quite CPU-intensive.. Not sure how to optimize this..

Thursday, March 8, 2007

Breaking the count-limit in views on the web

Show n' Tell Thursday
I thought I'd sit this Thursday out, but too much free time I guess.

First, open the demo-db in notes.
Click Create test-documents (creates 5001 documents).
Open the view on the web.
A counter will tell how many "documents" currently fetched

The parsing of the HTML is quite CPU-intensive.
On my PC it takes IE7 about 15 seconds, and FF about 20 seconds to get all 5001 items.

There are more elegant ways of getting more documents than the server-limit. With this method, you can control the layout from the view, and you don't have to mess about with XML or JSON.

If someone can provide me with a more complex database with 1500+ (non-sensitive) documents, I can try to add browser-side click-to-sort columns.

Demo-db: NoCountLimit.zip

Screenshots:

Top


Bottom