Processing, in the meantime…

Can’t even remember when was my last post 😦

A lot of things to work with, lot of really cool stuff to try and experiment with… Summer holidays, parties and relaxing… Now we’re here!

 

There was a lot of things going on. Last thing is this:

 

Thing is, this is not something very big, for you, me, but its kind of cool to do it in one hour from very very basic knowledge of Processing.

Bye!

Processing the ideas!

Hey hey, it is a bit late in the night, so I’m going to make this shorter for the sake of my sleep.

There was some time since I did last introduction in Processing. I have had many things to do, so I abandoned it, hoping I will come back to it someday in the future. Awwww, like a tale! 🙂 I almost feel sorry for me! Almost! Anyway, like a good old(young) student I don’t have time to do things I would like, or at least I don’t have enough time… Where is the Processing in this story??? Here it is!

This semester I had to do some seminar on formal languages, automata and language processors. That has to do with computational theory. I had freedom to choose subject of my seminar, and I did. It is about cellular automata. Wolfram’s rules, Rule 30 (not that you would firstly picture in your mind) and Conway’s game of life. Game of life or just Life was very fascinating to me. So fascinating I wanted to make it by myself. I did. I programmed it in C, with the lousy visualization in terminal (with 0 and 1). Then I remembered. Processing! Just the right tool for it!

But wait! I did not know the intermediate techniques for it! That did not scare me, and should not scare you. Very similar to Java. You don’t know Java? Never mind, you will learn it for a short period because it is very intuitive. With knowing the C and Java, and some basics in graphics, programming the game of life took me couple of hours.

Here it is:

Code is quite simple, and I will post it here. Since I don’t like how my wp is formatting the code, I will post link to it, when I figure out how to present it.

At the end, program is not complicated, Processing is not complicated too, but the game is very fun to set and watch.

Bye !:)

Processing the processing

Me again! (Noooo) 😀

As you might already figured out, I have a custom to write here periodically. As you might also figured out, this is one of those days I’m super inspired to write some super cool extra blog articles! 😀 Wow, cookie for me! 🙂

Having in mind that I had a long working summer and little time to relax, my interests lately are not so miserable. It’s like like a dream, and I don’t know if I’m sleeping or not, coz I’m feeling very tired. Being very tired and bored with everything, I started to read RSS feeds through RSSOwl. Nice thing, all RSS feeds you choose, every day, at any time, for you! Wow 🙂 So, after reading about news in open source world, I stepped over one particular link about open source applications for video editing. Here it is. There was a particular thing that kinda poke my imagination. Yes, program for working with graphics ( and sound, but I’m not into that yet ). It’s called Processing.

There’s one very neat thing with Processing. I don’t know how deep are you in Java programming language, but Processing syntax is very much like Java’s. Great thing for me! Don’t know about you. Being familiar with Java syntax, it’s not going to be very hard to start with it. But, that is not the neat thing I was going to speak about.

I had experience, that I wanted to make some simple pong game in Java, when I started learning it. Buuuut, there was a big problem! So many things to figure out by my self, or to take a books and read. Eventually, books would have give me better understanding and take me a longer time to do it (in right way, of course). Since I’m inpatient, I wanted to make something fast. So, I took Java’s API, and read little about double buffering. I made something, but lost my patience after all that guessing and doing it all wrong. Here comes Processing, winning the day! Processing gives you speed in doing all sweeet graphics programming, without worrying about double buffering or anything else. You just have to learn some basics, get some code dumped in the Processing main window, and press play. If you are lucky, you’ll do some basics very fast, and proceed to 3D graphics with OpenGL. Yes! Processing has libraries for many things, and for OpenGL among all others.

Soooo, go there and do some Processing, and let me know what was your impression! Bye!

PBS4C#

Ok ppl, this is something I’ve been working on in past few weeks.

There is a particular project called pbs4java. With it, you can call pbs commands from java implemented methods. I used it as a idea.

There was the certain need for the .net implementation, and I did some programming to enable some basic methods for work with pbs with .net. Now, don’t get me wrong, I’m not a .not programmer!!! 😀 Nor I like m$, buuut as this is for science, I think I can live with it.

Anyway, as soon as I finish up my first release, I’m going to make some noise in here 🙂

Making a simple web service using axis2

Me again! 8)

In last article related to Axis, we talked about installing Axis2 on tomcat server. Today, I’m going to write about making a basic web service, using axis2. Now, I do not have the great knowledge on using web services, but I managed to make them work. For following this mini tutorial, you are going to need Linux, Tomcat6, Java, Axis2. If you do not have that, just follow this tutorial.

First, let us decide what will our service do! Since it is going to be simple tutorial and simple service too, let us make service that will calculate sum of 2 numbers.

