jump to navigation

Design pattern (Part 1) February 25, 2008

Posted by essamabdelaziz in JAVA.
add a comment

Nowadays I’m so interested in Design pattern

So will start to blog regarding the same starting

Today I will start to give a small introduction about design pattern later on i will go in depth to

talk about every pattern one by one in details

*What is design pattern?

If a problem occurs over and over again, a solution to that problem has been used effectively. That solution is

described as a pattern.

*design pattern VS Framework?

A framework is a product and

a design pattern is a specification.

Therefore a design pattern is part of your system design and a framework is part of your system.

The two could be looked at different contexts.

A design pattern suggests a solution for a recurring design problem in an application and the solution is generally open for future extensions.

A framework is a suite of packages using which applications (or the logical layers of applications), with all the functional and non-functional requirements, can be developed and hosted.

A design pattern it is the best solution for your problem like SingleTone,etc..

A framework like JSF,Struts,Spring,Hibernate

Do I have to use the design pattern?

If you want to be a professional Java developer, you should know at least some popular solutions to coding

problems. Such solutions have been proved efficient and effective by the experienced developers. These

solutions are described as so-called design patterns. Learning design patterns speeds up your experience

accumulation in OOA/OOD. Once you grasped them, you would be benefit from them for all your life and

jump up yourselves to be a master of designing and developing. Furthermore, you will be able to use these

terms to communicate with your fellows or assessors more effectively.

Many programmers with many years experience don’t know design patterns, but as an Object-Oriented

programmer, you have to know them well, especially for new Java programmers. Actually, when you solved

a coding problem, you have used a design pattern. You may not use a popular name to describe it or may not

choose an effective way to better intellectually control over what you built. Learning how the experienced

developers to solve the coding problems and trying to use them in your project are a best way to earn your

experience and certification.

Remember that learning the design patterns will really change how you design your code; not only will you

be smarter but will you sound a lot smarter, too.

How many design patterns?

Many. A site says at least 250 existing patterns are used in OO world, including Spaghetti which refers to

poor coding habits. The 23 design patterns by GOF are well known, and more are to be discovered on the

way.

Note that the design patterns are not idioms or algorithms or components

What is the relationship among these patterns?

Generally, to build a system, you may need many patterns to fit together. Different designer may use different

patterns to solve the same problem. Usually:

• Some patterns naturally fit together

• One pattern may lead to another

• Some patterns are similar and alternative

• Patterns are discoverable and documentable

• Patterns are not methods or framework

• Patterns give you hint to solve a problem effectively

 

http://www.javacamp.org/designPattern/index.html

The real reason of success “Teamwork” February 16, 2008

Posted by essamabdelaziz in JAVA.
2 comments

Teamwork is Cooperative effort by the members of a group or team to achieve a common goal or missions and as we all know that it is not used just in work but we can find it in all the needs of life.

Nowadays most of projects require that people work together, so teamwork has become an important concept everywhere. Effective teams are an intermediary goal towards getting good, sustainable results.

It is so deep field and I can got everything about it but there is two questions took my attention

How we apply the teamwork concept?

1- Listen to other people’s ideas. When people are allowed to freely express their ideas, these initial ideas will produce other ideas.
2- Ask questions, interact, and discuss the objectives of the team.
3- Treat others with respect and to support their ideas.
4- All the members should trust each other.
5- Help one’s coworkers, which is the general theme of teamwork.
6- Share with the team to create an environment of teamwork.
7- For a team to work effectively it is essential team members acquire communication skills and use effective communication channels between one another.
8- Be diplomat and tolerant.

There is a wonderful saying says “A Teamworker is the oil that keeps the machine running…the yeast that helps the dough rise. They are good listeners and diplomats, talented at smoothing over conflicts and helping parties understand each other without becoming confrontational” and unfortunately it is rarely in our society this days.

What are the laws of successful teamwork?

1- The Significance: One Is Too Small a Number to Achieve Greatness
2- The Big Picture: The Goal is More Important Than the Role
3- The Niche: All members Have a Place Where They Add the Most Value
4- The Great Challenge: As the Challenge Escalates, the Need for Teamwork Elevates
5- The Chain: The Strength of the Team Is Impacted by Its Weakest Link
6- The Bad Apple: Rotten Attitudes Ruin a Team
7- The Countability: Team-mates Must Be Able to Count on Each Other When It Counts
8- The Identity: Shared Values Define the Team
9- The Communication: Interaction Fuels Action

