Skip to content

Instantly share code, notes, and snippets.

@bryantp
Created August 16, 2013 17:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bryantp/6252018 to your computer and use it in GitHub Desktop.
Save bryantp/6252018 to your computer and use it in GitHub Desktop.
api.reddit.com/r/learnprogramming
{"kind": "Listing", "data": {"modhash": "n4a0dpx8yo65e7ed871aae57d3431fd7b9c9e1dda32f2d8122", "children": [{"kind": "t3", "data": {"domain": "self.learnprogramming", "banned_by": null, "media_embed": {}, "subreddit": "learnprogramming", "selftext_html": "<!-- SC_OFF --><div class=\"md\"><p>The website in question pulls information from our SAP system and brings it to a searchable format everyone on the network can access. We are a project based company so every morning I would like to run a report telling me where each project stands. This is my first project so I KNOW I sound like a noob, I'm just looking to be pointed in the right direction. Below is a screen shot of the UI <a href=\"http://i.imgur.com/uA42mDH.png\">http://i.imgur.com/uA42mDH.png</a></p>\n</div><!-- SC_ON -->", "selftext": "The website in question pulls information from our SAP system and brings it to a searchable format everyone on the network can access. We are a project based company so every morning I would like to run a report telling me where each project stands. This is my first project so I KNOW I sound like a noob, I'm just looking to be pointed in the right direction. Below is a screen shot of the UI http://i.imgur.com/uA42mDH.png", "likes": null, "link_flair_text": null, "id": "1khk7o", "clicked": false, "stickied": false, "title": "I'm wanting to run daily reports pulling data from a my companies intranet website...where do I begin.", "media": null, "score": 20, "approved_by": null, "over_18": false, "hidden": false, "thumbnail": "", "subreddit_id": "t5_2r7yd", "edited": false, "link_flair_css_class": null, "author_flair_css_class": null, "downs": 3, "saved": false, "is_self": true, "permalink": "/r/learnprogramming/comments/1khk7o/im_wanting_to_run_daily_reports_pulling_data_from/", "name": "t3_1khk7o", "created": 1376689971.0, "url": "http://www.reddit.com/r/learnprogramming/comments/1khk7o/im_wanting_to_run_daily_reports_pulling_data_from/", "author_flair_text": null, "author": "Infinityseed", "created_utc": 1376661171.0, "ups": 23, "num_comments": 6, "num_reports": null, "distinguished": null}}, {"kind": "t3", "data": {"domain": "self.learnprogramming", "banned_by": null, "media_embed": {}, "subreddit": "learnprogramming", "selftext_html": "<!-- SC_OFF --><div class=\"md\"><p>Any suggestions are appreciated.</p>\n</div><!-- SC_ON -->", "selftext": "Any suggestions are appreciated.", "likes": null, "link_flair_text": null, "id": "1khl6o", "clicked": false, "stickied": false, "title": "I just finished learning some HTML and CSS(and a little of javascript), what can I build for practice?", "media": null, "score": 20, "approved_by": null, "over_18": false, "hidden": false, "thumbnail": "", "subreddit_id": "t5_2r7yd", "edited": false, "link_flair_css_class": null, "author_flair_css_class": null, "downs": 4, "saved": false, "is_self": true, "permalink": "/r/learnprogramming/comments/1khl6o/i_just_finished_learning_some_html_and_cssand_a/", "name": "t3_1khl6o", "created": 1376690907.0, "url": "http://www.reddit.com/r/learnprogramming/comments/1khl6o/i_just_finished_learning_some_html_and_cssand_a/", "author_flair_text": null, "author": "TehCheesyOne", "created_utc": 1376662107.0, "ups": 24, "num_comments": 12, "num_reports": null, "distinguished": null}}, {"kind": "t3", "data": {"domain": "self.learnprogramming", "banned_by": null, "media_embed": {}, "subreddit": "learnprogramming", "selftext_html": "<!-- SC_OFF --><div class=\"md\"><p>Hello folks</p>\n\n<p>I'm making a 3D strategy RPG in Unity with C#. Currently I have completed creating a tiled map and the camera. Next I'm going to be creating objects on the map; player characters, npcs, chests/resource spots/whatever. I was wondering about the best way to store these objects.</p>\n\n<p>The main ways I was thinking are (a) storing all objects in a single array, (b) storing them in multiple arrays based on type (i.e. a pc array, enemy array, other npc array etc), or (c) storing them in a dictionary using their coordinates as a key (which is how I implemented the tiled map).</p>\n\n<p>With a dictionary, I would be able to check if there was already an object at a particular coordinate with O(1), but I would have the change the key of an object every time it moves, which doesn't seem good. However, using an array (or multiple arrays) would force me to iterate through the entire array if I want to check if there is something at a particular coordinate (or when doing it a lot, create a new array of occupied coordinates).</p>\n\n<p>Which would be the best method?</p>\n</div><!-- SC_ON -->", "selftext": "Hello folks\n\nI'm making a 3D strategy RPG in Unity with C#. Currently I have completed creating a tiled map and the camera. Next I'm going to be creating objects on the map; player characters, npcs, chests/resource spots/whatever. I was wondering about the best way to store these objects.\n\nThe main ways I was thinking are (a) storing all objects in a single array, (b) storing them in multiple arrays based on type (i.e. a pc array, enemy array, other npc array etc), or (c) storing them in a dictionary using their coordinates as a key (which is how I implemented the tiled map).\n\nWith a dictionary, I would be able to check if there was already an object at a particular coordinate with O(1), but I would have the change the key of an object every time it moves, which doesn't seem good. However, using an array (or multiple arrays) would force me to iterate through the entire array if I want to check if there is something at a particular coordinate (or when doing it a lot, create a new array of occupied coordinates).\n\nWhich would be the best method?", "likes": null, "link_flair_text": null, "id": "1khiap", "clicked": false, "stickied": false, "title": "[C# in Unity] Storing game objects in an array, dictionary or other", "media": null, "score": 14, "approved_by": null, "over_18": false, "hidden": false, "thumbnail": "", "subreddit_id": "t5_2r7yd", "edited": false, "link_flair_css_class": null, "author_flair_css_class": null, "downs": 3, "saved": false, "is_self": true, "permalink": "/r/learnprogramming/comments/1khiap/c_in_unity_storing_game_objects_in_an_array/", "name": "t3_1khiap", "created": 1376688009.0, "url": "http://www.reddit.com/r/learnprogramming/comments/1khiap/c_in_unity_storing_game_objects_in_an_array/", "author_flair_text": null, "author": "Kottamba", "created_utc": 1376659209.0, "ups": 17, "num_comments": 3, "num_reports": null, "distinguished": null}}, {"kind": "t3", "data": {"domain": "self.learnprogramming", "banned_by": null, "media_embed": {}, "subreddit": "learnprogramming", "selftext_html": "<!-- SC_OFF --><div class=\"md\"><p>One of the common questions we get from people is how we spend our time in our twelve week apprenticeship cohorts. While we have many labs and sample projects available to our apprentices, the best learning experiences are found by creating "breakable toys": applications that the apprentices choose that are aligned with their interests.</p>\n\n<p>Our current cohort has several members who have fallen in love with the card game Dominion, and so we decided it would be interesting to build a simple application to keep track of the dozens of card types for browsing and create a random card picker since you only play with ten types in a single game.</p>\n\n<p>Several of the apprentices challenged me to create some screencasts of how we went through the process and share it out so that potential applicants can get a glimpse into what our apprentices are capable of after 7 weeks of training. I agreed, and have started production on these videos.</p>\n\n<p>Whether you are an experienced developer who wants to see what C#, ASP.NET MVC4, and SQL Server bring to the table or a beginner who wants to see what it's like to build a minimum viable product, feel free to join us on our YouTube channel. The first set of videos is published, and the rest of the series is coming soon! Free, no registration required, hope you enjoy.</p>\n\n<p><a href=\"http://www.youtube.com/playlist?list=PLg6qLo5I5vnWGjWE-MjP1t_zzfAmKeTBa\">youtube playlist</a></p>\n</div><!-- SC_ON -->", "selftext": "One of the common questions we get from people is how we spend our time in our twelve week apprenticeship cohorts. While we have many labs and sample projects available to our apprentices, the best learning experiences are found by creating \"breakable toys\": applications that the apprentices choose that are aligned with their interests.\n\nOur current cohort has several members who have fallen in love with the card game Dominion, and so we decided it would be interesting to build a simple application to keep track of the dozens of card types for browsing and create a random card picker since you only play with ten types in a single game.\n\nSeveral of the apprentices challenged me to create some screencasts of how we went through the process and share it out so that potential applicants can get a glimpse into what our apprentices are capable of after 7 weeks of training. I agreed, and have started production on these videos.\n\nWhether you are an experienced developer who wants to see what C#, ASP.NET MVC4, and SQL Server bring to the table or a beginner who wants to see what it's like to build a minimum viable product, feel free to join us on our YouTube channel. The first set of videos is published, and the rest of the series is coming soon! Free, no registration required, hope you enjoy.\n\n[youtube playlist](http://www.youtube.com/playlist?list=PLg6qLo5I5vnWGjWE-MjP1t_zzfAmKeTBa)", "likes": null, "link_flair_text": null, "id": "1khmt6", "clicked": false, "stickied": false, "title": "Building a Web App With Software Craftsmanship Guild", "media": null, "score": 9, "approved_by": null, "over_18": false, "hidden": false, "thumbnail": "", "subreddit_id": "t5_2r7yd", "edited": false, "link_flair_css_class": null, "author_flair_css_class": null, "downs": 8, "saved": false, "is_self": true, "permalink": "/r/learnprogramming/comments/1khmt6/building_a_web_app_with_software_craftsmanship/", "name": "t3_1khmt6", "created": 1376692450.0, "url": "http://www.reddit.com/r/learnprogramming/comments/1khmt6/building_a_web_app_with_software_craftsmanship/", "author_flair_text": null, "author": "ericswc", "created_utc": 1376663650.0, "ups": 17, "num_comments": 0, "num_reports": null, "distinguished": null}}, {"kind": "t3", "data": {"domain": "self.learnprogramming", "banned_by": null, "media_embed": {}, "subreddit": "learnprogramming", "selftext_html": "<!-- SC_OFF --><div class=\"md\"><p>Greetings all, I'm a on-the-job/self taught sysadmin looking to complete a CS degree. The professor teaching the CS1 / Intro to Programming course this semester insists that given my background I should skip it and jump right into Data Structures (which isn't being taught this semester)...</p>\n\n<p>I feel modestly comfortable with perl, and cobble together examples to get things done in other languages... so sure I have a rudimentary understanding of programming basics, but I'd really like to start at the bottom with this formal curriculum to fill in any gaps, etc.</p>\n\n<p>I'm looking for any thoughts, opinions, criticism on the matter.</p>\n\n<p>Thanks in advance!</p>\n</div><!-- SC_ON -->", "selftext": "Greetings all, I'm a on-the-job/self taught sysadmin looking to complete a CS degree. The professor teaching the CS1 / Intro to Programming course this semester insists that given my background I should skip it and jump right into Data Structures (which isn't being taught this semester)...\n\nI feel modestly comfortable with perl, and cobble together examples to get things done in other languages... so sure I have a rudimentary understanding of programming basics, but I'd really like to start at the bottom with this formal curriculum to fill in any gaps, etc.\n\nI'm looking for any thoughts, opinions, criticism on the matter.\n\nThanks in advance!", "likes": null, "link_flair_text": null, "id": "1khnus", "clicked": false, "stickied": false, "title": "Sysadmin told by Computer Science professor to not bother with CS1 / Intro to Programming?", "media": null, "score": 10, "approved_by": null, "over_18": false, "hidden": false, "thumbnail": "", "subreddit_id": "t5_2r7yd", "edited": false, "link_flair_css_class": null, "author_flair_css_class": null, "downs": 3, "saved": false, "is_self": true, "permalink": "/r/learnprogramming/comments/1khnus/sysadmin_told_by_computer_science_professor_to/", "name": "t3_1khnus", "created": 1376693373.0, "url": "http://www.reddit.com/r/learnprogramming/comments/1khnus/sysadmin_told_by_computer_science_professor_to/", "author_flair_text": null, "author": "nihilistic_moose", "created_utc": 1376664573.0, "ups": 13, "num_comments": 11, "num_reports": null, "distinguished": null}}, {"kind": "t3", "data": {"domain": "self.learnprogramming", "banned_by": null, "media_embed": {}, "subreddit": "learnprogramming", "selftext_html": "<!-- SC_OFF --><div class=\"md\"><p><a href=\"http://ideone.com/y1wKB8\">http://ideone.com/y1wKB8</a></p>\n\n<p>i wrote this earlier and feel like a bad person. what exactly do you do when you need to look for a match between two vectors without nesting a million for loops? in my case i have a vector of a structure which ccontains a vector of strings... it gets deep.</p>\n\n<p>this was also my first attempt at playing with c++11 stuff... at least it's fun :(</p>\n</div><!-- SC_ON -->", "selftext": "http://ideone.com/y1wKB8\n\ni wrote this earlier and feel like a bad person. what exactly do you do when you need to look for a match between two vectors without nesting a million for loops? in my case i have a vector of a structure which ccontains a vector of strings... it gets deep.\n\nthis was also my first attempt at playing with c++11 stuff... at least it's fun :(", "likes": null, "link_flair_text": null, "id": "1khjgs", "clicked": false, "stickied": false, "title": "[c++11] alternative to nesting for loops for comparing vector elements?", "media": null, "score": 9, "approved_by": null, "over_18": false, "hidden": false, "thumbnail": "", "subreddit_id": "t5_2r7yd", "edited": false, "link_flair_css_class": null, "author_flair_css_class": null, "downs": 4, "saved": false, "is_self": true, "permalink": "/r/learnprogramming/comments/1khjgs/c11_alternative_to_nesting_for_loops_for/", "name": "t3_1khjgs", "created": 1376689234.0, "url": "http://www.reddit.com/r/learnprogramming/comments/1khjgs/c11_alternative_to_nesting_for_loops_for/", "author_flair_text": null, "author": "tehoreoz", "created_utc": 1376660434.0, "ups": 13, "num_comments": 5, "num_reports": null, "distinguished": null}}, {"kind": "t3", "data": {"domain": "self.learnprogramming", "banned_by": null, "media_embed": {}, "subreddit": "learnprogramming", "selftext_html": "<!-- SC_OFF --><div class=\"md\"><p>need help with a visual basic program for an assignment i'm doing basically i am creating a phone plan calculator in which i input data from the client and hit the calculate button to tell me average monthly cost, annual cost etc.</p>\n\n<p>the problem i have is that it also needs "A summary of the customer\u2019s selections, with each item that generates a cost being listed". the layout they want is 3 columns with the "item", "Value entered" and the "Cost"</p>\n\n<p>if anyone could help with that it would be great</p>\n</div><!-- SC_ON -->", "selftext": "need help with a visual basic program for an assignment i'm doing basically i am creating a phone plan calculator in which i input data from the client and hit the calculate button to tell me average monthly cost, annual cost etc.\n\nthe problem i have is that it also needs \"A summary of the customer\u2019s selections, with each item that generates a cost being listed\". the layout they want is 3 columns with the \"item\", \"Value entered\" and the \"Cost\"\n\nif anyone could help with that it would be great", "likes": null, "link_flair_text": null, "id": "1khi6a", "clicked": false, "stickied": false, "title": "(need help) displaying inputs after a button is clicked (VB)", "media": null, "score": 8, "approved_by": null, "over_18": false, "hidden": false, "thumbnail": "", "subreddit_id": "t5_2r7yd", "edited": false, "link_flair_css_class": null, "author_flair_css_class": null, "downs": 3, "saved": false, "is_self": true, "permalink": "/r/learnprogramming/comments/1khi6a/need_help_displaying_inputs_after_a_button_is/", "name": "t3_1khi6a", "created": 1376687868.0, "url": "http://www.reddit.com/r/learnprogramming/comments/1khi6a/need_help_displaying_inputs_after_a_button_is/", "author_flair_text": null, "author": "Drakthull", "created_utc": 1376659068.0, "ups": 11, "num_comments": 4, "num_reports": null, "distinguished": null}}, {"kind": "t3", "data": {"domain": "self.learnprogramming", "banned_by": null, "media_embed": {}, "subreddit": "learnprogramming", "selftext_html": "<!-- SC_OFF --><div class=\"md\"><p>I just started learning c# after spending some time with python (it's awesome btw) and so far i made an mp3 downloader with a player built-in and a bad clone of win7 calculator before that. It was very fun to do but i am stuck now. Problem is i dont know what to do next. Do you guys have any suggestions? I really don't care what the project is as long as its useful to someone.</p>\n\n<p>Any help very much appreciated.</p>\n\n<p>About the mp3 downloader: It has language support (english and turkish) and you can search a song and select it to be downloaded, after that you can see all the downloaded files and play one. I'm really proud of it as a beginner since it's my first useful program, i would like to share it and get opinions but it can be considered as "pirate" so if it's okay in here ill post it. Thanks!</p>\n\n<p>Oh btw i don't know anything about threading and socket programming stuff. Projects including these would be very helpful :)</p>\n</div><!-- SC_ON -->", "selftext": "I just started learning c# after spending some time with python (it's awesome btw) and so far i made an mp3 downloader with a player built-in and a bad clone of win7 calculator before that. It was very fun to do but i am stuck now. Problem is i dont know what to do next. Do you guys have any suggestions? I really don't care what the project is as long as its useful to someone.\n\nAny help very much appreciated.\n\nAbout the mp3 downloader: It has language support (english and turkish) and you can search a song and select it to be downloaded, after that you can see all the downloaded files and play one. I'm really proud of it as a beginner since it's my first useful program, i would like to share it and get opinions but it can be considered as \"pirate\" so if it's okay in here ill post it. Thanks!\n\nOh btw i don't know anything about threading and socket programming stuff. Projects including these would be very helpful :)", "likes": null, "link_flair_text": null, "id": "1khi2e", "clicked": false, "stickied": false, "title": "[Question][C#] Fun projects for beginners", "media": null, "score": 9, "approved_by": null, "over_18": false, "hidden": false, "thumbnail": "", "subreddit_id": "t5_2r7yd", "edited": false, "link_flair_css_class": null, "author_flair_css_class": null, "downs": 5, "saved": false, "is_self": true, "permalink": "/r/learnprogramming/comments/1khi2e/questionc_fun_projects_for_beginners/", "name": "t3_1khi2e", "created": 1376687757.0, "url": "http://www.reddit.com/r/learnprogramming/comments/1khi2e/questionc_fun_projects_for_beginners/", "author_flair_text": null, "author": "cagdassalur", "created_utc": 1376658957.0, "ups": 14, "num_comments": 6, "num_reports": null, "distinguished": null}}, {"kind": "t3", "data": {"domain": "self.learnprogramming", "banned_by": null, "media_embed": {}, "subreddit": "learnprogramming", "selftext_html": "<!-- SC_OFF --><div class=\"md\"><p>Hello everyone!</p>\n\n<p>I've tried searching the sub for materials related to cross-platform development between ipad and andriod tablets but I came up empty-handed, so I hoped someone around could be able to help answer my question.</p>\n\n<p><strong>What I'm trying to achieve</strong></p>\n\n<p>I want to make a small scheduler-type application that is compatible with both android and ipad, which will synchronize tasks across a server / database and share them among all users.</p>\n\n<p><strong>What would be ideal</strong></p>\n\n<p>A platform-agnostic method so that one solution "app" can be used by both ipad users and android users. I've spoken to a friend about this and he made comment about html5/javascript but didn't know any details. If anyone has any resources, even pointing me towards the right direction that would be very appreciated</p>\n\n<p>Thank you for your time, and thank you for reading.</p>\n</div><!-- SC_ON -->", "selftext": "Hello everyone!\n\nI've tried searching the sub for materials related to cross-platform development between ipad and andriod tablets but I came up empty-handed, so I hoped someone around could be able to help answer my question.\n\n**What I'm trying to achieve**\n\nI want to make a small scheduler-type application that is compatible with both android and ipad, which will synchronize tasks across a server / database and share them among all users.\n\n**What would be ideal**\n\nA platform-agnostic method so that one solution \"app\" can be used by both ipad users and android users. I've spoken to a friend about this and he made comment about html5/javascript but didn't know any details. If anyone has any resources, even pointing me towards the right direction that would be very appreciated\n\nThank you for your time, and thank you for reading.", "likes": null, "link_flair_text": null, "id": "1khhyw", "clicked": false, "stickied": false, "title": "x-platform for ipad / android tablets?", "media": null, "score": 8, "approved_by": null, "over_18": false, "hidden": false, "thumbnail": "", "subreddit_id": "t5_2r7yd", "edited": false, "link_flair_css_class": null, "author_flair_css_class": null, "downs": 4, "saved": false, "is_self": true, "permalink": "/r/learnprogramming/comments/1khhyw/xplatform_for_ipad_android_tablets/", "name": "t3_1khhyw", "created": 1376687644.0, "url": "http://www.reddit.com/r/learnprogramming/comments/1khhyw/xplatform_for_ipad_android_tablets/", "author_flair_text": null, "author": "HexByte", "created_utc": 1376658844.0, "ups": 12, "num_comments": 1, "num_reports": null, "distinguished": null}}, {"kind": "t3", "data": {"domain": "self.learnprogramming", "banned_by": null, "media_embed": {}, "subreddit": "learnprogramming", "selftext_html": "<!-- SC_OFF --><div class=\"md\"><p>I'm thinking about making a change to a project that I'm on. I want to switch from knockoutjs and jqwidgets to BreezeJs and AngularJs (ng-grid is nice and much more concise than jqxgrid). I don't know if this will be viable in the time frame I have to finish the project. However I do think in the long run I want to make these changes. </p>\n\n<p>I have the project setup in GitHub for source control. What I need to know is, is it better to create a new branch and make my changes in the branch or should I fork the project and make my changes there?</p>\n\n<p>Thanks!</p>\n</div><!-- SC_ON -->", "selftext": "I'm thinking about making a change to a project that I'm on. I want to switch from knockoutjs and jqwidgets to BreezeJs and AngularJs (ng-grid is nice and much more concise than jqxgrid). I don't know if this will be viable in the time frame I have to finish the project. However I do think in the long run I want to make these changes. \n\nI have the project setup in GitHub for source control. What I need to know is, is it better to create a new branch and make my changes in the branch or should I fork the project and make my changes there?\n\nThanks!", "likes": null, "link_flair_text": null, "id": "1khq2e", "clicked": false, "stickied": false, "title": "GitHub - Should I Branch or Fork?", "media": null, "score": 4, "approved_by": null, "over_18": false, "hidden": false, "thumbnail": "", "subreddit_id": "t5_2r7yd", "edited": false, "link_flair_css_class": null, "author_flair_css_class": null, "downs": 3, "saved": false, "is_self": true, "permalink": "/r/learnprogramming/comments/1khq2e/github_should_i_branch_or_fork/", "name": "t3_1khq2e", "created": 1376695301.0, "url": "http://www.reddit.com/r/learnprogramming/comments/1khq2e/github_should_i_branch_or_fork/", "author_flair_text": null, "author": "Drfiasco", "created_utc": 1376666501.0, "ups": 7, "num_comments": 2, "num_reports": null, "distinguished": null}}, {"kind": "t3", "data": {"domain": "self.learnprogramming", "banned_by": null, "media_embed": {}, "subreddit": "learnprogramming", "selftext_html": "<!-- SC_OFF --><div class=\"md\"><p>Hi!</p>\n\n<p>It seems that the general consensus is that bcrypt is a great algorithm for storing passwords, simply because it's so slow, making brute-forcing unfeasible.</p>\n\n<p>However, wouldn't it be very taxing if you run a well-trafficked website having to translate passwords into hashes a lot? Or is this a negligible cost?</p>\n\n<p>Thanks!</p>\n</div><!-- SC_ON -->", "selftext": "Hi!\n\nIt seems that the general consensus is that bcrypt is a great algorithm for storing passwords, simply because it's so slow, making brute-forcing unfeasible.\n\nHowever, wouldn't it be very taxing if you run a well-trafficked website having to translate passwords into hashes a lot? Or is this a negligible cost?\n\nThanks!", "likes": null, "link_flair_text": null, "id": "1khlmp", "clicked": false, "stickied": false, "title": "[Security] cost of bcrypt", "media": null, "score": 8, "approved_by": null, "over_18": false, "hidden": false, "thumbnail": "", "subreddit_id": "t5_2r7yd", "edited": false, "link_flair_css_class": null, "author_flair_css_class": null, "downs": 4, "saved": false, "is_self": true, "permalink": "/r/learnprogramming/comments/1khlmp/security_cost_of_bcrypt/", "name": "t3_1khlmp", "created": 1376691364.0, "url": "http://www.reddit.com/r/learnprogramming/comments/1khlmp/security_cost_of_bcrypt/", "author_flair_text": null, "author": "ansc", "created_utc": 1376662564.0, "ups": 12, "num_comments": 2, "num_reports": null, "distinguished": null}}, {"kind": "t3", "data": {"domain": "self.learnprogramming", "banned_by": null, "media_embed": {}, "subreddit": "learnprogramming", "selftext_html": "<!-- SC_OFF --><div class=\"md\"><p><strong>Answer in comments</strong></p>\n\n<p><a href=\"http://jsfiddle.net/bjKX7/\">JSFiddle Here</a></p>\n\n<p>I'm trying to write a re-usable function for a form that could have a variable amount of inputs and has jQuery to validate whether the inputs have a value or not. Therefore I'm using a loop to count through all the inputs in a fieldset and marks their labels as required if the input is empty.</p>\n\n<p>Then if all of the inputs have a value, go ahead and go to the next fieldset.</p>\n\n<p>The trouble I'm having is saying "Do each of the arrays positions have a value? If so move forward." Instead what I'm getting is "Do any of the arrays positions have a value? If so move forward."</p>\n\n<p>I'm unaware of how to do this differently so any input would be greatly appreciated. </p>\n</div><!-- SC_ON -->", "selftext": "**Answer in comments**\n\n[JSFiddle Here](http://jsfiddle.net/bjKX7/)\n\nI'm trying to write a re-usable function for a form that could have a variable amount of inputs and has jQuery to validate whether the inputs have a value or not. Therefore I'm using a loop to count through all the inputs in a fieldset and marks their labels as required if the input is empty.\n\nThen if all of the inputs have a value, go ahead and go to the next fieldset.\n\nThe trouble I'm having is saying \"Do each of the arrays positions have a value? If so move forward.\" Instead what I'm getting is \"Do any of the arrays positions have a value? If so move forward.\"\n\nI'm unaware of how to do this differently so any input would be greatly appreciated. ", "likes": null, "link_flair_text": null, "id": "1khpi1", "clicked": false, "stickied": false, "title": "Having issues stopping the loop at the correct place.", "media": null, "score": 3, "approved_by": null, "over_18": false, "hidden": false, "thumbnail": "", "subreddit_id": "t5_2r7yd", "edited": 1376673003.0, "link_flair_css_class": null, "author_flair_css_class": null, "downs": 2, "saved": false, "is_self": true, "permalink": "/r/learnprogramming/comments/1khpi1/having_issues_stopping_the_loop_at_the_correct/", "name": "t3_1khpi1", "created": 1376694808.0, "url": "http://www.reddit.com/r/learnprogramming/comments/1khpi1/having_issues_stopping_the_loop_at_the_correct/", "author_flair_text": null, "author": "tommyschoolbruh", "created_utc": 1376666008.0, "ups": 5, "num_comments": 5, "num_reports": null, "distinguished": null}}, {"kind": "t3", "data": {"domain": "self.learnprogramming", "banned_by": null, "media_embed": {}, "subreddit": "learnprogramming", "selftext_html": "<!-- SC_OFF --><div class=\"md\"><p>I'm using the java CDT. I just downloaded it and got it all set up. I'm trying to run a hello world program. The code is... </p>\n\n<h1>include <iostream></h1>\n\n<p>using namespace std;</p>\n\n<p>int main() {<br/>\n cout << "Hello World" << endl;<br/>\n return 0;<br/>\n}</p>\n\n<p>When I run it, the console doesnt say "Hello World" unless I'm running it in debug mode and set a break point at return 0;. Is my program supposed to be terminating without even letting me see what is printed in the console? </p>\n\n<p>EDIT: I found a solution to the problem. I had to add "linker flags" to minGW. project properties > C/C++ Build > Settings > MinGW C++ Linker > Misc then added the text -static-libgcc -static-libstdc++ to it. I'm glad I got it to work, but I don't understand why I needed to do this.</p>\n</div><!-- SC_ON -->", "selftext": "I'm using the java CDT. I just downloaded it and got it all set up. I'm trying to run a hello world program. The code is... \n \n \n\n#include <iostream>\nusing namespace std;\n\nint main() { \n\tcout << \"Hello World\" << endl; \n\treturn 0; \n}\n \nWhen I run it, the console doesnt say \"Hello World\" unless I'm running it in debug mode and set a break point at return 0;. Is my program supposed to be terminating without even letting me see what is printed in the console? \n \nEDIT: I found a solution to the problem. I had to add \"linker flags\" to minGW. project properties > C/C++ Build > Settings > MinGW C++ Linker > Misc then added the text -static-libgcc -static-libstdc++ to it. I'm glad I got it to work, but I don't understand why I needed to do this.", "likes": null, "link_flair_text": null, "id": "1kgj9x", "clicked": false, "stickied": false, "title": "Newbie C++ question", "media": null, "score": 54, "approved_by": null, "over_18": false, "hidden": false, "thumbnail": "", "subreddit_id": "t5_2r7yd", "edited": 1376617468.0, "link_flair_css_class": null, "author_flair_css_class": null, "downs": 8, "saved": false, "is_self": true, "permalink": "/r/learnprogramming/comments/1kgj9x/newbie_c_question/", "name": "t3_1kgj9x", "created": 1376644941.0, "url": "http://www.reddit.com/r/learnprogramming/comments/1kgj9x/newbie_c_question/", "author_flair_text": null, "author": "DesertOTReal", "created_utc": 1376616141.0, "ups": 62, "num_comments": 23, "num_reports": null, "distinguished": null}}, {"kind": "t3", "data": {"domain": "self.learnprogramming", "banned_by": null, "media_embed": {}, "subreddit": "learnprogramming", "selftext_html": "<!-- SC_OFF --><div class=\"md\"><p>I have a crap job and I want to learn everything so I can go into web development html5 java script php etc... </p>\n\n<p>I learn best by brief explanation of what something does then an example or two then give me problems to solve programs to write fix the error etc... </p>\n\n<p>Also what else should I learn I've heard that ruby is good to learn but not necessary</p>\n</div><!-- SC_ON -->", "selftext": "I have a crap job and I want to learn everything so I can go into web development html5 java script php etc... \n\nI learn best by brief explanation of what something does then an example or two then give me problems to solve programs to write fix the error etc... \n\nAlso what else should I learn I've heard that ruby is good to learn but not necessary", "likes": null, "link_flair_text": null, "id": "1kgmnt", "clicked": false, "stickied": false, "title": "learn web development", "media": null, "score": 35, "approved_by": null, "over_18": false, "hidden": false, "thumbnail": "", "subreddit_id": "t5_2r7yd", "edited": false, "link_flair_css_class": null, "author_flair_css_class": null, "downs": 11, "saved": false, "is_self": true, "permalink": "/r/learnprogramming/comments/1kgmnt/learn_web_development/", "name": "t3_1kgmnt", "created": 1376647741.0, "url": "http://www.reddit.com/r/learnprogramming/comments/1kgmnt/learn_web_development/", "author_flair_text": null, "author": "the_guy1", "created_utc": 1376618941.0, "ups": 46, "num_comments": 13, "num_reports": null, "distinguished": null}}, {"kind": "t3", "data": {"domain": "self.learnprogramming", "banned_by": null, "media_embed": {}, "subreddit": "learnprogramming", "selftext_html": "<!-- SC_OFF --><div class=\"md\"><p>I figure I should start using one since it's becoming pretty standard.</p>\n\n<p>To my understanding it's just source control right? So it's an online place to store your code which you can version/update/pull?</p>\n\n<p>But others can see your code?</p>\n\n<p>If i'm wrong, do correct me.</p>\n</div><!-- SC_ON -->", "selftext": "I figure I should start using one since it's becoming pretty standard.\n\nTo my understanding it's just source control right? So it's an online place to store your code which you can version/update/pull?\n\nBut others can see your code?\n\nIf i'm wrong, do correct me.", "likes": null, "link_flair_text": null, "id": "1kgni7", "clicked": false, "stickied": false, "title": "Never used GitHub or any sort of subversion system, is GitHub the best one?", "media": null, "score": 28, "approved_by": null, "over_18": false, "hidden": false, "thumbnail": "", "subreddit_id": "t5_2r7yd", "edited": false, "link_flair_css_class": null, "author_flair_css_class": null, "downs": 8, "saved": false, "is_self": true, "permalink": "/r/learnprogramming/comments/1kgni7/never_used_github_or_any_sort_of_subversion/", "name": "t3_1kgni7", "created": 1376648492.0, "url": "http://www.reddit.com/r/learnprogramming/comments/1kgni7/never_used_github_or_any_sort_of_subversion/", "author_flair_text": null, "author": "bustyLaserCannon", "created_utc": 1376619692.0, "ups": 36, "num_comments": 16, "num_reports": null, "distinguished": null}}, {"kind": "t3", "data": {"domain": "self.learnprogramming", "banned_by": null, "media_embed": {}, "subreddit": "learnprogramming", "selftext_html": "<!-- SC_OFF --><div class=\"md\"><p>Hi, I was wondering if anyone could help me find a tutorial to get News Results from one of the major search engines legally in a data format. I assume there should be an API for this?</p>\n</div><!-- SC_ON -->", "selftext": "Hi, I was wondering if anyone could help me find a tutorial to get News Results from one of the major search engines legally in a data format. I assume there should be an API for this?", "likes": null, "link_flair_text": null, "id": "1kglzn", "clicked": false, "stickied": false, "title": "[Python/API] API for getting search results from Bing, Google, Yahoo?", "media": null, "score": 30, "approved_by": null, "over_18": false, "hidden": false, "thumbnail": "", "subreddit_id": "t5_2r7yd", "edited": false, "link_flair_css_class": null, "author_flair_css_class": null, "downs": 6, "saved": false, "is_self": true, "permalink": "/r/learnprogramming/comments/1kglzn/pythonapi_api_for_getting_search_results_from/", "name": "t3_1kglzn", "created": 1376647178.0, "url": "http://www.reddit.com/r/learnprogramming/comments/1kglzn/pythonapi_api_for_getting_search_results_from/", "author_flair_text": null, "author": "piptook", "created_utc": 1376618378.0, "ups": 36, "num_comments": 7, "num_reports": null, "distinguished": null}}, {"kind": "t3", "data": {"domain": "self.learnprogramming", "banned_by": null, "media_embed": {}, "subreddit": "learnprogramming", "selftext_html": "<!-- SC_OFF --><div class=\"md\"><p>The sdl tutorials around the net are great. However, I'd rather start with 2 since it seems so much better. The TwinklebearDev tutorials are a little bare, although decent. I've learned some from that. Is there any other good ways to learn a library like this?</p>\n</div><!-- SC_ON -->", "selftext": "The sdl tutorials around the net are great. However, I'd rather start with 2 since it seems so much better. The TwinklebearDev tutorials are a little bare, although decent. I've learned some from that. Is there any other good ways to learn a library like this?", "likes": null, "link_flair_text": null, "id": "1kgliq", "clicked": false, "stickied": false, "title": "[C++] What is the best way to learn SDL2 without having known SDL 1.2?", "media": null, "score": 25, "approved_by": null, "over_18": false, "hidden": false, "thumbnail": "", "subreddit_id": "t5_2r7yd", "edited": false, "link_flair_css_class": null, "author_flair_css_class": null, "downs": 6, "saved": false, "is_self": true, "permalink": "/r/learnprogramming/comments/1kgliq/c_what_is_the_best_way_to_learn_sdl2_without/", "name": "t3_1kgliq", "created": 1376646766.0, "url": "http://www.reddit.com/r/learnprogramming/comments/1kgliq/c_what_is_the_best_way_to_learn_sdl2_without/", "author_flair_text": null, "author": "LiteralGuy", "created_utc": 1376617966.0, "ups": 31, "num_comments": 6, "num_reports": null, "distinguished": null}}, {"kind": "t3", "data": {"domain": "self.learnprogramming", "banned_by": null, "media_embed": {}, "subreddit": "learnprogramming", "selftext_html": "<!-- SC_OFF --><div class=\"md\"><p>I have no idea how to make a useful program. I know how to cin and cout to make a program in the command prompt that maybe says something like "Hello World!" or can do a simple text program that can solve a math question. But now, I want to develop my own Music player program, (something like Itunes, or MediaMonkey) but have no idea how to make my own interface appear, or make a file play. Where can i go to learn commands in c++, like how to actually get a program to do somethin. Starting to learn the language but now i feel stuck.</p>\n</div><!-- SC_ON -->", "selftext": "I have no idea how to make a useful program. I know how to cin and cout to make a program in the command prompt that maybe says something like \"Hello World!\" or can do a simple text program that can solve a math question. But now, I want to develop my own Music player program, (something like Itunes, or MediaMonkey) but have no idea how to make my own interface appear, or make a file play. Where can i go to learn commands in c++, like how to actually get a program to do somethin. Starting to learn the language but now i feel stuck.", "likes": null, "link_flair_text": null, "id": "1kgn0o", "clicked": false, "stickied": false, "title": "Understand how C++ works (writing code) but...", "media": null, "score": 23, "approved_by": null, "over_18": false, "hidden": false, "thumbnail": "", "subreddit_id": "t5_2r7yd", "edited": false, "link_flair_css_class": null, "author_flair_css_class": null, "downs": 10, "saved": false, "is_self": true, "permalink": "/r/learnprogramming/comments/1kgn0o/understand_how_c_works_writing_code_but/", "name": "t3_1kgn0o", "created": 1376648040.0, "url": "http://www.reddit.com/r/learnprogramming/comments/1kgn0o/understand_how_c_works_writing_code_but/", "author_flair_text": null, "author": "Phoyze", "created_utc": 1376619240.0, "ups": 33, "num_comments": 19, "num_reports": null, "distinguished": null}}, {"kind": "t3", "data": {"domain": "self.learnprogramming", "banned_by": null, "media_embed": {}, "subreddit": "learnprogramming", "selftext_html": null, "selftext": "", "likes": null, "link_flair_text": null, "id": "1kga0s", "clicked": false, "stickied": false, "title": "Looking for a good IDE to code Java, preferably for OS X, but Windows works as well", "media": null, "score": 31, "approved_by": null, "over_18": false, "hidden": false, "thumbnail": "", "subreddit_id": "t5_2r7yd", "edited": false, "link_flair_css_class": null, "author_flair_css_class": null, "downs": 12, "saved": false, "is_self": true, "permalink": "/r/learnprogramming/comments/1kga0s/looking_for_a_good_ide_to_code_java_preferably/", "name": "t3_1kga0s", "created": 1376637139.0, "url": "http://www.reddit.com/r/learnprogramming/comments/1kga0s/looking_for_a_good_ide_to_code_java_preferably/", "author_flair_text": null, "author": "Xenzzyx", "created_utc": 1376608339.0, "ups": 43, "num_comments": 34, "num_reports": null, "distinguished": null}}, {"kind": "t3", "data": {"domain": "self.learnprogramming", "banned_by": null, "media_embed": {}, "subreddit": "learnprogramming", "selftext_html": "<!-- SC_OFF --><div class=\"md\"><p>I'm parsing xml file that looks like this:</p>\n\n<pre><code><posts> \n <row Id="1" Title="abc" Body="abc" />\n <row Id="2" Title="xyz" />\n</posts>\n</code></pre>\n\n<p>I'm parsing the XML file and saving the data in MySQL database. The <strong>body attribute contains HTML text</strong>, so I am using MySQLdb.escape_string() to escape the text before inserting it in database.</p>\n\n<p>Code excerpt:</p>\n\n<pre><code>tree = xml.parse("post.xml")\nrow = tree.findall("row")\n\nfor i in row:\n p_id = i.attrib.get("Id")\n title = i.attrib.get("Title")\n body = i.attrib.get("Body")\n\n if body != "" :\n query = """INSERT IGNORE INTO post (post_id, title, body)\n VALUES ('%s', '%s', '%s') """, (p_id, title, MySQLdb.escape_string(body))\n</code></pre>\n\n<p>The problem is when the row doesn't contain any attribute, then it returns 'None' and it gives following error:</p>\n\n<pre><code>... MySQLdb.escape_string(body)....\nTypeError: must be string or read-only buffer, not None\n</code></pre>\n\n<p>I tried using If statement to find null value, but it doesn't work. I know it is a simple problem but I can't get around it.</p>\n\n<p>Any help and suggestion will be appreciated. Thanks in advance!</p>\n</div><!-- SC_ON -->", "selftext": "I'm parsing xml file that looks like this:\n\n <posts> \n <row Id=\"1\" Title=\"abc\" Body=\"abc\" />\n <row Id=\"2\" Title=\"xyz\" />\n </posts>\n\nI'm parsing the XML file and saving the data in MySQL database. The **body attribute contains HTML text**, so I am using MySQLdb.escape_string() to escape the text before inserting it in database.\n\nCode excerpt:\n\n tree = xml.parse(\"post.xml\")\n row = tree.findall(\"row\")\n\n for i in row:\n p_id = i.attrib.get(\"Id\")\n title = i.attrib.get(\"Title\")\n body = i.attrib.get(\"Body\")\n \n if body != \"\" :\n query = \"\"\"INSERT IGNORE INTO post (post_id, title, body)\n VALUES ('%s', '%s', '%s') \"\"\", (p_id, title, MySQLdb.escape_string(body))\n\nThe problem is when the row doesn't contain any attribute, then it returns 'None' and it gives following error:\n\n ... MySQLdb.escape_string(body)....\n TypeError: must be string or read-only buffer, not None\n\nI tried using If statement to find null value, but it doesn't work. I know it is a simple problem but I can't get around it.\n\nAny help and suggestion will be appreciated. Thanks in advance!", "likes": null, "link_flair_text": null, "id": "1khydk", "clicked": false, "stickied": false, "title": "[Python, MySQL] Problem parsing XML file where attribute doesn't exist", "media": null, "score": 0, "approved_by": null, "over_18": false, "hidden": false, "thumbnail": "", "subreddit_id": "t5_2r7yd", "edited": false, "link_flair_css_class": null, "author_flair_css_class": null, "downs": 1, "saved": false, "is_self": true, "permalink": "/r/learnprogramming/comments/1khydk/python_mysql_problem_parsing_xml_file_where/", "name": "t3_1khydk", "created": 1376701982.0, "url": "http://www.reddit.com/r/learnprogramming/comments/1khydk/python_mysql_problem_parsing_xml_file_where/", "author_flair_text": null, "author": "sav3mys0ul", "created_utc": 1376673182.0, "ups": 1, "num_comments": 0, "num_reports": null, "distinguished": null}}, {"kind": "t3", "data": {"domain": "self.learnprogramming", "banned_by": null, "media_embed": {}, "subreddit": "learnprogramming", "selftext_html": "<!-- SC_OFF --><div class=\"md\"><p>So, if I have a website that needs login functionality but only have one user, would it be feasible to simply hardcode the credentials within my PHP login script?</p>\n</div><!-- SC_ON -->", "selftext": "So, if I have a website that needs login functionality but only have one user, would it be feasible to simply hardcode the credentials within my PHP login script?", "likes": null, "link_flair_text": null, "id": "1khy11", "clicked": false, "stickied": false, "title": "Quick PHP question.", "media": null, "score": 0, "approved_by": null, "over_18": false, "hidden": false, "thumbnail": "", "subreddit_id": "t5_2r7yd", "edited": false, "link_flair_css_class": null, "author_flair_css_class": null, "downs": 1, "saved": false, "is_self": true, "permalink": "/r/learnprogramming/comments/1khy11/quick_php_question/", "name": "t3_1khy11", "created": 1376701696.0, "url": "http://www.reddit.com/r/learnprogramming/comments/1khy11/quick_php_question/", "author_flair_text": null, "author": "fucking_leverpostej", "created_utc": 1376672896.0, "ups": 1, "num_comments": 0, "num_reports": null, "distinguished": null}}, {"kind": "t3", "data": {"domain": "self.learnprogramming", "banned_by": null, "media_embed": {}, "subreddit": "learnprogramming", "selftext_html": "<!-- SC_OFF --><div class=\"md\"><p>I'm trying to determine if new programmers are interested in understanding how microprocessors work? The internal operations... how it converts assembly language code into moving bits.</p>\n\n<p>I've been programming for over 20 years and there were many times that my microprocessor knowledge helped me. On the other hand, many developers know very little about them and still do fine. I feel the more you know the better but what do you think?</p>\n\n<p>I'm developing a video course on microprocessor operations and architecture aimed at those without any electronics background and I'm trying to get a feel for the audience. What do you want to know?</p>\n</div><!-- SC_ON -->", "selftext": "I'm trying to determine if new programmers are interested in understanding how microprocessors work? The internal operations... how it converts assembly language code into moving bits.\n\nI've been programming for over 20 years and there were many times that my microprocessor knowledge helped me. On the other hand, many developers know very little about them and still do fine. I feel the more you know the better but what do you think?\n\nI'm developing a video course on microprocessor operations and architecture aimed at those without any electronics background and I'm trying to get a feel for the audience. What do you want to know?", "likes": null, "link_flair_text": null, "id": "1khudw", "clicked": false, "stickied": false, "title": "Is understanding microprocessors important to you?", "media": null, "score": 0, "approved_by": null, "over_18": false, "hidden": false, "thumbnail": "", "subreddit_id": "t5_2r7yd", "edited": false, "link_flair_css_class": null, "author_flair_css_class": null, "downs": 2, "saved": false, "is_self": true, "permalink": "/r/learnprogramming/comments/1khudw/is_understanding_microprocessors_important_to_you/", "name": "t3_1khudw", "created": 1376698782.0, "url": "http://www.reddit.com/r/learnprogramming/comments/1khudw/is_understanding_microprocessors_important_to_you/", "author_flair_text": null, "author": "knife_sharpener", "created_utc": 1376669982.0, "ups": 2, "num_comments": 1, "num_reports": null, "distinguished": null}}, {"kind": "t3", "data": {"domain": "self.learnprogramming", "banned_by": null, "media_embed": {}, "subreddit": "learnprogramming", "selftext_html": "<!-- SC_OFF --><div class=\"md\"><p>So far comp sci related courses I have taken are intro to java and data structures. In the fall i am planning on finishing the three part java course for the major, taking algoritms, a multimedia course, and a computers sculpture course</p>\n</div><!-- SC_ON -->", "selftext": "So far comp sci related courses I have taken are intro to java and data structures. In the fall i am planning on finishing the three part java course for the major, taking algoritms, a multimedia course, and a computers sculpture course", "likes": null, "link_flair_text": null, "id": "1kgcm6", "clicked": false, "stickied": false, "title": "What companies can I apply to for a winter computer science Internship as just a new comp sci major, in the NYC area preferably, anywhere else is ok too", "media": null, "score": 22, "approved_by": null, "over_18": false, "hidden": false, "thumbnail": "", "subreddit_id": "t5_2r7yd", "edited": false, "link_flair_css_class": null, "author_flair_css_class": null, "downs": 7, "saved": false, "is_self": true, "permalink": "/r/learnprogramming/comments/1kgcm6/what_companies_can_i_apply_to_for_a_winter/", "name": "t3_1kgcm6", "created": 1376639241.0, "url": "http://www.reddit.com/r/learnprogramming/comments/1kgcm6/what_companies_can_i_apply_to_for_a_winter/", "author_flair_text": null, "author": "hungrynow", "created_utc": 1376610441.0, "ups": 29, "num_comments": 3, "num_reports": null, "distinguished": null}}, {"kind": "t3", "data": {"domain": "self.learnprogramming", "banned_by": null, "media_embed": {}, "subreddit": "learnprogramming", "selftext_html": "<!-- SC_OFF --><div class=\"md\"><p><em>Edit:</em> I think I am going about this wrong.</p>\n\n<p>I'm thinking if I turn the radio button into a response to be clicked, ie:</p>\n\n<p><button id="1a" onclick="return handleClick();" type="submit">(A)</button></p>\n\n<p>and had text appear next to the option, it would be simpler to code. But I seem to be stuck.</p>\n\n<p>How can I make text appear in a location on the page when a button is clicked? I'd need it to where that button is local to the text, or I do not want one button click to reveal all of the hidden text on the page.</p>\n\n<p>I cut the code short for size sake:</p>\n\n<p><script language ="Javascript"></p>\n\n<p>function handleClick()\n { </p>\n\n<p>var amountCorrect = 0; </p>\n\n<p>for(var i = 1; i <= 20; i++) {</p>\n\n<p>var radios = document.getElementsByName('group'+i);</p>\n\n<p>for(var j = 0; j < radios.length; j++) {</p>\n\n<pre><code>var radio = radios[j];\n\nif(radio.value == "correct" && radio.checked) {\n\n amountCorrect++;\n\n}\n</code></pre>\n\n<p>}\n }<br/>\n alert("Percent Correct: " + amountCorrect/20 );</p>\n\n<pre><code>alert("Highlight above submit button for answers. Hit the back button when done." );\n</code></pre>\n\n<p>}\n </script>\n</head></p>\n\n<p><body>\n<form name="quiz" method="post" name="buttons" id="quiz" onsubmit="return false">\n<br></p>\n\n<p>DIRECTIONS: Select the best version of the underlined part of the sentence. There is a choice that is the same as the original sentence. If you think the original sentence is best, pick that choice.\n<br><br></p>\n\n<ol>\n<li>Because of his longstanding reputation with the board of trustees, \nhe did not have to make the normally required presentation of<u> his proposal, therefore, \nthe board</u> was accused of failing to follow due process.<br></li>\n</ol>\n\n<p><input id="answer" type="radio" name="group1" value="wrong"> (A) his proposal, therefore, the board<br>\n<input id="answer" type="radio" name="group1" value="wrong"> (B) his proposal therefore, the board<br>\n<input id="answer" type="radio" name="group1" value="correct">(C) his proposal; therefore, the board<br>\n<input id="answer" type="radio" name="group1" value="wrong"> (D) his proposal, therefore the board<br><br></p>\n\n<ol>\n<li>Ms. Ceita Hernandez, who is the founder of the Cuban-American Alliance,<u> and who has been</u> a child care advocate for over a decade.<br></li>\n</ol>\n\n<p><input id="answer" type="radio" name="group2" value="wrong">(A) and who has been<br>\n<input id="answer" type="radio" name="group2" value="wrong">(B) she has been<br>\n<input id="answer" type="radio" name="group2" value="wrong">(C) and she has been<br>\n<input id="answer" type="radio" name="group2" value="correct">(D) has been<br><br></p>\n\n<p>I know I am supposed to use a different coding method so students can't guess the answer if they check the source. This is a formative assessment, ie ungraded.</p>\n</div><!-- SC_ON -->", "selftext": "*Edit:* I think I am going about this wrong.\n\nI'm thinking if I turn the radio button into a response to be clicked, ie:\n\n<button id=\"1a\" onclick=\"return handleClick();\" type=\"submit\">(A)</button>\n\nand had text appear next to the option, it would be simpler to code. But I seem to be stuck.\n\nHow can I make text appear in a location on the page when a button is clicked? I'd need it to where that button is local to the text, or I do not want one button click to reveal all of the hidden text on the page.\n\n\n\nI cut the code short for size sake:\n\n<script language =\"Javascript\">\n\nfunction handleClick()\n { \n\nvar amountCorrect = 0; \n \nfor(var i = 1; i <= 20; i++) {\n\n var radios = document.getElementsByName('group'+i);\n\n for(var j = 0; j < radios.length; j++) {\n\n var radio = radios[j];\n\n if(radio.value == \"correct\" && radio.checked) {\n\n amountCorrect++;\n\n }\n }\n } \n alert(\"Percent Correct: \" + amountCorrect/20 );\n\n\talert(\"Highlight above submit button for answers. Hit the back button when done.\" );\n }\n\t\t</script>\n</head>\n\n<body>\n<form name=\"quiz\" method=\"post\" name=\"buttons\" id=\"quiz\" onsubmit=\"return false\">\n<br>\n\nDIRECTIONS: Select the best version of the underlined part of the sentence. There is a choice that is the same as the original sentence. If you think the original sentence is best, pick that choice.\n<br><br>\n\n\n1. Because of his longstanding reputation with the board of trustees, \nhe did not have to make the normally required presentation of<u> his proposal, therefore, \nthe board</u> was accused of failing to follow due process.<br>\n\n<input id=\"answer\" type=\"radio\" name=\"group1\" value=\"wrong\"> (A) his proposal, therefore, the board<br>\n<input id=\"answer\" type=\"radio\" name=\"group1\" value=\"wrong\"> (B) his proposal therefore, the board<br>\n<input id=\"answer\" type=\"radio\" name=\"group1\" value=\"correct\">(C) his proposal; therefore, the board<br>\n<input id=\"answer\" type=\"radio\" name=\"group1\" value=\"wrong\"> (D) his proposal, therefore the board<br><br>\n\n2. Ms. Ceita Hernandez, who is the founder of the Cuban-American Alliance,<u> and who has been</u> a child care advocate for over a decade.<br>\n\n<input id=\"answer\" type=\"radio\" name=\"group2\" value=\"wrong\">(A) and who has been<br>\n<input id=\"answer\" type=\"radio\" name=\"group2\" value=\"wrong\">(B) she has been<br>\n<input id=\"answer\" type=\"radio\" name=\"group2\" value=\"wrong\">(C) and she has been<br>\n<input id=\"answer\" type=\"radio\" name=\"group2\" value=\"correct\">(D) has been<br><br>\n\n\n\nI know I am supposed to use a different coding method so students can't guess the answer if they check the source. This is a formative assessment, ie ungraded.", "likes": null, "link_flair_text": null, "id": "1kg8eh", "clicked": false, "stickied": false, "title": "[Javascript] I created a quiz, but I would like each wrong answer to spur an alert. How would I code that? Code inside.", "media": null, "score": 25, "approved_by": null, "over_18": false, "hidden": false, "thumbnail": "", "subreddit_id": "t5_2r7yd", "edited": 1376611392.0, "link_flair_css_class": null, "author_flair_css_class": null, "downs": 6, "saved": false, "is_self": true, "permalink": "/r/learnprogramming/comments/1kg8eh/javascript_i_created_a_quiz_but_i_would_like_each/", "name": "t3_1kg8eh", "created": 1376635832.0, "url": "http://www.reddit.com/r/learnprogramming/comments/1kg8eh/javascript_i_created_a_quiz_but_i_would_like_each/", "author_flair_text": null, "author": "anonoman925", "created_utc": 1376607032.0, "ups": 31, "num_comments": 11, "num_reports": null, "distinguished": null}}, {"kind": "t3", "data": {"domain": "self.learnprogramming", "banned_by": null, "media_embed": {}, "subreddit": "learnprogramming", "selftext_html": "<!-- SC_OFF --><div class=\"md\"><p>I'm a little puzzled on the whole concept of text based adventure games like the classic, Zork and many others. Like, how does one code the program so that if someone says that they want to go back to where they first were, then they'll be taken back to that specific part of the game. Would one need to add a whole new embedded "if statement" into the one that is currently running? I'm being a bit vague here, so I'll try show in this rough demonstration below:</p>\n\n<p>"Hello adventurer, would you like to go north, east, south, or west?"</p>\n\n<p>if (playerinput == north or n)</p>\n\n<p>{</p>\n\n<p>"There is a door in your way, would you like to go BACK or try open the door?"</p>\n\n<p>}</p>\n\n<p>/*if the player were to say "back" then wouldn't the program would have to go back to the beginning where it first said "Hello adventurer would you like to go blah blah blah". Or would there have to be a whole new if statement embedded into the one the program is currently in. Like this: */</p>\n\n<p>{</p>\n\n<p>"There is a door in your way, would you like to go BACK or try open the door?"</p>\n\n<p>if (playerinput_2 == back)</p>\n\n<p>{</p>\n\n<p>"Hello adventurer, would you like to go north, east, south, or west?"</p>\n\n<p>if (playerinput_3 == north or n)</p>\n\n<p>blah blah blah</p>\n\n<p>} }</p>\n\n<p>So how does the program go back to the start?</p>\n</div><!-- SC_ON -->", "selftext": "I'm a little puzzled on the whole concept of text based adventure games like the classic, Zork and many others. Like, how does one code the program so that if someone says that they want to go back to where they first were, then they'll be taken back to that specific part of the game. Would one need to add a whole new embedded \"if statement\" into the one that is currently running? I'm being a bit vague here, so I'll try show in this rough demonstration below:\n\n\"Hello adventurer, would you like to go north, east, south, or west?\"\n\nif (playerinput == north or n)\n\n{\n\n\"There is a door in your way, would you like to go BACK or try open the door?\"\n\n}\n\n/*if the player were to say \"back\" then wouldn't the program would have to go back to the beginning where it first said \"Hello adventurer would you like to go blah blah blah\". Or would there have to be a whole new if statement embedded into the one the program is currently in. Like this: */\n\n{\n\n\"There is a door in your way, would you like to go BACK or try open the door?\"\n\nif (playerinput_2 == back)\n\n{\n\n\"Hello adventurer, would you like to go north, east, south, or west?\"\n\nif (playerinput_3 == north or n)\n\nblah blah blah\n\n} }\n\nSo how does the program go back to the start?", "likes": null, "link_flair_text": null, "id": "1kh4vy", "clicked": false, "stickied": false, "title": "Just asking a quick question about text based adventures. (Newbie here)", "media": null, "score": 5, "approved_by": null, "over_18": false, "hidden": false, "thumbnail": "", "subreddit_id": "t5_2r7yd", "edited": false, "link_flair_css_class": null, "author_flair_css_class": null, "downs": 2, "saved": false, "is_self": true, "permalink": "/r/learnprogramming/comments/1kh4vy/just_asking_a_quick_question_about_text_based/", "name": "t3_1kh4vy", "created": 1376666430.0, "url": "http://www.reddit.com/r/learnprogramming/comments/1kh4vy/just_asking_a_quick_question_about_text_based/", "author_flair_text": null, "author": "a_stupidquestion", "created_utc": 1376637630.0, "ups": 7, "num_comments": 3, "num_reports": null, "distinguished": null}}], "after": "t3_1kh4vy", "before": null}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment