Thursday, April 12, 2007

Internet Explorer Hacks and Tips

Odd Toolbar Behavior

Did you ever get your Toolbars in IE set just right only to reboot and you lose your settings? Many times when Toolbars are added or removed the Registry entry that controls these settings does not get updated or has become corrupt. You can download a small reg file to reset (to default) and correct this behavior.

  • Download: ResetBrowserToolbar .reg [right-click and select: "Save Target As"
    To use: right-click and select: Merge - Ok the prompt and reboot.

Missing Status Bar

The above reg file will correct this behavior, if your status bar disappears when opening a new IE browser window. However make sure that option is selected - right-click the top Toolbar and select: Status Bar. If you are still having problems verify the below Registry entries exist and are correct:

[HKEY_CURRENT_ USER\Software\ Microsoft\ Internet Explorer\Main]
"Show_StatusBar"="yes"
"Show_URLinStatusBar"="yes"

Opening Internet Explorer Full Size

Ever notice sometimes you right-click on a link and open a new window and it's not full screen? This usually occurs because IE remembers the last window size when closed. Many times a background pop-up will do this too, if it is the last window closed. To resize the window and regain control:

  • Close all instances of Internet Explorer except for one.
  • Right-click on a link in the page and select: "Open in New Window"
  • Close the first browser window using the [ X ] (upper right corner)
  • Resize the window manually by dragging the sides to the desired size.
    Note: Do NOT click the Maximize button, you must do it manually.
  • Hold down the Ctrl key and click the Close button (upper right)

[Exception]
In some cases the "Remember last window size" info becomes corrupted in the Registry.

[HKEY_CURRENT_ USER\Software\ Microsoft\ Internet Explorer\Main]
"Window_Placement"=

To reset the "Window_Placement" entry to default. You can download a small reg file to reset (to default) and correct this behavior.

Download: ResetWindowPlacemen t.reg [right-click and select: "Save Target As"]
To use: right-click and select: Merge - Ok the prompt and reboot.

Gain more viewing space

  • Right-click the Toolbar and select: "Unlock the Toolbars"
  • Left-click the Address Bar button, it changes to a four-way arrow
  • Drag the Address Bar into the empty space next to Help in the Toolbar
  • Next, right-click on any of the Icon Buttons, and uncheck Text Labels
  • Also you can select: Small Icons from the Customize menu.
  • Then right-click the Toolbar and select: "Lock the Toolbars"

Resize your IE Cache size

By default IE reserves 10% of your drive space for the Temporary Internet Files. This was fine several years ago but since then the hard drive capacities have increased dramatically. If you happen to have one of these large disks the 10% is truly unnecessary and wasteful.

  • Close all instances of Internet Explorer and Outlook Express
  • Control Panel | Internet Options | General tab
  • Click Settings and move the slider to 50 mb, click Ok
  • Click Delete Files and also select: "Delete all offline files", click Ok
  • Click Clear History, click Ok, Apply\Ok

Note: While viewing Newsgroup messages Outlook Express dumps a series of zero-byte files into the TIF. When Outlook Express is closed it fails to cleanup these files. To delete these zero-byte files you must select the above option "Delete all offline files".

Spell Checker for Internet Explorer

ieSpell is a free Internet Explorer browser extension that spell checks text input boxes.
Editors Note: has an option to integrate the database from other spell checkers.

Agent Ransack (freeware) File searching software
This is not a replacement to Microsoft's built-in Search Utility, it's just much faster!

Removing Unwanted IE Menu Items

  • Scan your system with Ad-Aware or SpyBot
  • Run HijackThis! and select the "08/09" items you want removed.

To manually remove from the Registry [Experienced Users]

[HKEY_CURRENT_ USER\Software\ Microsoft\ Internet Explorer\MenuExt]

  • Click open "+MenuExt" (left pane) Locate the desired Menu Extension (highlight)
    Make a note of the corresponding (htm) file (right pane)
    Right-click the desired key (Menu Extension) select: Delete
    Note: always Export before editing the Registry.
  • Close Regedit, Open Windows Explorer
    Locate and delete the "corresponding (htm) file" (if exists)

Repairing your Winsock Connection

If you have suddenly lost your Internet connection after removing a unwanted program (such as NewDotNet, and Commonname) the following steps will help restore your connection.

Fast Printing web pages without images

  • Create a one line .css file [example] "NoImages.css", copy the below line to Notepad and Save As: NoImages.css. Open Internet Options | General tab | Accessibility button, place a check in "Format documents using my style sheet", click OK.

    IMG { display: none !important;}
    Download
    : NoImages.css [right-click and select: Save Target As]

The next time you want to print the contents of a web page but don't want to waste the time and ink printing all the ads, banners, etc. just Toggle the above option on\off.


Note: there is no need to restart IE as this trick works on the fly. Also be aware that CWShredder detects any/all .css files as suspect and deletes them. CWShredder is no longer recommended ... avoid using this outdated program.

Thursday, April 5, 2007

CSS Underscore Hack : IE cross compatibility issue solved

CSS Hack:

Every Developer would have struggled with Cross Browser Compatibilities and that too these days, the things which work with IE doesnt work with FF and vice versa. Once you are into this issue, it is really difficult to make it up. You have to see both the browsers as two pans of a balance.There are so many hacks coming in. One such is "The underscore hack", which can be used almost for all issues.

What is this Underscore Hack issue?
Underscore issue as the name implies is nothing but adding a underscore for every property which behaves differently in IE and FF. Say you have a left margin specification.

left:5px;

But this is not getting properly displayed in IE, IE needs 8 px for that same layout.so the hack is we are adding one more specificaiton which goes like

_left:8px

this "_" specified value will be taken by IE and FF/other browser will take the other value.

But sometimes, we go to an extent of using negative values for proper display using "_", but that is not a standard practise. we should avoid that.

JSON vs XML

This article is intented to give a brief Sketch about JSON and a small comparison between JSON and XML

The JavaScript Object Notation, or JSON, is a lightweight syntax for representing data. It is based on a subset of the JavaScript Programming Language, Standard ECMA-262 3rd Edition - December 1999. JSON is a text format that is completely language independent.

JSON is a collection of name/value pairs and that is an Object. An object is an unordered set of name/value pairs. An object begins with { (left brace) and ends with } (right brace). Each name is followed by : (colon) and the name/value pairs are separated by , (comma).
The main advantage of JSON is that, it can be represented in any language standard say C, java and even in Scripts. The entire list is here.

I just tried CSS JSON, it was pretty easy. Here is one example. Say Suppose we have one CSS structure which goes like this.

selector-1 {
property-1:value1;
property-2:value2;
}

And how can we represented in JSON, it is really easy. Here it goes

{
“selector-1″:{
“property-1″:”value-1″,
“property-n”:”value-n”
}
}

Sounds easy???

Let us take another Ordinary XML schema and let us try representing them in JSON.

This is the XML version.
For example, an address book application might provide a Web service that yields address cards in this XML format:



Name
PH

abcd@xyz.com
me@mailme.com

+12345678
+1234 1234

1234 Oil Mill St
Chennai, IND

5678 Oil Mill St
Chennai, IND

http://techasilo.blogspot.com/
http://techasilo.blogspot.com/



Now we will analyse this XML, there is root entity called “card” and it has child nodes namely “fullname”,”org”,”telephone” etc. In turn they have

attributes. Let us take the innermost entity “telephones” it has attributes say “type” and “value”. So how can we represent them in JSON.
We can have name value pair arrays which goes like

“telephones”: [
{”type”: “work”, “pref”: 1, “value”: “+12345678″},
{”type”: “mobile”, “value”: “+1234 1234″}
],

So similarly it applies to all other elements and all the elements are contained in one OBJECT and we can draw them as

{
“fullname”: “Name”,
“org”: “PH”,
“emailaddrs”: [
{”type”: “work”, “value”: “abcd@xyz.com”},
{”type”: “home”, “pref”: 1, “value”: “me@mailme.com”}
],
“telephones”: [
{”type”: “work”, “pref”: 1, “value”: “+12345678″},
{”type”: “mobile”, “value”: “+1234 1234″}
],
“addresses”: [
{”type”: “work”, “format”: “us”,
“value”: “1234 Oil Mill St Chennai, IND”},
{”type”: “home”, “format”: “us”,
“value”: “5678 Oil Mill St Chennai, IND”}
],
“urls”: [
{”type”: “work”, “value”: “http://techasilo.blogspot.com/”},
{”type”: “home”, “value”: “http://techasilo.blogspot.com/”}
]
}

It is! It is sure that JSON will replace XML in future. But how?
Json is a notation; this raised some doubts for me. JSON is also a markup language like XML. Then what is the difference between JSON and XML.
-Both are text based.
-Both uses Unicode.
-Both are readable by humans.

But JSON has less redundancy, XML will be best for making documents and JSON can be for best interchange.

Why JSON would be a best way for interchange?
XML is not well suited to data-interchange because
*It carries a lot of baggage,
*It doesn’t match the data model of most programming languages.
And JSON overcomes all these disadvantages and still manages to provide interoperability and openness.

But one disadvantage is that, JSON is not extensible, but some says it doesn’t need to be, because they say JSON is not a Document markup Language, so it is not
necessary to define new tags and attribute to represent data in it and it doesn’t provide any display capabilities.

JSON might be the next Universal Standard.The next Generation of Technology

Wednesday, April 4, 2007

Generics - .Net Vs Java

All of you would have heard about the new feature called “Generics” that has been introduced both in .Net CLR for Whidbey as well as Java 1.5. Given below is a small comparison between the Generics in both these technologies with respect to their role in improving performance.

What is Generics?

“Generics” is a means of creating parameterized objects, i.e. specifying the objects that a class can work with at the time of declaring the objects. These objects are then evaluated at the compile time itself unlike at the run time as is the case without Generics.

While .Net Generics offers a performance boost to the program, Generics in Java is mainly intended to improve code clarity and readability.

The advantages offered by Generics in Java are:

1) Improved code readability
2) Reduced casts.

However, it is important to note that since casting is still being performed behind the scenes, the Java programs will not receive a performance boost from using generics. The addition of generics to the Java language is not intended to improve performance; it is intended to increase program readability and reliability while maintaining backwards compatibility with existing programs.

How is Generics in .Net different from that of Java?

Generics in .NET offer all of the advantages mentioned for them in the Java world, but unlike the Java world, in the .NET world we do find potential performance gains mentioned as an advantage of using .NET generics. Technically, the reason appears to be that the Java implementation is based in the Java compiler which simply generates an ordinary collection wrapped with type casting, just as we would use without generics to build a type-safe collection. But in .NET generics are implemented within the CLR, so that the code itself is type safe and type-casting is eliminated. In other words, generic variables (as opposed to java) don't need any casts at all as they are stored in the specific type. So if there is a generic list of ints it is internally handled as a real int-array and not as an array of objects which get cast to Integer and then unboxed. Thus the expected performance gains.

Current benchmarks of a quick-sort of an array of one million integers shows that the generic method is three times faster than the non-generic equivalent. This is because boxing of the values is avoided completely. The same sort over an array of string references resulted in a 20 percent improvement in performance with the generic method due to the absence of a need to perform type checking at run time.

The following links give more information on what generics are:

http://research.microsoft.com/projects/clrgen/generics.pdf

http://java.sun.com/j2se/1.5/pdf/generics-tutorial.pdf

Sunday, April 1, 2007

AXIS client stubs deployed in Weblogic 8.1

A call to a Web service has become the nerve of web application development and this post is to discuss about one of the issues that we faced in deploying an axis generated client stub module in Weblogic 8.1.

The underlying problem is the version conflict of the javax.xml.soap.* package used by AXIS and Weblogic 8.1. Axis uses a new version of this package while the application server Weblogic 8.1 has an older version. Finally you end up with an Exception when the client program written to use the axis client stub is deployed on Weblogic.

How do you solve it?
1) Make a modification to the Weblogic startup script such that the saaj.jar of axis is ahead in the CLASSPATH (before WEBLOGIC_CLASSPATH) before webservices.jar of Weblogic.

