{"id":4839,"date":"2015-10-28T16:38:56","date_gmt":"2015-10-28T21:38:56","guid":{"rendered":"http:\/\/www.thejuliagroup.com\/blog\/?p=4839"},"modified":"2015-10-28T18:51:08","modified_gmt":"2015-10-28T23:51:08","slug":"i-never-made-a-halloween-costume-but-here-is-some-code-i-wrote","status":"publish","type":"post","link":"https:\/\/www.thejuliagroup.com\/blog\/i-never-made-a-halloween-costume-but-here-is-some-code-i-wrote\/","title":{"rendered":"I never made a Halloween costume but here is some code I wrote"},"content":{"rendered":"<p>Many years ago, I was walking through the exhibits at the county fair with my late husband (he was alive then, that&#8217;s why he\u00a0was able to walk with me) and I lamented,<\/p>\n<blockquote><p>Look at those quilts. My grandmother makes quilts. Look at those crocheted tablecloths. My other grandmother crochets. Look at me &#8211; what do I make?<\/p><\/blockquote>\n<p>My wonderful husband turned to me and said in his good-old-boy, country accent,<\/p>\n<blockquote><p>Money. That&#8217;s what you make that your grandmothers didn&#8217;t make. You make money, darlin&#8217;.<\/p><\/blockquote>\n<p>Everyone is posting pictures of the cute Halloween costumes their mom made for them or that they made for their children. I never made a Halloween costume in my life, but here is a copy of some code I finished last weekend that makes a graph with different types of pastries. Another function I wrote (not shown here) changes it from Spanish to English. If you get it correct, it takes you to another problem that does bar graphs with actual bars.<\/p>\n<p>I didn&#8217;t make a costume but I did make money from working on this project which The Spoiled One can use to buy whatever costume she likes.<\/p>\n<p><a href=\"http:\/\/www.thejuliagroup.com\/blog\/wp-content\/uploads\/2015\/10\/cake_graph.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-4840\" src=\"http:\/\/www.thejuliagroup.com\/blog\/wp-content\/uploads\/2015\/10\/cake_graph-300x228.jpg\" alt=\"graph with pastries\" width=\"450\" height=\"343\" srcset=\"https:\/\/www.thejuliagroup.com\/blog\/wp-content\/uploads\/2015\/10\/cake_graph-300x228.jpg 300w, https:\/\/www.thejuliagroup.com\/blog\/wp-content\/uploads\/2015\/10\/cake_graph.jpg 947w\" sizes=\"auto, (max-width: 450px) 100vw, 450px\" \/><\/a><\/p>\n<pre>&lt;script type=\"text\/javascript\"&gt;\r\n    $( window ).load(function() {\r\n        var ncup = 0;\r\n        var nd = 0 ;\r\n        var ncake = 0 ;\r\n        var thisone = 0;\r\n        var sesstries = 0 ;\r\n        document.getElementById(\"arrow\").addEventListener(\"click\", function(){\r\n           if(ncake== 4 &amp; nd ==5 &amp; ncup==7){\r\n               window.location.href=\"problem5_go_to.html\" ;\r\n           }\r\n            else {goFail();}\r\n        });\r\n        document.getElementById(\"button1\").addEventListener(\"click\", function(){\r\n            location.reload();\r\n        });\r\n        document.getElementById(\"button2\").addEventListener(\"click\", function(){\r\n           window.location.href =\"..\/learn_more4.html\";\r\n        });\r\n        $(function () {\r\n            $(\".abox\").draggable({\r\n                helper: \"clone\",\r\n                start: function (event, ui) {\r\n                    thisone = 1;\r\n                },\r\n                revert: function (event, ui) {\r\n                    $(this).data(\"uiDraggable\").originalPosition = {\r\n                        top: 0,\r\n                        left: 0\r\n                    };\r\n                    return !event;\r\n                }\r\n            });\r\n            $(\".bbox\").draggable({\r\n                helper: \"clone\",\r\n                start: function (event, ui) {\r\n                    thisone = 100;\r\n                },\r\n                revert: function (event, ui) {\r\n                    $(this).data(\"uiDraggable\").originalPosition = {\r\n                        top: 0,\r\n                        left: 0\r\n                    };\r\n                    return !event;\r\n                }\r\n            });\r\n            $(\".cbox\").draggable({\r\n                helper: \"clone\",\r\n                start: function (event, ui) {\r\n                    thisone = 1000;\r\n                },\r\n                revert: function (event, ui) {\r\n                    $(this).data(\"uiDraggable\").originalPosition = {\r\n                        top: 0,\r\n                        left: 0\r\n                    };\r\n                    return !event;\r\n                }\r\n            });\r\n            $(\".a\").droppable({\r\n\r\n                drop: function (event, ui) {\r\n                    if (thisone != 1) {goFail();}\r\n                    if (thisone == 1) {\r\n                        nd++;\r\n                        if (nd &gt; 5) {\r\n                           goFail();\r\n                        }\r\n\r\n                       \/\/ $(this).draggable('disable');\r\n                        $(this).append($(ui.helper).html());\r\n                    }\r\n                    else {\r\n\r\n                        $(\".abox\").draggable('disable');\r\n                       $(\".bbox\").draggable('disable');\r\n                    }\r\n                }\r\n            });\r\n\r\n            $(\".b\").droppable({\r\n\r\n                drop: function (event, ui) {\r\n\r\n                    if (thisone == 100) {\r\n                       ncup++;\r\n                        if (ncup &gt; 7) {\r\n                            goFail();\r\n                        }\r\n                        \/\/ $(this).draggable('disable');\r\n                        $(this).append($(ui.helper).html());\r\n                    }\r\n                    else {\r\n                        $(\".abox\").draggable('disable');\r\n                        $(\".bbox\").draggable('disable');\r\n                    }\r\n                }\r\n            });\r\n            $(\".c\").droppable({\r\n\r\n                drop: function (event, ui) {\r\n\r\n                    if (thisone == 1000) {\r\n                        ncake++;\r\n                        if (ncake &gt; 4) {\r\n                            goFail();\r\n                        }\r\n                        \/\/ $(this).draggable('disable');\r\n                        $(this).append($(ui.helper).html());\r\n                    }\r\n                    else {\r\n                        $(\".cbox\").draggable('disable');\r\n                        $(\".cbox\").draggable('disable');\r\n                    }\r\n                }\r\n            });\r\n        });\r\n\r\n        function goFail(){\r\n\r\n            var prev = sessionStorage.getItem(\"caketries\");\r\n                   $(\".missed\").hide();\r\n\r\n\r\n            if (prev != 1 )\r\n            {\r\n                sessionStorage.setItem(\"caketries\", \"1\") ;\r\n                $(\"#wrong1\").show();\r\n                prev = sessionStorage.getItem(\"caketries\");\r\n              \r\n\r\n            }\r\n        else {\r\n                sessionStorage.setItem(\"caketries\", \"0\") ;\r\n                $(\"#wd2\").hide();\r\n                $(\"#container\").addClass(\"green\");\r\n            $(\"#wrong2\").show();\r\n\r\n        }\r\n\r\n        }\r\n    }) ;\r\n\r\n&lt;\/script&gt;<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Many years ago, I was walking through the exhibits at the county fair with my late husband (he was alive then, that&#8217;s why he\u00a0was able to walk with me) and I lamented, Look at those quilts. My grandmother makes quilts. Look at those crocheted tablecloths. My other grandmother crochets. Look at me &#8211; what do&#8230;<\/p>\n","protected":false},"author":5,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_kad_post_transparent":"","_kad_post_title":"","_kad_post_layout":"","_kad_post_sidebar_id":"","_kad_post_content_style":"","_kad_post_vertical_padding":"","_kad_post_feature":"","_kad_post_feature_position":"","_kad_post_header":false,"_kad_post_footer":false,"_kad_post_classname":"","_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[17,1,9,8],"tags":[],"class_list":["post-4839","post","type-post","status-publish","format-standard","hentry","category-computer-games","category-dr-de-mars-general-life-ramblings","category-software","category-technology"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.thejuliagroup.com\/blog\/wp-json\/wp\/v2\/posts\/4839","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.thejuliagroup.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.thejuliagroup.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.thejuliagroup.com\/blog\/wp-json\/wp\/v2\/users\/5"}],"replies":[{"embeddable":true,"href":"https:\/\/www.thejuliagroup.com\/blog\/wp-json\/wp\/v2\/comments?post=4839"}],"version-history":[{"count":5,"href":"https:\/\/www.thejuliagroup.com\/blog\/wp-json\/wp\/v2\/posts\/4839\/revisions"}],"predecessor-version":[{"id":4845,"href":"https:\/\/www.thejuliagroup.com\/blog\/wp-json\/wp\/v2\/posts\/4839\/revisions\/4845"}],"wp:attachment":[{"href":"https:\/\/www.thejuliagroup.com\/blog\/wp-json\/wp\/v2\/media?parent=4839"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.thejuliagroup.com\/blog\/wp-json\/wp\/v2\/categories?post=4839"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.thejuliagroup.com\/blog\/wp-json\/wp\/v2\/tags?post=4839"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}