Amazing things could be accomplished today if we could get members and leaders to trust and commit to the teamwork process of joint problem solving, consensus decision making and shared leadership.

The lack of teamwork’ is blamed for such a wide variety of everyday business dilemmas — dilemmas like late delivery, poor quality, a blown budget or poor customer management. That because the people in businesses do not understand the real meaning of teamwork concept.

http://sarahhamidmahmoud.blogspot.com/2008/01/real-reason-of-success-teamwork.html

DataBase transaction February 14, 2008

Posted by essamabdelaziz in DataBase.
add a comment

transaction
A transaction is a set of one or more statements that are executed together as a unit, so either all of the statements are executed, or none of the statements is executed.

Using Transactions
There are times when you do not want one statement to take effect unless another one completes. For example, when the proprietor of The Coffee Break updates the amount of coffee sold each week, he will also want to update the total amount sold to date. However, he will not want to update one without updating the other; otherwise, the data will be inconsistent. The way to be sure that either both actions occur or neither action occurs is to use a transaction.

Disabling Auto-commit Mode
When a connection is created, it is in auto-commit mode. This means that each individual SQL statement is treated as a transaction and is automatically committed right after it is executed. (To be more precise, the default is for an SQL statement to be committed when it is completed, not when it is executed. A statement is completed when all of its result sets and update counts have been retrieved. In almost all cases, however, a statement is completed, and therefore committed, right after it is executed.)
The way to allow two or more statements to be grouped into a transaction is to disable auto-commit mode. This is demonstrated in the following line of code, where con is an active connection:

con.setAutoCommit(false);
Example:

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;

/**
*
* @author javadb.com
*/
public class Main {

/**
* Updates tables using a transaction
*/
public void updateDatabaseWithTransaction() {

Connection connection = null;
Statement statement = null;

try {
Class.forName(”[nameOfDriver]“);

connection = DriverManager.getConnection(”[databaseURL]“,
“[userid]“,
“[password]“);

//Here we set auto commit to false so no changes will take
//effect immediately.
connection.setAutoCommit(false);

statement = connection.createStatement();

//Execute the queries
statement.executeUpdate(”UPDATE Table1 SET Value = 1 WHERE Name = ‘foo’”);
statement.executeUpdate(”UPDATE Table2 SET Value = 2 WHERE Name = ‘bar’”);

//No changes has been made in the database yet, so now we will commit
//the changes.
connection.commit();

} catch (ClassNotFoundException ex) {
ex.printStackTrace();
} catch (SQLException ex) {
ex.printStackTrace();

try {
//An error occured so we rollback the changes.
connection.rollback();
} catch (SQLException ex1) {
ex1.printStackTrace();
}
} finally {
try {
if (statement != null)
statement.close();
if (connection != null)
connection.close();
} catch (SQLException ex) {
ex.printStackTrace();
}
}

}

/**
* @param args the command line arguments
*/
public static void main(String[] args) {

new Main().updateDatabaseWithTransaction();

}
}

Sun to buy MySQL for $1 billion February 13, 2008

Posted by essamabdelaziz in DataBase.
add a comment

SAN FRANCISCO (AP) – Sun Microsystems Inc.’s deal to buy open-source software company MySQL AB for $1 billion deepens Sun’s bet that its road to prosperity lies in distributing free software that generates hefty maintenance fees and could sell more servers.

The acquisition, announced before the market opened Wednesday, gives Santa Clara-based Sun a foothold in the rapidly expanding market for database software for Web-based companies.

MySQL’s software is used by some of the world’s biggest Web sites to archive and retrieve information, and with people creating more Web content every day, demand for those services is quickly growing.

Sun, in a separate announcement, also pre-announced second quarter revenue that would narrowly exceed Wall Street estimates. Profit during the quarter would fall at the high end of analysts’ expectations, Sun said.

Sun is paying $800 million in cash and assuming $200 million in options to acquire MySQL. The Swedish company makes open-source database software used by companies such as online search leader Google Inc., popular Internet hangout Facebook Inc. and Finnish phone maker Nokia Corp.

Sun said the deal will help spread MySQL’s software to large corporations, which have been the biggest customers of Sun’s servers and software, and boost its distribution through Sun’s relationships with other server makers such as IBM Corp. and Dell Inc.

