I made quite a bit of progress in my opengl, more on this later. But I was assigned another task for kshitij webteam work.
Material: 250 pages of share prices copy-pasted into a .doc file. Task: Add all the data into a sql database Current proposed solution: Copy paste. Will require an average user about 6-7 hours of work. And prone to be very buggy.
What I tried to do: Convert the html into unicode and parse it. Strip out all formatting and tags between << and >>. Now look for a repeating pattern and store the appropriate data in a memory buffer from which you make an sql file where all the commands are placed for easy addition into a server via phpmyadmin for web access and php use.
My experience: I used visual studio for the first time in a non guided project. Since I was a veteran of writing quick easy console programs, I was able to get hello world program running with medium effort. I got up some reference docs about CString in firefox in the background and started the coding. Wrote a little testing function with CStrings to familarize myself with them and things worked fine. I tried printing them with cout, when I had a error. After some typecasting issues, I tried using the GetBuffer function to make some use but it just kept printing the memory address of the variable, and even printf did the same thing. I looked online and realized cout and cstring don’t like each other. So I decided to chuck it and wrote the code in dev-c++ 5beta, and the code compiled. I haven’t used STL much so I resorted to using strings in their most primitive format and wrote a simple, surprisingly efficient code to parse the entire code and ignore anything unless an >> is encountered and until a <<. The code compiled but the compiler kept telling me that the fstream header was deperceated. I didn’t have time to look in the net for updated headers. I ended up uysing them anyway and they worked surprisingly well. So I ran them on the html code generated by word and the results was scary. The size of the file, instead of falling, increased by a factor of four and the text was unreadable. Some tweaking later realized that this is no ordinary html, so had to abandon that. Seems like we’ll have to copy paste. I went to a seniors room and he proposed something that made me want to kick myself.
His solution: Copy paste the entire document in excel and export in csv after applying delimiters and then adding to the sql database. Too simple to be true, and it dind’t work because there was an inconsistent number of fields.
My final solution: Make the file into excel and export as a comma seperated values file. This worked but made no sense when viewed raw. So I wrote code to first load a large number of lines into a buffer. Sort it into the four – the three tables and junk lines. Write three seperate files and independently parse them and make loading of files into the sql easy.
The current problem: I was crippled without cout to display realtime debugging information(I still don’t use all the great debugging features like watches yet, for some reason) i display values of results of critical function for debugging purposes. That and cstring still had some problems. Ultimately rushin solved my problem by telling me that there are inbuilt console printing functions. And that rocks. Now with cfile and cstring in my palm I can fix this up.
But not today. Have to mug and do illu kaam. will Update when done.

0 Response to “Visual C++ Rocks”