Quarta-feira Jun 18, 2008

Firefox 3 Record

Over 8,000,000 downloads in 24 hours!

Amazing number!

Congratulations Firefox!

Firefox 3

Terça-feira Jun 17, 2008

Firefox 3 Download Day

Hi Everybody!

There is still time!

Let´s download it!

Firefox 3 Rocks!


Download Day 2008

Cheers

Quarta-feira Jun 04, 2008

WebServices and JSP on NetBeans 6.1

Turn The Very Easy mode On and Play

Hi Everybody! Today I'm writing a little review (that may sounds like a tutorial) about the easiest way to write a simple Web Service and use it on your projects. See, you don't need to be an expert on Web Services nor JSP nor Web Technologies, because we are using NetBeans 6.1, the only IDE you need to learn something big on the very easy way.

From 6.0 to 6.1, NetBeans has grown faster, more stable and more practical. I haven't found anything specific about the development of WS using the New NetBeans, only using the 5.5 version. That's why I decided to write it here.

I've downloaded the Web & JavaEE Pack of Netbeans 6.1 on NetBeans Download Center. It comes with TomCat and Glassfish bundled, but we can use others Containers too, like JBOSS, for example. On the Services tab, on the left side of IDE, you can find the servers that NetBeans is using.

You may click on 'Servers' and choose 'Add Server...', A list of 'Connectible' servers appears. You will be able to connect Servers like JBOSS, WebSphere, BEA WebLogic, Sailfin, and, of course, TomCat, Sun Application Server and Glassfish, all out-of-the-box. (They just need to be installed, TomCat and Glassfish can be installed during NetBeans Setup).

Now Let's Start our Web Service. We just need to go to File -> New Project (Ctrl+Shift+N), choose Web on Categories and Web Application on Projects. Then Press Next. Choose the name and folders of your application and press Next again, then choose the server where your Web Application will be deployed. You will see the screens below (but they will be shown separated, through the next steps, not layered). On the End, just press Finish. (If you press Next, you will be able to choose a framework like JSF or Struts)

Now we have our Web Project. A Default index.jsp is there waiting - delete it - we are doing WebServices for now. Select the Project, click on the Project name with your right mouse button, choose New -> Web Service... on the list. NetBeans will then open a tab on the development area showing it's graphical interface to create Web Services, just like that:

A Web Service is quite like a java class (it's a .java file), in which the methods are called Operations. A Web Service may have many Operations. So, let's create our Operations clicking at the 'Add Operation...' Button. A window will pop up, asking the details of your operation, just like this:

I created two operations, one to add a user (the addUser Operation show above) and one to check if the user has been added to the list, like a login check (the checkUser Operation). NetBeans shows me the details graphically:

(If the image is too little, click with your right mouse button and choose View Image, The blog may be resizing the pictures, making them unreadable)

Now we go to the Source Code (Clicking on the Source button on the development area, just below the file tab)! You can click with the right button on the Operation and choose 'Go to Source' option on the Menu.
At The Source you see all the Structure of your code. Out of the methods scope, create a List of Users like:
>> List users; . There is no User Class defined in the package, so click on the light bulb near the code and ask NetBeans to create User Class in the package for you:

Go to User Class source code and add two parameters to the class: String username; and String password;
Then we ask NetBeans to create the getter and setter methods, and to override equals and hash code methods. How?? Easy! Just click with the right button and select Insert Code: A little menu will appear:

and we may choose to generate many kinds of methods. For example, if we choose to generate equals and hash code, another windows will pop up asking about which parameters of the class do you want to use, just like this:

Any doubts about the User Class, see it's source here.

Back to the Web Service source code, now we have to implement the addUser and checkUser Operations. They are both easy, see the idea of the code below:
To add a user:
   User user = new User();
   user.setLogin(login);
   user.setPassword(password);
   if(!users.contains(user)) { //if the user is not already on the list
     users.add(user); // add the user and return true to say everything has gone OK
     return true;
   } else { // user is already on the list.
     return false; // Return false to say no one has been added to the list
   }

To check the User:
   User user = new User();
   user.setLogin(login);
   user.setPassword(password);
   if(users.contains(user)) { //if the user is on the list
     return true; // let it login, return OK
   } else { // user isn't on the list
     return false; // return 'there is a problem here'
   }

The Full Web Service Code can be viewed (and copied ;) ) here.

Now, we may just Run our Web Service, and see that it's Running on the Service tab under your container's Web Applications.

