Saturday, June 14, 2014
Working Journey Year 1
Back to the topic. I started working full-time since July 2013 with a local StartUp. Now, it is June 2014. It is close to 1 year indeed. I thought of writing something while I still have some free time.
It has been 1 crazy year. Prior to that, I took a month break after my National Service. Well, it was pretty difficult to rewire my brain cells at first. I guess it has been somewhat rewired to a certain extent and still getting rewired every now and then.
Nevertheless, I do not know how to express how crazy the journey was and still is. The first working language that I was required to work with was Objective-C for iOS development. I think it was like 6 months using Objective-C. I was involved in 3 apps that I don't think you can find it in AppStore because it is a custom app that are not for public/individuals use.
The next language were HTML/CSS & PHP. I was working with these for about a month. I had some basic knowledges on HTML a couple of years back then. Nevertheless, it is not difficult to start HTML/CSS from scratch and it is pretty fun. This time around however, instead of just basic knowledges, I rather call it, actual implementation. Oh and there is this cool stuff that I touched, called media query. In a nutshell, you use media query if you want to use different styles for let say different screen sizes.
PHP was and still a nightmare though. No matter how hard I try to master it, I just can't. It is too difficult to master it!! Learning it easy, but to actually implement it, it is not easy for me. I just can't do PHP!! The same goes for JavaScript! I am just not good at these 2! It drives me crazy!! But it keeps on coming to me in a way or another. I recall telling people to love things that you hate because the things that you hate will always haunt you. Well, now it seems these two languages are haunting me down and there is no way I can love them!! Hel*, I hate them!
Next was AppleScript. It is not really hard to learn but it is pretty troublesome. I kept on getting the syntax wrong. There is not much documentation or tutorial on the net. But at least, this is slightly better than PHP/JavaScript. I used this in one of my iOS project.
Moving on, I never thought that I would be creating a Facebook game one day. Oh don't get me wrong, I did not do it alone. I got the chance to do that in early May 2014 if I remember correctly. That is not so bad you know but.. the deadline was like 1 WEEK!! On top of that, I never used FLASH neither have I worked with ActionScript before. But the good thing is, I don't have to do FLASH but I've got to program the game's logics in ActionScript. Well, at least I rather do that than messing around with PHP and JacaScript! ActionScript was not as difficult as I thought either but it is pretty tricky. The naming convention of the variables and functions differs from other languages. Oh and for this project, we were building a game for Air Asia Singapore prior to Taylor Swift's concert. Well, it is over now and you can't find the game any more.
There was a buzz a couple of months or years back then about Arduino and Raspberry Pi. I've always wanted to explore these 2 things one day but then the cost was the main factor of me procrastinating it. Well, I am not sure whether it is a coincidence or a destiny, but I was required to prototype a product for a client recently using Arduino. Oh and as usual, I've never worked with Arduino and I just started playing around with it like 2 months back then, and still playing with it right now. It is pretty fun ya know and pretty nostalgic too! Everything that I have learnt in SP started coming back to me slowly, especially the electrical components parts. Not to mention that I always fall asleep during microcontroller lectures. Haha!
At first, my company got me 2 custom Arduinos to play with which cost about $200 in total in addition to whatever electrical components that I needed. That was 2 months ago. Then now, I was given a collection of Arduinos and a couple of shields worth more than $1000 to play with!! I pretty enjoyed playing with Arduinos but..when I checked one of the board that was bought for me (Or to be exact, I wanted to play with it) which was called 'BLE Mini', I think I am having a bad dream perhaps. It was purely C and programming it is 100% more difficult than playing with Arduinos.
Just so that we are on the same channel, Arduino is not difficult. 'BLE Mini' is a nightmare!! It is like I might even become a firmware engineer if I play with 'BLE Mini' too long. Wait a second.. It is not that I am scared of being a firmware engineer, I am just afraid of programming the Mini!
To get the matter even more exciting, I started my part-time degree in January 2014. Only god knows how crazy it is to juggle between work and studies. Trust me, it is something that you cannot understand neither can you comprehend the challenges unless if you have been in the same shoe before. :)
Well, I guess that's all for today. I was writing this while waiting to download all the SDKs and tools required for Android development. Now, back to Android! :)
Tuesday, May 14, 2013
Sunday, March 31, 2013
Lambda Expression Only Available With -std=c++0x or -std=gnu++0x
I was revising my C++ programming based on a book that I borrowed from a library titled, "Sams Teach Yourself C++ in One Hour a Day", written by Siddhartha Rao. The book is good. Its pact with tons of examples. But its proofreading is not so good. So, if your programming is not bad, you should be able to spot the mistakes when you read through. The downside to this book is that it does not mention the solution that we have to configure if certain examples does not work. for example, it makes quite a difference to,
Ok, I think I have drifted away. Let's get back on the track. So, today, while I am trying out the lambda function, I came across this error, "Lambda Expression Only Available With -std=c++0x or -std=gnu++0x".
I googled for quite sometime. Most of the answers are for those who are familiar with their IDE. They keep on saying add the command line to your compiler. I looked at my compiler setting, I scratched my head.
After searching and thinking for awhile. I opened up my compiler setting again for the second time. This time, I read carefully, then I saw something and I ticked it as shown below:
Sunday, November 6, 2011
AutoIt for automation
Its time for me to write an automation script or say some automation tutorial before the release of my ebook to the public.
I need to complete this thing by next week. I will start doing in on next Friday IF I am home.
Before I lose focus, I shall include the link to the automation programming language below.
Here you go!
Well, I have to say that I've never used this language before. But I know I will be able to grasp it in a matter of time. Hope that I will be able to learn it by next Friday.
Till then.
Sunday, August 15, 2010
Savings Calculator
Ok, so basically.. I've completed this application about 2 or 3 weeks ago.
We were expected to complete some sort of desired application within 1 month approximately.
To desing your own application is a headache man especially if you have no idea on what are you going to create.. and that situation happens to me.. It took me about 1 or 2 weeks to generate an idea before the assignment started.
How did I get the application idea?
Ok, so basically I was having this final module in my business certificate which is Finance. There was a topic which I find it difficult to understand. So, I put some effort in understanding the first half of the topic. Then, I decided to create an application using some concepts that managed to go through my mind.
So, what is this application about?
This is a very simple application which help you to calculate how much money will there be in your savings assuming you just keep it there for a number of periods.
It also tell you how much you need to deposit into your savings account based on your financial target.
Next, it also does calculate how much you'll have in your account if you did deposit regularly at a specific timing, say at every beginning of the month.
Oh, by the way, after I completed this application. I did study the rest of this topic and I realized that my application is not that good after all. There are still some concepts that I can add in in this application. But, I did not have time to modify it and add more features as I was having tons of deadlines. here are the projects that I need to submit: (all of them more or less on the same deadline)
1. Finance presentation.
2. Advanced Programming Lab Tes.
3. Microprocessor System and Programming Lab Test.
4. OOP application submission.
5. Final Year Project ~ (Continuous)
Here are the screenshots of the project in making as well as the final product:
Savings Calculator Version 1.0