However, this is not a suggested one as this modification would be applied for all the applications deployed in that container. A change should be application specific. Let’s go for an application specific solution.

2) Make modification to the weblogic.xml in the application such that you instruct the server to look for classes in web-inf first rather than the files on the server's classpath.

In WEB-INF\weblogic.xml

<weblogic-web-app>
<container-descriptor>
<prefer-web-inf-classes>true</prefer-web-inf-classes>
</container-descriptor>

http://ws.apache.org/axis/java/install.html#WebLogic8.1

However beware of few more things when you use this solution - Your application will not have only calls to web services - Of course there be other jars. For example - Problem in parsing XML files, Weblogic server specific codes which conflicts with the jars in you web-inf (ejb client stubs and so on).

For solving the problems with parsing - makes necessary entries in the XML registry of the server to point to the new versions of the series you would have in you web-inf.

-Djavax.xml.parsers.DocumentBuilderFactory=org.apache.xerces.jaxp.DocumentBuilderFactoryImpl
-Djavax.xml.parsers.SAXParserFactory=org.apache.xerces.jaxp.SAXParserFactoryImpl
-Djavax.xml.transform.TransformerFactory=org.apache.xalan.processor.TransformerFactoryImpl

3) Making modification to the Weblogic startup script to include the following JAVA_OPTIONS would force the server to use the Message Factory of axis. But this solution did not work for me :(

-Djavax.xml.soap.MessageFactory="org.apache.axis.soap.MessageFactoryImpl"

Try these and do add your comments if any of these solutions are not working or are not valid.