Search the Community
Showing results for tags 'algorithm'.
-
I am building a calendar based on this plugin http://arshaw.com/fullcalendar/I have added a feature where upon selecting a timeslot a popup window appears with a dropdown menu where the time selected will appear therejust like outlook.com calendar.I have managed the above by "taking" the HTML segment(which contains the time in numeric format,,,13:00 for example) of the time slot clicked and "transferring" that to the drop down menu-by selecting a specific value in it.And here is my problem:Every numeric value is hold in this element HTML Code: <div class="fc-event-inner"><div class=
-
Hello, I'm a beginner and i just wrote an extremely simple program for solving a linear equation. It works, but i was wondering if you guys can take a look. Here it is: <?php$a = 5;$b = 10;$r = -($b/$a);if($a == 0 && $b == 0) {echo 'There are infinitely many solutions';}elseif($a>0 && $b>0) {echo $r;}elseif($a>0 && $b == 0) {echo 'X is equal to zero';}else {echo 'There are no solutions';}?> It's really, really basic and some parts aren't really correct(i guess). Please, tell me what you think. It isn't really complete, because the variable "a", might
-
I'm trying to write an algorithm return an array sorted by a given property in a JSON object. Here's an example of what I want to sort: obj_to_be_sorted = {'four' : {'num' : 4},'one' : {'num' : 1},'three' : {'num' : 3},'two' : {'num' : 2}} sort = function(obj, property, reverse_order) { a = [] for (key in obj) { a.push(key) } return a.sort(a, { /* I think it would involve the sort function... */ }} sorted_array = sort(obj_to_be_sorted, 'num', false); // should return the JSON keys sorted by the 'num' property, i.e. ['one', 'two', 'three', 'four'] I just don't know I would go about doin