Dienstag, 2. Februar 2010

Okay 6.0 is alive!

Puh that was a bunch of work.

But I finished the Bot and the file downloader. It basically is a java server page (JSP) and the datastorage in the background.
First I export all the generated HTML Code into a string, then I add it to the datastore and generate a link with the waveletid and waveid to the JSP. The JSP gets the Parameters and queries the Database for the content of the wave.
Then I put the content into the JSP and the html file is ready.

Wasn't that difficult, but I didn't know what power is behind the serverpages. Nice one! I hope to extend it with the other blips if it is available. I'm soo glad :)
The Sourcecode will be up on Google Code and Sourceforge later this evening.

Here are some Pictures:

No Way

Good evening,

today I tried to solve the download issue. You know, Google doesn't allow any Filewrites or Filereads, their opinion is to use the datastore. This is really similar to a database, so that is nothing for my case.

I had a new idea with a JSP inside the Wave Robot which has a textarea and sends the form to a new servlet. This servlet should write the content from the textarea to a file and write it to the output stream (a true download!).

Hmm I just got a new idea, I should save the content of the blip to the datastorage of Google. Then I can pass a parameter(waveid, blipid) to a servlet that shows the content from the datastore.This might be the solution =)

bye!

Sonntag, 31. Januar 2010

Clean up

I cleaned up the code and solved the last bugs with the overlapping image tags.
I commented it and added some author,copyright, param and return annotations in the comment sections.

You can find the new code on Sourceforge!
http://portexy.sourceforge.net

Freitag, 29. Januar 2010

Pictures of the new functions

At first I have to say, that I disabled all iteration until the new API is deployed.
The second thing I need to tell you is that I commented out the tableinsertion, cause it is a bit rocky and not that visible cause it messes a lot of code up, that's not soo good.
But I want to share some pictures of the new image parsing:

I made some LateX formulas from Watexy (Thank you :-) ).


This picture turns into....
















This one!
 
Sidenote: I know that 1/n is equal 0 :P

I made a public sandbox wave out of it, please visit!

Though it works in this case, I have some buggy waves. I guess this problem comes from old annotation I've set when I debugged. We will see what the problem was!
Bye!

Finished

Hey,

I almost finished the image parser to my PorteXy robot.

I tried a lot and had to debug and return many outprints. But I have solved it.
The whole "get every image and parse it into html" thing works like this:

We need a two dimensional array of string and set one column to the position of the element and the second column to the URL. The length of the array is the number of elements in our elementype list from our actual textview.
After adding every element piece to the array I need to sort it by its position. Thats because the index will overlap later in the annotationparsing (that was why it failed the wole time -.-). So I wrote a StringArrayComparator which implements the basic Comparator interface. I wrote it for sorting the two columned arrays by one of the two columns. In my case it is the first one, which represents the position.
After sorting I just need to add them as a annotation:
Inside a for loop I am setting a new annotation at this certain blip from the parameter. This new annotation is named "IMG" and is used in the part where I'm going through the annotation list. Its value is the img URL from the element.
You may ask where I get the position from?
You can get the position of a certain element from the textviews' getPosition(ELEMENT) method.
This position is stored in the annotation in a range object.

I also added a escaping part to the getAllfrom_blip() method, obvious there are characters in HTML you won't have in the text areas. The best (and only?) example are greater and lower than (< >). I forgot to escape them and I didn't thought about it in the past. So I added it now, it'll be secure as well ;)
If you have any other characters that need to be escaped write a comment in the section below!

Tomorrow I need to clean up the code and comment it.

bye and I wish you a nice evening.

Mittwoch, 27. Januar 2010

Small PorteXy Update

Hey forum,

my friend used porteXy last night and wanted me to extend it with image exportation. This might be a good idea, I'm looking at it now.
After I finished the table insertion, I get along with the file downloader. But I have to stop working on it because a Java fileextension for Google Wave is announced. I will wait for it and this solution is not a "frickle" stuff like writing half of the code in python.

So my new aims:
  • Image exportation (TextView Elements)
  • still the Filedownload (waiting for new API deployment)

And I got a quite good source for you if you are developing with Google Wave:
http://groups.google.de/group/google-wave-api/topics?hl=de

That's the group I am sometimes talking of. There are some of the Wave devs and I am sometimes posting there too ;)

Have a nice day!

    Montag, 25. Januar 2010

    Java besides Google Wave

    Dear reader,

    the last few weeks were a bit boring about Google Wave and I developed with java.net on my home network to show how powerful java actually is.

    What did you exactly do?
    At first I implemented a server with a serversocket which is listening to a certain port and awaiting a connection from a client. It was just a basic i/o chat with some in- and outputstreams. That was quite easy so I decided to add more functionality to my application.
    The first thing I added was a multithreaded server, you know: It awaits a connection with a while(true) loop and then it starts a thread with the i/o stuff. That is the best solution if multiple clients will connect.
    Basically I was a bit disappointed that you could only send textmessages from a client to a server, but then I read about sending images. So I wrote a client class which opens a socket to the server and pulls an bytearray out of the image. Then this array is send to the server via a stream and on the serverside I did the same vice versa.
    There were several problems:
    1. The server didn't know whether the stream was text or image
    2. There is a need of two GUIs server / client, minimizeable to tray
      The Server GUI is just a TextArea which is logging every connection and incoming message.



      The main function is the drag&drop'able window (you can drag the pictures over the frame and drop it), on the server side is a popup frame like in the MSN Messenger.This popping frame is clickable and if you click on it the text that was send, is copied to your system's clipboard.
      So the issue is to devide between a text and an image. I had some ideas of setting a "type" byte in the bytearray, but then I made two sockets with two different ports and made the server listen to both in two threads.
      With that improvement it is possible to send text and image at the same time.



      The diagram of the classes in BlueJ looks like that:


      What you see here is the architecture of the Client and Server. The Client starts in the StartUp's class main function, then the GUI will be created and the fileDrop manages the Drag&Drop events on the GUI. When the send button is pressed a new object of clientText will be created, this is an inheritance of ClientImage and provides an own socket just with another outputstream than the clientimage. Besides the streams the image is turned into bytearray whereas the text is just a string.

      The TextTransfer class manages the copy to clipboard ability on the server.


      So the main usecase of this application is when I am sitting on my desktop and another one is sitting anywhere else (but he must be in my local area network) in the house, I can communicate with him.
      The next steps I would like to do:
      1. Adding a "server search", my DHCP gives new addresses all the time so I had to compile the source with a new IP
      2. Get Client and Server together, like a PeerToPeer chat client.
        Like always I am uploading it to SourceForge and other codesites. It took nearly 1 1/2h to comment it :)

        So we all saw, what we could do with a little bunch of code, we implemented Threads, we parallelized, we created GUI's and we had developed with TCP/IP protocol and sockets. And the best is, we can run the code in a *.jar file on every operating system on the world, just if java is supported.
        In my own network I run it from Windows XP to 7 and from Debian lenny to Ubuntu karmic.

        Here is the sourceforge link: https://sourceforge.net/projects/lanchatter/

        I hope GoogleWaves new API will be deployed soon, I am dying of boredom =/

        Have a nice day forum!