Archive for the 'webdesign' Category

Page 2 of 3

JavaScript: what if nested ‘this’ doesn’t work?

Note: Examples used in that post require usage of prototype.js.

Imagine you have a JavaScript class with some features related to the current view. One of the method in that class is supposed to add an observer on all anchors marked with class “delete”. That observer is also defined in this class. In other words, you have a number of “delete” links (similar to one below) and you want to register an event handler that would fire when either of those links is clicked.

The link exmple:

<a href="#" class="delete">delete</a>

Let’s assume the aforementioned methods are defined as follows:

registerDeleteHandlers: function() {
	$$('a.delete').each(function(anchor) {
		anchor.observe('click', this.deleteItem);
	});
},
deleteItem: function(event) {
	...
}

As you would discover the handler wouldn’t be registered… It’s because this inside the inner function (which really registers the observer) is binded to a different context!

Simple solution (smarter)

Define the registerDeleteHandlers function as follows:

registerDeleteHandlers: function() {
	$$('a.delete').each(function(anchor) {
		anchor.observe('click', this.deleteItem);
	}.bind(this));
}

Another way around

Inside the registerDeleteHandlers function you can bind this to a temporary variable and use it in the inner function instead of this. So the registerDeleteHandlers function would look like that:

registerDeleteHandlers: function() {
	var self = this;
	$$('a.delete').each(function(anchor) {
		anchor.observe('click', self.deleteItem);
	});
}

FCKeditor – inline html editor

fckeditor logo FCKeditor   inline html editor

Should you need provide inline html editor feature in your web application (WYSIWYG editor), have a look at FCKeditor.

FCKeditor is very useful and functional. Let me cite a couple of its features:

  • Integration with ASP, ASP.NET, Java, ColdFusion, Perl, PHP, JavaScript and more
  • Complete toolbar customization
  • Skins support
  • Plugins support
  • Multi-language support with automatic user language detection
  • Lightweight and fast
  • Font formatting: type, size, color, style, bold, italic, etc
  • Text formatting: alignment, indentation, bullets list, etc
  • Link and anchors support
  • Image insertion, with upload and server browsing support
  • Table creation and editing (add, delete rows, etc) – one of the best systems on the market
  • Right click context menus support

I believe it’s worth recommending.

 FCKeditor   inline html editor

ASP.NET AJAX In Action

If you’re about to start playing with AJAX in ASP.NET it’s a good idea to read this book: ASP.NET AJAX In Action by Alessandro Gallo, David Barkol, Rama Krishna Vavilala (see on amazon).

It very well describes basics of AJAX and shows basic and more advanced techniques of applying it in ASP.NET. There are exaplanations of Microsoft Ajax Library, UpdatePanel, ASP.NET AJAX client components, bulding AJAX-enabled controls, and much, much more. All well written and supported with extensive examples.

AJAX Control Toolkit – Could not load file or assembly vjslib

I wanted to play around with ASP.NET AJAX Control Toolkit. There are a few steps to do before you can start using this tool. Among others, you need to build the Visual Studio Solution provided in the downloaded zip file.

When I tried to build the solution I got this error:

Error 1 Could not load file or assembly ‘vjslib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a’ or one of its dependencies. The system cannot find the file specified. C:\Program Files\Microsoft ASP.NET\Ajax Control Toolkit\TemplateVSI\TemplateVSI.csproj 60 5 TemplateVSI

Solution

This is what AJAX Control Toolkit documentation says:

The TemplateVSI project has a dependency on vjslib.dll which is a part of the Visual J# Redistributable…

The above mentioned package can be found there. Installing it solved this problem, at least on my computer.

ASP.NET powered with AJAX

For those who develop web applications in ASP.NET and want to learn how to include AJAX I recommend a series of video tutorial on ASP.NET AJAX.

The series is created (from time to time new videos are added) by Joe Stagner and others from the Microsoft product team. It teaches the basic tricks and explanations of how things should be done.

