Saturday, March 13, 2010

Inkscape - How to draw a rectangle with round corners

Hello,

In this period I'm studying Inkscape drawing and I want to show you how to draw a simple rectangle with round corners:
a) select rectangle tool on the left.
b) a change bar will appear:
*set Rx and Ry to 16 to have round corners on the rectangle you will draw.
*set Rx and Ry to 0 to go back to normal rectangle.





That's all.

Thursday, November 19, 2009

Eclipse identification FAIL

Eclipse identification FAIL

at here:



Paul.

Eclipse

Hello everybody.
Right now I'm learning JSF.
And while working with internationalization and localization and resource bundle I got this nice error:



Paul.

Saturday, October 17, 2009

Combining JSP JavaBeans Servlets

Hello everyone,

I haven't wrote on this blog for a long, long time.
I actually was busy with finishing the computer science faculty.
Now I'm at master studies in computer science.

One of the first challanges was Java Web Technologies(using J2EE).
JSP, JavaBeans, Servlets.
A Web application can be wrote as a MVC.
Control-Servlet
JSP-View
JavaBeans-Model.

The comunication between JSP and Servlets is made using JavaBeans:
a) A JavaBeans is a public class that:
The required conventions are:
*The class must have a public default constructor. This allows easy instantiation within editing and activation frameworks.
*The class properties must be accessible using get, set, and other methods (so-called accessor methods and mutator methods), following a standard naming convention. This allows easy automated inspection and updating of bean state within frameworks, many of which include custom editors for various types of properties.
*The class should be serializable. This allows applications and frameworks to reliably save, store, and restore the bean's state in a fashion that is independent of the VM and platform.

//example:
/**
* Class PersonBean.
*/
public class PersonBean implements java.io.Serializable {

private String name;

private boolean deceased;

/** No-arg constructor (takes no arguments). */
public PersonBean() {
}

/**
* Property name (note capitalization) readable/writable.
*/
public String getName() {
return this.name;
}

/**
* Setter for property name.
* @param name
*/
public void setName(final String name) {
this.name = name;
}

/**
* Getter for property "deceased"
* Different syntax for a boolean field (is vs. get)
*/
public boolean isDeceased() {
return this.deceased;
}

/**
* Setter for property deceased.
* @param deceased
*/
public void setDeceased(final boolean deceased) {
this.deceased = deceased;
}
}

b)a JSP page using a JavaBean:
<% // Use of PersonBean in a JSP. %>





Name:

Deceased?




Enter a name:

Choose an option:






c)The Servlet-I will only list the part necessary to take the bean and use it:
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
HttpSession session=request.getSession();
PersonBean pers=(PersonBean)session.getAttribute("person");
out.print(pres.getName());

//we also can set and send a bean
session.setAttribute("person2", pers);
getServletContext().getRequestDispatcher("Result.jsp").forward(request, response);
}



Paul.

Sunday, July 27, 2008

Tools for my Selenium tests

Here are my tools:

Windows XP,Vista & Ubuntu 8.04
Eclipse(I forgot to mention that I write my tests in java): with Subversion plugin&Maven plugin.
Maven tool installed as standalone with .m2 repository directory.
Mozilla Firefox(2&3 - you will understand why later):
-with next plugins and addons:
*Selenium IDE - will help a lot;
*Firebug - If you have Ajax code with Source View of Mozilla you will not see the source and firebug is here to save us;
*XPath Checker for short XPath to that element;
*XPather Browser for the long XPath to element.

Paul.

Friday, July 25, 2008

Selenium tests for Summer.

This summer I'm gone write selenium tests for a web application: XWIKI.
So this summer I'll learn you about selenium tests.

Paul.

P.S.: Sorry about java posts that I've promised. I promise that I will tell you more about it later when I will learn how to write a web application with java technologies.

Sunday, May 04, 2008

More about iterators

Iterators(C++) can be definied for object of classes from std.
Examples: vector, list, map, etc.

Example for vector:
//header
#include vector

//type definition
typedef vector vect;
//type declaration
vect v(20);

//iterator definition
typedef vect::iterator vectiter;
//iterator declaration
vectiter v;

//iterator use
//listing all the values in vector
for(vectiter i=vect.begin() ; i!=vect.end() ; ++i ){
//two ways:
cout<< i->list();
cout<<(*i).list();
}

//other iterator use
//deleting a value from vector
vectiter i=vect.find(new int(5));
if(i==vect.end())
{
cout<<"The element doesn't exist";
}
else{
vect.erase(i);
}

Tuesday, April 29, 2008

A lex example for Simple language

Simple language looks like this:
LET
declarations of variables.
IN
statements;
END

declarations of variables:
INTEGER i.

statements:
READ i;

the lex example that generates a lexical analyzer:
ident [a-z][a-zA-Z0-9]*
digit [0-9]
number [0-9][0-9]*
%%
"LET"|"IN"|"END"|"INTEGER"|"READ"|"WRITE" { printf("Key word: %s",yytext); }
("INTEGER")(" ")+({ident})(" ")* { printf("Token variable declaration: %d",yytext); }
("READ")(" ")*({ident})(" ")*(";") { printf("Token : %s",yytext); }
("WRITE")(" ")*({ident})(" ")*(";") { printf("Token : %s",yytext); }
%%
main(char *argv[])
{
yyin=fopen(argv[1],"r");
yyout=fopen(argv[2],"w");
}

A regular expression for lex

Now I'm real busy, but I will still write about lex.
A regular expression is used for identification of patterns in a text.
There are some rules:
* - it means that the block that has this at the end can appear 0 times or many times;
+ - it means that the block that has this at the end can appear 1 times or many times;
? - it means that the block that has this at the end can appear 0 time or 1 time;

Example:
//this is a lex example
("for")(" ")*("(")(";")(";")(")")(" ")*("(")

this regular expression is for:
for(;;){
or
for (;;) {

I've put the (" ")* because there can be as many spaces as 0 or many.