version 3.0 interface demo
Future Plan:
1. improve this application and make it portable. (web application/android app)
2. create more application based on finance concepts that I have studied for exam
3. Create application for Android
4. Expecting starting date: March 2011
Some demo clip below:
Sunday, August 23, 2009
Tic Tac Toe Artificial Intelligence
It is mainly consist of if-else condition and it is not that relieable. If I were given a 2nd chance, I'll write a better AI codes that this one such as using switch/map/binary tree/etc .
If you are a student searching for an AI reference, I strongly recommend you to use your own creativity and understanding and please dont copy mine 100% . Because by copying my codes,
you'll not be able to gain the satisfaction feeling after you have comlpeted the codes.
Oh , one more thing! my AI is only about 70% intelligent I guess . I ensure you that you can't beat my AI if you are the 2nd player . Enjoy!
//-------AI codes begin ..............
if( (board[0]==human)&&(board[1]==human)&&(board[2]=='c') ) // blocks human moves 0 , 1 , 2 { move = 2 ; cout << "c" << endl ; return move ; } if( (board[0]==human)&&(board[2]==human)&&(board[1]=='b') ) // blocks human moves { move = 1 ; cout << "b" << endl ; return move ; } if( (board[2]==human)&&(board[1]==human)&&(board[0]=='a') ) // blocks human moves { move = 0 ; cout << "a" << endl ; return move ; }
if( (board[3]==human)&&(board[4]==human)&&(board[5]=='f') ) // blocks human moves 3 , 4 , 5 { move = 5 ; cout << "f" << endl ; return move ; }
if( (board[4]==human)&&(board[5]==human)&&(board[3]=='d') ) // blocks human moves { move = 3 ; cout << "d" << endl ; return move ; }
if( (board[6]==human)&&(board[7]==human)&&(board[8]=='i') ) // blocks human moves 6 , 7 , 8 { move = 8 ; cout << "i" << endl ; return move ; } if( (board[8]==human)&&(board[6]==human)&&(board[7]=='h') ) // blocks human moves { move = 7 ; cout << "h" << endl ; return move ; } if( (board[8]==human)&&(board[7]==human)&&(board[6]=='g') ) // blocks human moves { move = 6 ; cout << "g" << endl ; return move ; }
if( (board[0]==human)&&(board[3]==human)&&(board[6]=='g') ) // blocks human moves 0 , 3 , 6 { move = 6 ; cout << "g" << endl ; return move ; } if( (board[6]==human)&&(board[3]==human)&&(board[0]=='a') ) // blocks human moves { move = 0 ; cout << "a" << endl ; return move ; } if( (board[6]==human)&&(board[0]==human)&&(board[3]=='d') ) // blocks human moves { move = 3 ; cout << "d" << endl ; return move ; }
if( (board[1]==human)&&(board[4]==human)&&(board[7]=='h') ) // blocks human moves 1 , 4 , 7 { move = 7 ; cout << "h" << endl ; return move ; }
if( (board[4]==human)&&(board[7]==human)&&(board[1]=='b') ) // blocks human moves { move = 1 ; cout << "b" << endl ; return move ; }
if( (board[2]==human)&&(board[5]==human)&&(board[8]=='i') ) // blocks human moves 2 , 5 , 8 { move = 8 ; cout << "i" << endl ; return move ; } if( (board[8]==human)&&(board[2]==human)&&(board[5]=='f') ) // blocks human moves { move = 5 ; cout << "f" << endl ; return move ; } if( (board[5]==human)&&(board[8]==human)&&(board[2]=='c') ) // blocks human moves { move = 2 ; cout << "c" << endl ; return move ; }
if( (board[2]==human)&&(board[4]==human)&&(board[6]=='g') ) // blocks human moves 2 , 4 , 6 { move = 6 ; cout << "g" << endl ; return move ; }
if( (board[4]==human)&&(board[6]==human)&&(board[2]=='c') ) // blocks human moves { move = 2 ; cout << "c" << endl ; return move ; }
if(board[4] == 'e') { move = 4 ; cout << " e " << endl ; return move ; } if(board[0]=='a') { move = 0 ; cout << " a " << endl ; return move ; } if(board[2]=='c') { move = 2 ; cout << " c " << endl ; return move ; } if(board[6]=='f') { move = 6 ; cout << " g " << endl ; return move ; } if(board[8]=='i') { move = 8 ; cout << " i " << endl ; return move ; } if(board[1]=='b') { move = 1 ; cout << " b " << endl ; return move ; } if(board[3]=='d') { move = 3 ; cout << " d " << endl ; return move ; } if(board[5]=='f') { move = 5 ; cout << " f " << endl ; return move ; } if(board[7]=='h') { move = 7 ; cout << " h " << endl ; return move ; }
Wednesday, August 5, 2009
Tic Tac Toe Source
//===========codes starts here=======
#include
#include
#include
using namespace std;
char X = 'X' ;
char O = 'O' ;
char EMPTY = ' ' ;
char TIE = 'T' ;
char NO_ONE = 'N' ;
char playAgain ;
void instructions() ; //display instructions //
char askYesNo(string question) ; //ask whether you want to go 1st
char humanPiece() ; //determine human piece . returns 'x' / 'o' //
char opponent(char piece) ; //returns 'x'/'o' based on the previous choice //
void displayBoard(const vector
int computerMove(vector
int isLegal(const vector
char winningCondition(vector
int main()
{
do
{
bool TrueFalse ;
char move , a ;
//int NUM_SQUARES = 9 ;
char alpha[] = { 'a','b','c','d','e','f','g','h','i' } ;
vector
int size = board.size() ;
vector
instructions() ; //
char human = humanPiece() ; //
char computer = opponent(human) ; //
char turn = X ;
displayBoard(board) ; //
char winner = NO_ONE ;
int legal = 0 ;
char check ;
int index ;
while(winner == NO_ONE ) //
{
if(turn == human)
{
do
{
cout << "Please enter an alphabet to choose that move : " ;
cin >> move ;
it = find(board.begin(), board.end(), move); //
index = it-board.begin() ; //replace it with this //
//cout << index ;
//cout << it ;
//cout << *it ;
legal = isLegal(board , index) ; // it replaced with index //
if(legal == 0)
{
cout << "invalid move , please enter the correct alphabet! " << endl ;
}
else
{
cout << "That move is valid" << endl ;
}
}while(legal != 1 ) ;
if(move == 'a') //
{
board.erase(board.begin()) ;
board.insert(board.begin() , 1 , human) ;
}
if(move == 'b') //
{
board.erase(board.begin()+1) ;
board.insert(board.begin()+1 , 1 , human) ;
}
if(move == 'c') //
{
board.erase(board.begin()+2) ;
board.insert(board.begin()+2 , 1 , human) ;
}
if(move == 'd') //
{
board.erase(board.begin()+3) ;
board.insert(board.begin()+3 , 1 , human) ;
}
if(move == 'e') //
{
board.erase(board.begin()+4) ;
board.insert(board.begin()+4 , 1 , human) ;
}
if(move == 'f') //
{
board.erase(board.begin()+5) ;
board.insert(board.begin()+5 , 1 , human) ;
}
if(move == 'g') //
{
board.erase(board.begin()+6) ;
board.insert(board.begin()+6 , 1 , human) ;
}
if(move == 'h') //
{
board.erase(board.begin()+7) ;
board.insert(board.begin()+7 , 1 , human) ;
}
if(move == 'i') //
{
board.erase(board.begin()+8) ;
board.insert(board.begin()+8 , 1 , human) ;
}
}
else
{
int ComMove = computerMove(board) ;
board.erase(board.begin()+ComMove) ;
board.insert(board.begin()+ComMove , 1 , computer) ;
}
displayBoard(board) ; //
turn = opponent(turn) ; //
check = winningCondition(board) ; //
//cout << "check is : " << check ;
//cout << "winner is : " << winner ;
winner = check ;
//cout << "winner is : " << winner ;
}
if((winner=='w') && (human == X)) // X condition for human
{
cout << "Congratulation human! you have won ... I'll defeat you next time!" << endl ;
}
if((winner=='w') && (computer==X)) //X for computer condition
{
cout << "I have defeated you human ... Is that all you got?! " << endl ;
}
if((winner=='c') && (human==O)) // O's condition for human
{
cout << "Congratulation human! you have won ... I'll defeat you next time!" << endl ;
}
if((winner=='c') && (computer==O))
{
cout << "I have defeated you human ... Is that all you got?! " << endl ;
}
if(winner == TIE)
{
cout << "Seems that our skills are equal .. Hence , its a draw! " << endl ;
}
cout << " do you want to play again ?
cin >> playAgain ;
}while(playAgain == 'y') ;
return 0;
}
void instructions()
{
cout << "Welcome to the Tic Tac Toe game." << endl ;
cout << "You will be playing against the Computer (Com)." << endl ;
cout << "You need to make your move by entering character a-i" << endl ;
cout << "The number corresponds to the desired board postion as shown" << endl ;
cout << " a | b | c " << endl ;
cout << " --------- " << endl ;
cout << " d | e | f " << endl ;
cout << " --------- " << endl ;
cout << " g | h | i " << endl ;
cout << "Now, prepare yourself! The game is about to begin.." << endl<
char askYesNo(string question)
{
char response ;
do
{
cout << question << " Yes (y) / No (n) : " << endl ;
cin >> response ;
}
while (response!='y' && response !='n') ;
return response ;
}
/*int askNumber(string question , int high , int low)
{
int number ;
do
{
cout << question << " (" << low << " - " << high << ") : " ;
cin >> number ;
}while(number>high || number
return number ;
}*/
char humanPiece()
{
char go_first = askYesNo("Do you want to move first ? ") ;
if(go_first == 'y')
{
cout << "Then , take the 1st move ! You'll be using X as your character piece" << endl ;
return X ;
}
else
{
cout << "Then, I'll go first" << endl ;
return O ;
}
}
char opponent(char piece)
{
if(piece == O)
return X ;
else
return O ;
}
void displayBoard(const vector
{
cout << board[0] << " | " << board[1] << " | " << board[2] << endl ;
cout << "---------" << endl ;
cout << board[3] << " | " << board[4] << " | " << board[5] << endl ;
cout << "---------" << endl ;
cout << board[6] << " | " << board[7] << " | " << board[8] << endl ;
cout << endl ;
}
int isLegal(const vector
{
//if((board[index]==X)&&(board[index]==O)) //('a'||'b'||'c'||'d'||'e'||'f'||'g'||'h'||'i'))
if(board[index] == 'a')
{
return 1 ;
}
if(board[index] == 'b')
{
return 1 ;
}
if(board[index] == 'c')
{
return 1 ;
}
if(board[index] == 'd')
{
return 1 ;
}
if(board[index] == 'e')
{
return 1 ;
}
if(board[index] == 'f')
{
return 1 ;
}
if(board[index] == 'g')
{
return 1 ;
}
if(board[index] == 'h')
{
return 1 ;
}
if(board[index] == 'i')
{
return 1 ;
}
else
{
return 0 ;
}
}
/*bool isLegal(int move , const vector
{
return (board[move] != (X||O)) ;
}*/
int computerMove(vector
{
int move ;
cout << "I shall take " ;
//if no one can win
if(board[4] == 'e')
{
move = 4 ;
cout << " e " << endl ;
return move ;
}
if(board[2] == 'c')
{
move = 2 ;
cout << " c " << endl ;
return move ;
}
if(board[6] == 'g')
{
move = 6 ;
cout << " g " << endl ;
return move ;
}
if(board[8] == 'i')
{
move = 8 ;
cout << " c " << endl ;
return move ;
}
if(board[3] == 'd')
{
move = 3 ;
cout << " d " << endl ;
return move ;
}
if(board[4] == 'a')
{
move = 4 ;
cout << " a " << endl ;
return move ;
}
if(board[5] == 'f')
{
move = 5 ;
cout << " f " << endl ;
return move ;
}
if(board[1] == 'b')
{
move = 1 ;
cout << " b " << endl ;
return move ;
}
if(board[7] == 'h')
{
move = 7 ;
cout << " h " << endl ;
return move ;
}
}
char winningCondition(vector
{
if((board[0]==X)&&(board[1]==X)&&(board[2]==X))
{
return 'w' ; //someone has won
}
if((board[3]==X)&&(board[4]==X)&&(board[5]==X))
{
return 'w' ;
}
if((board[6]==X)&&(board[7]==X)&&(board[8]==X))
{
return 'w' ;
}
if((board[0]==X)&&(board[3]==X)&&(board[6]==X))
{
return 'w' ;
}
if((board[1]==X)&&(board[4]==X)&&(board[7]==X))
{
return 'w' ;
}
if((board[2]==X)&&(board[5]==X)&&(board[8]==X))
{
return 'w' ;
}
if((board[2]==X)&&(board[4]==X)&&(board[6]==X))
{
return 'w' ;
}
if((board[0]==X)&&(board[4]==X)&&(board[8]==X))
{
return 'w' ;
}
//O's winning condition return 2
if((board[0]==O)&&(board[1]==O)&&(board[2]==O))
{
return 'c' ; //O's user has won
}
if((board[3]==O)&&(board[4]==O)&&(board[5]==O))
{
return 'c' ;
}
if((board[6]==O)&&(board[7]==O)&&(board[8]==O))
{
return 'c' ;
}
if((board[0]==O)&&(board[3]==O)&&(board[6]==O))
{
return 'c' ;
}
if((board[1]==O)&&(board[4]==O)&&(board[7]==O))
{
return 'c' ;
}
if((board[2]==O)&&(board[5]==O)&&(board[8]==O))
{
return 'c' ;
}
if((board[2]==O)&&(board[4]==O)&&(board[6]==O))
{
return 'c' ;
}
if((board[0]==O)&&(board[4]==O)&&(board[8]==O))
{
return 'c' ;
}
//if( (board[0]==(X&&O)) , (board[1]==(X&&O)) , (board[2]==(X&&O)) , (board[3]==(X&&O)) , (board[4]==(X&&O)) , (board[5]==(X&&O)) , (board[6]==(X&&O)) , (board[7]==(X&&O)) , (board[8]==(X&&O)) )
//if(board[0],board[1],board[2],board[3],board[4],board[5],board[6],board[7],board[8]==(X||O))
if( ((board[0]==X)||(board[0]==O)) && ((board[1]==X)||(board[1]==O)) && ((board[2]==X)||board[2]==O) && ((board[3]==X)||(board[3]==O)) && ((board[4]==X)||(board[4]==O)) && ((board[5]==X)||(board[5]==O)) && ((board[6]==X)||(board[6]==O)) && ((board[7]==X)||(board[7]==O)) && ((board[8]==X)||(board[8]==O)) )
{
return TIE ;
}
else
{
return NO_ONE ; // indicate no one has won
}
}