High Performance Web Sites

Recently I’ve been reading “High Performance Web Sites” (look at amazon).

I think it’s a good book who can be recommended to all who do even little bit of front end development. The book describes 15 rules (regarding CSS, JavaScript, etc.) that should be followed in order to deliver high performance web sites. It’s rather short (c.a. 150 pages) and easy to read, but the suggestions described by the author can be helpful while you work.

FeedMap = Blogs + Maps

feedmap logo FeedMap = Blogs + Maps

What is feedmap? Let me cite its authors:

… feedmap is about mapping your blog! Using FeedMap you can tell the world where you are blogging from! Or you can simply search for bloggers right around where you live! Or even better let other local bloggers to discover your blog…

I had a look at this service and I must say its idea is very good. Really you can discover blogs of authors that live in the same town or are even your neighbours. And of course you can make your own blog more discoverable. However, I believe the authors need to improve some things (layout, minor issues and some more important stuff, like not working link). Anyway, great idea! I wish feedmap luck!

Of course I submitted this blog (info on feedmap), and my photoblog (info on feedmap).

Continue reading ‘FeedMap = Blogs + Maps’

Listen what you really want!

I used to listen to Pandora, but that has been impossible for some time because it’s been suspended in Poland (and some other countries). Let me quote Pandora’s authors:

We are deeply, deeply sorry to say that due to licensing constraints, we can no longer allow access to Pandora for most listeners located outside of the U.S.

At the same time I listened to last.fm but for some reason (why?) I stopped. Recently I re-discovered that service and I’m really excited about it! For those who haven’t used it, it’s a social network that allows to listen music you like (what you declare and tracks with similar genre that you may like), learn your friends’ music tastes, find information about music events that take place near the place you leave, discover new artists/tracks, etc. You can listen music either via a web browser or using special player (the player is more efficient and handy). This player can also register (scrobble) what you listen on your PC from CDs or mp3 files and updates your music profile. Eventually, you can listen what you like wherever you go provided you have Internet connection.

If you’d like to see what I’ve been listening to recently, look below at my “Top albums music quilt”:

Web 2.0 gaming

doof logo thumb Web 2.0 gaming

Recently, I’ve encountered doof, a new Web 2.0 service, kind of “new one”… The authors promote it with the slogan: “Have fun playing games and competing in tournaments, pesonalising your profile and expressing yourself”. Then, what actually doof is?

doof screen thumb Web 2.0 gaming

First of all, doof is a fancy website with astonishing flash design (see above). User can adapt the screen according to their needs. Then, users can choose from a wide range of games, including a number of retro ones and classics. Users are given a space to communicate by sending mails, instant messages, virtual gifts. Also, they can create a photo album that can be synchronized with Facebook. Thanks to news feeds, people know what’s going on in their doofish world, who played a game recently, who received a gift, etc. One can give feedback for the authors, suggest possible improvements and failings.

All in all, the authors had a great idea and they succeeded in creating a brand new, very fresh and marvellous Web 2.0 service. I believe that despite doof is games-oriented, it can meet tastes of not only keen gamers, but also people who just like to have fun seeing others and interacting on their social network.

You can read more about doof in doof blog.

Web 2.0 and social networks around the world and in Poland

I’ve just read an article about popularity of Web 2.0 and social networks in general all around the world. Quite nice article to me.
Basing on what the information passes there, in Poland we don’t have any popular social networking websites. To some extend it’s correct – if Poles use social networking websites, these are mostly Polish services, mostly unknown for people from abroad. Below, there is a list of the most popular (to me):

More and more Poles are blogging these days. I believe, the most popular blogging platforms in Poland are: blog.pl, Blox, Bloog.pl and blog.onet.pl. Also, Blogger and WordPress are frequently used.

Anyway, it’s good to know Poland is not a black hole on the World’s Internet map icon wink Web 2.0 and social networks around the world and in Poland

If you think the abovementioned lists lack from any services, please let me know. We can populate this ranking together.