Monday, July 27, 2009

Transition from C to C++

I have been working as a software developer for five years since year 2003. I have been spent four years at the beginning of my career on C language and one year on C++ language since I am working as a game developer on last year.

From my perspective, C and C++ are pretty much the same. What I mean is in terms of programming syntax and semantic. C programming syntax is still compatible under C++ environment where the file extension was saving under CPP file. But if C++ syntax was saving under C extension and try to compile it with C compiler, it will prompt a syntax error.

I have compiled a list of key note for C programmer making transition from C to C++:
  • C++ has smart pointer whereas C is pointer.
  • C++ adopted functor whereas C is using function pointer.
  • Memory allocation should adopt RAII technique.
  • Should not rely much on structure whereas should focus more on object design.
  • Should familiar with template design as this will utilize the code reuse concept.
  • Error handling should be done on one side by using exception. Return code only indicate the status of the execution of a process, not to instruct what should be done next.
C++ is a powerful language, programmer should aware of what they coding so that this language is not overuse. For example:
  • Multiple inheritance should use carefully because this will increase the risk of code maintenance as the hierarchy level was increase.
  • goto keyword should use extensively in the code as this will lead the program flow much more complicated.
Here are some good books that worth to read:
  • Accelerate C++: Practical Programming by example
  • Effective C++
  • Exceptional C++ and More Exceptional C++

Sunday, July 26, 2009

Information overload

What is Information overload?

This happen when you have collect too much information on hand but you don’t need all of them.

Below is the list of symptoms of Information overload

Stress You have done a lot of search, but it seems to be that you have not enough time to read it or there are still missing part.
Poor memory No matter how hard you have read and how hard you force yourself to memorize something, you still not able to recall it.
Inattentive You are not able to concentrate on one thing and get distracted easily.

Here are some tips that may help you out
  1. Plan your purpose of acquiring the information.
  2. Organise your work and get rid of clutter on your table.
  3. Put aside the information that is not relevant to you.
  4. Try to focus, ignore those chat lines, idle gossip, and surfing the Internet aimlessly.
  5. Focus on one task at a time and complete it before starting a new task.

Improve your memory
  • Listen to Baroque music. This type of music has tempo ranges from 55 to 65 beats per minute. It has a frequency of 500 hertz that can harmonies your brain waves, causing our bodies become relaxed and minds alert. One example is Pachelbel.
  • Use music as a memory aid. Music could be a powerful memory trigger.
  • Speed up your reading. An average person can have a reading speed of 200 to 250 words per minute (wpm). There are three attributes showing that you are a slow reading person. First, read word by word. This will cause your eye strain, and boring. Second, sub-vocalise when reading. This will reduce the reading rate because muscular activity tires you out. Third, re-read earlier section waste time and slow down your reading rate.

Speeding up your reading

  • Read groups of word. This is to reduce pausing as you read.
  • Minimise sub-vocalise. Reading either aloud or silently was a bad habit.
  • Reduce regression. Don’t go backwards when you read and force yourself to finishing your reading. Try stop at a section if not whole chapter.
  • Focus and avoid any temptation. Choose the most productive time for your reading. E.g. early in the morning.

Saturday, July 25, 2009

The benefit of using __declspec

  • Only applied to pure interface class
  • Compiler stop initializing the vfptr in constructor and destructor.
  • Only references to the vtable that are associated with the class will be remove.
  • Can reduce code size.
I don't know where did I get the above mention notes but I did jot it in my notebook. I think it should be use with novtable storage-class attribute. It suppose to be use with other Microsoft specific storage class attribute and shouldn't be standalone.

I found an article which describe how this keyword can help in code optimization, how the code will improve when disabling vtable initialzation, and how to indicate a function not to throw an exception.

Windows SDK in VS2008

The Problem
Few days ago I was creating a COM project and try to compile it using midl command, but it shows me that midl was not recognize by windows (I was using the VS tool command prompt).

My Action
First I check on the windows environment variables to ensure they are properly sit there. Then I dive into the directory where the VS installed, my finding was shock because the SDK wasn't there?

I did a search through internet and found a post from forum mention that it should be install together with another component then only the SDK will install properly. What is that component actually? It is Crystall Report.

The solution
Iniatially I feel vague because why Microsoft have to tied the SDK with Crystal Report? I have no other choice. Thus I follow what the guy said. The result was that guy is telling the true.

