How to Zip a folder in Java

September 18, 2007 · Posted in java · 1 Comment 

Using the in-built zip function of java, attached is a sample code to copy a folder and all its sub-folders into a zip file.

Java Program to Zip a folder

This program uses Commons IO – IOUtils library to copy files.

How to check GMail RSS/Atom feed

September 17, 2007 · Posted in java · 1 Comment 

Google provides a feed url to check your new mail(s) in your inbox. The url is https://gmail.google.com/gmail/feed/atom.

You would need to authenticate first with your gmail username and password and it will list the unread email(s).

I was reading about Rome and thought to write a small program utilizing its features to read my gmail feed. Attached is the java program to read the gmail feed.

Let me know if you have any comments.

CSS Float

September 12, 2007 · Posted in css · Comment 

float is not a positioning property in CSS —the only position properties in CSS are absolute, relative, fixed, and static—however, when you combine widths, margins, and floats, you have CSS properties at your command that are often more reliable in terms of layouts than any of the available position properties.

I was reading about CSS and was trying to create a layout using float. There is a great article that explains CSS float in detail.

Advantages of using CSS

September 12, 2007 · Posted in css · Comment 

CSS is becoming very popular these days and creating layouts using CSS is becoming a standard. The advantages of using CSS are:

  • Easier to make site-wide changes. It is easier to maintain one CSS file rather than modifying each page.
  • Making changes to layout does not affect the HTML or server side code.
  • As browsers cache the style sheet page, the page loading becomes fast. The styles classes are not loaded from server each time, if different pages of same site use the same CSS, the cache is read.
  • As property with value is defined at a common style class and we use the same class at different locations, so we use less code. Less code means less bandwidth consumption and easy to maintain the content.
  • Layout and position of navigation can be completely consistent across a site.

Rules for Speeding Up Your Web Site

September 4, 2007 · Posted in css, general web, javascript · Comment 

Yahoo Developer Network posted a nice set of rules to speed up your website. The excerpt is as follows:

  1. Make Fewer HTTP Requests
  2. Use a Content Delivery Network
  3. Add an Expires Header
  4. Gzip Components
  5. Put Stylesheets at the Top
  6. Put Scripts at the Bottom
  7. Avoid CSS Expressions
  8. Make JavaScript and CSS External
  9. Reduce DNS Lookups
  10. Minify JavaScript
  11. Avoid Redirects
  12. Remove Duplicate Scripts
  13. Configure ETags

You can read the full article here.