Sunday, May 18, 2008
Trick to track the argument in console
FEATURE LIST:
- Search path. This feature allows dynamically to search the desired path
- List. This is to show out the search result.
- Output. Export search result to text file.
The first two already done. Third feature still in progress.
During this experience project, I found a very interesting issue. How to track the input passing in through the command line? Lets take a look:
void main(int argc, char *argv[], char *envp[])
Initially I was using argc to track how many command was passing in. This is not really a good method of doing this because when passing in more and more options, it duplicate the same task. Refer to the code below:
switch(argc)
{
case 1: // no option was pass in
break;
case 2: // 1st option was pass in
break;
case 3: // 1st and 2nd option was pass in
break;
...
...
case n: // until n number of option was pass in
break;
}
Anyhow I have overcome this issue by tracking down the number of command passing in by using the argv pointer array. If argv[1] is empty, definitely I know that option number 1 is not there. Otherwise there must be an option passing in. For doing that, I just need a while loop to track every element in argv. But how do I know how many option was passing in? By using NULL checker? Actually I was using argc to get the total element in argv. I get this inspiration from MSDN.
Sunday, May 4, 2008
My first day in C++ .Net.
The first application that adopts this technology is my search file console program. The objective of this program is to retrieve all the files by searching through the particular location (including the remote media and network media).
This is not an error I guess, it just unable to retrieve the debug information. I do not know how to solve this problem, if you read this post and have any suggestion on this, do let me know. Thus I have to recreate the project by choosing “Win32 Console Application” under the Win32 category.
Now, the primary keys to deal with Files are DirectoryInfo, FileSystemInfo, and FileAttributes. The sample below will show all the files (not directory) in C drive.
DirectoryInfo ^di = gcnew DirectoryInfo("C:\\");
for each(FileSystemInfo ^fsi in di->GetFileSystemInfos())
{
if(fsi->Attributes != FileAttributes::Directory)
{
Console::WriteLine(fsi->Name);
}
}
Sunday, September 23, 2007
My modem is working now
An error message prompt timeout expired while waiting for the PPP interface to come up. This is so annoying for me to click on the OK button every time I connect to the Internet. This is annoying too every time I need to configure my modem after Linux was bootup.
Things going to solve soon. I need some configuration setting to make my modem “permanently” stay in my Linux.
Sunday, September 16, 2007
Tools to detect my modem
This tool can help you to detect your modem device, the files needed to compile your modem and many more. It was a very good tool. To use it, follow this simple steps:
gunzip Scanmodem.gz
chmod U+X Scanmodem
./scanModem- gentoo-wiki.com/HOWTO_slmodem
This will create a ModemData.txt under a Modem directory (there are many more files generated). So I open up the file and I see a lot of info which I couldn’t understand. The very interesting part to me is this:
PCI ID: 2000:2800
Subsystem ID: 122d:2800
…
…
Candidate modem in PCI bus: 00:0c.0
Class 0703: 200:2800
Primary PCI_id: 2000:2800
Type needed: slamr
After reading this, so called spec, I become blur and struggle. It seems helpless on Internet after a few weeks of searching and googling. The only hope is to go back read carefully the README from the package. This is the only hope I think.
One thing for sure is my modem chipset is SL2800.
Saturday, September 15, 2007
First try on installing a modem on Mandriva 2007
I am surprising that I am able to see the driver source code after I have extract the zip file. (I am new to the Linux world.) There is no exe file. I go through the instruction from the README file and following every step to in the setup process. It gives me an error. This is so interesting that the console showing which line is having trouble in which file. Just like a debugger. I follow what have been told by the compiler to see what is inside the code.
Open it. I have no idea on how to fix the code although I am a C++ developer. (Frankly my core skills are UI only.) This is so funny that I can read the C++ code but I have no idea on how this code is work. I put this aside for a few weeks until I manage to find a latest driver. I get the package from here.
It compiled and installed but I have no way to configure it. Did some Google search and I got this thread. This thread did mention about on how to setting up and configuring the modem. It works exactly. Unfortunately the modem is not able to query. Is it my false?
Wednesday, September 12, 2007
Changing Direction of My Project
Currently I was busy in setting up my Linux box on my machine. I have facing some troubleshooting issues during setup. (I am newbie in Linux.) Not the installation of Linux but the driver itself. It is pretty hard to find a driver in Linux. But I enjoy the process.
Monday, September 10, 2007
WHAT is Winmodem
These few days working on Linux modem and been struggling in installing the driver. Winmodem and Linmodem are a new term which I see frequently during my searching process. I was curious about these and did a search from the Internet. This is what I got.
"A Winmodem is a software modem designed to work with the Microsoft Windows
operating system. A traditional modem uses hardware to perform its tasks, but
Winmodems perform their key tasks with software. This makes them smaller and
cheaper to produce, but it also means they cannot be easily used on other
operating systems because the driver support requires far more effort to
produce." - en.wikipedia.org/wiki/Winmodem
Another resource which talks more on this is available from this link.
