Thursday, June 23, 2005

Online Game for Cell phones

By: Zemog Xilef Sevet

I attended a training about Game Development last May 23, 2005. On the third day, we were given an assignment to present our idea on games for the cell phones. We were asked to give our own game models. I was able to come up with three titles but my mind was so occupied that I was not able to fully conceptualize it.

Then today, something popped into my mind as I sit behind my desk. Maybe SMS center like Smart and Globe will consider this idea.


What is the idea?

They will promote an online game that will require two players. The idea here is that two players will log in. Or a player will just see who is logged in and send an invitation to that player (same concept with yahoo games).

What is the focus?

The focus is actually more on money generation for the centers. Each player will agree that whoever will lose on the game will be the one to be charged for the text payments.

How will it work?

Players will play by “sending commands” considered to be text messages (could be P 1.00 per move if we are talking about chess game). The game will continue until 1 player will quit or lose. Each “command” will be saved and counted. At the end game, whoever will lose or quit, his or her load will be deducted according the number of commands sent by both parties.

Conclusion

This idea just came up on my mind. There is no guarantee of any feasibility on this matter.

“Smart people make things great” 

Monday, June 20, 2005

Chain Emails and SMS

By: Zemog Xilef Sevet

This article is not meant for people who forward chain emails but to those who started it.

Sometimes we receive a forwarded email in our inbox that has a line “Pass this to everyone or else you will have bad luck”. Emails like this is what we called chain emails. This is also done in SMS.

Messages like this oftentimes have religious contents which will catch the attention of every reader and in a way “obey” to the sender by forwarding it to his/her friends.

Some people also like to start a chain merely because they think it’s harmless and its “cool” knowing how far your mail would go without knowing the real implications. Next time you hit the forward and send button please consider the following.

Technological Implication

Laymen may not know this but a bulk of unnecessary and redundant messages has great effect on the storage of emails. It will consume a large amount of space. It can also clog a network. Imagine a single person with 20 friends and each friend has 20 other friends, so on and so forth. Just imagine how many emails around the world will go to and fro the network. There are also instances wherein you can no longer receive emails because your inbox is full.

Social Implication

Contents of the chain email maybe amusing to some but not to others. Some people feel irritated, annoyed and harassed because of the implied threat contained in the email just like the example above. While some may just shrug it off, others can not.

What to do

I am not against the content of the email (unless it is negative) but the way we send the email. We should be responsible enough in sending it like getting only the part that you want to share and omit the line that will oblige the reader to send it to other people. Let them decide without any force. You may also tell the sender to be responsible enough in sending emails and ask not to do it again.

Using the words of God to do evil things

This doesn’t mean we are judging the writer of the chain email but the way things have been done sometimes suggest us to drive into conclusion that what he is up to is bad. Why would a person send a letter with a rebukable obligation that promises ill effects if you will not pass it? This is completely a reverse of what God wants us to do. Readers, you know what you are reading. Do not let fear or superstitions pollute your mind. Who among us has the right to cast bad luck to people? Unfortunately we can not read the mind of the composer. All we can do is draw a hypothetical conclusion about it.


This is an original article with reference to:
http://www.umich.edu/~policies/chain-mail.html
http://www.kith.org/logos/things/chain.html

Friday, June 17, 2005

Using Flash Drives

By Zemog Xilef Sevet

Flash Drives are in today especially to IT Professionals. Flash drive is a small, portable flash memory card that plugs into a computer’s USB port and functions as a portable hard drive with up to 2GB of storage capacity. It is very easy to use.
It is more durable than external drives since it does not contain internal moving parts. USB flash drives also are called pen drives, key drives or simply USB drives. http://www.webopedia.com/TERM/U/USB_flash_drive.html

I would like to share with you how useful these drives are to me. As a freelance programmer, I devout a lot of my spare time in making my client’s program. Although I have a laptop I could carry anywhere I go, it is not so convenient especially for a long travel. I sometimes work with my program in my office. After office hours I will have transfer it to a hard disk for me to continue the program at home. This is not a good idea since hard disk is vulnerable. If you drop your HD, there is a big chance it will not work anymore. This is where flash drives come into the picture. It has enough capacity to store my program. It is very light and it can be ported anywhere. All you have to do is to put it in your pocket or lace it on your neck.

