Perl 6 - the future is here, just unevenly distributed

IRC log for #webwork, 2013-05-22

| Channels | #webwork index | Today | | Search | Google Search | Plain-Text | summary

All times shown according to UTC.

Time Nick Message
01:03 mgage_ joined #webwork
04:24 mgage_ joined #webwork
12:30 mgage_ joined #webwork
15:47 mgage_ joined #webwork
15:56 rbeezer joined #webwork
16:55 mgage_ joined #webwork
17:44 Paul_Pearson joined #webwork
18:33 mgage_ joined #webwork
18:54 dbwalton joined #webwork
18:56 dbwalton Is anyone familiar with DBImportExport.pm?  I'm trying to export db records for a class and it stalls saying, "Code point \u0004 is not a valid character in XML at /opt/webwork/webwork2/lib/WeBWorK/Utils/DBImportExport.pm line 336" (trying to export a last answer in problem_user element).
18:56 dbwalton Clarify:  I'm trying command-line wwdb
18:58 mgage_ doubt that this is DBimportExport.pm specific -- looks like you have a hidden character perhaps? or something weird that was entered into an answer blank
18:58 dbwalton Is there a way to have DBImportExport filter out any invalid characters? Or should I attempt to do something to the original database?
18:59 mgage_ you could modify the code near that point to limit the characters passed to printing characters
19:00 mgage_ I think you'd need to modify code somewhere around line 336 -- there are lots of filters available -- many are already in WW and there are more on CPAN
19:01 dbwalton Do you have any quick suggestions on a filter in WW? Otherwise, I'll go dig one up.
19:01 mgage_ even something like s/[^a-zA-Z0-9}//g (you can add other characters you want to allow would work
19:03 dbwalton I tried s/[[:^ascii:]]//g, but got the same error.  I restarted apache after the edit.  Is there some other service that might have used the old code?
19:03 mgage_ there are escapeHTML and escapeURL filters around -- those might not be their exact names.   encode and decode are sometimes used.  You can also use encode/decode base64 which will replace everything by a code using only ascii characters .
19:03 mgage_ if you are just doing a one time fix -- then modifying the database might be quicker.
19:06 dbwalton thx
19:21 dbwalton s/[[:^print:]]//g worked
19:23 mgage_ great.  you might post the problem and your solution to bugzilla so we don't use it -- we have not been very cautious about sanitizing submitted answers.  They don't cause trouble immediately but they can foul up the database and sometimes allow for XSS exploits.  I've pushed some changes written by Geoff Goehle to release/2.7 to mitigate this but the job is not done.
19:55 hij joined #webwork
20:02 hij Hello. Anybody here? I have a question.
20:02 mgage_ hi
20:03 hij I want to know how to get user information in a problem defnition/file.
20:03 hij left #webwork
20:03 mgage_ can you explain further? user information is normally in one the .lst class list files
20:04 hij joined #webwork
20:04 hij Sorry about that. My client crashed.
20:04 hij Not sure if my question went out.
20:05 hij I want to get account information about a student when they open up a problem.
20:05 hij Can I get a user's section number or other information in the problem definition?
20:05 mgage_ that is provided as part of the environment to the problem.
20:06 hij How do I get the environment? Is there an environment variable?
20:07 mgage_ look at http://webwork.maa.org/wiki/How_to_list_Context_flags near the bottom
20:08 * hij is looking
20:08 mgage_ you can use PGinfo.pl to get a list of all the environmental variables.
20:09 hij Okay. I will take a look. Thank you!
20:09 mgage_ http://webwork.maa.org/pod/pg_TRUNK/macros/PGinfo.pl.html has more detail
20:10 hij excellent. That is a big help. Thank you. I will poke around.
20:10 mgage_ the environment hash is also %envir but many values are dereferenced and available as standard $ variables.
20:10 hij is %envir available as a variable in the problem environment?
20:11 mgage_ yes -- also I believe the hash pointer is $rh_input->envir
20:11 mgage_ probably better to use %envir in problems,  possibly the hash pointer in macros since that can't be doctored easily from within the problems.
20:12 hij Ah, good. I will see what I can find. We want to set up a class with randomly assigned section numbers and have the different students assigned different types of problems as part of an experiment.
20:12 mgage_ cool -- can you tell me where you are doing this?  I would like to hear how this comes out
20:13 hij Right now we are just trying to see if it is possible and will try to kick some ideas around.
20:13 hij Basically, we have an intro stats class.
20:13 mgage_ sounds like a good experiment
20:13 mgage_ brb
20:13 hij The question is whether or not one or two extra questions that focus on data sets will make a difference.
20:13 mgage_ phone call
20:13 * hij nods
20:25 mgage_ back
20:25 hij It shuold be interesting.
20:25 hij I am trying to access $rh_input->envir{'sectionName'}
20:25 hij And I am not getting anything?
20:26 hij Do I need to cast it to a hash?
20:26 mgage_ try $rh->{envir}->{sectionName}
20:26 mgage_ I mean $rh_input
20:27 hij Tried $rh_input->{envir}->{'sectionName'} and no deal
20:27 mgage_ let me look
20:29 mgage_ sorry -- hard to do these things entirely from memory  -- try just $envir
20:29 mgage_ $envir->{sectionName]
20:29 hij I tried that originally. Let me try again.
20:30 hij I think it might have worked.
20:30 mgage_ You can also use   warn ref($envir) to see what type it is
20:30 hij Let me try another envronmental value.
20:30 mgage_ I think that warn  $sectionName will work also
20:31 hij I think that it is working. The admin account does not have a section number set, so that is why I might have missed it before.
20:32 mgage_ actually the new way to get debug messages is   DEBUG_MESSAGE(^) is the official way to get debugging information out
20:32 mgage_ right
20:32 hij Okay, it is working. I can get the user name. I just did not have sectionName set on this account.
20:33 hij I think that we can make this work.
20:33 hij Now we just need to flesh it out.
20:33 hij Thank you!
20:34 mgage_ np -- let me know how it goes (I'm gage@math.rochester.edu)
20:34 hij envir{'sectionName'} and $envir{'studentID'} was what I was using.
20:34 hij Will do, thank you again!
20:34 mgage_ kk
20:53 hij left #webwork
20:59 rbeezer joined #webwork
21:31 mgage_ joined #webwork
22:43 mgage_ joined #webwork
23:52 mgage_ joined #webwork

| Channels | #webwork index | Today | | Search | Google Search | Plain-Text | summary