Skip to content

Category: java

Image convertion to GrayScale/Binary/R/G/B


This is a small exercice of Multimedia class (INE5431). We need to implement:

1) Transform the image to GrayScale
2) Generate one image to each component color (R/G/B)
3) Transform the GrayScale image to binary

To transform RGB to GrayScale we need to use this expression:

Y = 0.3R + 0.59G + 0.11B;

And them, to convert the GrayScale to Binary

if (Y > 127) {b = 1; } else { b = 0; }

If we want just one color component, we need to get all image pixels and leave just the component that we want, or just copy the component to a new image.

In this project, we access an image and we have some functions to do what we want, convertion to GrayScale, Binary, and Component RGB. From the source image, we create a buffer image of the same size to all images and we create a for to go over all pixels and make the transformation and put it to the new buffer image.

Continue reading Image convertion to GrayScale/Binary/R/G/B

JavaSpaces – An introductory example.

Hello, This example, is a microblog service, "similar" to twitter. It uses JavaSpaces JavaSpaces - example Best Regards, Matheus

Continue reading JavaSpaces – An introductory example.

WebServices – An introductory example.

Hello, This example shows on Client to a Web Service. One Web Service that is a Client too (Collector) and just a Web Service (Store)…

Continue reading WebServices – An introductory example.

An example of use of CORBA


CORBA (Common Object Request Broker Architecture) is a standart defined by OMG (Object Management Group), this let distributed object from different languages and OS to communicate. It also provides total transparency in the communication. The IDL (Interface Definition Language) is the tecnology used to describe the interfaces. IDL has your own data types, that are mapped to the data types in other languages. There is an IDL compiler, it generates the codes that do the communication.

But how it works? We have some definitions in a .idl file, in this case Bank-idl (remember to change the filename).

Continue reading An example of use of CORBA

Java RMI – Intro and Example

Good Night,

Java RMI (Remote Method Invocation), is a mechanism that let the user, create distributed applications using Java. It takes care of Sockets, protocols and others. But how it works? All the magic is done by RMI. It have a server named RMIREGISTRY, where your server connect and says "I'm here". After this Clients can connect to RMIREGISTRY and find the server that it wants.

I will show you an example of a Car Advertisement server, where Clients can add and search for Vehicle.

Continue reading Java RMI – Intro and Example

Send files using XML-RPC in Java

Hello Tooday Jorge send me an e-mail asking how to send files using XML-RPC. So I did some modifications in Client and Server, Java XML-RPC…

Continue reading Send files using XML-RPC in Java

MD5 “Decrypter”, Java

Hello What is MD5 Decrypter? It is a distributed system to break MD5 hash using bruteforce. Implementation of MD5 Decrypter There is a lot of…

Continue reading MD5 “Decrypter”, Java

Parking Lot Exercise, Java, Concurrent Programming

Hello, This is a problem of Concurrent Programming that I solved in a test: The parking lot have 30 spots. Since the parking lot have…

Continue reading Parking Lot Exercise, Java, Concurrent Programming

Client and Server, Java XML-RPC

Good night,

A few days ago I created a XML-RPC server to test some functions. What is XML-RPC? XML-RPC is a remote procedure call (RPC) protocol which uses XML to encode its calls and HTTP as a transport mechanism.(wikipedia) To start using XML-RPC in Java I used apache xml-rpc.

Example client and server XML-RPC.

Best Regards,
Continue reading Client and Server, Java XML-RPC