What about CDs or floppy drives? Well, CDROMS and CD writers are not so common in computers compared to USB ports. Another thing is that you can add, save, update delete data in flash drives, unlike CDs that it is not that flexible. Apparently, floppy disks are out of the picture if we are talking about large storage media and data protection.

However, some operating system does not support plug and play on flash drives, like Win98 series, NT and early Linux distros. But it is ok if you bring with you the driver. In my opinion, it is still best to have flash drives around.

Thing to ponder:

There is no flash drive yet that could be detected in any OS (specially the old versions), so what I’m thinking is, can we make one? Hmm.. sounds a good thing huh! Bye.

Thursday, June 16, 2005

Why Do You Need To Partition Your Hard Disk?

By Zemog Xilef Sevet

This article does not talk about the technical side of why we need to partition our hard disk rather this is intended to help the person realize that there is a need to do so whether you are a technical person or not.

This is based on my personal experience. Partitioning your hard disk will save you a lot of time, money and headache!

Partition your hard disk in such a way that your operating system and data files can be separated housed separately.

In the event that a virus will attack your PC and corrupt your operating system, what you can do is to format your disk and start with a fresh install or you can download anti-virus but it’s not a guarantee especially if the virus is new. You need to copy your data files if you didn’t partition your hard disk before formatting it.

Now, how much time will it take you to copy all the files if you have, say 40GB of data? Can you assure yourself that you have copied all the necessary files? How about your favorite links from websites? How about your hidden/secret files? You need to be sure that everything is copied before you proceed. What about the need of another hard disk to temporarily save your files? It’s quite a headache actually.

Now, if you have partitioned your hard disk, you will only format the part where the OS resides. No transferring of files! No headache!

So next time, take this as an advice. Partition your hard disk.

What’s The Gender of the Computer?

By Zemog Xilef Sevet

Computer and human beings have something in common. The latter has blood that runs in a vessel called veins that carries it to the heart. Computers also have blood called current that runs in a vessel called wires that carries it to and fro the heart, power supply. If humans don’t have a brain, he/she can not work, communicate or synchronized everything within his/her system. Same with computers, if it doesn’t have a CPU, it can not work, communicate or synchronized its accessories.

Human needs scratch pads or paper for him to store anything because his brain can not consume everything. Computer uses memories to store big files every time it processes since the registers are not big enough to store everything. We also need writing materials just like computers that need a printer to express what is on its mind.

Human beings has gender, whether male or female, what about computers? Computer is a she! Why? Because she is moody. Through experience, computers are very moody when you fix her. Why? I do not know! Sometimes when you fix a computer it will take you until midnight to fix her and still you can’t understand why she will not work until you decide to sleep. The next day, you turned it on, do some settings and it will work! What a mess of time . Just like females, sometimes you don’t understand why she’s like that.

So my conclusion is… Computer is a female.

How to make and access your own “.h” file in C++

As a programmer, there are times wherein you will have to use a template. Templates are usually used whenever you have projects that have some common segments within it. Others would just copy and paste some of these lines to the other programs. But there is a quicker way on how to minimize your time at work. This can be done through user-defined files.

In C++, you can make your own files “.h” like the standard files in #include directive. This article presents how to make and access your own “.h” file.

How to make the user-defined file

#include “iostream.h”
#include “conio.h”

void clr(void)
{
clrscr();
cout<<”This is an example of a program using a user-defined file\n”;
}

Then save this program as “sample.h”. Do not run this program has an error. The error in this program is not significant and you do not have to worry about. As you notice there is no main function. That’s the cause of error. If there is another cause of error then you have to fix it.

Make a program and link the file.

#include “iostream.h”
#include “conio.h”
#include “sample.h”

main()
{
clr();
cout<<”Hello World”;
getch();
return 0;
}

Run the above program.

Let’s take a look at the program

There are 3 links in there. You noticed I also used quotations instead of the angle bracket. C++ gives that option.

