Show Bid Request
C++ MySQL / Linux API Project
Bid Request Id: 12961
|
|
|
Posted by: |
Riquet1 (3 ratings)
(Software buyer rating 10)
|
Non-action Ratio: |
Very Good - 0.00%
|
Posted: |
Apr 8, 2002 11:56:20 AM EDT
|
Bidding Closes: |
Apr 12, 2002 3:58:33 PM EDT
|
Viewed (by coders): |
317 times
|
Deadline: |
4/22/2002
TIME EXPIRED
|
|
|
|
Description:
This Linux Based C++ program which involves two phases:
Phase A Assighment - Reading the file efficiently for parsing line by line for Syntax Checking and further processing.
Given the following Sample ASCI file with an invoice, the program has to read an entire data file Which can be from less than 1 K like the following, up to an unlimited size, which in reality could top 100K. The difference in sizes between the files are the “detail lines” of the invoice. These lines are identified by their tag, which starts with a 551 at the left, followed by a 554 line for each detail item. The following example is an entire file which contains two detail lines in it. The rest of the info is header stuff:
500|1|3658|2004986|400|| 501|3658|2004986|400|1|H3|400||GME010808L63|MARR610323HASRYC03|9.04680|0|0|0|0|0|1034.208|7|7|7|1|GDI MEX, S.A. DE C.V.|COLINAS SECCION COLINAS PARQUE INDUSTRIAL EL FLORIDO||11730|22597|TIJUANA|BC|MEX| 505|2004986|08042002|1327-18|FOB|USD|46600.00|46600.00|USA|CA|33-0952223|MEC DESIGNS INC.|PATHWAY STREET SUITE 101||9540|92071|SANTEE| 506|2004986|1|08042002| 506|2004986|2|08042002| 507|2004986|MQ|20013242| 509|2004986|16|140.00000|2| 510|2004986|16|0|161| 511|2004986|1|PLACAS NO:| 511|2004986|2|VER DATOS DE MERCANCIA EN FACTURA ANEXA.| 511|2004986|3|ANEXO COPIA DE CERTIFICADO T.L.C.| 551|2004986|84659101|1||CORTADORA DE PALOS AUTOMATICA|193602.00|193602|193602|21400.00|1.000|6|1.000|6|0|0|1||||USA|USA|CA|BC|BC|CA| 554|2004986|84659101|1|TL|| 551|2004986|84282099|2||BANDA TRANSPORTADORA ALIMENTADORA|75993.00|227979|227979|25200.00|3.000|6|3.000|6|0|0|1||||USA|USA|CA|BC|BC|CA| 554|2004986|84282099|2|TL|| 801|m3658107.098|1|15|1| 999|3658|107
Assignment for Phase A
Create a program called validate which would be called with two arguments:
Syntax: int validate(szFileName, nMode)
Example of a unix program call: $ validate _ m3333001.001 _ 1
The program would return:
1 if the file was found and processed, f the file was not found … other codes would be created depending on the errors in the file.
1) Create a function that reads the whole file passed to is a parameter in the Linux command line into a “malloc-ed” Memory Buffer:
EG: lBytes = ValidateFile( szFileName, pszFileContents, nMode); lBytes = ValidateFile(“/data/validate/m3333001.001”, pszFileContents, 1); (continues in the "Deliverables" section)
Deliverables: Complete and fully-functional working program(s) in executable form as well as complete source code of all work done.
Complete copyrights to all work purchased.
(Continues from above) Where long lBytes .- is the size of the file read in Bytes, char szFileName[256].- is the Name of the file to be read char * pszFileContents - is a pointer to a dynamically allocated memory space with the file contents nMode - is an reserved Flag for internal use (it sets the validation Mode) 2) Create a ReadLine which when called retrieves the following line from the pszFileContents Buffer after each call and puts it into a line buffer szCurrentLine. It would be an equivalent to a scanf();
Syntax: int ReadLine(pszFileContents, szCurrentLine)
EG: nCharacters = Readline(pszFileContents, szCurrentLine)
Where Int nCharacters is the number of characters read in the line. When EOF is found, -1 would be returned. char * pszFileContents is the pointer to the “file contents” memory space szCurrentLine is a null terminated array of characters where the line contents will be stored.
The function would return the number of characters in the line.
3) Create a function which would take an array of pointers to character strings and fill them with the fields in such line. As the sample above shows, the “field delimiter” is the “pipe character” | .
Syntax: int nFields(szCurrentLine, pszFieldList);
The function would return the number of fields in the line, and would fill the dynamically allocated Array of dynamically allocated strings in such a mode that we could access each of the fields as follows:
pszFieldList[0], pszFieldList[1], pszFieldList[2], etc.
Looking at the first line of the sample above,
500|1|3658|2004986|400||
nFields would return 6, where
pszFieldList[0] would contain “500” pszFieldList[1] would contain “1” pszFieldList[2] would contain “3658” pszFieldList[3] would contain “2004986” pszFieldList[4] would contain “400” pszFieldList[5] would contain “”
4) Cleanup Field List Function
Write a CleanUpFieldList(pszFieldList); which would free the memory of the dynamically allocated arrays and do the cleanup work in order to prepare for the next time around.
Syntax: int nCleanupFieldList (pszFieldList));
Phase B Assignment - MySQL select Query.
When in validation mode, each line, depending on the tag, we need to concentrate on the tags which contain the “551” prefix. Once we find the 551 prefix, the third field will contain an Item Catalog Number which we would then Need to find in a Product table on a “mysql” database, based on such “catalog item number”. A specific case in the example above, by looking at the following line:
551|2004986|84659101|1||CORTADORA DE PALOS AUTOMATICA|193602.00|193602|193602|21400.00|1.000|6|1.000|6|0|0|1||||USA|USA|CA|BC|BC|CA|
We would look at the “Catalog” table based on the third field above, containing the value: “84659101” in the CatNumber field of the mysql table.
1) Write a Function to look up at such a mysql table and return an array of the fields if found, Not found otherwise.
Platform:
Linux Platform, written on c++ (cpp).
Using the mysql c++ api on RedHat Linux.
Comments MUST be in English - please.
We have written applications using php, Mycrosoft Access with odbc, shell calls, etc. but have not been able to get it to work with c++ yet. Any advice on a special library which we will need to download in order for the c++ application to work?
Thanx
Must be 100% finished and received by buyer on:
Apr 22, 2002 EDT
Deadline legal notes: All times are expressed in the time zone of the site EDT (UT - 5). If the buyer omitted a time, then the deadline is 11:59:59 PM EDT on the indicated date.
Special Conditions / Other:
Phase 1 must be completed by 4/15/2002. Only coders with experience with Redhat linux, mysql, and cpp.
Comments musb be in English - please.
Remember that contacting the other party outside of the site (by email, phone, etc.) on all business projects < $500 (before the buyer's money is escrowed) is a violation of both the software buyer and seller agreements.
We monitor all site activity for such violations and can instantly expel transgressers on the spot, so we thank you in advance for your cooperation.
If you notice a violation please help out the site and report it. Thanks for your help.
|
|
Bidding/Comments:
|
All monetary amounts on the site are in United States dollars.
Rent a Coder is a closed auction, so coders can only see their own bids and comments. Buyers can view every posting made on their bid requests. |
See all rejected bids (and all comments)
Name |
Bid Amount |
Date |
Coder Rating |
|
|
This bid was accepted by the buyer!
|
$150 (USD)
|
Apr 8, 2002 9:41:50 PM EDT
|
9.81
(Excellent)
|
|
|
Hi,
I have worked extensively with Linux, mysql and C++. I have also completed many homework assignments at Rentacoder using gcc under Linux. I can complete this by your deadline. |
|
|
|
|
|