Friday, October 15, 2010

15 October 2010

Spent almost the whole day working on assignment 4 part 1. Had to work with many static data, which means lots of hardcoding. Doesn't feel right to me. Still, managed to learn more things. Played around with the UINavigationController and UITabBarController. It all seemed so confusing at first. The moment I started to work on the program, somehow it all became clear. I was able to understand the way these controllers work.

Found out that there are some properties to identify the controls that we put in the interface builder. We needed the unique identifiers in order to work with the controls, since we are not making use of IBOutlets in this assignment.

Encountered the problem of losing my array of images. All along, I set the property of my instance variable to 'assign', and somehow, the array gets missing later on when I want to access it. Then, I decided to change it to 'copy', and the problem was gone. A lesson learnt! Gonna ask Kevin more about this on Monday.

We were also invited to the GM group's meeting. A colleague, Gim Han, presented on how he went about reconstructing contour lines drawn by doctors and present them in 3D. He talked about his algorithms and explained why he was taking a particular approach. Kinda amazed throughout the whole presentation. The stuff he talked about were so foreign to me. I really wonder how long it took he to come up with all those algorithms. All the staff in the meeting room were very helpful, providing constructive feedback. I can actually see the teamwork there when they helped one another to clarify their doubts.

Thursday, October 14, 2010

14 October 2010

Went through Stanford University's iPhone Application Development (Winter 2010) lectures 6, 7 and 8 today. Learnt about View Controllers (lecture 6), Navigation and Tab Bar Controllers (lecture 7), as well as Scroll Views and Table Views (lecture 8). Generally, I feel that all these are necessary and can be found in almost all iPhone applications. They actually help the developers to better structure their codes (view controllers - MVC); the users to better navigate and interact with the application (navigation controllers, tab bar controllers, scroll views, table views). These are useful controls to better present data too.

Just watched Stanford University's iPhone Application Development (Spring 2009) lecture 8 as well. Had to go through this as the one in Winter 2010 didn't have the demo. We'll need to try out the demos in order to gain a better understanding before moving on to work on assignment 4.

Tried out the demos after watching the lectures. The codes were relatively simple to implement and I think I might have gotten the hang of it. Lets see how it goes for assignment 3 later on...

Gotta be more proactive! We didn't even have the HR's contact until Kevin asked.

looks like the age where the kids start getting their own tech gadgets are getting lower and lower...

Wednesday, October 13, 2010

13 October 2010

Completed the basic functionalities of Hello Poly part 2 (assignment 3). Played around with views and drawing polygons onto the view. It was kinda confusing at first, but once the flow was defined properly, everything fit into place. Learnt how to make use of NSUserDefaults too. At least now I know why some iPhone applications are able to resume my previous sessions.

Tried working on the extra credits. Still have no idea how to set the gradients. More research to be done! Gonna continue with the extra credits part after lunch.

Time now: 12 pm, lunch time!


Back from lunch... 12.40 pm. Ate at the hawker centre opposite Fusionopolis with Zac. It's really affordable! No wonder so many people were there when we arrived.


Completed assignment 3! Learnt quite a number of new things through this assignment. Had quite a tough time trying to figure out the rotation of the polygon. At first, I placed the code at the wrong place, and the whole view rotated about the origin (0, 0). Then once I shifted the code to a more appropriate position (after CGContextBeginPath(context);), the polygon rotated, however, still about the origin. Looked up on the documentations and after some searching on Google, I realized that in order to get the polygon to somehow rotate on it's center, this has to be done:

CGContextTranslateCTM(context, CGRectGetMidX(rect), CGRectGetMidY(rect));
CGContextRotateCTM(context, (angleToRotate * M_PI / 180));
CGContextTranslateCTM(context, -(CGRectGetMidX(rect)), -(CGRectGetMidY(rect)));

Shared with Zac on how to do this, and he shared with me on how to draw grid lines in the background (:

Also learnt how to play with animations. It really makes the whole interface look better. Before the implementation of the animations, I had my controls clustered due to the small display for the iPhone. Thought that it would be really difficult from my past experiences with Silverlight and WPF. But true to what Kevin said, it was really simple. Just 4 or 5 lines of code and we're set!




Kevin talked to us regarding where we could get help when we encounter problems during development:
- Manuals (iOS Development Guide)
- Apple Documentation (through Xcode)
- Forums (e.g. Stack Overflow)

Gonna spend some time to read up on the manuals to learn more about the basics.

Tuesday, October 12, 2010

12 October 2010

Continued with assignments 2A and 2B today. Managed to do them without much problems. Probably because we have done the other assignment of the Fall (2010) edition where we created the calculator. Getting used to the syntax in Objective-C already. Many thanks to Kevin who spent time going through with us what we have done and helping us brush up on our concepts.

Finished going through lecture 5 as well as trying out the sample codes in the lecture slides. Had quite a few problems trying to get the program working though. At first, we had no idea as to where to place the sample codes. I tried putting them in the delegate class, but nothing happens. After some clarifications with Kevin, we were told not to touch anything in the delegate class for now.

Hence, we moved on to create a new View Project. In this project, implemented the drawRect method. I supposed that it would work already, however, that wasn't the case. After some researching on the net, I realized that the drawRect method belongs to the UIView class. Since our ViewController class inherits from the UIViewController class, the drawRect method doesn't work.

After modifying the class to inherit from UIView, I thought that it would work. However, that again wasn't the case. After researching, I realized that the initWithFrame method has to be implemented as well. From there, we managed to get our programs working. Finally! We spent like... 2 hours? Oh man. It's kinda tough to think clearly with fever, flu, cough and sore throat around :( get well soon alex! -.-

Some references that I used:
http://www.questionhub.com/StackOverflow/2811427

Time now is 6.20 pm, time to pack up and get some rest at home!

Monday, October 11, 2010

11 October 2010

Started the day with Kevin talking to us regarding product demonstrations. Never let your audiences tell you what to show. As a developer, the strengths of your product are only known by you. Therefore, never be just satisfied with finishing up the product. Test it out, learn how to best show it off!

Time now is 11.16 am. Just finished the 3rd Podcast lecture on iPhone Application Development where most of it talks about memory management. Oh and by the way, saw this and thought that it really helps on program efficiency. Instead of writing this:

- (BOOL) canCastVote
{
if (age >= 21)
{
return YES;
}
else
{
return NO;
}
}

It can be done simply this way:

- (BOOL) canCastVote
{
return ([age >= 21]);
}

Time is 11.50 am, lunch time! (:

Time now, 12.30 pm, back from lunch. Time to resume watching lectures.

Finished watching lectures 3 and 4 at 1.50 pm. Time passes really quickly when we're learning huh.

Just realized that we were working on the "wrong" assignments from the start. We're supposed to work on the Winter (2010) version, but instead we went to work on the Fall (2010) version. Hence, Zac and I were tasked to complete Assignments 1A, 1B, 2A as well as 2B. We also managed to finish going through lectures 3 and 4.

Progressed quite a lot today. Learnt many new Objective-C syntax via assignments 1A and 1B. Still have yet to complete 2A and 2B, but will get them done ASAP! Yearning to learn more new things~ Stack Overflow is a good place to look for answers too. Most of the time when I Google for anything that has got to do with Objective-C, the results are from Stack Overflow. I've added some links that actually helped in the "Useful Links" panel (:

Another thing to note!
People look for readability in source codes -

"The best source codes have the most spaces."

The amount of spaces doesn't matter after the codes comes out of the compiler. It's the efficiency that matters anyway (: