[Solved] Remove quotes from JSON [closed]

Okay, so apparently you want to take out the quotes and indent it nicely? Then I would do that beforehand: function indent(str) { return str.replace(/\n/g, ‘\n\t’); } function toPrettyObject(obj) { var ajsoln = []; // Actual JavaScript Object Literal Notation if(Object.prototype.toString.call(obj) === ‘[object Array]’) { for(var i = 0; i < obj.length; i++) { ajsoln.push(indent(toPrettyObject(obj[i]))); … Read more

[Solved] Perl on Modules-Inheritance,Polymorphism [closed]

Ok. The object constructor syntax you are using is a bit akward, I’d prefer my $obj = Stats->new(13,4,56,43,33); In Perl, new is not an ordinary keyword, but a simple sub, and should be used as such. The Foo->sub(@args) syntax is exactly equivalent to Foo::sub(‘Foo’, @args), and thus takes care of passing the correct class name … Read more

[Solved] Generate Gaussian and Uniform Random Variable [closed]

Generally I’m not in the habit of answering questions that clearly prove you haven’t tried anything yourself. Today is no different, but I’ll do the following: I’m gonna provide you with a little code, that contains a few intentional errors. It’s up to you to figure out what the code does, and where the problems … Read more

[Solved] Find size of rectangles to fill area

As far as I understand, you want to place n rectangles with fixed C=W/H ratio on the wall with given Width and Height Let rectangle height is h (unknown yet), width is w = C * h Every row of grid contains nr = Floor(Width / (C * h)) // rounding down Every column contains … Read more

[Solved] find and differentiate words in javascript [closed]

If it is about the longest possible matching (sub)string, thus the most specific one, the task actually can be solved pretty easy. sort the array descending by each of its string-item’s length property. Iterate the array … for each string item, try whether it is included within the given text. Stop iterating with the first … Read more

[Solved] Popup text box in HTML with javascript

Does this meet your requirements? function showPopup() { document.getElementById(‘2’).style.display = “block”; } function syncValueWith2() { document.getElementById(‘2’).value = document.getElementById(‘1’).value; } function syncValueWith1() { document.getElementById(‘1’).value = document.getElementById(‘2’).value; } <textarea onkeyup=”syncValueWith2()” id=”1″></textarea> <br> <textarea onkeyup=”syncValueWith1()” id=”2″ style=”display: none;”></textarea> <input type=”button” value=”Show Popup” onclick=”showPopup()”> solved Popup text box in HTML with javascript

[Solved] What exactly means equal ‘=’ in PHP and how can I deduce where is a simply assign or array extend?

= is always an assignment, the only special case here is the assignment to $arr[]. You may read that as “assignment to unspecified array key”, and it results in the array key being auto-generated. It’s analogous to arr.push(…) or similar in many other languages. 1 solved What exactly means equal ‘=’ in PHP and how … Read more