But, let's Test it to see if it's really working!
Expand the Web Service Folder of Your Project and select your Web Service. Click with the right button and select Test Web Service:

Something like that will be opened on your Browser:

Amazing, isn't it?? You may test your Web Service as you want, and get answers like this:

Tip: Add some users using the addUser Operation and see if checkUser works returning True for added Users and False for unknown users.

Now Lets quickly create our JSP! Yes... really fast.

Create a New Project (File -> New Project). Select Web / Web Application Again!
Now we may use the 'index.jsp' file. There is a palette on the right side of the IDE, you may drag and drop HTML Form Items to your code. You need a FORM that collect user's login and password. Something like this:

<form name="loginForm" action="checkLogin.jsp" method="POST">
<input type="text" name="login" value="Your Login" />
<input type="password" name="pwd" value="\*\*\*\*\*\*\*" />
<input type="submit" value="Submit" name="loginSubmit" />
</form>

The Form action is checkLogin.jsp... so Let's create it. Click on your new Web Project name with the right button, go to New -> JSP. Create the JSP named checkLogin.
Now let's add a client to our WebService, the one we created on the other Project.
Click with right button on your New Project Name, go to New -> Web Service Client...
Select the Project where the WebService has been Created, just like this:

There are other ways to get the Web Service (thought WSDL link, for example), you may explore it yourself latter.
Wait while NetBeans process the Web Service into your New Project, you will be able to see it on the project. Like this:

(On the properties of the webservice, you will find the WSDL address of the service, then you can visualize it o the browser, and see it's XSD too.)

Now, go to the JSP code. Below the Hello World default Message, click with the right button and select:
Web Service Client Resources -> Call Web Service Operation
A window will appear asking which operation you want to choose:

Choose checkUser and NetBeans will do all the code for you. Of course, you need to put some by yourself. Our FORM, on index.jsp, send it's data using POST. so let's get these values from POST. Add the fallowing code before the Web Service process, just after the 'try {' put by NetBeans on your JSP:
    String uname = request.getParameter("login");
    String pwd = request.getParameter("pwd");

Then, change the generated code lines to point to your collected data:
    java.lang.String login = uname;
    java.lang.String password = pwd;
    // TODO process result here
    boolean result = port.checkUser(login, password);
    if(result) {
       out.println("User Logged");
    } else {
       out.println("Access Denied");
    }
    } catch (Exception ex) {
       out.println(ex.getMessage());
       out.println("Unable to operate the WebService");
    }

Any doubts, check index.jsp and checkLogin.jsp codes.

Then, ask NetBeans to Run the index.jsp file. The browser will be opened with your JSP page asking a login and password (Just after the Hello World! message). Try the login and password you have added using the Test tool and see if checkLogin grants access to the users or not. Try the users you have added and another ones. If no User is recognized, the data on the Server may has been lost, try adding new login/passwords using the Test Tool or using the addUser Operation, now you know how to do it.

You don't need to use a Web Interface to access your Web Service, you can create a Java Project with a GUI that connects to the server and use the Web Service, or use a Mobile, everything through NetBeans. Just Explore!

Remember!! We are keeping this user information on a List inside the Memory (through the Web Service inside the Server). If you restart the Server or the IDE, all information may be lost. This example is just a simple one, to do a more professional system, you should use a database, this way your data will be kept safe.

Hope you enjoy that! The text is quite big, but it's simple to do that!
Any doubts or tips, just send a comment! ;)

Cheers
Jonas

Sexta-feira Mai 30, 2008

OpenSolaris DAY Statistics

Hi Everybody!

It's a pleasure for all Sun Campus Ambassador Team!
I'm here to announce the OpenSolaris Day Numbers!

3 days of presentations.

24 Universities
31 presentations
1819 people heard about OpenSolaris 2008.05 through our event!
- 1732 Students
- 85 Professors / Researchers

The List of Institutions:
Centro Universitário da FEI
Centro Universitário Estadual da Zona Oeste - UEZO
Centro Universitário Salesiano de São Paulo - UNISAL
Faculdade Anhangüera de Taubaté
FATEC - Cruzeiro
FATEC - Zona Sul
Instituto CPTEC/INPE
Pontifícia Universidade Católica do Rio Grande do Sul – PUC RS
SEBRAE
Universidade Católica de Brasília
Universidade de Santa Cruz do Sul
Universidade de São Paulo - USP
Universidade do Vale do Rio dos Sinos - UNISINOS
Universidade Estácio de Sá - UNESA
Universidade Estadual Paulista - Rio Claro - UNESP
Universidade Estadual Paulista - S. J. Rio Preto - UNESP
Universidade Estadual Paulista – Bauru - UNESP
Universidade Federal da Bahia - UFBA
Universidade Federal de São Carlos - UFSCar
Universidade Federal do Rio de Janeiro - UFRJ
Universidade Federal do Rio Grande do Norte - UFRN
Universidade Federal do Rio Grande do Sul - UFRGS
Universidade Lemos de Castro
Universidade Paulista - UNIP

