Blog On Tech By Kenyth

A little bit more...

Monday, September 03, 2007

Common sense: difference between application database and data warehouse

(This post is a collection of information found available on line)
Introduction

I'm a beginner in this aspect. Basically, an app database and a data warehouse have in common is that they're both databases. However they serve for different purposes.

Diff

cite from resource 1:
The primary difference betwen you application database and a data warehouse is that while the former is designed (and optimized) to record , the latter has to be designed (and optimized) to respond to analysis questions that are critical for your business.


Application databases are OLTP (On-Line Transaction Processing) systems where every transaction has to be recorded, and super-fast at that. An application database system is designed to make sure that every transaction gets recorded within the time users are served.

Data warehouses are designed as OLAP (On-Line Analytical Processing) systems, these databases contain read-only data that can be queried and analyzed far more efficiently as compared to your regular OLTP application databases.

cite from resource 3 (read this resource linked below for a thorough understanding):

A common way of introducing data warehousing is to refer to the characteristics of a data warehouse as set forth by William Inmon:


Figure 1-1 Contrasting OLTP and Data Warehousing Environments

Text description of dwhsg005.gif follows
Text description of the illustration dwhsg005.gif


More words on either one

An application database mainly serve for processing real time business data. It shows the whole picture of the business objects world. Every application should normally have an application database to gain any feature concerning persistence. However, a data warehouse is not a must for every business application. It is mainly for analysis of historical (or accumulated) data, and sometimes for real time. Because it is for analysis, it is normally configured as read only for the analysis that is based on it (that is, the end user). In data warehouses there're not only data directly reflecting the status of business objects of some time, but also (and mainly this kind) data derived from business objects data.

data in data warehouse:
Raw data: mappings of business object data
Summary data: monthly statistics
Meta data: day, month, year, etc

Further reading:     
  1. Business Intelligence: What is Data Mining?
  2. Business Intelligence - What is it?
Resources
  1. Database vs. Data Warehouse
  2. GeekInterview.com  >  Interview Questions  >  Data Warehousing
  3. Oracle9i Data Warehousing Guide Release 2 (9.2)

Sunday, August 05, 2007

Smartly load your properties

Method Parameter format Lookup failure behavior Usage example
ClassLoader.
getResourceAsStream()
"/"-separated names; no leading "/" (all names are absolute) Silent (returns null) this.getClass().getClassLoader()
.getResourceAsStream
("some/pkg/resource.properties")
Class.
getResourceAsStream()
"/"-separated names; leading "/" indicates absolute names; all other names are relative to the class's package Silent (returns null) this.getClass()
.getResourceAsStream
("resource.properties")
ResourceBundle.
getBundle()
"."-separated names; all names are absolute; .properties suffix is implied Throws unchecked
java.util.MissingResourceException
ResourceBundle.getBundle
("some.pkg.resource")

and there're more tips in the linked resource below.

Resources
  1. Smartly load your properties

Difference Between ResourceBundle and Properties Classes in Java

GMHK wrote:
> Can anyone tell me the whats the difference between the resource bundle
> and Properties classes in java.
> As both uses the .properties file to get the string constants.

No, they don't necessarily. A resource bundly does not have to be
file-based. The common implementation, however is. And that common
implementation (PropertyResourceBundle) indeed uses properties files and
thr Properties class.

However, resource bundles also come with a particular lookup-schema to
select a particular bundle according to the Locale. Something which you
don't get with Properties, but which is important when you do some
actual localization.

> At what point of time would the programmer decide to choose which of
> the either classes.

A resource bundle (properties file based or otherwise) when in need for
the lookup of locale-specific data. A naked properties file when in need
for keeping some small (FSWO) set of data persistent (e.g. application
configuration data), which is not supposed to be translated.

You didn't mention Preferences. I still preferen Properties over
Preferences because of the easy-to-work-with text file format, but they
can be used for the same purpose as Properties, without the need of
having to deal with files.

> What i understood so far is resourcebundle makes uses of String manager
> to get the string.
> where as the Properties tries to read the properties directly.

Both map keys to values. The biggest difference is how they get that
mapping. ResourceBundles follow a build-in lookup schema taking a locale
into account. Properties need to be provided with some InputStream,
which the programmer has to handle explicitely. Properties have an easy
way to be written to an OutputStream, while ResourceBundles are ment to
be read-only.

/Thomas
Resources
  1. Difference Between ResourceBundle and Properties Classes in Java

Friday, July 27, 2007

Regular expression and CharSequence in Java

Introduction
Regular expression, specified as a string, is first compiled into an instance of Pattern. The regular expression constructs supported by Pattern are almost the same (see comparison to Perl 5 in javadoc of class pattern) as that supported by Perl 5. The Pattern engine performs traditional NFA-based (Nondeterministic Finite Automate) matching with ordered alternation as occurs in Perl 5.

The regex Package
Two major class Pattern and Matcher, both of which have non-public constructor which means  the client can't new instances of them directly. A Pattern instance is the compiled intermediate representation, plus some helper methods, of the string form regular expression. Instances of Pattern are immutable which means they're thread-safe. And each instance of Matcher, produced by factory method of Pattern, corresponds to each matching between the bound regular expression of the target string ( i.e., the string to be matched). Further information about how to use this package in a program can be found in the resources section.

regex matching in CharSequence
Despite being as part of the java library, the regex package is also used by other parts of the library. These usages are listed below:
boolean String.matches( String regex );
String String.replaceAll( String regex, String replacement )
String String.replaceFirst( String regex, String replacement )
String[] split( String regex )

Note that rather than class String or some other concrete representation of CharSequence, interface CharSequence is widely depended upon both in Pattern and String. Classes implementing CharSequence mainly include String, StringBuffer and StringBuilder. And the implemented methods include such methods that we usually use with String as charAt(int), length(), and subSequence(int, int).


Resources
  1. Interface java.lang.CharSequence
  2. Package java.util.regex
  3. Lesson: Regular Expressions

About Me

My photo
I'm finishing my master degree in Software Engineering, Computer Science. I believe and have been following what Forrest Gump's Mam said: you have to do the best with what god gave you.