From derrick at csociety.org Tue Apr 1 09:25:31 2014 From: derrick at csociety.org (derrick) Date: Tue, 01 Apr 2014 12:25:31 -0400 Subject: [Purdue-pm] April Meeting Plans In-Reply-To: References: Message-ID: <533AE87B.5010205@csociety.org> On 03/31/2014 09:36 AM, Dave Jacoby wrote: > Next meeting is going to be a two-talk meeting, plus of course our regular > banter. I am presenting on the solution to a Node problem I had, with a > side step into NoSQL. I forget Derrick was going to talk about. Care to > remind us? JSON Primer From jacoby.david at gmail.com Mon Apr 14 04:59:49 2014 From: jacoby.david at gmail.com (jacoby.david at gmail.com) Date: Mon, 14 Apr 2014 04:59:49 -0700 (PDT) Subject: [Purdue-pm] REMINDER: Purdue Perl Mongers meets TOMORROW! Message-ID: <534bcdb5.c474320a.3c59.7a26@mx.google.com> Greetings! This is an automated message to announce that Purdue Perl Mongers will meet TOMORROW at 11:30am in WSLR 116. Generally, we discuss computing, dynamic languages, Purdue and the overlap of those three (plus whatever else comes up) until Noon, then have one or more more formal presentations. We don't always discuss Perl -- we have had presentations on Python, Javascript, HTML4, Selenium, and many other topics -- so if you are not an experienced Perl user, there's still a place for you. Check our Twitter feed (@purduepm), our Google+ Community (https://plus.google.com/communities/100780979348959606696) or our web page (http://pm.purdue.org) for more information. From mdw at purdue.edu Mon Apr 14 05:10:02 2014 From: mdw at purdue.edu (Mark Daniel Ward) Date: Mon, 14 Apr 2014 08:10:02 -0400 Subject: [Purdue-pm] REMINDER: Purdue Perl Mongers meets TOMORROW! In-Reply-To: <534bcdb5.c474320a.3c59.7a26@mx.google.com> References: <534bcdb5.c474320a.3c59.7a26@mx.google.com> Message-ID: <534BD01A.1010807@purdue.edu> Dear Perl Mongers, I noticed that there is a short Directory for Purdue Perl colleagues here: http://pm.purdue.org/Wiki/wiki.pl/Directory I don't know how to add my name, but I'm definitely interested in what you are doing, and I like following the Perl Mongers posts online. How may I get added to that short directory? Best wishes, Mark Mark Daniel Ward, Ph.D. Associate Professor Department of Statistics Purdue University 150 North University Street West Lafayette, IN 47907-2067 mdw at purdue.edu phone: (765) 496-9563 On 4/14/14 7:59 AM, jacoby.david at gmail.com wrote: > Greetings! > > This is an automated message to announce that Purdue Perl Mongers > will meet TOMORROW at 11:30am in WSLR 116. > > Generally, we discuss computing, dynamic languages, Purdue and the > overlap of those three (plus whatever else comes up) until Noon, > then have one or more more formal presentations. We don't always > discuss Perl -- we have had presentations on Python, Javascript, > HTML4, Selenium, and many other topics -- so if you are not an > experienced Perl user, there's still a place for you. > > Check our Twitter feed (@purduepm), our Google+ Community > (https://plus.google.com/communities/100780979348959606696) > or our web page (http://pm.purdue.org) for more information. > > > _______________________________________________ > Purdue-pm mailing list > Purdue-pm at pm.org > http://mail.pm.org/mailman/listinfo/purdue-pm From gizmo at purdue.edu Tue Apr 15 07:44:58 2014 From: gizmo at purdue.edu (Joe Kline) Date: Tue, 15 Apr 2014 10:44:58 -0400 Subject: [Purdue-pm] REMINDER: Purdue Perl Mongers meets TOMORROW! In-Reply-To: <534bcdb5.c474320a.3c59.7a26@mx.google.com> References: <534bcdb5.c474320a.3c59.7a26@mx.google.com> Message-ID: <534D45EA.5050103@purdue.edu> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I was gonna make it today but I need to fix something semi-work related (oddly it is perl related though...) joe -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iEYEARECAAYFAlNNRekACgkQb0mzA2gRTplzxQCgjoxZwMwxrHcXkOVvlXtncqW+ P2kAn2Bj/1+yLkKJ0tnxsR7jNnfq1CS+ =7yOw -----END PGP SIGNATURE----- From jacoby.david at gmail.com Tue Apr 15 09:50:30 2014 From: jacoby.david at gmail.com (Dave Jacoby) Date: Tue, 15 Apr 2014 12:50:30 -0400 Subject: [Purdue-pm] Coming Computing Events Message-ID: Greater Lafayette Open Source Symposium (GLOSSY) is hosting GitHub for a presentation "Learn Git and GitHub". Tuesday, April 22, 6pm at LWSN 1142. Please RSVP. http://www.meetup.com/Greater-Lafayette-Open-Source-Symposium/events/169602662/ GLOSSY is also having an afternoon of Lightning-ish Talks: not full, hour-long conference-style talks, but not the tightly-enforced five minutes of lightning talks. Saturday, April 26, 2-4pm at the MatchBOX Coworking Studio (17 South 6th Street, Suite X, Lafayette, IN). Our Derrick will be talking about web testing with Selenium, Graham McCullough of Purdue's RCAC will present on system management with Puppet, and, I think, Monger Broc Seib will show us Google's new web programming language, Dart. Plus, of course, there will be the opportunity to tour the facility. http://opensourcelafayette.org/ twitter: @opensourcelala -- David Jacoby jacoby.david at gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From mark at purdue.edu Tue Apr 15 11:30:27 2014 From: mark at purdue.edu (Mark Senn) Date: Tue, 15 Apr 2014 14:30:27 -0400 Subject: [Purdue-pm] reading JSON with different programming languages Message-ID: <24079.1397586627@pier.ecn.purdue.edu> Derrick Kearney is going to prepare some JSON and the following people will talk and/or write about how they read it with the following programming languages before or at the Purdue Perl Mongers meeting on May 20, 2014. Send email to markiest at purdue.edu (remove "iest" from the email address) with any corrections or additions to the below list. LANGUAGE WHO Mathematica Mark Senn Perl Dave Jacoby PHP Chris Orr pro Mark Senn Python Joe Kline Ruby Rick Westerman Mark Senn, Systems Programmer, Engineering Computer Network, Purdue University From derrick at csociety.org Wed Apr 23 09:38:22 2014 From: derrick at csociety.org (derrick) Date: Wed, 23 Apr 2014 12:38:22 -0400 Subject: [Purdue-pm] reading JSON with different programming languages In-Reply-To: <24079.1397586627@pier.ecn.purdue.edu> References: <24079.1397586627@pier.ecn.purdue.edu> Message-ID: <5357EC7E.8070700@csociety.org> I got held up working on some other stuff, I'll put together the json this coming weekend. dsk On 04/15/2014 02:30 PM, Mark Senn wrote: > Derrick Kearney is going to prepare some JSON and the following people > will talk and/or write about how they read it with the following > programming languages before or at the Purdue Perl Mongers meeting on > May 20, 2014. Send email to markiest at purdue.edu (remove "iest" from > the email address) with any corrections or additions to the below list. > > LANGUAGE WHO > Mathematica Mark Senn > Perl Dave Jacoby > PHP Chris Orr > pro Mark Senn > Python Joe Kline > Ruby Rick Westerman > > Mark Senn, Systems Programmer, Engineering Computer Network, Purdue University > _______________________________________________ > Purdue-pm mailing list > Purdue-pm at pm.org > http://mail.pm.org/mailman/listinfo/purdue-pm > From jacoby at purdue.edu Wed Apr 23 10:14:31 2014 From: jacoby at purdue.edu (Dave Jacoby) Date: Wed, 23 Apr 2014 13:14:31 -0400 Subject: [Purdue-pm] reading JSON with different programming languages In-Reply-To: <5357EC7E.8070700@csociety.org> References: <24079.1397586627@pier.ecn.purdue.edu> <5357EC7E.8070700@csociety.org> Message-ID: <5357F4F7.7030509@purdue.edu> Question I have is: Should we be showing "This is JSON as a bunch of text, and VOILA! This is it as a data object!"? Is that the limit of what we're doing here? On 4/23/2014 12:38 PM, derrick wrote: > I got held up working on some other stuff, I'll put together the json > this coming weekend. > > dsk > > On 04/15/2014 02:30 PM, Mark Senn wrote: >> Derrick Kearney is going to prepare some JSON and the following people >> will talk and/or write about how they read it with the following >> programming languages before or at the Purdue Perl Mongers meeting on >> May 20, 2014. Send email to markiest at purdue.edu (remove "iest" from >> the email address) with any corrections or additions to the below list. >> >> LANGUAGE WHO >> Mathematica Mark Senn >> Perl Dave Jacoby >> PHP Chris Orr >> pro Mark Senn >> Python Joe Kline >> Ruby Rick Westerman >> >> Mark Senn, Systems Programmer, Engineering Computer Network, Purdue >> University >> _______________________________________________ >> Purdue-pm mailing list >> Purdue-pm at pm.org >> http://mail.pm.org/mailman/listinfo/purdue-pm >> > > _______________________________________________ > Purdue-pm mailing list > Purdue-pm at pm.org > http://mail.pm.org/mailman/listinfo/purdue-pm -- Dave Jacoby Developer, Purdue Genomics Core Lab http://web.ics.purdue.edu/~djacoby/ 274 days using standing desk From derrick at csociety.org Wed Apr 23 10:19:33 2014 From: derrick at csociety.org (derrick) Date: Wed, 23 Apr 2014 13:19:33 -0400 Subject: [Purdue-pm] reading JSON with different programming languages In-Reply-To: <5357F4F7.7030509@purdue.edu> References: <24079.1397586627@pier.ecn.purdue.edu> <5357EC7E.8070700@csociety.org> <5357F4F7.7030509@purdue.edu> Message-ID: <5357F625.4060408@csociety.org> I'm thinking there will be a few options for the challenge. I'll lay them out this weekend, but they will be something like. 1. reading / writing json text from / to a file 2. read json data from file, and perform some calculation and plot. dsk On 04/23/2014 01:14 PM, Dave Jacoby wrote: > Question I have is: Should we be showing "This is JSON as a bunch of > text, and VOILA! This is it as a data object!"? Is that the limit of > what we're doing here? > > On 4/23/2014 12:38 PM, derrick wrote: >> I got held up working on some other stuff, I'll put together the json >> this coming weekend. >> >> dsk >> >> On 04/15/2014 02:30 PM, Mark Senn wrote: >>> Derrick Kearney is going to prepare some JSON and the following people >>> will talk and/or write about how they read it with the following >>> programming languages before or at the Purdue Perl Mongers meeting on >>> May 20, 2014. Send email to markiest at purdue.edu (remove "iest" from >>> the email address) with any corrections or additions to the below list. >>> >>> LANGUAGE WHO >>> Mathematica Mark Senn >>> Perl Dave Jacoby >>> PHP Chris Orr >>> pro Mark Senn >>> Python Joe Kline >>> Ruby Rick Westerman >>> >>> Mark Senn, Systems Programmer, Engineering Computer Network, Purdue >>> University >>> _______________________________________________ >>> Purdue-pm mailing list >>> Purdue-pm at pm.org >>> http://mail.pm.org/mailman/listinfo/purdue-pm >>> >> >> _______________________________________________ >> Purdue-pm mailing list >> Purdue-pm at pm.org >> http://mail.pm.org/mailman/listinfo/purdue-pm > > From derrick at csociety.org Mon Apr 28 10:35:51 2014 From: derrick at csociety.org (derrick) Date: Mon, 28 Apr 2014 13:35:51 -0400 Subject: [Purdue-pm] reading JSON with different programming languages In-Reply-To: <24079.1397586627@pier.ecn.purdue.edu> References: <24079.1397586627@pier.ecn.purdue.edu> Message-ID: <535E9177.2040703@csociety.org> Wow, I think I really messed this one up! I was working on the first part of the challenge problem this weekend and had a huge brain fart. I need your help to getting this sample json file cleaned up. In our last meeting we learned about the JSON file format. I created the sample json file I wanted to use for the first part of the challenge, but I accidentally mixed up some of values while I was writing the file. To make things worst, my favorite text editor mysteriously now opens json files in read only mode, so I can't just go in and fix it by hand (ugh, technology). I uploaded the file here: http://www.csociety.org/~kearneyd/tmp/purduepm_json_challenge_1.json While I sort things out with my system, if you have a bit of extra time, can you write a program that will do the following: 1) Read and Parse the JSON file. Read the json file into memory and parse it into data structures that best fit the programming language you are using. There are 6 data types you need to worry about: Primitive Types: * null * booleans * strings * numbers Structured Types: * arrays * objects More information about the json file format can be found here: http://json.org/ The file represents a dictionary, or hash table, or associative array. There is probably a library available in your programming language, you can use to quickly read and parse the file. The json.org website has a list of some libraries for popular programming languages. After parsing the file into your language's data structures, you should print the values stored in the data structures to stdout or another file to make sure you are reading the data properly. don't just print the file after reading it. 2) Fix the JSON file and write it back to disk. Here is where it gets tricky. Even though the json file was syntactically correct, I made some mistakes in the data that is stored in it. Here is a summary of what I wanted for each key in the dictionary : * null_value should be a json NULL or None value, not a string. * boolean_true should be a json true value, not false * boolean_false should be a json false value, not true * integer_number should be the integer representation of its current value, not the floating point representation (ie 3) * number_examples -> "not a number" should not even be in the dictionary, lets remove it. * in "array", the string "value5" should read "value4" to match "key4" Can you write a program to make these specific changes? Don't forget to comment your code. If you find an interesting way of addressing elements inside of the structure, please highlight that in your code. For example, how would you find the value for "key4" in the file? If there were multiple dictionary keys named "key4" in the file, how could you make sure you were addressing the correct one? The data in the outputted file should look something like like this: { "null_value": null, "boolean_true": true, "boolean_false": false, "string": "this is my string.", "integer_number": 3, "number_examples": { "positive integer": 9, "negative integer": -1, "float": 2.3, "positive_exponent": 4.35e+58, "negative_exponent": 4.3508e-93 }, "array": [true,null,["value3"],{"key4":"value4"}] } Note that the order of the keys (null_value, boolean_true, boolean_false, ...) does not matter since the pairs of a json object are unordered. We'll discuss how to perform these actions in the different programming languages people chose to use in the next meeting on May 20, 2014. Thanks, dsk On 04/15/2014 02:30 PM, Mark Senn wrote: > Derrick Kearney is going to prepare some JSON and the following people > will talk and/or write about how they read it with the following > programming languages before or at the Purdue Perl Mongers meeting on > May 20, 2014. Send email to markiest at purdue.edu (remove "iest" from > the email address) with any corrections or additions to the below list. > > LANGUAGE WHO > Mathematica Mark Senn > Perl Dave Jacoby > PHP Chris Orr > pro Mark Senn > Python Joe Kline > Ruby Rick Westerman > > Mark Senn, Systems Programmer, Engineering Computer Network, Purdue University From bradley.d.andersen at gmail.com Mon Apr 28 10:39:26 2014 From: bradley.d.andersen at gmail.com (Bradley Andersen) Date: Mon, 28 Apr 2014 13:39:26 -0400 Subject: [Purdue-pm] reading JSON with different programming languages In-Reply-To: <535E9177.2040703@csociety.org> References: <24079.1397586627@pier.ecn.purdue.edu> <535E9177.2040703@csociety.org> Message-ID: maybe i am missing something, but, according to http://jsonlint.com/, http://www.csociety.org/~kearneyd/tmp/purduepm_json_challenge_1.json is valid json ... On Mon, Apr 28, 2014 at 1:35 PM, derrick wrote: > Wow, I think I really messed this one up! > > I was working on the first part of the challenge problem this weekend and > had a huge brain fart. I need your help to getting this sample json file > cleaned up. > > In our last meeting we learned about the JSON file format. I created the > sample json file I wanted to use for the first part of the challenge, but I > accidentally mixed up some of values while I was writing the file. To make > things worst, my favorite text editor mysteriously now opens json files in > read only mode, so I can't just go in and fix it by hand (ugh, technology). > > I uploaded the file here: > http://www.csociety.org/~kearneyd/tmp/purduepm_json_challenge_1.json > > While I sort things out with my system, if you have a bit of extra time, > can you write a program that will do the following: > > 1) Read and Parse the JSON file. > > Read the json file into memory and parse it into data structures that best > fit the programming language you are using. There are 6 data types you need > to worry about: > > Primitive Types: > * null > * booleans > * strings > * numbers > > Structured Types: > * arrays > * objects > > More information about the json file format can be found here: > http://json.org/ > > The file represents a dictionary, or hash table, or associative array. > > There is probably a library available in your programming language, you > can use to quickly read and parse the file. The json.org website has a > list of some libraries for popular programming languages. > > After parsing the file into your language's data structures, you should > print the values stored in the data structures to stdout or another file to > make sure you are reading the data properly. don't just print the file > after reading it. > > > 2) Fix the JSON file and write it back to disk. > > Here is where it gets tricky. Even though the json file was syntactically > correct, I made some mistakes in the data that is stored in it. Here is a > summary of what I wanted for each key in the dictionary : > > * null_value should be a json NULL or None value, not a string. > * boolean_true should be a json true value, not false > * boolean_false should be a json false value, not true > * integer_number should be the integer representation of its current > value, not the floating point representation (ie 3) > * number_examples -> "not a number" should not even be in the dictionary, > lets remove it. > * in "array", the string "value5" should read "value4" to match "key4" > > Can you write a program to make these specific changes? Don't forget to > comment your code. If you find an interesting way of addressing elements > inside of the structure, please highlight that in your code. For example, > how would you find the value for "key4" in the file? If there were multiple > dictionary keys named "key4" in the file, how could you make sure you were > addressing the correct one? > > The data in the outputted file should look something like like this: > > { > "null_value": null, > "boolean_true": true, > "boolean_false": false, > "string": "this is my string.", > "integer_number": 3, > "number_examples": { > "positive integer": 9, > "negative integer": -1, > "float": 2.3, > "positive_exponent": 4.35e+58, > "negative_exponent": 4.3508e-93 > }, > "array": [true,null,["value3"],{"key4":"value4"}] > } > > > Note that the order of the keys (null_value, boolean_true, boolean_false, > ...) does not matter since the pairs of a json object are unordered. > > > We'll discuss how to perform these actions in the different programming > languages people chose to use in the next meeting on May 20, 2014. > > Thanks, > > dsk > > > > On 04/15/2014 02:30 PM, Mark Senn wrote: > >> Derrick Kearney is going to prepare some JSON and the following people >> will talk and/or write about how they read it with the following >> programming languages before or at the Purdue Perl Mongers meeting on >> May 20, 2014. Send email to markiest at purdue.edu (remove "iest" from >> the email address) with any corrections or additions to the below list. >> >> LANGUAGE WHO >> Mathematica Mark Senn >> Perl Dave Jacoby >> PHP Chris Orr >> pro Mark Senn >> Python Joe Kline >> Ruby Rick Westerman >> >> Mark Senn, Systems Programmer, Engineering Computer Network, Purdue >> University >> > > _______________________________________________ > Purdue-pm mailing list > Purdue-pm at pm.org > http://mail.pm.org/mailman/listinfo/purdue-pm > -------------- next part -------------- An HTML attachment was scrubbed... URL: From derrick at csociety.org Mon Apr 28 10:44:05 2014 From: derrick at csociety.org (derrick) Date: Mon, 28 Apr 2014 13:44:05 -0400 Subject: [Purdue-pm] reading JSON with different programming languages In-Reply-To: References: <24079.1397586627@pier.ecn.purdue.edu> <535E9177.2040703@csociety.org> Message-ID: <535E9365.3070102@csociety.org> the json is valid so part you can read it in part 1. part 2 is to update some values in the file and write the data back to disk. On 04/28/2014 01:39 PM, Bradley Andersen wrote: > maybe i am missing something, but, according to http://jsonlint.com/, > http://www.csociety.org/~kearneyd/tmp/purduepm_json_challenge_1.json is > valid json ... > > > On Mon, Apr 28, 2014 at 1:35 PM, derrick wrote: > >> Wow, I think I really messed this one up! >> >> I was working on the first part of the challenge problem this weekend and >> had a huge brain fart. I need your help to getting this sample json file >> cleaned up. >> >> In our last meeting we learned about the JSON file format. I created the >> sample json file I wanted to use for the first part of the challenge, but I >> accidentally mixed up some of values while I was writing the file. To make >> things worst, my favorite text editor mysteriously now opens json files in >> read only mode, so I can't just go in and fix it by hand (ugh, technology). >> >> I uploaded the file here: >> http://www.csociety.org/~kearneyd/tmp/purduepm_json_challenge_1.json >> >> While I sort things out with my system, if you have a bit of extra time, >> can you write a program that will do the following: >> >> 1) Read and Parse the JSON file. >> >> Read the json file into memory and parse it into data structures that best >> fit the programming language you are using. There are 6 data types you need >> to worry about: >> >> Primitive Types: >> * null >> * booleans >> * strings >> * numbers >> >> Structured Types: >> * arrays >> * objects >> >> More information about the json file format can be found here: >> http://json.org/ >> >> The file represents a dictionary, or hash table, or associative array. >> >> There is probably a library available in your programming language, you >> can use to quickly read and parse the file. The json.org website has a >> list of some libraries for popular programming languages. >> >> After parsing the file into your language's data structures, you should >> print the values stored in the data structures to stdout or another file to >> make sure you are reading the data properly. don't just print the file >> after reading it. >> >> >> 2) Fix the JSON file and write it back to disk. >> >> Here is where it gets tricky. Even though the json file was syntactically >> correct, I made some mistakes in the data that is stored in it. Here is a >> summary of what I wanted for each key in the dictionary : >> >> * null_value should be a json NULL or None value, not a string. >> * boolean_true should be a json true value, not false >> * boolean_false should be a json false value, not true >> * integer_number should be the integer representation of its current >> value, not the floating point representation (ie 3) >> * number_examples -> "not a number" should not even be in the dictionary, >> lets remove it. >> * in "array", the string "value5" should read "value4" to match "key4" >> >> Can you write a program to make these specific changes? Don't forget to >> comment your code. If you find an interesting way of addressing elements >> inside of the structure, please highlight that in your code. For example, >> how would you find the value for "key4" in the file? If there were multiple >> dictionary keys named "key4" in the file, how could you make sure you were >> addressing the correct one? >> >> The data in the outputted file should look something like like this: >> >> { >> "null_value": null, >> "boolean_true": true, >> "boolean_false": false, >> "string": "this is my string.", >> "integer_number": 3, >> "number_examples": { >> "positive integer": 9, >> "negative integer": -1, >> "float": 2.3, >> "positive_exponent": 4.35e+58, >> "negative_exponent": 4.3508e-93 >> }, >> "array": [true,null,["value3"],{"key4":"value4"}] >> } >> >> >> Note that the order of the keys (null_value, boolean_true, boolean_false, >> ...) does not matter since the pairs of a json object are unordered. >> >> >> We'll discuss how to perform these actions in the different programming >> languages people chose to use in the next meeting on May 20, 2014. >> >> Thanks, >> >> dsk >> >> >> >> On 04/15/2014 02:30 PM, Mark Senn wrote: >> >>> Derrick Kearney is going to prepare some JSON and the following people >>> will talk and/or write about how they read it with the following >>> programming languages before or at the Purdue Perl Mongers meeting on >>> May 20, 2014. Send email to markiest at purdue.edu (remove "iest" from >>> the email address) with any corrections or additions to the below list. >>> >>> LANGUAGE WHO >>> Mathematica Mark Senn >>> Perl Dave Jacoby >>> PHP Chris Orr >>> pro Mark Senn >>> Python Joe Kline >>> Ruby Rick Westerman >>> >>> Mark Senn, Systems Programmer, Engineering Computer Network, Purdue >>> University >>> >> >> _______________________________________________ >> Purdue-pm mailing list >> Purdue-pm at pm.org >> http://mail.pm.org/mailman/listinfo/purdue-pm >> > From bradley.d.andersen at gmail.com Mon Apr 28 10:45:20 2014 From: bradley.d.andersen at gmail.com (Bradley Andersen) Date: Mon, 28 Apr 2014 13:45:20 -0400 Subject: [Purdue-pm] reading JSON with different programming languages In-Reply-To: <1956273185.121592.1398707044275.JavaMail.root@mailhub020.itcs.purdue.edu> References: <1956273185.121592.1398707044275.JavaMail.root@mailhub020.itcs.purdue.edu> Message-ID: oh i see, sorry for that. i should probably read the whole thing before replying On Mon, Apr 28, 2014 at 1:44 PM, Rick Westerman wrote: > Of course it is syntactically correct. But it is logically wrong. What > we should do to help out poor old Derrick is to read in the file, correct > it logically, and write it back out. That is the challenge. > > ----- Original Message ----- > > maybe i am missing something, but, according to http://jsonlint.com/ , > > http://www.csociety.org/~kearneyd/tmp/purduepm_json_challenge_1.json > > is valid json ... > > > > > > > > On Mon, Apr 28, 2014 at 1:35 PM, derrick < derrick at csociety.org > > > wrote: > > > > > > Wow, I think I really messed this one up! > > > > I was working on the first part of the challenge problem this weekend > > and had a huge brain fart. I need your help to getting this sample > > json file cleaned up. > > > > In our last meeting we learned about the JSON file format. I created > > the sample json file I wanted to use for the first part of the > > challenge, but I accidentally mixed up some of values while I was > > writing the file. To make things worst, my favorite text editor > > mysteriously now opens json files in read only mode, so I can't just > > go in and fix it by hand (ugh, technology). > > > > I uploaded the file here: > > http://www.csociety.org/~ kearneyd/tmp/purduepm_json_ challenge_1.json > > > > While I sort things out with my system, if you have a bit of extra > > time, can you write a program that will do the following: > > > > 1) Read and Parse the JSON file. > > > > Read the json file into memory and parse it into data structures that > > best fit the programming language you are using. There are 6 data > > types you need to worry about: > > > > Primitive Types: > > * null > > * booleans > > * strings > > * numbers > > > > Structured Types: > > * arrays > > * objects > > > > More information about the json file format can be found here: > > http://json.org/ > > > > The file represents a dictionary, or hash table, or associative array. > > > > There is probably a library available in your programming language, > > you can use to quickly read and parse the file. The json.org website > > has a list of some libraries for popular programming languages. > > > > After parsing the file into your language's data structures, you > > should print the values stored in the data structures to stdout or > > another file to make sure you are reading the data properly. don't > > just print the file after reading it. > > > > > > 2) Fix the JSON file and write it back to disk. > > > > Here is where it gets tricky. Even though the json file was > > syntactically correct, I made some mistakes in the data that is stored > > in it. Here is a summary of what I wanted for each key in the > > dictionary : > > > > * null_value should be a json NULL or None value, not a string. > > * boolean_true should be a json true value, not false > > * boolean_false should be a json false value, not true > > * integer_number should be the integer representation of its current > > value, not the floating point representation (ie 3) > > * number_examples -> "not a number" should not even be in the > > dictionary, lets remove it. > > * in "array", the string "value5" should read "value4" to match "key4" > > > > Can you write a program to make these specific changes? Don't forget > > to comment your code. If you find an interesting way of addressing > > elements inside of the structure, please highlight that in your code. > > For example, how would you find the value for "key4" in the file? If > > there were multiple dictionary keys named "key4" in the file, how > > could you make sure you were addressing the correct one? > > > > The data in the outputted file should look something like like this: > > > > { > > "null_value": null, > > "boolean_true": true, > > "boolean_false": false, > > "string": "this is my string.", > > "integer_number": 3, > > "number_examples": { > > "positive integer": 9, > > "negative integer": -1, > > "float": 2.3, > > "positive_exponent": 4.35e+58, > > "negative_exponent": 4.3508e-93 > > }, > > "array": [true,null,["value3"],{"key4": "value4"}] > > } > > > > > > Note that the order of the keys (null_value, boolean_true, > > boolean_false, ...) does not matter since the pairs of a json object > > are unordered. > > > > > > We'll discuss how to perform these actions in the different > > programming languages people chose to use in the next meeting on May > > 20, 2014. > > > > Thanks, > > > > dsk > > > > > > > > On 04/15/2014 02:30 PM, Mark Senn wrote: > > > > > > > > > > Derrick Kearney is going to prepare some JSON and the following people > > will talk and/or write about how they read it with the following > > programming languages before or at the Purdue Perl Mongers meeting on > > May 20, 2014. Send email to markiest at purdue.edu (remove "iest" from > > the email address) with any corrections or additions to the below > > list. > > > > LANGUAGE WHO > > Mathematica Mark Senn > > Perl Dave Jacoby > > PHP Chris Orr > > pro Mark Senn > > Python Joe Kline > > Ruby Rick Westerman > > > > Mark Senn, Systems Programmer, Engineering Computer Network, Purdue > > University > > > > ______________________________ _________________ > > Purdue-pm mailing list > > Purdue-pm at pm.org > > http://mail.pm.org/mailman/ listinfo/purdue-pm > > > > > > _______________________________________________ > > Purdue-pm mailing list > > Purdue-pm at pm.org > > http://mail.pm.org/mailman/listinfo/purdue-pm > > -- > Rick Westerman > westerman at purdue.edu > > Bioinformatics specialist at the Genomics Facility. > Phone: (765) 494-0505 FAX: (765) 496-7255 > Department of Horticulture and Landscape Architecture > 625 Agriculture Mall Drive > West Lafayette, IN 47907-2010 > Physically located in room S049, WSLR building > -------------- next part -------------- An HTML attachment was scrubbed... URL: From gizmo at purdue.edu Mon Apr 28 12:46:52 2014 From: gizmo at purdue.edu (Joe Kline) Date: Mon, 28 Apr 2014 15:46:52 -0400 Subject: [Purdue-pm] reading JSON with different programming languages In-Reply-To: <535E9177.2040703@csociety.org> References: <24079.1397586627@pier.ecn.purdue.edu> <535E9177.2040703@csociety.org> Message-ID: <535EB02C.8070502@purdue.edu> -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Are we to write our own JSON parsers, or can we use the languages JSON parsers if it has one? Just asking since I wasn't at the meeting and such. Thanks, joe -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (GNU/Linux) Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iEYEARECAAYFAlNesCwACgkQb0mzA2gRTpmeYQCfdvI658XWuM2Pk0WpEDvAnhbF vYUAnRdKMtRD0KoT6ssTbDynxV0k0IXR =09NW -----END PGP SIGNATURE-----