And cheers for all Brazil's Sun CAs that made that happen!
Alex Rafael Branti, Douglas Ramiro, Fábio Augusto, Gabriela Souza, João Paulo Samara, Jonas Dias, Leonardo Alves, Leví Silva, Luiz Felipe Aquino, Marcelo Arbore, Oscar Tanner, Pedro Reis, Ramon Lopes, Ricardo Severo, Silveira Neto, Stephania Silva, Thiago Gonzaga, Tom Mix Petreca, Vitorio Sassi!

Segunda-feira Mai 05, 2008

The New OpenSolaris Released!

HI ALL!!

A great conquest! A Great OS! The release of the future! ;)

Download it NOW!!
The amazing new OpenSolaris!! At www.opensolaris.COM

GET IT!!

Cheers!

Quinta-feira Mar 27, 2008

Developing OpenGL with NetBeans 6.0.1

Last semester I did a subject on my university where I needed to do a project with OpenGL. Our professor asked us to program a 3D graphic modeler – a program capable of drawing 3D figures, set material properties and scale, move, rotate, group and copy them. We could not use high level libraries like Java3D, he wanted us to program OpenGL, only that. Things got complicated, but NetBeans made my life easier... again!

A OpenGL code may became quite complicated if you do not take care. There are too many settings, many variables, matrices, transformations... and a little detail can turn things horrible if you don't know what you are doing. On this point, working with a great IDE may help you a lot!

Another fact is that I liked the way of programming openGL with JAVA.
On the most other programming languages, you should use callback functions to do things on openGL, for example: you may create a function display() that will draw things on the screen, in python:

def display():
“Draw a triangle”
glClear(GL_COLOR_BUFFER_BIT)
“Set Color”
glColor3f (1.0, 1.0, 1.0)
glBegin(GL_TRIANGLES);
glVertex3f(0.0, 1.0, 0.0);
glVertex3f(-1.0, -1.0, 0.0);
glVertex3f(1.0, -1.0, 0.0);
// Finished Drawing The Triangle
glEnd();
glutSwapBuffers()

but then, you should say to openGL that display() is the one taking care of screen drawings, saying:

glutDisplayFunc(display)

In JAVA there is no callback function, it's just Programming to an Interface style! It's really cool and make your code more comprehensive. My openGL project become more understandable having a Sphere class that extends Shape class and implements Drawable interface (you know, my sphere is actually a drawable shape!)! The openGL functions like display(), init(), reshape() can all be coded inside a class that implements the interface GLEventListener, just that... make more sense to me! In Java:

//Draw a triangle
public void display(GLAutoDrawable drawable)
{
GL gl = drawable.getGL();
// Clear the drawing area
gl.glClear(GL.GL_COLOR_BUFFER_BIT);
gl.glBegin(GL.GL_TRIANGLES);
gl.glVertex3f(0.0f, 1.0f, 0.0f); // Top
gl.glVertex3f(-1.0f, -1.0f, 0.0f); // Bottom Left
gl.glVertex3f(1.0f, -1.0f, 0.0f); // Bottom Right
// Finished Drawing The Triangle
gl.glEnd();
// Flush all drawing operations to the graphics card
gl.glFlush();
}

This post is not about teaching OpenGL, it's just too complicated for a single post. But you may find your way through NetBeans6.0 OpenGl plugin and the following tutorial:

http://jerome.jouvie.free.fr/OpenGl/Tutorials1-5.php

(and you may want to check the OpenGL red book too)

BUT LET'S START THIS GUIDE about turning JavaOpenGL ON at NetBeans6.0.1 and HAVE FUN!

The first step is to download the the cool JOGL plugin from NetBeans.org page:

http://plugins.netbeans.org/PluginPortal/faces/PluginDetailPage.jsp?pluginid=3260

The file downloaded from above is zipped, unzip all the nbm files (that are inside the zip) on a directory.

