Dean Edwards rules! Look at the comment #77, though :)
I understand level 5, but I don't know yet why
var button = document.getElementById("hello");
button.addEventListener("click", function(event) {
hello(WORLD);
}, false);
is better than
var button = document.getElementById("hello");
button.onclick = function() {
hello(WORLD);
};
Could someone explain it?
Friday, September 29, 2006
Levels of JavaScript Knowledge
Sunday, August 27, 2006
ASP.NET 2.0: Cross Page Postbacks
Most regular Web pages written by professional developers in ASP, PHP or other conventional languages use HTTP POST operation for submitting data from one page to another, often hidden page which manages data submission and normally updates a database. It was considered to be a bad practice to POST to the same page. First of all, it leads to inability to use browser's Reload/Refresh button (you would get "Page expired" message) unless some special manipulations with cache are performed. Also, it potentially leads to multiple modifications of a database in case Reload was performed.
ASP.NET introduced a paradigm of POSTing to a same page as a main method. It used internal tricks to deal with "Page expired" and multiple data updates. In my opinion, it was teaching newbie developers, who didn't realize what happens under the hood to a bad technique. (Not a first time MS is doing that, though).
It looks like obvious considerations started to overturn strange ideas of MS Web designers - thus "Cross Page Postbacks" are introduced in ASP.NET 2.0. Most of experienced Web developers who are not inclined to a weird Microsoft's idea of transforming page-based architecture of World Wide Web to Windows desktop applications behavior used it all the time in most Web languages...
Tuesday, August 22, 2006
ASP: Server.Execute vs. server-side includes
I suddenly realized on advantage Server.Execute() command has over server-side includes in a classic ASP: Server.Execute() is a part of normal execution flow and thus works as a conditional include. There is no normal way to include files conditionally with <!--#include file [or virtual]="_our_file.asp"-->, because those includes are treated with something like ASP preprocessor. On the other hand, local variables declared in calling file are available inside include and are not available in executed file - that's one reason I never used it.
VB.NET vs. C#
1) Is it right that anything which could be done with C# could be (as easy and elegant) done in VB.NET?
2) What programmers are easier to find on a market, VB.NET or C#? Which out-of-school (university) programmers are easier to find, VB.NET or C#?
3) Which programmers tend to get more money, C# or VB.NET?
Tuesday, August 15, 2006
FireFTP
FireFTP is a very convenient FTP client program: it runs directly from your Firefox browser and is organized very well. It's my favorite now.
Monday, August 07, 2006
Bookmark synchronization
I finally found a working software for bookmark synchronization across separate computers. Bookmark Sync and Sort This add-on works with Mozilla Firefox and allows to upload your bookmarks to FTP address of your choice (I use a directory on my domain) and to download them to another machine. I just synchronized bookmarks on my machine here with my home Firefox. I also found another software which allows to synchronize bookmarks (favorites) across many different browsers on a single machine http://www.syncbookmarks.com/ (they are planning to add FTP and http://del.icio.us/ synchronization later on). So, together this add-on and this application allowed me to synchronize bookmarks on all browsers at home and on my Firefox at work!
Update, July 25, 2008: Unfortunately, neither "Bookmark Sync and Sort" plugin nor Syncbookmarks application work with Firefox 3. Syncbookmarks does not report any error, but doesn't pick Firefox's bookmarks. I'm switching from to a new and powerful Foxmarks plugin. It works beautifully in a fully automated mode. A version for IE is going to be released. To sync bookmarks for SeaMonkey or Opera you can use Foxmarks for Firefox and Internet Explorer in a combination with Syncbookmarksto to copy IE favorits into SeaMonkey or Opera bookmarks. (I always use Firtefox as a main bookmark source.)
Friday, August 04, 2006
Folksonomy
More and more often I have a feeling that Web-related knowledge increases in a chain reaction manner and I'm falling behind. Thanks to Internet, Tim Berners-Lee, and Google but... how to cope with it?
Did you here about Folksonomy and Tag Clouds?
Wednesday, August 02, 2006
Interview with Jakob Nielsen, a world athority in Web usability
Matt Mickiewicz interviews Jakob Nielsen, author of the brand new book "Prioritizing Web Usability," about AJAX, usability's close link to keyword advertising, and some of the advertising formats we're seeing around the Web today.
Monday, July 31, 2006
Brothercake
Here's a fantastic JavaScript site. Look at his Ultimate Drop Down Menu! I have his book but haven't started to read it :(
Saturday, July 15, 2006
AJAX File Uploader
In an administrative interface of my Photo Gallery I'm using XMLHttpRequest to send all the information about picture being uploaded to a server and check its validity. (I used synchronous mode because at the time I programmed it all the AJAX heap wasn't there yet). I wanted to upload files with the help of XMLHttpRequest without page reloading, but I couldn't find a way to do that. There were some proprietary IE solutions and proprietary Mozilla solutions, but no common one. To upload file, HTML form must set ENCTYPE="multipart/form-data" (a default value is "application/x-www-form-urlencoded") and it seems that XMLHttpRequest cannot do that.
The solution I found was to check everything and send a data to server using XMLHttpRequest without page reloading, then to upload a picture using conventional FORM POST operation inside an IFRAME.
It looks like that there is nothing new that and this Indian guy uses similar approach with his "AJAX File Uploader" class.
Although.... let's investigate all results of corresponding Google search.
Friday, July 14, 2006
TestDrive
I created a new sub domain for learning and testing new [Web] technologies. I will add some examples of using various Web-related technologies there.
http://testdrive.kelman-all.com/
I'm starting to educate myself with an unusual strength :) I fell behind once again.
******************
JavaScript - version 1.7 is about to be released
http://developer.mozilla.org/en/docs/New_in_JavaScript_1.7
The cool feature of JavaScript is that it allows to check if a function is defined and create your own version otherwise, adding it to a prototype of an object. For example, JavaScript's String object lacks trim() method. http://www.developingskills.com/ds.php?article=jstrim&page=1 shows how to fix it.
Yesterday I found a cool library which implements new 1.6 -1.7 methods of arrays in a similar manner: when your browser's JavaScript will become 1.6 and then 1.7 your code won't break, but will automatically use built in methods instead of custom ones.
http://4umi.com/web/javascript/array.htm
********************
AJAX - it's a pleasure! It's a coming way of making really interactive Web applications which communicate with a server without page reloading. There are plenty of books on this issue (and I bought almost all of them) but one really stands apart: Ajax Design Patterns by Michael Mahemoff
His site is http://ajaxpatterns.org/.
********************
PHP. Version 5 is a full-fledged OOP language with a lot of convenient and powerful libraries developed for it. You normally can do anything you can do in ASP.NET, for example, but in a much easier and more flexible way. I was surprised when I started to work with PHP on how much better, bigger, and more convenient is its standard library and common user-developed libraries than ones used in ASP. Open Source rules!
I'm going to learn and pass Zend PHP Certification http://www.zend.com/store/zend_php_certification
********************
Design Patterns
It's a cool thing, if you learn it with an excellent Head First Design Patterns (thank you, Andrew, for pointing me to it) written by by Elisabeth Freeman and Eric Freeman
*********************
MySQL 5.1 and PostgreSQL - I need to jump into that.
*********************
.NET
I still need to get heavily involved into ASP.NET and C# development. While I like C#, I think that ASP.NET approach suffers greatly from usual Microsoft's design flaw: it's too big, it's too predefined, so when you develop a real application you spend more time on finding workarounds for built-in events and other features which work the way they were designed, but not the way your application's business logic dictates.
Thursday, July 06, 2006
Eric's weblog - Will Ajax get another bad rap? Yahoo worm
Here's an interesting set of articles about Ajax security ("Samy worm").
Also, Eric showes there a workable soliution for implementing timeout warnings for session expiration.
Javascript Closures
Javascript Closures - an article by jibbering.com.
Closures and IE Circular References and What makes closures interesting?
Wednesday, July 05, 2006
How to implement timeout warnings for session expiration?
Hi everybody!
My bank's Web site has a neat feature: after some period of user inactivity it displays a JavaScript confirmation window asking to click a button to stay connected. If user clicks a button within some short time interval, he/she stays connected. Otherwise, after closing a confirmation window user is forcefully redirected to logout screen.
I think it's a nice user-friendly feature. It's too often when users of my ASP applications enter a bunch of data to a form, then went somewhere, return and click on a "Submit" button just to realize that session was already expired and all data entered was lost.
Question: how to implement that feature (wit ASP or PHP back-ends)?
ASP provides Session_OnEnd event (PHP does not), but it gives no help: I don't think you can refresh a session at the time this event is fired, and you cannot interact with user from inside this event handler.
I can imagine running JavaScript timer on each page. When it decides that session is about to expire, it displays a warning. In case user says he wants to continue, JavaScript connects to a server using XMLHttpRequest and runs some script there, which automatically resets a session expiration time. A response from a server should tell JavaScript to reset a timer.
But what if there are more than one browser window, frame, or iframe open for this site? Especially for multiple windows we need a way for server to initiate counter reset on all client windows when one of them is refreshed. (By the way, it isn't implemented correctly on my bank's website). We could make one more XMLHttpRequest to a server just before displaying a coming expiration warning. It will ask a server for actual expiration time and reset this window's timer as necessary. But for server to know expiration time it must be reset during each page server script running and saved ... in a session variable.
Another solution which comes to mind would be to use server-push technology to reset all necessary client timers. There are some interesting news about it there.
It would be nice to implement timer on a server instead of client JavaScript... but I have no idea of how to do it in ASP or PHP.
What do you think about all that?
Monday, April 17, 2006
The World Wide Web Consortium’s (W3C) new Web API Working Group has released a working draft of the official specification for the XMLHttpRequest obje
As Kevin Yank said in his BLOG entry at SitePoint
The World Wide Web Consortium’s (W3C) new Web API Working Group has released a working draft of the official specification for the XMLHttpRequest object, which is at the heart of AJAX.
Wednesday, April 05, 2006
How to install Zend Server on both IIS and Apache
1. Install Zend Client.
2. Install Zend Server on Apache. Point to it's associated copy of php.ini (PHP 5 in my case).
For Apache to work with a particular php.ini, httpd.conf should contain a line
PHPIniDir _path_to_php.ini without file name and trailing slash; like"C:/phpini/php5".
For Apache to work simultaneously with IIS servers must listen to different ports.
3. Make a copy of Program Files\Apache Group\Apache2\htdocs\ZendStudioServer folder.
4. Run Zend Server installer again. It will uninstall itself. Choose to keep php.ini (and httpd.conf) files.
5. Run Zend Server installer and choose to install it on IIS.
For IIS to use a particular copy of php.ini file, PHPRC environmental variable should be added and pointing to php.ini file; like"C:/phpini/php4".
6. Take a copy of Apache Group\Apache2\htdocs\ZendStudioServer folder which you created on step 3 and replace actual folder (which was changed during uninstallation of Zend Server from Apache). Restart Apache.
7. Modify Start Menu links if necessary, to point to Zend Server on correct ports.
Note: if for some reason your php.ini file has a line describing ZendOptimizer and that version of Optimizer is not installed, Zend Server or Zend Optimizer installer will complain about it during installation. Just ignore it: a latest Optimizer will be installed and php.ini corrected.
Note:Installing Zend Server on IIS first and on Apache second will lead to inability to run it under IIS.
That's it.
Thursday, March 30, 2006
onBeforeUnload event
As most of people I thought that onBeforeUnload event is not supported by Mozilla browsers because it contradicts to purists view on how Internet page should behave. But it turned out that I'm wrong! Even people from Mozilla developers team recognized an importance of this event for Web Application (do not mix this term with a regular Web page). For example it allows to ask user if he wants to leave a page without saving a modified data. Even more, it allows to stay on a page until user agrees to leave.
However, Microsoft in its usual intentional ignorance of the fact that more and more people using other browsers (Firefox/Mozilla) provides a proprietary non-standard example of using onBeforeUnload event on their page. And most people still follow that bad approach and think that only IE supports this feature.
That's wrong! Here's an example which works with Mozilla/Firefox as well! Please try it and think if it could be helpful to use on your company's web site.
Monday, March 20, 2006
Adding trim functions to the JavaScript String object
"The String object in JavaScript contains several powerful methods for manipulating strings. Strangely, though, it doesn't contain any methods that readily permit the removal of whitespace from the beginning or end of a string..." URI