Clr() is not a built-in function in C++ but since you have defined it in your sample.h file, there is nothing to worry about. What C++ will during compilation is that it will look for the definition of clr() in sample.h file when it can not locate it in conio.h and iostream.h

User-defined files can make your program more personalized. What I mean is that you can use your name or any words as a function name like in clr. I can replace the clr in the file and in the program to Gomez and run the program!

Tuesday, June 14, 2005

Cash dispenser using G-Cash

Abstract

This project will involve a cash dispenser of different bills. The cash dispenser can be ported anywhere. This will be powered by a 220 VAC or a battery. The essence of having this equipment is to encash your G-cash. All a person will do is to send a G-cash load to a certain number and an amount will be dispensed equal to the load.

As an income generating project, the dispenser will deduct a certain amount of money or percentage whichever is higher.
This project has no feasibility study as of this moment and I can not guarantee that people will support/receive this innovation openhandedly.

Monday, June 13, 2005

Sample Program Using Structures in C++

This is just a simple program illustrating how to use structures, user-defined functions, string functions and switch.

This program is an example to be given to the participants in Pagadian where I will give training on C++ Programming.

#include
#include
#include

struct record
{
char name[200];
int age;
char address[200];
} rec[10];

void add()
{
clrscr();
cout<<"Adding Record\n\n";
for (int num=1;num<=3;num++)
{
cout<<"Enter Name No."< cin>>rec[num-1].name;
cout<<"Enter his/her age: ";
cin>>rec[num-1].age;
cout<<"Enter his/her address: ";
cin>>rec[num-1].address;
}
return;
}
void modify()
{
int y, element;

clrscr();
cout<<"Modify Menu\n\n\n";
cout<<"What record number do you want to modify? ";
cin>>y;
cout<<"\nThe record contains\n\n";
cout<<"Element\t\tData\n";
cout<<"1\t\tName:\t"< cout<<"2\t\tAge:\t"< cout<<"3\t\tAddress:\t"< cout<<"\nWhat element do you like to modify? ";
cin>>element;
switch(element)
{
case 1: cout<<"\n\nNew name:\t";
cin>>rec[y-1].name;
cout<<"\nUpdate successful!";
break;
case 2: cout<<"\n\nNew age:\t";
cin>>rec[y-1].age;
cout<<"\nUpdate successful!";
break;
case 3: cout<<"\n\nNew Address:\t";
cin>>rec[y-1].address;
cout<<"\nUpdate successful!";
break;
default:cout<<"\nNo such element number!";

}
getch();
}
void del()
{
int y;

clrscr();
cout<<"Delete Menu\n\n\n";
cout<<"What record number do you want to delete? ";
cin>>y;
strcpy(rec[y-1].name," ");
rec[y-1].age = 0;
strcpy(rec[y-1].address," ");
}
void display()
{
clrscr();
cout<<"Display Menu\n\n\n";
cout<<"NAME\t\t\tAGE\t\t\tADDRESS\n\n";
for (int x=1;x<=3;x++)
{
if (strcmp(rec[x-1].name," ") != 0 && rec[x-1].age != 0)
cout< }
getch();
}
main()
{
char option;

clrscr();
while (option != 'e')
{
clrscr();
cout<<"MENU\n\n";
cout<<"a. Add\n";
cout<<"b. Modify\n";
cout<<"c. Delete\n";
cout<<"d. Display\n";
cout<<"e. Exit\n";
cout<<"Please enter your choice: ";
cin>>option;
switch (option)
{
case 'a': add();break;
case 'b': modify();break;
case 'c': del();break;
case 'd': display();break;
case 'e': break;
default: cout<<"Invalid selection";
}
}
getch();
return 0;
}

Wednesday, June 08, 2005

Greater Position, Greater Responsibility

When our president appointed me as the Dean of College here in our institution I was aware of the big responsibilities I need to tackle everyday. One day, my friend asked me why he can not get a good position in their office. Then I remember a story I read when I was in grade school. The story involves the owner and the employee. One day, the boy (employee) approached his superior and asked, “Sir, why didn’t you hire me as a supervisor and instead you hired somebody else? And why am I receiving small wage where in fact I work a lot than our new supervisor?”