Sun believes it can sell more server computers and ring up higher maintenance fees by also offering software whose source code is publicly available for free.

MySQL competes with non-open-source offerings from Microsoft Corp. and Oracle Corp., which dominate database software for traditional businesses.

However, MySQL is the rapidly growing market leader in open-source database software, particularly among Web-based companies, where it commands about 80 percent of the global market, according to Sun Chief Executive Jonathan Schwartz.

Microsoft is less than 10 percent of that market, Schwartz said.

“We are really acquiring a database that customers and Web companies across the world have moved to at a breathtaking clip,” Schwartz said in an interview. “The titans of the Web all use MySQL — banks, automobile companies, pretty much all of the Fortune 500 runs MySQL in their shops.”

The acquisition, expected to close in the third or fourth quarter, takes pressure off Sun to spend some of the cash it has been accumulating. It also bolsters its software offerings with a well-known name in Internet data retrieval.

“This gives us access to every hot Web company on earth, and every company that will be hot 5 years from now,” Schwartz said. “For us, this is completely landscape-changing.”

Sun also said it expects second-quarter net income of between $230 million to $265 million, or 28 cents to 32 cents per share. Analysts surveyed by Thomson Financial were expecting profit of between 22 cents and 38 cents.

Sun predicts $3.6 billion in sales during the second quarter. Analysts were expecting, on average, $3.58 billion in sales.

The company was expected to release its results January 24.

Despite financial difficulties that have plagued Sun since the dot-com meltdown in 2001, the company has been accumulating a cash horde that reached $5.9 billion at the end of the 2007 fiscal year.

In recent quarters, as Sun has returned to profitability under new management and tightened cost controls, investors have pressured the company to spend some of its war chest in ways that boost its value.

Still, some shareholders remain skeptical about the company’s prospects.

Sun’s stock price has slid about 25 percent since the company’s 1-for-4 reverse stock split in November, an essentially cosmetic maneuver to remove the stigma of slumping shares.

In a reverse stock split, a company lowers the number of outstanding shares, boosting the value of each share, while keeping total market value unchanged.

As a result, Sun’s share price jumped from around $5 to more than $20, but has fallen sharply since then, closing Tuesday at $14.98 before the acquisition and results were announced.

Sun shares rose 55 cents, or more than 3 percent, to $15.53 Wednesday.

 http://news.moneycentral.msn.com/ticker/article.aspx?Feed=AP&Date=20080116&ID=8050292&Symbol=IBM

 

LDAP AND JNDI February 13, 2008

Posted by essamabdelaziz in JAVA.
add a comment

My Dears,

I have collected a few tips regarding LDAP and how to deal with Active Directory in java.

I will blog whatever I get Whenever I have the chance .

Here I will start with LDAP .

LDAP:

 

  • Lightweight Directory Access Protocol (LDAP)
  • was developed in the early 1990s as a standard directories protocol.
  • LDAP defines how clients should access data on the server
  • JNDI does for LDAP what JDBC does for Oracle — it provides a standard API for interacting with naming and directory services using a service provider interface (SPI)
  • LDAP is a standard way to provide access to directory information
  • An LDAP directory entry is a collection of attributes with a name, called a distinguished name (DN). The various types of additional data obout that DN, (e.g. phone number, email address, mailing address, security access code) may have restricted access to a subset of users of the database.

eads from right to left. Here is an example of an DN:

uid=styagi,ou=people,o=myserver.com

o

Organization

ou

Organizational unit

cn

Common name

sn

Surname

givenname

First name

uid

Userid

dn

Distinguished name

mail

Email address

Some common LDAP attributes


*Any attribute can have one or more values, depending on how it is defined the schema.

 

have alook here

to find a very useful article regarding the same .

 

 

Did Egypt Win…..!? February 8, 2008

Posted by essamabdelaziz in General.
add a comment

Dear all,

it was a long  time since i last wrote any thing here..it was a pretty busy on my side.

i  back again and i will  keep writing as soon as i get achance .

yestrday i was watching  the semi final egypt Vs Cote D’Ivoir in africian cup.

omani guy was sitting beside me and he was very ardent  as he is an  egyption

a fter the  game while  omani friend’s were   congarts me for the victory,

i was so happy with the spirit i felt regardless we won the game or not .

i felt how great the arabian People is   ….