IE Conditional Tag with XSLT

Another hack in the life of UI developer, dont know for how long we have to take this burden.

Well, you are here because you are using XSLT and have noticed that IE conditional tag or comment is not showing up in output of XSLT transformation. What could be the reason?

Reason is that XSLT transformation does not output comments given in XSL sheets to HTML stream. So how to use IE conditional tags when you really need them.

The answer is tag + CDATA (Unparsed Character Data) tag. Following is the example showing correct way of doing it:

before (not working):

after (working perfectly):
something speical for Internet Explorer

In the example above we are using tag to output to HTML stream and using CDATA type to outupt rest of the code inside the comment tags. So one little hack and desired output presented.

JavaScript Error: Expected Identifier in IE

If you are getting ‘Expected Identifier’ JavaScript error on IE this means you have some conflict with Mr. Gates :)

Okay to the point, this can happen due to two reasons (as per my knowledge, let me know if you know something else):

1. Some typing mistake in your code

var myVar = {
function1: function() { // some code },
variable1: ‘Some value’,
variable2: ‘Another value’,
};

Notice the extra comma after the last variable defined just before } braces, Firefox will ignore this but IE will not. Lets move to second reason.

2. You have used reserved keyword in your code mostly as variable name Just yesterday, I got this error on IE due to some old written JS code. First I tried to find the code mistake but after looking at the code with a sharp eye I found that some reserved words were used. Following is the code I corrected

obj.class = ‘up’; ///this works in Firefox
obj.className = ‘up’; ///this is the correct implementation

var onloadstat = 0; //works in FF but in IE its a reserved keyword same as ‘class’

At the end, if you get the ‘Expected Identifier’ JS error in IE first look for these mistakes. You will be able to fix the error quickly.

About my blog

This blog will have contents for my own reference so that I don’t have to do Google search again ;)

I will also be happy if someone is taking benefits from my knowledge. If you like the blog, don’t forget to leave a comment :)

The Future of the Internet?

Here is a thought-provoking video that presents a vision of what the Internet might become before the end of the century. Will Google eventually attain world domination? Will copyright laws be one day a thing of the past? Enjoy the show!

nonstandard property :: innerHTML (but is a de facto standard)

The innerHTML property is not part of the DOM. It isn’t part of any standard. It is a proprietary addition created by Microsoft.

Normally, I wouldn’t recommend using anything proprietary in JavaScript code (although the XMLHttpRequest object itself is a proprietary addition). However, the innerHTML property is exceptionally well supported, considering that it is nonstandard. It is, in effect, a de facto standard: it is supported in all the major browsers. The reason why innerHTML has been so widely adopted, without any endorsement from the W3C, is that it is very useful in certain situations.

DOM methods allow you to manipulate a document very precisely. You can create elements, attributes, and text, one node at a time. That is very powerful, but it is also quite time-consuming.

The innerHTML property uses brute force. If you read the innerHTML property of an element, you will receive a string of HTML. This is a read/write property, meaning that you can also assign a string of HTML to go inside an element.

Any HTML that was previously inside the element will be obliterated and replaced with the contents of the string.

Which you choose for your web app XML, JSON, or HTML?

If you are a Ajax developer you should know these three words XML, JSON & HTML (using innerHTML)

So which you will choose the best to get your data from server to manipulate on client browser? if you are not sure about this then read following article

What’s Your Poison? XML, JSON, or HTML? by Jeremy Keith

which is a part of his book Bulletproof Ajax. The article is here:

As for my preference I use HTML as it is very easy way and safe also, read the article and decide what is best for you.

Opera 9.2 is out for lovers (all platforms)

Opera version 9.2 has been released. I’m sure everyone will find browsing faster and more enjoyable with Opera’s many new features

According to official opera blog:

9.2 is not only an important update with bug fixes and the new Speed Dial functionality, it’s also a milestone in spreading Opera to new users around the world: Opera 9.2 for Windows ships with 31 languages.

Download

Click here to download opera for Linux/UNIX, Window and Mac.

Copy MySQL database from one server to another remote server

Usually you run mysqldump to create database copy:
$ mysqldump -u user -p db-name > db-name.out

Copy db-name.out file using sftp/ssh to remote MySQL server:
$ scp db-name.out user@remote.box.com:/backup

Restore database at remote server (login over ssh):
$ mysql -u user -p db-name <>
How do I copy a MySQL database from one computer/server to another?

Short answer is you can copy database from one computer/server to another using ssh or MySQL client.

You can run all the above 3 commands in one pass using mysqldump and mysql commands (insecure method, use only if you are using VPN or trust your network):
$ mysqldump db-name | mysql -h remote.box.com db-name

Use ssh if you don’t have direct access to remote mysql server (secure method):
$ mysqldump db-name | ssh user@remote.box.com mysql db-name

You can just copy table called foo to remote database (and remote mysql server remote.box.com) called bar using same syntax:
$ mysqldump db-name foo | ssh user@remote.box.com mysql bar

This will not just save your time but you can impress your friend too ;) .
Almost all commands can be run using pipes under UNIX/Linux oses.

MySQL connections can be made securely to a remote server via SSL. Just thought I would mention that as it is an additional option to consider. http://dev.mysql.com/doc/refman/5.0/en/secure-connections.html

1 2 3 4 5  Scroll to top