In a distant, the owner saw a truck full of load. He told the boy, “Go and ask the driver of the truck where he is going.” So the boy approached the driver and asks. He then returned and said the driver is going to a nearby barangay to deliver the load. Then the owner said “Ask the driver what is in that truck”. The boy came back with a reply “The truck is full of sack of rice”. Then the owner told him to ask how many sack of rice.

The boy goes back and forth asking and relaying the answer to his boss until he was exhausted then the owner called his new supervisor. He said, “Kindly ask the driver where he is going.” The supervisor obligingly does as he was told. He then came back to report, “Sir, the driver is going to deliver 20 sacks of rice to a nearby barangay. He is from a town 25 kilometers from here. The sack of rice will be delivered to a certain Mr. Wong who is a businessman engaged in rice buy and sell. He stops for a while to fix an engine trouble. That’s all sir.”

The owner turned to the boy and said, “Now you see why I hired him as a supervisor. In addition to that, you may not see him working or see him just writing a report but the task should not be counted as to how much it literally weights. You are maybe carrying sacks of rice everyday while he is only holding a pen. The weight that is considered here is the responsibility. You are maybe responsible in stacking sacks of rice but your supervisor has more responsibility because he is also answerable for your actions and the things that may happen to you while your working.

Tuesday, June 07, 2005

PHP Code: Get the difference between two dates

The program consist of two files. The first file can be named according to what you like as long as you will have an extension of .php and the other file is named display.php.

The first file's task is to get the date (two dates) from the user. It has textboxes and a submit button. After clicking the submit button, display.php will be called and PHP compiler will parse the file taking only the "php part". PHP is just similar to C++ in terms of syntax. Method post is being used here for the first file. Here are the codes of the two files:

FILE 1:

< html >
< head >
head
body
< form action="display.php" method="post" >
//Starting Date
//Month:
//Day:
//Year:




Ending Date




//Month:
//Day:
//Year:




//




*Formating: Month and Day should be in numbers without
leading zero.
< /body >
< /html >

FILE 2:

< html >
< body >

$month1=$_POST[mo1];
$day1=$_POST[da1];
$year1=$_POST[ye1];

$month2=$_POST[mo2];
$day2=$_POST[da2];
$year2=$_POST[ye2];

$numdays = 0;
$initial = $month1;
$final = 12;

for ($count = $year1; $count <= $year2; $count++)
{
if ($count == $year2)
$final = $month2 - 1;
else
$final = 12;
for ($x = $initial; $x <= $final; $x++)
{
switch ($x)
{
case 1: $daycount = 31;
break;
case 2: if ($year1%4 == 0)
$daycount = 28;
else
$daycount = 29;
break;
case 3: $daycount = 31;
break;
case 4: $daycount = 30;
break;
case 5: $daycount = 31;
break;
case 6: $daycount = 30;
break;
case 7: $daycount = 31;
break;
case 8: $daycount = 31;
break;
case 9: $daycount = 30;
break;
case 10: $daycount = 31;
break;
case 11: $daycount = 30;
break;
case 12: $daycount = 31;
break;
default: echo "No such month";
}
$numdays = $numdays + $daycount;
}
$initial = 1;
//echo $numdays;
//echo " ";
}

$realnumberofdays = $numdays - $day1 + $day2 + 1;

echo "There is/are ";
echo $realnumberofdays;
echo " number of day(s) in a given date"

?>
< /body >
< /html >

In file 2 (display.php), the logic is quite simple. There are two loops here. I used for loop since for me its more readable.

The inner loop dictates the month where you will get your number of days. The outer loop dictates the year, from the initial year up to the final year.

You should also take careful observation to the inputted initial and final dates (month and year to be specific)

In the program, I first assume the initial month will carry its first day. Say, instead of Feb. 3 as the input, I initialized it to Feb. 1 but of course taking into consideration the 3 days.

In the final date, I also take into consideration the month and the date. In the FOR loop, if you notice there is a $final = $month2 - 1 when the year is the final year. Why is this so? For example if your final date is December 23, we will not include the december in the loop but taking into account the 23 days.