Note: This plugin is really nice: check it's features list:
\* Editor for the OpenGL Shading Language (GLSL) with compiler error annotation, code folding, syntax highlighting, auto completion and documentation.
\* Easy access to the GLSL compiler and linker of your graphics driver integrated in the editor
\* OpenGL Capabilities Viewer
\* Integration of JOGL GUI components into the Matisse GUI builder
\* JOGL project templates
\* Ready to run JOGL demos and examples of the OpenGL Programming Guide (also known as Red Book)

Ready to use it? Let's install it!
Open you NetBeans IDE. Go to Tools > Plugins

On the window, go to "Downloaded" tab (it may be empty). Press the "Add Plugins..." button. Go to the directory you unzipped the plugin's nbm files, select ALL of them and press OK. The plugin items will appear on the list on the left just like the picture above. Leave all of them selected and press Install button.

You will go through some installation steps; accept the terms of agreement and press Install. The installer may alert you that the plugin is not signed (or something like that), just ask to install it anyway. In the end, you will need to restart your IDE.

Done. The JOGL plugin is installed. After NetBeans restart, you can go through File > New Project and see the OpenGL project option on Categories list.

The Simple JOGL Application is the perfect place to start doing your openGL project, it's an almost empty openGL application that you may increase.

You may have a look at the Demos too (to have an idea about what you can do with OpenGL and JOGL). This plugin cames with many JOGL demos and Red Book demos. So, if you are studing OpenGL using the Red Book, you will find the examples there. You just need to expand OpenGL categories on the New Project window to see the Demos folders:

JOGL Infinite Shadow Volumes Demo:

A very interesting point of the plugin is that it does integrate the OpenGL Panel and OpenGL Canvas to the Matisse system, so you can create your GUI using Matisse and put OpenGL elements on it.

Developing GUI on NetBeans is incredibly easy, and now you can include OpenGL elements on your projects! Quite nice!

Thats all! Hope you enjoy developing OpenGL on NetBeans6.0.1

Cheers! :)

Sábado Mar 15, 2008

Tech Demo at Estácio

Hi all,

Today, I did a 2 hours presentation with Pedro Reis (another CA from Rio de Janeiro) at Estácio de Sá University, on the center of Rio. We had an attendance of 62 people, including 5 professors, of the Java Development pos graduation class.

The presentation slides were prepared by Bruno Bastos (Petrópolis Sun CA) and I added some ones latter. The first arrangement was that Bruno and Luiz Aquino would do the today’s tech talk on Estácio, but in the end, things got totally different.

Bruno had an important appointment for today and Luiz Aquino got Dengue disease and needed to stay resting. So, I completed the task with Pedro!

Bruno made a cool web service and client system on NetBeans to show on the presentation. I constructed a simpler one during the demo (to make it on shorter time), and then, showed Bruno’s. The examples were quite nice because we were able to illustrate many features of NetBeans on a single shot, like the easy implementation of a web service, it’s integration with Glassfish and the way to use it on a client that can be developed using NetBeans Matisse! Everybody got really impressed!

Aside the Web Services and GlassFish, we talked about NetBeans 6.0 features (emphasizing the new ones), the SAI program, and the Java Certification, explaining how they can get theirs with discount! I inserted an OpenSolaris slide, focusing on SXDE, for fast and easy development, they got tempted to try it!

In the end, we raffled some souvenirs like Sun pens, All Access Kit DVDs, OpenSolaris mini-books and locksmiths.

Some professors on the room asked us to schedule more presentation on another institutes and universities on Rio that they give classes too. They will help us organize it there.

Quinta-feira Mar 13, 2008

XAMPP with NetBeans

Heya!

I'm programming a little registration web system for NACAD (the lab I do work in at UFRJ) using PHP. I was already using xampp platform to have Apache, MySql and PHP working together easily for development. Then I noticed a cool PHP plugin for NetBeans 6.0 and then, decided to use, since there is no real good IDE for php development.
Let's start from the beginning. ;D

You can download XAMPP for Solaris, Linux, Windows and Mac at http://www.apachefriends.org/en/xampp.html . It's installation is really easy, you can find any necessary information on xampp's site above. After installation, you may start your services using:
on Solaris:
#/opt/xampp/xampp start
on Linux:
$sudo /opt/lampp/lampp start

Notice that /opt/\*ampp is the directory you (yourself) chose to install xampp. We usually istall on /opt but you may put it anywhere you like.

Your projects folder must be inside the htdocs folder on xampp installation directory to be accessed trough http://localhost/myProject/index.php, for example, like:
on Solaris:
/opt/xampp/htdocs/myProject
on Linux:
/opt/lampp/htdocs/myProject

