Friday 29 February 2008

Working on Profile Page

The homepage really is a tough piece of work. Yesterday I finally finished the editProfile page and the registration.

I now started with the Profile Page itself. I had the design ready yesterday by 4AM. But the logic part is really tough. I have done the handling whether it is the logged in user itself and some more stuff. But it's hardly tested at all since I don't have the buddy stuff done.

Next steps:
  • Youtube Video Selection (Should be done within a few minutes)
  • Read out BuddyList and display of them in the Page
  • Work with the wall (Post Comments in the Profile)
  • Show Entries from the Blog (which currently doesn't exist)
Another Tough part will be probably the Avatar Upload, but I'm gonna see tomorrow. I'm just afraid that I will run out of time :-( I have to become faster, especially since the Messenger isn't finished. One nice Feature for the future I might still implement in the next days would be the selection of Profile Layouts since I managed to put a decent base for it.
Anyway, it's 3am again. Time to put in some last lines of code and go to sleep.

Monday 25 February 2008

Registration Initially works

It was much much more work than I expected, but initially the registration page works!!!
I had to do some more integration work of the database and localization class. Though it doesn't sound like, it was a lot of work I went through. Tomorrow I want to continue with the edit profile page to get the basics done and then continue with the profile itself.

After that I should go over to the Avatar upload stuff which could end up in a huge amount of work. But I'm positive about it. At least I'm now even ore satisfied with this huge amount of work I initially put into developing helper classes and stuff like that. I'm even able to reuse classes which where originally only planned for the server. With a few changes in some, since I have no control over the order of instances creates.

Well, it's 4:30am, so I'm closing down the stuff since I actually don't not want to skip classes tomorrow.

Sunday 24 February 2008

Productive day

Another important step done for this day (though the next one started since its 2:35) I finished the database connection pool and almost got the login mechanism finished. so for tomorrow I can go on with the registration page and have a look how far i can come. With some luck I will be able to view the Profile page which would be a really decent mile stone. Hopefully I can continue tomorrow without any surprises :)

Saturday 23 February 2008

Back on Track

After a forced break caused by an unexpected assignment i can continue again. Having lost 4 days have plenty of stuff to ketch up with. I am currently at a point where I started to depend on features that are out sourced to the website. Since I have kinda lost my focus to the messenger (thanks to that assignment) I decided to now work on the web page. Unfortunatelly there have been two issues which have basically driving me crazy.

Problem 1 (wasted 1 day on it)

I tried to develop the whole page how the W3C wants it to be with CSS and Divs only. The main layout went easy with Dreamweaver, but getting tabs done was one single nightmare! As I defenetely don't have time to play around with that I made this point with a "highly forbidden" table. But I think I'm not the only one:
http://www.randyrants.com/2005/04/css_sucks_bollo.html
http://www.decloak.com/Dev/CSSTables/CSS_Tables_16.aspx

Problem 2 (Wasted another day on that one)

I know packages a good thing and I use them extensively. But why the hack is Tomcat unable to find classes in the /WEB-INF/classes folder when they are not in a package? It was thanks to a friend who has given me the advice to try it with a package which has basically resqued a huge amount of my time.

What is done now?

Next to wasting time with those tiny little annoyances, I have also been working successfully. For example the main Layout of my website is done! And it looks pretty nice for that short time i have spent for it :) Tomcat is running, I even managed to get Eclipse working how I wanted it in less than 30 mins (was a bit afraid of gettings stuck). Since the class stuff is running I am also finished the localization class which allows me to use on single textfile containing all the Strings from a specific language to put them into the page.  The next steps are: Get the database Connection Pool running and get the user login/registration running. After that its gonna be filling up within contet. First main stuff like User Profile,... oh and not to forget the Avatar upload! <- Memory to me! I hope that I will be able to work decently fast since I have the ability to use plenty of classes developed for the instant messenger. The Localization module for example was done by modifying the Client Localization class from the messenger.
Maybe I'm gonna post some screenshots soon :-P

Saturday 16 February 2008

A decent amount of work done

So, I already managed a decent amount of work threugh the last days. Sending messages initially works, though I have to make more tests in this direction. Currently it works out very well if a contact is offline and the message has to be stored in the database. Loggin in also works fine now. The next steps now are the development Signing in and signing out. I also fixed some bugs with the Aspect ration and the loss of transparency when resizing images. I also found some decent ways to call the web browser which will allow me to outsource some stuff to the social network. Like the registration, buddy search and stuff like that. Even the database works now quiet well. The user interface also looks better and better. Currently I work on the sign in sign out function. I hope its not too long anymore and it's gonna be just adding new Features. I will also have to stop working a bit as Assignments have started again. Though I don't like this fact because it's putting away my attention. Here is just a small list of future steps within the messenger:
  • Allow Avatar change
  • Implement file exchange
  • Allow detailed Profile fiews
  • BuddySearch within the BuddyList
  • Social networking Features
  • Other stuff
So, I hope this will be finished soon. It's middle of february already.

Monday 11 February 2008

Database giving me a headache

