Sunday, January 31, 2010

The Plot Diagram Of Flowers For Algernon

In frames

When I was free (now that I think, some years ago ...) I started to live sharing. With a girl, very nice, vegetarian, clean, respectful, loved my cat and had a boyfriend just as nice and quiet her. It was nice. I was very pleased that experience the truth. Soon I moved on to the good life, and lived with a partner. I will spend that time missed because I do not want say anything special, just that life is good.
Now, I had no choice but to seek a roommate, not so nice, it costs you pay, you do not know that there are brooms, which has the TV on at all times that even my grandmother would let her take Sonotone deaf does not stop eating pipes and the incessant noise the "clack" is unsettling, the couch is yours, the floor is yours, has a son, just as capricious that this individual, is blond and has the face of an angel, but after a weekend you realize otherwise (ONLY ONE COMES IN TWO). Carrying the invoices do not know, I do not care, hygiene, noise, as if there is a goat in the dining room, full weeks left clothes in the washer or hung on the washing and drying obviously shared. C reo I should thank that each tenga su nevera, llamarme maniática, pero a mi las cosas me gusta dejarlas en su sitio y el tiempo que ocupe.
Esta semana he estado en casa de mi madre, no está muy fina y a mi me iba mejor en cuanto a transporte al trabajo y la uni de los examenes. Que placer, que limpieza, que silencio, que zen.
A mi me gusta llegar a casa y escuchar el silencio, pasear descalza y ni oirme a mi misma, tenerlo todo en orden, hacer la cama, el baño, la cocina, fregar los platos despues de comer, y sobretodo pagar el dia que toca sin rechistar.
En definitiva....que experiencia....mas...odiosa. Será que me habia acostumbrado a lo bueno! pero para eso me he puesto las pilas, en breve pienso mudarme a poder ser SOLA aunque sea a un minipiso with my animals. I have it clear, I do not want more men in my house (with apologies to the decent) and if it were the case it would make an elaborately detailed cast me down again avoid falling into the disastrous mistake.

OmMmMmMmMmM ... try to think of birds will not hear the movie from the other side of the flat wings 23 of the night .....

Tuesday, January 26, 2010

Magic Mountain Crowded In January

roommate and less Kyara More I Dear Magi

The blog continues to be the non-reality. Nor am I kyara, not everything is as it is written on it and I'm not a cartoon. I'm trying to be less kyara and more me. Sounds strange that over me, because every day I'm actually less. I have glasses, he carried little but one day I decided that I looked good and I left them laying. Han ssiempre last year and was complaining to me the other day I reviewed the eye doctor and he confirmed that he would never see 100%, my eyesight and can only reach 80% and that I am still young. Speaking of youth
think I'am in crisis. Next month my birthday and I think this is the first time I dislike the fact. Is it because I have spent 11 months out, virtually imprisoned in a room and can be preferably in bed. Yes, I have the feeling that a year of my life I've jumped
This is over, or so I say again and again to convince himself. Last week I started a new job (after getting fired in December of the other), do not quite fit, but as today who has a job is a treasure because I will not complain.
Well, I said, despite that my mother says this is my year (being Pisces) and besides that my boyfriend says that I get lucky (being aquarium), I hope the tarotisa no mistake, though there are certain things that are misplaced, it seems that the puzzle begin to arm themselves should be. And above all, hopefully (at times).

Best Place To Eat At Whistler

Factories Design: Singleton

In this article we will see one of the common creational patterns, the Singleton . This pattern ensures that a class has only one instance and provides a global point of access to it.

This pattern is often used when one class controls access to a single physical resource or when data must be available to all application objects.

The Singleton pattern is implemented by a class a private constructor. There will be a method that will instantiate the object by calling the constructor only if there is still no.

can cause problems for programs with multiple threads, if two threads try to create the instance at the same time and it does not exist yet. That only one of them can create the object you can use mutual exclusion (synchronized ) in the method of creating a class that implements the pattern .

should say also that if multiple class loaders for the application may be an instance of the class in each of them, but the instance is unique in that magazine.

A successful deployment of Singleton pattern in Java could be the next Bill proposed by the researcher Pough:
 
public class Singleton {/ / Private constructor Prevents instantiation from classes
Other private Singleton () {}

/ ** * SingletonHolder
is loaded on the first execution of
* Singleton.getInstance () or the first access to
* SingletonHolder.INSTANCE, NOT before.
* / private static class

SingletonHolder {private static final Singleton INSTANCE = new Singleton ();}

public static
Singleton getInstance () {return
SingletonHolder.INSTANCE;
}}