Since myProject folder keeps all your PHP scripts, HTML, images, etc...

Now you may open your NetBeans. You don't have it yet ?!?! Come on! Download it at www.netbeans.org.

Open NetBeans! If your NetBeans do not support PHP (yet), go to Tools > Plugins on the Menu Bar. You may find PHP plugin on the “Available Plugins” Tab. Mark the check box and press Install button to take it!

Press Next button and accept the terms of the contract, then go on through the installation! After finished, you may restart your fantastic IDE.

After that, let's create our new Project. Go to File>New Project menu option. Choose PHP on the left box and on the right one choose PHP project with existing sources (or just PHP project if you are about to start a project from the zero).


Click Next.

Choose your project name, it's location and folder. Notice it's not the folder where your existing sources are in, it's just where NetBeans will keep your project settings and other stuffs.


Press Next.

Now you may give the folder where your existing sources are. On my example, it would be at /opt/lampp/htdocs/myProject.


Click next.

This step is to set your web server. Using xampp, you would be running apache, so you should inform NetBeans about it to let him test your application directly using the existing server. Don't worry, it will be really easy.

On the Configured Web Servers drop down menu, you may just see No Servers.


Press Manage Button.

On the new screen, chose a connection name (xampp for example). On Server type, chose Local Web Server with File Access.


Click Next.

On next screen you have to point the server configuration file, i.e., show the httpd.conf apache configuration file path to NetBeans.
httpd.conf can be found at xampp_instal_directory/etc (for example: /opt/lampp/etc/httpd.conf on Windows it'll be at /xampp/apache/httpd.conf), as you can see:


On Choose host N... menu, choose localhost, and press Next.

Write localhost on server name and leave port 80 for default http configuration.


You can leave Base Directory field empty. Press Next.

On the file access configuration, write the path to your project. DON'T leave /opt/lampp/htdocs directory path only, you may don't have write access to this directory, put /opt/lampp/htdocs/myProject and be sure you have read and write permissions at myProject folder.
Now you can finalize the server configuration and choose it as your Configured Web Server on your Project Creation Window.


Now you may finalize your project creation and start working!

Have Fun!

Terça-feira Mar 11, 2008

The World Greatest SuperComputer - Sun did it!

Sun implemented the Ranger Supercomputer on TACC (Texas Advanced Computing Center)!
They now got 504 teraflops to use!!

More cool Details at (in portuguese) :

http://blogs.sun.com/TAI/

(in english)

Jonathan's Blog

Cheers!

Sexta-feira Fev 29, 2008

29 of February

Today the UNIX+OpenSolaris vacation course @ UFRJ ended!
Next week the subscrebers will be doing the test to grant them the UFRJ certification.
I'll post more details latter... I'm just tired by now.

Cheers!

Quarta-feira Fev 27, 2008

Slides: SMF and Zones

UFRJ UNIX+Solaris Admin course material:

Aula Extra de OpenSolaris - Parte SMF e Zonas

Terça-feira Fev 26, 2008

The Dolphin and the Sun together

"Today Sun and MySQL officially join forces..."
That word came from Rich Green, Sun's Executive Vice President that deals with Software.
These are great news! MySQL already has a big community and is, definitely, a fantastic database! Joining Sun, we will have a complete Web2.0 platform that will rocks over the global market.

Quarta-feira Jan 02, 2008

Happy 2008

Happy New Year!!

Next is a photo of Sun Campus Ambassador Team on our reunion at São Paulo last month (and last year... hehe)

Sábado Dez 29, 2007

Vacation Course

Planning the last details about the UNIX + OpenSolaris course we will give on February at UFRJ with Professor Gabriel Silva. It will be a 40hs course preparing to Solaris Administration Sun certification.

Some days ago the Brazil's Sun Campus Ambassador had a meeting at São Paulo Sun Office. It was very nice.

Next is a photo of me taken by Silveira Neto (a friend Ambassador) at the end of the meeting. I was talking together with Luiz Aquino (on the left) and Bruno Bastos (on the right) to the new Ambassadors.

Segunda-feira Dez 03, 2007

NETBEANS 6.0 RELEASED

Today they released the amazing new NetBeans!! Try it and get amazed too!


DOWNLOAD IT

About

Well... Let's keep this blog updated for now on!!

Search

Categories
Archives
« Abril 2014
SegTerQuaQuiSexSábDom
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
    
       
Today