I lost quite some time today only by trying to figure out how to make inserts into two tables having the same ID. The problem was that I am using some kind of inheritance for users. I am basically treating  Members, Chatrooms and Groups as some kind of users as all of them share some attributes. So I have a lookup table which records the users ID it's type and some common attributes. As a result of this, it was necessary to also create an entry into the Lookup table with the same User ID. The problem now was that in Oracle SQL it's almost impossible to efficiently insert into two tables having the same Attributes, especially with Sequences, as I haven't found any possibility to read out the current or following value nor avoid it being overwritten/changed between two inserts. The only way would be to read out the just written row, but how? Here I would possibly have to add another key or something else to quickly find this row. Also reading out the highest value userID would be inefficient, as I might have to run through thousends of rows and compare them. And again, how to guarantee that another Thread would't do the same? The Server is split into two parts which only communicate through the database. At the end of the day I decided to solfe the problem by generating random UserIDs and check whether this userID already exists. This allow me to add assure that the generated ID does not exist and that the same ID won't be used by another thread/process at the same time as the possibility is extremely low that the same ID will be produced by the generator. The next problem occured with Java. Programming in this language for such a long time, by accident I had to find out today, that Integers can not be set to be unsigend which reduced my number of usable chars down to less than 16bits. In this case I no made a difficult decision and change the format to chars from 0-9, a-z, A-Z.  I hope that there won't be anymore such suprises waiting for me.

Sunday 10 February 2008

Work on messaging System goes on

I only worked on the server and database related stuff. Todays work mostly contained work on dealing with messages. This was actually much more work than I originally expected. Having to deal with message de and encoding to/from a sendable format, identfying users involved and dealing with messages to offline and HTTP hidden users. Only the fact that the recipient could be a Chatroom with a number of users makes the situation much more complicated. All in all plenty of work. I am still not sure how to deal with that log. My latest idea is to store it as textfiles to reduce load on the database, but here again I am not sure whether this would be faster at all and how to synchronize it. One way would be a Buffer which is being emptied into the Log after time intervals. Furthermore two log Files would be stored which work accross the servers.
  • HTTP Log: Would be filled by the Socket server and read + emptied by the HTTP Server.
  • SOCKET Log: Would be filled by the HTTP Server and read + emptied by the Socket Server.
The main problem is just how to read those while the other side is writing on them? Probably just wait a few millisekonds and try it again. But again, it all only seems to be good if it is faster than a Database. I will have to consult some Database experts probably ;-)

Saturday 9 February 2008

Database work is going on

I did not manage as much as I wanted, but it is still some good work considering that I forgott again plenty of SQL Stuff. Well, the server is running, the DSN connection works, my connection Pool as well and I am already able to verfiy the userlogin through the database. I will only do as much as necessary as the time schedule is too tight to mess around with optimisation. Currently I work on reading out the buddyList. Tomorrow will get on much faster with it after I have worked myself into it again. In addition to the database I also lost some time by meeting a Bug in the Java String.split(String) method till I figured out that the method is not able to deal with all characters for splitting. Hoping for a good day tomorrow.

Friday 8 February 2008

Working on the database

I finally startet with some real database work. Till yet I only had a small Dummy Connection which was just enough to simulate a login and the buddyList transfer to the client. The last work on the clients side was to send a message.  This required to work a little more on the server so I decided to now stick with the server and start with the DB. During my work on the I had to add two components into the DB.
  • A chat object with a userlist within the chat.
  • A Database Log to allow communication between both servers.
I got the idea with the Database Log when I startet with messages. The easiest way wold be that each client would regularly poll the DB and to check whether anything has changed (new messages, new buddies,...). How am I planning to implement it? The design is not finished yet but I already got the main concept. Each time a buddy request, message or other user related event occurs, it will be logged into the Log Table. On the TCP or Socket based server one static class with a separate DB-Connection would query this table and notify all client handlers using MVC about those changes. In this case the entry would be delted from the log. In order to keep this method efficient, all entries older than  a minute will be deleted. At the moment I have to think about how to log the events and which events. Currently I am thinking of Storing it in the following Format: LogID, Time, User, Event The Event would be something very basic like "Received Message" and the notified user handler would check all received messages for this user within the db.

Monday 4 February 2008

BuddyList exchange initially works

It was a productive day today. The client now receives the Buddylist when logging in into the server and the UI shows the list. I also modified the protocol design so, that I don't rely on responses in the protocol. I did so by not sending the buddylist as one piece putting away Avatardownloads from the TCP protocol.
  • In more detail: The buddylist will now be sent as single buddies and the client adds them one by one, instead of sending the whole bunch at once (Java automatically split my one message into several).
  • The Avatar transfer went through a more radical design change. I decided to use a separate Imageserver and the client will download the images from the Avatar/Image Server using HTTP (no mather which connection is being used).
At the moment I am working on the implementation of the Avatar exchange and on further Avatar handling. Automatically load a backup avatar if the avatar has not been downloaded yet. Also some MVC stuff in case the Avatar is ready or the user goes offline,..... Nevertheless, there is still a lot to do!

Sunday 3 February 2008

Protocol Implementation

After a short break, I am now busy again with the project. Unfortunately not anymore with the speed I am used to. The Buddy List implementation was much harder than I expected. Mostly MVC redundancy caused difficulties and I had to change some structure in the background. In order to check how it works I have to continue with the protocol which also gives me a headache. Here it’s the synchronisation which is kinda tricky, especially since the protocol has to be split into two lower level protocols. My current design involves the usage of message which requires time accurate responses(some message need a correct response from the other side). E.g.: • Server: Send a Buddy • Client: Say whether Avatar is required • Server: Send Avatar (if required) Due to the required asynchronous communication it could happen different messages come in while waiting for a response. At the moment I am planning to change the protocol design so, that I don’t depend on responses. I’m going to see tomorrow how I’m going to change it. Especially I have to check how to deal with file transfers.