Showing posts with label Tips. Show all posts
Showing posts with label Tips. Show all posts
1 comments 2010-03-20

Recently I was reading books about Object Oriented design and analysis to refresh my designing skills. While doing that I came across few interesting design principles, I hope these will be helpful to new developers/designers
  1. Identify the aspects of your application that vary and separate them from whats stays the same.
  2. Program to an Interface, not an implementation.
  3. Favor composition over inheritance.
  4. Strive for loosely coupled designs between objects that interact.
  5. Classes should be open for extension, but closed for modification.
  6. Depend on abstractions. Do not depend on concrete class.
  7. Talk only to your Immediate friends - Principle of least knowledge.

0 comments 2010-03-04

These days many websites prefer to have fixed width body which is horizontally centered, and if you also want to create website like that, you would probably use "margin:auto;" style in your main container div inside body. This will work fine in most of the CSS2 and CSS3 compliant browsers(Firefox, Chrome) but in IE this page would not be centered!
Click here to see the Demo in IE.
You might be thinking "WTF is wrong with IE??".
Well there are many things which are wrong with IE, and this is just one of those.
Here is a workaround to fix this issue, use "text-align:center;" in BODY to align 'block' elements like "DIV". YUI also does the same in their reset css.
Click here to see the Demo with IE fix.
By now you must have noticed that we have to fix side effect of text-align when we use this approach, if you haven't noticed that in Demo, then again have a look at it.

0 comments 2010-02-12

As a web application developer, I tend to use XSLs very frequently, so I used the following technique to test my XSLs without spending money in buying professional XML/XSL editors like Oxygen. This trick will quickly allow you to test your XSL using XALAN's command line utility:

  1. Copy XML, XSL and XSLT processor jar in one folder. I am using XALAN(Download it from here) with jre 1.6(which should be installed on your machine). If you want to run this in many folders, you should put xalan.jar in one central location and add it to your CLASSPATH
  2. Run the following command in that directory 
  3. C:\test > java -cp c:\xalan.jar org.apache.xalan.xslt.Process -IN input.xml -XSL transformer.xsl -OUT output.xml
  4. output.xml is ready

To learn more about this command line utility, visit http://xml.apache.org/xalan-j/commandline.html and start saving money and time.

0 comments 2010-01-17

I am using Eclipse since few years and always liked their basic settings of font and appearance, but few days back when I was debugging a large source code file, I had to scroll up and down a lot even though those code sections were just 30-40 lines apart. So I thought of changing font size to see more code in my small laptop screen and debug it fast, but to my surprise when I went to change font size in preferences section, I was confused with so many options shown to me. I can understand by giving these many options they are allowing users to customize every part of IDE but it could have been lot simpler. Anyways, I wasted lot of time to figure it out so, I am putting my findings here to help other poor souls like me.

  1. In Eclipse, go to Window > Preferences > General > Appearances > Colors and Fonts
  2. Don't panic if you see lot of options, go to 'Basic' node and select 'Text Font'.
  3. Click 'Change' button and change the font size as per your requirement.
Doesn't it look so easy when you read this article? It is, but for new users this is not at all intuitive.
Anyways, Happy coding!