Although widely used, there is a stream against the use of this pattern due to the problems it introduces. On this page Scout Densmore explains the problems attributed to Brian Button Singletons. Then do an adaptation of what is said there:
  • The Singletons are usually used to provide a global point of access for service. Thus no need to pass a reference to this service, which is like using a global variable. In the end what happens is that the design units remain hidden within the code and are not visible when examining the interfaces. We need to inspect the code to understand what objects are using the classes.

  • The Singletons will limit the creation of objects. This is true, but now they are mixing two different responsibilities in the same class. A class should not worry about whether or not a Singleton, but you should only worry about their business responsibilities. To limit the creation of classes should be set up factories or other objects that restrict the creation. Thus, each object would maintain a better-defined responsibilities.

  • The Singletons promote tight coupling between classes . A loose coupling between classes can substitute alternative implementations of collaborating classes in testing. A better alternative is to modify the design to pass references to objects in the classes and methods so as to reduce the coupling.

  • The Singletons maintain the state until the completion of the program. This persistent state is detrimental to the unit tests, since each test must be independent of the others. If this is not met, could lead to situations where the tests fail where they should not because they are hiding mistakes. You can avoid passing object references to lectures and methods.

is why it looks like a design pattern to avoid whenever possible.

References:
Singleton Pattern in Wikipedia
Singleton Pattern - Design Patterns
Singletons in Java, the standard single instance David Barral
Singleton Pattern in c2.com Why Singletons Are
Evil by Scott Densmore
Other design patterns

Sunday, January 24, 2010

Canon Dslr Leather Bag

Selenium functional tests

HQ Selenium is a framework that automates functional testing of web applications. It consists of several tools used to define and automate these tests. Specifically, let's see:
  • Selenium IDE: This is a Firefox plugin that lets you define a test of a web application keeping in a script the actions executed by the user on the browser. This script can be re-run after every time you want.
  • Selenium RC (Remote Control) : Allows you to automate testing of web applications based on defined scripts using Selenium IDE.
We will now see an example of functional testing a web application.

First we descarganos Firefox plugin Selenium IDE . We can do it from this page . This will download the Selenium IDE plugin and install it in your browser. Then it will restart to complete installation.

Now let's do a test of a web application. In this case it is an application that stores all items of interest from magazines that I buy, and the proof is to introduce a new article.

First, we Tools-> Selenium IDE . This opens a window that lets you record the script with the test to be performed:

From this point all we do is recorded on your browser in the script. At this point introduce a new article called "New " and title "New ." Once entered, click on the red button on the Selenium IDE window to stop recording the script. Prove that it has introduced the item.

Now repeat the test by clicking the green triangle in the top right of the window Selenium IDE. This repeats the previous run and therefore, in the list of products we now have 2 items with the name "New ."

can save this test from File-> Save E. Test Cas But more interesting for us will option File-> Export Test Case As -> Java (JUnit) Selenium RC to export this script to a test case for JUnit we will use later to automate this test:
 com.example.tests package; 
com.thoughtworks.selenium
import .*;
import java.util.regex.Pattern;

