Showing posts with label reference. Show all posts
Showing posts with label reference. Show all posts

Friday, July 31, 2009

Leveraging Google to build your business

I read a nice post this morning about building business with Google by Eric at 過労死 Death by Overcoding.

It covers many aspects that may be involved in administering your business needs, such as:

  • Domain registration/host/email/office apps
  • Phone Management
  • Blog
  • The Application
  • Payments
  • AdWords
  • Analytics
  • Integration/Optimization

I recommend reading it to anyone who is starting up a web business. Following the steps mentioned in that blog post can be a real timesaver. And you do not need to hire an admin to do it all.

Friday, March 13, 2009

Visual Event

This is a really neat tool by Allan Jardine, a UI developer! It makes it so easy and visual to see what even handlers are attached to the elements of a page. Great addition to my toolbox!

When working with events in Javascript, it is often easy to loose track of what events are subscribed where. This is particularly true if you are using a large number of events, which is typical in a modern interface employing progressive enhancement. Javascript libraries also add another degree of complexity to listeners from a technical point of view, while from a developers point of view they of course can make life much easier! But when things go wrong it can be difficult to trace down why this might be.

Read the whole article about Visual Event

Saturday, November 22, 2008

CSS Naming Conventions

This is a great article about CSS coding: semantic approach in naming convention.

I am keeping this link for any time I will start a new project and will need to look back at some good advise for CSS naming conventions.

Surprisingly I was not far off with my currently undergoing project bar sorrento.

An image is worth a thousand words.

Nevertheless, I recommend you read the full story.

Sunday, August 31, 2008

How to get the server's timezone

The problem

How to get the server's timezone display name correctly and display it to the user in his locale.

server's default timezone

Firstly, you need to get the server's default timezone. This is easily achieved by the following call

final TimeZone timeZone = TimeZone.getDefault();

use daylight time?

Secondly, you need to find out if this timezone uses daylight time. This is important as some timezones change their names during daylight saving. Don't use the TimeZone.useDaylightTime() method

//final boolean daylight = timeZone.useDaylightTime();

This method works fine only for systems where the timezone never changes. If the administrator changes the time on the server, this change won't be reflected in subsequent calls. What you need to do instead, is to find out is the daylight savings is on right now.

final boolean daylight = timeZone.inDaylightTime(new Date());

user's locale

The last important step is to get the right locale, the locale you want this timezone name to display in. You could call Locale.getDefault(), but this returns server's default locale. You want the locale that the user is using. In a web application, the user's locale can be obtained from getLocale() method of ServletRequest object.

final Locale locale = servletRequest.getLocale();

final step - timezone display name

Now we can call getDisplayName method with all required parameters.

return timeZone.getDisplayName(daylight, TimeZone.LONG, locale);

Solution

To put this all together, the final solution may look like this method

private String getServerTimeZoneDisplayName()
{
final TimeZone timeZone = TimeZone.getDefault();
final boolean daylight = timeZone.inDaylightTime(new Date());
final Locale locale = servletRequest.getLocale();
return timeZone.getDisplayName(daylight, TimeZone.LONG, locale);
}

References


Creative Commons License This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 2.5 License.