Menu
Logged-In As
ACCOUNTNot Logged In
Make mged 'tables' command not call system()BRL-CAD
Status: ClosedTime to complete:
48 hrs
Mentors: Sean
BRL-CAD's geometry editor (MGED) provides hundreds of functions that users can call on the command line. One of our oldest commands writes data out to text files and calls the unix "sort" command to sort a list of items.. That's really bad. This task involves replacing the three calls to system() with a call to quicksort() or any other simple in-memory sorting mechanism. Code:
|
Uploaded Work
File name/URL | File size | Date submitted | |
---|---|---|---|
Tables.tar.gz | 5.7 KB | December 03 2012 10:34 UTC | |
Tables.tar.gz | 5.7 KB | December 03 2012 10:44 UTC | |
https://sourceforge.net/tracker/?func=deta... | n/a | December 04 2012 06:03 UTC |
I would like to work on this task.
This task has been assigned to Gmercer015. You have 48 hours to complete this task, good luck!
could you give me a general time of when you're usually available on IRC for helping? Appreciate it!
You just ask questions on IRC as well as here through comments, as there will be other mentors available to help you out.
Good Luck...!!
I think i've come up with a solution for replacing the system commands, but im not sure if i am completely right. How can i reach this file using BRL-CAD to check that my solution has the same results as the old system commands?
Run "mged -c /path/to/some/file.g" and select "nu" -- it'll start a simple command console. There are several example geometry files provided in the share/db directory that you can use for testing (look for moss.g for example).
Running the idents, regions, and solids commands will go through that ged_tables() function.
I attempted to use the console mged but to no avail, i know i'm doing something wrong with the solids function call but im not sure what.
C:\Users\Grant\Documents\BRLCAD_F\binmged -c C:\Users\Grant\Documents\BRLCAD_F\
share\brlcad\7.22.0\db\moss.g
BRL-CAD Release 7.22.0 Geometry Editor (MGED)
Thu, 05 Jul 2012 07:32:12 Eastern Daylight Time, Compilation 0
robert.g.parker@ARLANBNB15095:C:/Program Files (x86)/BRL-CAD 7.22.0
attach (nu|wgl)[nu]? nu
mged solids
Usage: solids file object(s)
mged solids moss.g
Usage: solids file object(s)
A .g file contains objects. You simply guessed that one of the contained objects might be named the same as the file. An okay guess, but obviously not fruitful. You're missing basic knowledge attained through just about any one of our introductory bits of documentation (like the mged quick ref sheet). Try the "tops", "ls", "tree", or "search" commands. There's documentation on all of those and the rest should become apparant.
I read up and understood how to call those commands now, the only problem is im not using a unix OS so the sort command does nothing in windows 7. Do i need to download a Virtual Machine UNIX OS to see the results then? The command prompt just shows the sort command instead of doing anything
WARNING: sort failure detected
The process cannot access the file because it is being used by another process.
WARNING: cat failure detected
Summary written in: castle.g
Processed 0 Regions
sort --numeric --key=2, 2 --output /tmp/ord_id castle.g right here, just shows the command on win7
cat /tmp/ord_id castle.g
mged solids castle.g gatebot
/tmp/mged_discr: No such file or directory
mged sort
invalid command name "sort"
mged
That would probably be the best/easiest way to test it. Alternatively, you could install Cygwin, which provides the unix command-line tools for Windows. It's going to be easiest to use the virtual machine image, though, since we've already set everything up.
Could i get this task extended please? I have an estimated 20 hours of flight travel time coming up in a couple hours and i would love to be able to finish this project while on vacation as i've put so much effort into solving this task, thanks!
The deadline of the task has been extended with 3 days and 0 hours.
Safe travels!
Could i receive another time extension please? I've spent to much time to let go of this project, i just need to finish this one up(only a little more, i promise!). The time difference is to far to be able to communicate with the mentors over here in japan so i hope it wouldnt be to much trouble asking my question here,
I finished up the qsort by second field, only problem is the file i have to sort. Will my file i need sorted include some statements without numbers? my function sorts the file considering there arent lines such as "Data results" or others that do not include any numbers.
what does
cat /tmp/ord_id
followed by a call to bu_vls_strcat(cmd, argv[1]);
do? my guess is it coppies the contents of the tmp file back to argv[1]? I'm not completly sure though.
Thank you if you could extend the deadline, i really apprecaite it!
The deadline of the task has been extended with 1 days and 0 hours.
I fixed the function to mimic the sort unix command exactly, never mind the question about my qsort! I couldn't find an edit button on my main post so i left this reply
Mentors,
We discussed over IRC and agreed that he could skip the final system() call that doesn't involve sort (it calls cat). We'll create a separate task for that.
The work on this task is ready to be reviewed.
Sorry for the confusion, both files submitted are exactly the same.
Melange has detected that the deadline has passed and no more work can be submitted. The submitted work should be reviewed.
One of the mentors has sent this task back for more work. Talk to the mentor(s) assigned to this task to satisfy the requirements needed to complete this task, submit your work again and mark the task as complete once you re-submit your work.
So from our discussions and what you wrote in your changelog notes, this looks like it's probably good but it's not feasible to review it as-is. Changes need to be submitted in patch format, otherwise they take far too long to review. See these for help on making a patch:
http://brlcad.org/wiki/Patches
http://brlcad.org/wiki/Deuces (when you're done section)
The deadline of the task has been extended with 1 days and 0 hours.
The follow-up task to fix the cat system() call is here, assuming someone doesn't claim it before you can fix up this patch:
http://www.google-melange.com/gci/task/view/google/gci2012/7966235
The work on this task is ready to be reviewed.
One of the mentors has sent this task back for more work. Talk to the mentor(s) assigned to this task to satisfy the requirements needed to complete this task, submit your work again and mark the task as complete once you re-submit your work.
The deadline of the task has been extended with 1 days and 0 hours.
So I see you created a new item on our patches tracker, but you didn't submit a *patch* file there (or here). A patch file is a text file that includes only the changes you made to files. The diff command will generate a patch file. The "svn diff" command is even better. Instead of providing entire modified .c files, you'll need to submit just your changes in patch format. Those two URLs I provided explain that in more detail and even walk you through the process for how to create a patch.
For what it's worth, making a patch is a fundamental developer skill so it's definitely worth learning. It's the way code changes are exchanged both throughout open source and professionally.
I'm terribly sorry, i thought i had uploaded the patch file! i must have accidently uploaded the text file, i read through the tutorial and created the patch file correctly it's still sitting here on my desktop(how embarassing!). Ill resubmit this now, thanks again for understanding.
The work on this task is ready to be reviewed.
updated sourceforge link with patch now, if for some reason the changelog.txt is needed it will still be in the compressed files aobe the link.
That's looking a lot better! The patch looks good but has several problems that make it unapplyable. Does it compile for you? I would assume you have, but you may have disabled or otherwise be ignoring warnings. In particular, I noticed the use of // comments throughout, which will halt our compilation.
See our HACKING file for an overview of many code styling and convention issues. For example, open scope curly braces should be on the same line as their statement, not the next line. The only exception are function scopes which should be on the next line.. Your whitespace indentation falls apart near the end of the patch as well.
Those are the critical issues. There are other problems like the hard-coded fixed buffer sizes, but those can be fixed in a subsequent GCI task.
Thanks again for all your efforts. Hopefully you learned a few things and (more importantly) had or are having fun1 It looks like there were be several follow-on tasks related to this that you or someone else will be able to claim.
If you provide your full name, we'll credit you accordingly in our authorship documentation.
One of the mentors has sent this task back for more work. Talk to the mentor(s) assigned to this task to satisfy the requirements needed to complete this task, submit your work again and mark the task as complete once you re-submit your work.
The work on this task is ready to be reviewed.
Im just thrilled to be able to help out in a legitamate open source project and actually finish something, so actually thank you! I updated the latest patch with what i searched through in the hacker file, changed functions to cross platform bu_func() and fixed commentings/style issues.
I put my name on the tracker, but in the case you miss it, my full name is Grant Mercer, and that would awesome if im added to the authorship!
Melange has detected that the deadline has passed and no more work can be submitted. The submitted work should be reviewed.
Congratulations, this task has been completed successfully.