public class Test {
SeleneseTestCase extends public void setUp () throws Exception {setUp
( http://change-this-to-the-site-you-are-testing/ "," * chrome ");}

testPrueba public void () throws Exception {
selenium.open (" / RevisteroMyFacesWeb / ") ;
selenium.click ("link = New Item");
selenium.waitForPageToLoad ("30000");
selenium.type (j_id_jsp_815202587_1: nombreArticulo "," New ");
selenium.type (j_id_jsp_815202587_1: descripcionArticulo" "New");
selenium.click (j_id_jsp_815202587_1: j_id_jsp_815202587_35 ");
selenium.waitForPageToLoad (" 30000 ");
}}

Once we defined the test now to automate. We will use JUnit tool and Selenium RC (Remote Control) . We will also use plugin Maven Selenium to , which starts the server Selenium RC when running the tests.

Create a Maven project with the following pom.xml :
 \u0026lt;project xmlns = "http://maven.apache.org/POM/4.0.0" 
xmlns: xsi = "http: / / www.w3.org/2001/XMLSchema-instance "
xsi: schemaLocation =" http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0. xsd ">
\u0026lt;modelVersion> 4.0.0 \u0026lt;/ modelVersion>
\u0026lt;groupId> com.roldan \u0026lt;/ groupId>
\u0026lt;artifactId> RevisteroPruebasSelenium \u0026lt;/ artifactId>
\u0026lt;version> 0.0.1-snapshot \u0026lt;/ version>
\u0026lt;dependencies>
\u0026lt;dependency>
\u0026lt;groupId> Junit \u0026lt;/ groupId>
\u0026lt;artifactId> Junit \u0026lt;/ artifactId>
\u0026lt;version> 3.8 .2 \u0026lt;/ version>
\u0026lt;scope> test \u0026lt;/ scope>
\u0026lt;/ dependency>
\u0026lt;dependency>
\u0026lt;groupId> org.seleniumhq.selenium.client-drivers \u0026lt;/ groupId>
\u0026lt;artifactId> selenium-java-client-driver \u0026lt;/ artifactId>
\u0026lt;version> 1.0.1 \u0026lt;/ version>
\u0026lt;scope> test \u0026lt;/ scope>
\u0026lt;/ dependency>
\u0026lt;/ dependencies>
\u0026lt;build>
\u0026lt;plugins>
\u0026lt;plugin>
\u0026lt;groupId> org.codehaus.mojo \u0026lt;/ groupId>
\u0026lt;artifactId> selenium-maven-plugin \u0026lt;/ artifactId>
\u0026lt;executions>
\u0026lt;execution>
\u0026lt;phase> process-test-classes \u0026lt;/ phase>
\u0026lt;goals>
\u0026lt;goal> start-server \u0026lt;/ goal>
\u0026lt;/ goals>
\u0026lt;configuration>
\u0026lt;background> ; true \u0026lt;/ background>
\u0026lt;/ configuration>
\u0026lt;/ execution>
\u0026lt;/ executions>
\u0026lt;/ plugin>
\u0026lt;/ plugins>
\u0026lt;/ build>
\u0026lt;/ project>

We also configure the Maven plugin for Selenium to start the Selenium server in the phase preceding the test ( process-test-classe s) defines two units, JUnit and Java client driver for Selenium , which allows running the tests set up from Selenium IDE . We will adapt

test class generated from Selenium IDE to make use of the Java driver for Selenium:
 com.roldan.selenium package; 
com.thoughtworks.selenium
import .*;
CrearNuevoArticuloTest
public class extends SeleneseTestCase {

protected DefaultSelenium createSeleniumClient(String url) throws Exception {
return new DefaultSelenium("localhost", 4444, "*firefox", url);
}

public void testCrearNuevoArticulo() throws Exception {
DefaultSelenium selenium = createSeleniumClient("http://localhost:8080/");
selenium.start();

selenium.open("/RevisteroMyFacesWeb/");
selenium.click("link=Nuevo Artículo");
selenium.waitForPageToLoad("30000");
selenium.type("j_id_jsp_815202587_1:nombreArticulo", "Nuevo");
selenium.type("j_id_jsp_815202587_1:descripcionArticulo", "New");
selenium.click (j_id_jsp_815202587_1: j_id_jsp_815202587_35 ");
selenium.waitForPageToLoad (" 30000 ");

selenium.stop ();

}}

The difference is that now at the beginning of create a test client Selenium and final test closes this client.

If the test is now released for this project with mvn test , will receive a browser that repeats the test set, and has been recorded yet another article.

References: Selenium
HQ Web
Turorial of Workaholics
on Selenium IDE Turorial of Workaholics on Selenium RC Tutorial
Two sequential tests Ideas on Selenium and JUnit
Web Selenium plugin for Maven

Friday, January 8, 2010

How To Make A Friendship Anklet



Each time you start developing a new application as software engineers we turn to face the same or similar problems have been addressed in previous developments. Not only that, we are facing in many cases the same problems others have had to solve.

Making all prior knowledge is useful and saves time in the design and development of new applications. This is something well known and therefore the patterns have emerged design, and guidelines to follow under certain conditions supported by prior knowledge.

In construction, the architect Christopher Alexander proposed the learning and use of a series of patterns for the construction of buildings higher quality. In his words, "each pattern describes a problem that occurs many times in our environment, as well as the solution to it, so that we can use this solution a million times later without having to think of it another time. "

The patterns Christopher Alexander and his colleagues identified are an attempt to formalize and capture a practical way generations of architectural knowledge. The patterns are not abstract principles that require their rediscovery for a successful implementation, nor are specific to a particular situation or cultural, are somewhere in between. A pattern defines a possible solution to correct a design problem within a given context, describing the invariant qualities of all solutions.

Taking the idea of \u200b\u200bpattern the computer world, a design pattern is a solution to a design problem that should possess the following characteristics:
  • must be checked its effectiveness solving similar problems in the past.
  • should be reusable, which means that it is applicable to different design problems in different circumstances. The

design patterns were a great success from the book Design Patterns written by the group Gang of Four (GoF, which were collected 23 common design patterns. These defined patterns by the GoF are divided into 3 groups creational patterns, structural and behavioral .

creational patterns: They try to solve the problems that can arise in the creation of objects.
  • Factory Abstract: Provides an interface for creating families of objects or dependent on each other, without specifying their concrete classes.
  • Factory Method: Define an interface for creating an object, but let subclasses decide which class to instantiate. Allows a class to its subclasses delegate object creation.
  • Builder: Separate the construction of a complex object from its representation so that the same construction process can create different representations. Prototype
  • : Specifies the types of objects to create using a prototypical instance, and create new objects by copying this prototype.
  • Singleton: Ensure a class has only one instance and provides a global point of access to it.

structural patterns: They try to facilitate the design identifying simple ways to establish relationships between entities.
  • Adapter: Convert the interface of a class into another which is what customers expect. Allow cooperating classes that otherwise could not to have incompatible interfaces.
  • Bridge: Decouple an abstraction from its implementation so that the two can vary independently. Composite
  • : Combine objects in tree structures to represent part-whole hierarchies. Allows customers to uniformly treat the individual objects and compounds. Decorator
  • : Dynamically adds new responsibilities to an object, providing a flexible alternative to inheritance to extend the functionality.
  • Facade: Provides a unified interface for a set of interfaces in a subsystem. Defines a high-level interface that makes the subsystem easier to use.
  • Flyweight: Use sharing to allow a large number of fine-grained objects efficiently.
  • Proxy: Provide a surrogate or representative of another object to control access to it.

Behavioral Patterns: Identify common communication patterns between objects and try to increase the flexibility of this communication.
  • Chain of Responsibility: Avoid coupling the sender of a request to its receiver by giving more than one object a chance to respond to the petition. Create a string with the receiving objects and passes the request through the chain until it is treated by an object.
  • Command: Encapsulate a request on an object, allowing you parameterize clients with different requests, queue or keep track of requests and to undo the operations.
  • Interpreter: Given a language, define a representation for its grammar along with an interpreter that uses the representation to interpret sentences in the language. Iterator
  • : Provides a way to sequentially access the elements of an aggregate object without exposing its internal representation.
  • Mediator: Define an object that encapsulates how they interact a set of objects. Promotes loose coupling by keeping objects from referring to each other explicitly, and lets you vary their interaction independently. Memento
  • : Represents and externalize an object's internal state without violating encapsulation, so that it can return to that status later.
  • Observer: Define a dependency on one-to-many relationship between objects, so that when an object changes state is notified and updated automatically every object.
  • State: Allow an object to alter its behavior when its internal state changes. Appear to change the object's class.
  • Strategy: Define a family of algorithms, encapsulate each one of them and make them interchangeable. Lets the algorithm vary independently from clients that use it.
  • Template Method: Define an operation in the skeleton of an algorithm, deferring some of its subclasses steps. Lets subclasses redefine certain steps of the algorithm without changing its structure.
  • Visitor: Represent an operation on elements of an object structure. Allows you to define a new operation without changing the classes of the elements on which it operates.

Over time, have arisen new patterns, especially in the field of enterprise Java development . Some of them are:
  • Front Controller Model View Controller (MVC) ended
  • View
  • Session Facade - Facade Session
  • Locator Service -
  • Object Locator Service value - Value Object object
  • Data Transfer - Data Transfer Object (DTO)
  • Officer of Company - Bussiness Delegate
  • Data Access Object - Data Access Object (DAO)
  • Dependency Injection (DI) - Inversion of Control (IoC)
  • Open Session In View (osiva)
  • ThreadLocal Session

In this article we have tried to give an introduction to design patterns . In future articles I will try to develop some of the patterns herein analyzed its usefulness, strengths and weaknesses.

References:
Design Patterns (Erich Gamma, Richard Helm, Ralph Johnson, Vlissides Hohn)
Professional Java Server Programming J2EE, 1.3 Edition (Subrahmanyam Allamaraju, Cedric Beust, Marc Wilcox, Sameer Tyagi Rod Johnson, Gary Watson, Alan Williamson, John Davies, Ramesh Nagappa, Andy Longshaw, PG Sarang, Tyler Jewell, Alex Toussaint)
Design Patterns in Wikipedia
Introduction to design patterns by Manuel Lagos Torres
ingenierosoftware.com Design Patterns in