Friday, October 29, 2010

29 October 2010 - More Bonjour!

As the title says, more Bonjour. We decided to go for a different approach today - to change our server and make use of delegation.

We managed to get the connections set up properly and were able to send and receive data on the client and server side. But, we have one problem. Since we're doing asynchronous data transfer, when the different touch evens are being called rapidly, the data being sent would be merged even before it reaches the receiving end. When this happens, unarchiving the data would cause the program to have errors, and we would not be able to display the user interactions properly.

We tried to solve the problem by applying threading, which I thought would work. Still, it failed. We didn't try doing synchronous data transfer as it would be slow if many users were to connect at the same time. We even tried to skip the unarchiving for data which exceeds a certain number of bytes, which obviously isn't the right way -.- this caused the interface to become jerky as some of the user interactions would be skipped.

Therefore, after doing some research, we realized that manual splitting and merging of the data's bytes has to be done before unarchiving on the receiving end starts. All along we were working based on the misconception that the way we send or receive is incorrect. However, that's not the case. It's actually due the the network that we're sending our data through. If data is being sent at a very fast rate, the data packets tend to be merged on the network. It has got nothing to do with the way we send or receive. It's much more of what should be on the receiving end before unarchiving the data.

Hence, we'll try out the splitting and merging of data packets on Monday to see what happens.

28 October 2010 - Bonjour again

Continued working with Bonjour again. Cracked our heads for the whole day! At first we missed out the code on the listening socket, which led to us not being able to listen to connections coming in. Once we added that in, things worked. We managed to establish the connections today - client joining the server.

However, there seems to be something wrong as the client is able to send the touches to the server, but not the other way round. We suspect that it has got to do with something related to NSOutputStream. Since it's already quite late, we decided to read up more on Bonjour after work.

Wednesday, October 27, 2010

27 October 2010 - Bonjour

Worked on the Bonjour protocol today. Had to get this right as this would be the groundwork for our project that we'll be working on soon in time to come. This time, it would not be the same as the assignments that we did before. Gotta research and try to get things working on our own. Only until the three of us (Kevin, Zac and I) are unable to find a solution, then it can be considered that we failed to do what we wanted. Then that is when we think of alternatives.

Kevin's right, we got to learn to express ourselves more. If we are unable to express ourselves well, we would tend to get the wrong message across, resulting in poor communications. The project could be directed onto another path because we failed to express ourselves well enough. Learnt this important lesson from Kevin today. Thanks Kevin :)

Managed to publish the NSNetService properly today. Gonna work on multiple interactions tomorrow. Hope that we can come up with something good :)

Tuesday, October 26, 2010

26 October 2010 - More on Touch

Continued working with Touch on iOS today. Managed to complete one of the multitouch assignment which requires interaction with irregular shapes before lunch. Zac and I found some classes on the net that catered for buttons with images that have transparent portions. Still don't quite understand how that class works though. The only thing I know is that the class is playing with the color pixels of the button's image. Gotta spend some more time understanding the codes.

Gonna go work on the other touch application in which a shape, say a square, would be able to follow the user's touch on the iDevice.

Just finished the second application, and it works! :D Time to go back and try to understand the classes that I used in the first application.

Watched the lecture on Bonjour protocol while waiting for Kevin to check on us. It's really cool! There are all sorts of things we can do with it. Really up to our imagination.

*edit* added some animations to the second application after Kevin came and looked at our work.

Monday, October 25, 2010

25 October 2010 - NSOperation & Touch

Tasks for the day:
- Watch lecture 14 on Multi-Touch
- Rework assignment 4 part 3 with the use of non-blocking technique
- Work on Multi-Touch Application

Watched the lecture on multi-touch this morning and tried out the demo applications. When we came back for lunch, Kevin took a look at our assignment 4 part 3. For that assignment, out interface was blocked whenever we retrieved data from Flickr. Hence, Kevin gave us a lecture on NSOperations (aka threading).

Kevin also told us about the hierarchy of data retrieval from the fastest to the slowest:
1. Memory
2. Disk
3. Local Network
4. Internet

We learnt that whenever we perform costly operations, it would always be good to make use of threading. This prevents blocking of codes and users would then have a better experience with the application. Else, if the application is being blocked due to the long code execution, the application would be unresponsive. The next thing on the user's mind would be to exit the application.

We managed to rework the application to remove blocking, and the whole process has become much more ideal. Here are some references used during the reworking of the application:


Now, we're given 2 multi-touch assignments to work on. We would be working on the second one first, which seems to be more difficult.

Got this useful link on the net to deal with irregular-shaped buttons. Gonna try it out tomorrow. Have to go back home and create the images.

Friday, October 22, 2010

22 October 2010

It's Friday again~

Kevin briefed us on what to do in the morning. We'd have to go through the Xcode preferences to see what each settings does, as well as to review the applications that we have programmed previously. After reviewing, we'll be cleaning up these codes so that they can be used for future references. I'm sure at some point when we're working on our upcoming projects, we're bound to forget some things. It's easier to recall what we have done ourselves anyway.

Zac found a whole list of Xcode settings and shortcut keys. Very useful! Check it out in the useful links section "List of Xcode Settings & Shortcut keys". OH, and after exploring Xcode's preferences, finally found the setting to have all windows in one. That makes the viewing much more cleaner! Do this by going to menu bar / Xcode / Preferences / General tab and change Layout to "All-In-One".

Went for lunch with Bernard and Zac today. Ate at the foodcourt on the first floor and went to walk around in the market place (basement). Bernard took us to the Sky Garden at the 23rd floor. There's such a nice view there, but the haze simply ruined it. -.-

Watched the lecture done by a guest lecturer who talks about the basics - getting help and debugging.

So far, life @ IHPC is real good. I've been learning new stuff and making progress everyday. Although it can be tiring at times, but still, we've to persevere. These stuff that we learn will definitely be put into use when we work on our actual project. Looking forward to that day.

Starting on Touch next week, one of the major components that we'll be interacting with in out project. Gotta have a goooooooood understanding on this part.

Thursday, October 21, 2010

21 October 2010

Continued working on assignment 4 part 3 (aka assignment 6) today. Managed to have more progress already. Learnt how to pull data from Flickr and populate the data in our application. I was also able to plot the pin locations on the MapView with the use of Flickr's photo geo-locations.

Zac met with a "crazy" problem while trying to add in a framework. 58 errors, crazy - Yes? No? After spending around 1 hour trying to debug, Kevin came to the rescue. Haha! Kevin the master programmer?

We tried to set up FaceTime on the Mac. But it doesn't seem to be calling the phone and the Mac at the same time. We're gonna go through the keynote tomorrow to find out more.

Oh yeah, gonna have to spend some time going through Xcode settings. Really important!