Service name: SimpleService
Methods: Add; arguments: a(int),b(int); returns int;

Before we get into coding, lets see what makes web service.
When you hear web service, you have to think about it being on some server. To put it on server is called deployment. So, we are going to deploy our web service, when we make it. What are we deploying? When making java web service, we are making an archive. That archive has extension aar, which is a basic jar extension, but renamed. What it has to contain? Main thing is, of course, our class, with methods. Another very important part is particular file called services.xml. Now, we are not going to get into ways of writing it, but you need to check this tutorial about it. This file has to be placed into META-INF document, so axis can find it and read it.

Folder structure:

SimpleService.aar
+ SimpleService.class
+ META-INF
   + services.xml

I hope you’ll get the idea 8)
Let us see the services.xml file:

<service name="SimpleService"> <parameter name="ServiceClass" locked="false">SimpleService </parameter> <operation name="add"> <messageReceiver class="org.apache.axis2.rpc.receivers.RPCMessageReceiver" /> </operation> </service>

Now, service name has to be the same as the name of the aar archive. In parameter tags, you have to put the whole path to the service class. In more complex projects, you’ll have packages, and you have to put all those dots, something like: folder1.folder2.Classfile. For our concern, it is only one file, so its name fill be enough. For the operation tag, you have to put the name of the method we will make, and this massageReceiver is the basic and default one.
Now, it is time for java coding. Stay calm, it is not going to be hard, just a few rows. Here it is:

public class SimpleService {
	public int add(int a, int b){
		return a+b;
	}
}

It wasn’t hard, was it?

Now all you have to do is to deploy it.
You do not have to write client for it, because you can try it through browser. If you are working on localhosto server, then address should be something like this:

From here, you can see where is the name of method, and which are the arguments.

And at last, but not at least, accessing this link http://localhost:8080/axis2/services/SimpleService?wsdl, you’ll get the WSDL, which is the most important part of communication between client and web services on server, but since this tutorial is for beginners, we shall not talk about it. To be honest, I don’t know to write it, but luckily axis makes it from your arr automatically. YEY for Axis!!! 😉

I hope this will be useful for someone who is facing the web services for the first time, because I was the newb not so long ago, and I know how it is to have sooo many questions, and not adequate literature. Feel free to ask if you have some questions about whis topic, and I’ll try to answer if I can. 8) Bye

Installing axis2 on Ubuntu host

Hey ppl, it is time for one of my super helpful mini tutorials 🙂

Its been a while since last post. I had lot of work and things on my mind. Today I decided to write mini tutorial about installing axis2, as I setup it again on my virtual machine.

Before we start, I’d like to tell you why I’m installing everythin again! 😦 It is because my old virtual machine was broken few days ago.

I had WinXP on it, and I was doing some IDEF0 and DFD diagrams. I needed ERWIN for some ER diagrams and I tried to install it. It started and took some time, and then VBox started going crazy! It shutdown WinXP virtual machine and threw me an error about it. If I just had a clue not to edit Virtual Box.xml file, I’d be very happy man right now. Anyway, I had removed some lines, or something like that and all my virtual machines and their snapshots were inaccessible. I have lost few hours trying to make it work again, but with no success. So, I’m giving you advice, FIRST READ THEN EDIT CONFIG FILES 🙂

Ok, now we will start with installing axis2.

First, you have to install java6, tomcat6 packages with next command:

sudo apt-get install sun-java6-jdk tomcat6-admin tomcat6-docs tomcat6-examples

Now, you can try accessing localhost:8080/ in your browser. If you try to get on admin pages, to deploy some servlet, you’ll get prompt for username and password. Because tomcat6 default install hasn’t those parameters in config file, you’ll have to edit /var/lib/tomcat6/conf/tomcat-users.xml. In it you’ll have to add next lines:

<role rolename=”admin”/>
<role rolename=”manager”/>
<user username=”admin” password=”password” roles=”admin,manager”/>

between tomcat-users tags. Change “password” with your own.

After this, you’ll have to restart tomcat6 with:

sudo /etc/init.d/tomcat6 restart

Then, you have to access manage-webapp link on localhost:8080/ and enter your username and password from tomcat-users.xml file.

Inside, you can do lot of things, but we will do war deploy :D. Since we are installing axis2, you must download WAR archive from this link: http://ws.apache.org/axis2/download/1_5_1/download.cgi

Then you choose path to axis2.war file, and deploy it. To access it, visit localhost:8080/axis2/. I’m pretty sure you’ll get error. It took me som time to figure out what is blocking it. The problem is in tomcat6 script in /etc/init.d directory. You have to switch tomcat security flag from yes to no. Then restart tomcat6, and you’ll have axis2 working.

That is all. Feel free to comment and ask, and I’ll feel equally free to answer them 🙂 BYE!