When the Crystal Report component is installing (the only component that I didn't installed in my local PC), I actually saw the Widnows SDK for Visual Studio 2008 was pending in the Install Component queue.

So the problem solved...
This is not my fault, please don't shoot me !!


Since I started publish my writing on the blog, I found out that writing was so enjoying to myself. At the beginning of writing the blog, I was so frustrate because I don't know how to present my thinking in the brain onto the paper. Thus there are few post at the beginning of this blog was so boring and the grammar are bad. The situation become even worst when I need to use English to present my thinking since I am not familiar with English especially those grammar.

But now I am getting comfortable with it. This is due to the experience in my writing, and keep practicing it, doing self review after each writing, and doing a lot of grammar checking through the Internet. All these effort are pay off to myself.

Recently I found another type of writing, called Journal. What the hell was that? I did some search using Google and Bing, they are many type of it from the search. Each type of journal will serve for different purpose. I am not going to talk about each of them here. But I am trying to give my own definition about this term, which is more suitable to myself I guess.

The definition:
It is a writing of your study on a subject together with your thinking about the subject and come up with your own specify opinion or suggestion on it.

This is true. Journal could be a good tool to keep track of your study and also your finding about the subject.

Sunday, July 12, 2009

Google Directory could be my study panel

Google directory is a tool for me to further up my study. How to say? I found the computer science directory and mathematics directory quite interesting to me. This tool could be my online learning tools as there provide some useful, but not all, of resources for me to reference.

One example I found is Learning via Primary Historical Sources. This resource was talked about the way of learning discrete mathematics and computer science from history source. I am sure discrete math is one of the subject in computer science program. Have a look on it when you got time. Beside calculating on number, lets try to learn math from history point of view.

Enjoy your reading.

Future of COM?

Just curious to know whether COM still exists in the future. Yes it is. Called COM3? Wait a minute, COM3 is a serial port name, will it crash? So what Microsoft did is rename it to COR, then later rename to COM+ 2.0, then ..., finally to .NET.

The information I mention above is from this post.

Saturday, July 11, 2009

The format of function calling from DLL

I got a problem when calling a function from DLL. And this rule is not well document in MSDN I guess. Thus it could be a very common mistake for those who are new to DLL. I have capture the rules when trying to call a function in DLL from the client program. Lets assume a simple DLL is created, and with a FuncA() being export to the client program in that DLL.

Rule 1) When fucntion is declare using __declspec

#define __EXPORT_MODULE __declspec(dllexport)
__EXPORT_MODULE int FuncA();

The function name from Dependencies Walker is shown like below


Rule 2) When function is declare using extern "C"

#define __EXPORT_MODULE extern "C" __declspec(dllexport)
__EXPORT_MODULE int FuncA();

The function name from Dependencies Walker is shown like below


Hope this make a clear sense :)

Sunday, July 5, 2009

Specialization for Computer Science in USM

There are six specialization have been designed for student major in Computer Science in USM. Let's check it out:

a) Information System Engineering
Courses offered under this specialization included Information Systems Theory & Management, Management & Engineering of Databases, E-Business Strategy, Architecture & Design, Software Project Management, Process & Evolution, and Decision Support Systems & Business Intelligence.

This specialisation incorporate main concepts and techniques in current business practices, such as business process engineering, re-engineering, redesign and reverse-engineering so that appropriate business values can be added to the resulting business solutions for the interested parties.

b) Multimedia Computing
Courses offered under this specialisation include Multimedia Systems, Web Engineering & Technology, Computer Graphics & Visual Computing, Multimedia Information Systems & Management, and Animation & Visual Reality.

This specialisation required student to apply the principles that underpin the design of multimedia, hypermedia, multimedia information, graphics and information retrieval systems including web-enabled systems. And also describe the range of media, tools and supporting devices that can be used to support the use and development of multimedia information, hypermedia, and graphical systems.

c) Distributed System & Security
Courses offered under this specialisation include Information Security & Assurance, Principles of Parallel & Distributed Programming, Distributed Systems & Grid Computing, Computer Systems Security & Protection, and Advanced Computer Architecture.

This specialisation required student to understand the current and emerging technologies, architectures and standards in computer hardware and software architectures, and apply this knowledge towards the design and implementation of new computer languages and modern operating systems.

d) Network Computing
Courses offered under this specialisation include Network/Socket Programming, Internet Protocols, Architecture & Routing, Network Monitoring & Security, Microprocessors & Embedded Systems, and Wireless & Ad Hoc Networks.

This specialisation required student to manage and secure computer systems and networks using current tools and techniques, to protect the security and confidentiality of user data, as well as implement preventive measures to deal with known and unknown cyber threats.

e) Software Engineering
Courses offered under this specialisation include Software Requirements Analysis & Modelling, Software Design & Architecture, Software Project Management, Process, & Evolution, Software Quality Assurance & Testing, and Automata Theory & Formal Language.

This specialisation required student to demonstrate an understanding and appreciation for the importance of negotiation, effective work habits, leadership and good communications with stakeholders in a typical software development environment.

f) Intelligent Systems
Courses offered under this specialisation include Artificial Intelligence, Knowledge Management & Engineering, Computer Vision & Image Processing, Natural Language Processing, and Intelligent Health Informatics.

This specialisation required student to use the latest technological developments that support the development of intelligent systems and their applications in various domains such as computer vision and natural language processing. Besides that, they may required to design and develop knowledge-based systems such as expert systems, case-based systems and knowledge management systems.

Saturday, July 4, 2009

Screen Resolution on S60

As I developing S60 application, I am facing a very tricking problem where the screen resolution was so different in between the emulator and the real phone. Thus I raise my problem in Nokia forum regarding on my issue.

The feedback I get from was disappointing me because this problem is a general defect of emulator. This is impossible to develop one emulator that cater for so many hand held devices with different resolution. Someone has suggest me to use J2ME Polish and LWUIT to solve my problem. But anyhow, this is not a guarantee solution which will not working 100% on the way that you want.

Please note that J2ME Polish use heavy preprocessing and it create a JAR file for every single devices whereas is fairly screen adaptive technology.