So if we will have the dates like Feb 3, 1999 - Dec. 23, 2000, the loop will considere Feb 1, 1999 - Nov. 30, 2000 then add the 3 days in february plus the 23 days in december. Of course we will have to take into consideration the leap year as you can see in the program.

In the last formula, I have plus 1 since if we have Jan 27, 1976 - Jan 27, 1976 (the same date) it is considered one day.

If you like to consider it zero (0) day, just take "plus 1" out.

Lastly, this program is not equipped with all the validations since I know you are an intelligent user. :)

NB: This is posted as a claim for originality.

Monday, June 06, 2005

C and C++, what’s the difference?

Both C and C++ are developed by people at Bell Labs. The latter is a general purpose programming language that incorporates almost all of the capabilities of C but adds a lot of capabilities making it more powerful and flexible programming language nowadays.

C++ includes Object Oriented Programming (OOP) technique by introducing classes. But because of the existence of a lot of OOPrograms nowadays, we could not feel C++ in the programming world. The reason is, C++ is a “hard-code” PL where people sometimes neglect apparently because it is time-consuming to code and debug in this language.

C++ is considered as a system PL rather than an application PL. There is a big difference between system and application as we all knew it. Do you know that Microsoft Windows and its Applications, Linux and other operating systems are coded in C/C++? Well, it’s true. Try to download the codes of Linux in the internet and view the codes, you could see 6 million+ lines of codes in C/C++. Now, you could see how powerful C++ really is.

This blog is devoted to all people who knew C and want to learn about C++ and use it as a basic tool in solving basic problems in computing. To begin with, may I introduce to you the twin. COUT and CIN. Practically, they are just the same as printf and scanf in C, respectively. COUT and CIN are two basic commands used by the computer and user in interacting. Consider the program below:

#include
main()
{
int age;

cout<<”\nEnter your age: “;
cin>>age;
}

There are two things new to you here. The use of the twin and the header file iostream.h. Like C, we need header files for the definition of some commands, in this example, cout and cin. The two commands are defined under the iostream.h file. If you like you can open the file and read it. It is usually located in the INCLUDE folder inside TC.

Try to encode the example above in a C++ editor, and compile it using the menu COMPILE or using shortcuts. Then RUN it.


IMPORTANT:

Sometimes an error will prompt when running a program. Sometimes you have to set something in a newly copied C++ compiler. Just like C or Pascal, you have to go to the DIRECTORIES that is found in OPTIONS menu. Be sure that the INCLUDE and LIBRARY Directory are set in the right path.

Another thing to consider is the TCDEF file that is sometimes set as read-only. This should not be a read-only file. So just change the property.

These two things are very typical errors encountered by students/instructors during the first day of their class.

Consider adding the segment below to our first program.

If (age < 18)
cout<<”\You are not allowed to drink alcoholic beverage yet”;
else
cout<<”\You are allowed to drink alcoholic beverage”;

In the above segment, I want you to focus your attention to the semicolon right before the word “else”

Sunday, June 05, 2005

Don’t be Judgmental

I was in a van going to Tacloban from Ormoc and I was reading a newspaper (as I always do to keep myself busy). I was struck by a column of a certain priest (I forgot the name). Anyway, as I’ve said I was struck by his column about being judgmental.

I was in deep reflection about the story he wrote:

Once there was a man and his faithful dog. One day, the man was out hunting for food while he left his son in a crib and the dog watching over his child. On the way home, he was met by his dog full of blood and with some meat on his mouth. Without anything being said, he drags his dog and raises a knife for the kill. After killing the dog, he ran to his house and found his child in deep sleep and beside him lays the big snake which obviously was killed by his faithful dog.

If not of his being quick on judging the dog, he will not regret what he’d done.

Sad to say a lot of people are like that. They usually think they are always right. They tend to neglect the emotions of other people and judge them according to what they think is right. We should put it in mind that only God has the right to judge a person. It is not our right to do so. But there is a great job, every Christian is ought to do to their brothers and sisters. To help each one of us change and live the Christian life God wants us to do.

Amen.