Numpy minimum in (row, column) format
How can I know the (row, column) index of the minimum of a numpy array/matrix? For example, if A = array([[1, 2], [3, 0]]), I want to get (1, 1) Thanks! ...
How can I know the (row, column) index of the minimum of a numpy array/matrix? For example, if A = array([[1, 2], [3, 0]]), I want to get (1, 1) Thanks! ...
Hello I have an array of persons, and i am trying to sort them by age using a sort descriptor. The age field in a patient is a string so when calling: ageSorter = [[NSSortDescriptor alloc] initWithKey:@"age" ascending:YES]; [personList sortUsingDescriptors:[NSArray arrayWithObject:ageSorter]]; It sorts them but 100 appears first becau...
I'm using WinInet to connect and retrieve information from one of our server. I'm using the following: indexdata: array of byte[1..5000] of byte; infoBuffer: array [0..5000] of char; BufferSize: DWORD; reserved: DWORD; text: string; BufferSize := Length(infoBuffer); res := HttpQueryInfo(hHttpRequest, HTTP_QUERY_RAW_HEADERS_CRLF, @inf...
var names=new Array("Charlie","Auggie","Hunter","Diesel","Harlum","Tank","Runt"); var rnames=Math.floor(Math.random(1,names.length)); That is my code, rnames is always 0. How would I tell the length of a table? (the length is 7 - in other words, i want to tell how many entries are inside of a table.) ...
Using PHP... an example. This produces a warning - as expected - and $myVar stays as bool(true). $myVar = true; $myVar[] = 'Hello'; // Warning: Cannot use a scalar value as an array But this next example 'works', $myVar is converted into an array with a single element 'Hello'. $myVar = false; $myVar[] = 'Hello'; // Converted into a...
When using a returned value to determine the number of an element in an array, does javascript throw quotes around it? Example : This tallys the number of times unique characters are used. var uniques = {}; function charFreq(s) { for(var i = 0; i < s.length; i++) { if(isNaN(uniques[s.charAt(i)])) uniques[s.charAt(i)] ...
In Java, Arrays.equals() allows to easily compare the content of two basic arrays (overloads are available for all the basic types). Is there such a thing in C# ? Is there any "magic" way of comparing the content of two arrays in C# ? ...
I cant seem to do this in an elegant way, and I don't understand some of the behaviour I'm seeing. I have my array stored in html like so: <input type="hidden" id="myField" value="1,2,3,5,8,13"> To add a value I must do this, is this really the cleanest way to do this? $('#myField').val($('#myField').val() + ',' + 21); And to remo...
Hi I am having an incredibly hard time with what should be a simple issue. As of CodeIgniter 1.7, '$this->input->post();' supported arrays but I cannot for get the values into the array for some reason. I have 7 check boxes that store into an array 'services[]' as you can see by this example view: <?php $servicesdata = array ( ...
I'm trying to sort a multidimensional array by multiple keys, and I have no idea where to start. I looked at uasort, but wasn't quite sure how to write a function for what I need. I need to sort by the state, then event_type, then date. My array looks like this: Array ( [0] => Array ( [ID] => 1 ...
I have about 50 users in a database and I want to send them a newsletter. $result = mysql_query("SELECT email FROM users") or die(mysql_error()); $row = mysql_fetch_array( $result ); // had 50 emails How do I put the $row['email'] into the mail code below. $m->setBcc(Array("[email protected]", "[email protected]","[email protected]"));...
OK so I have this applet I am making and I want it to generator a world according to a number... Here it is: public int[][] loadBoard(int map) { if (map == 1) { int[][] board = { { 2,2,24,24,24,24,24,3,3,0,0,0,1 }, { 2,2,24,23,23,23,24,1,3,0,0,0,1 }, { 1,1,24,23,23,23,24,1,3,3,3,3,1 }, { 1,1,24,24,23,24,24,1,1,1,1,3,1 }, ...
I can generate a few lines of code that will do this but I'm wondering if there's a nice clean Rubyesque way of doing this. In case I haven't been clear, what I'm looking for is an array method that will return true if given (say) [3,3,3,3,3] or ["rabbits","rabbits","rabbits"] but will return false with [1,2,3,4,5] or ["rabbits","rabbits...
I'm trying to code a method which loads a map according from a number inside loadBoard(NUMBER_HERE); But I get 'unreachable statment' on the line return board; Here is my code: public int[][] loadBoard(int map) { if (map == 1) { return new int[][] { {2,2,24,24,24,24,24,3,3,0,0,0,1 }, { 2,2,24,23,23,23,24,1,3,0,0,0,1 }, ...
Hey guys, So what's getting pushed to this array is dependant on a few radio boxes. I've got this for standard and wheelchair seats: if(document.getElementById('standardseat').checked) { //Standard seat is checked seatsArray.push(e.posX, e.posY); } else if(document.getElementById('wheelchairseat').checked) { //Wheelchair seat is ch...
hi there, currently i am doing this: $values = array( 'id' => $sel['id'], 'creator_id' => $sel['creator_id'], 'campaign_id' => $sel['campaign_id'], 'save_results' => $sel['save_results'], 'send_results_url' => $sel['send_results_url'], 'reply_txt' => $s...
Hi, i am trying to create array from window.location.hash variable but i am failling. My code is: $.each(window.location.hash.replace("#", "").split("&"), function (i, value) { value = value.split("="); var my_item = {value[0] : value[1]}; form_data[i] = my_item; }); consol...
I have this code that loops through a list and post it in an option tag. But I get an undefined offset notice everytime I try to run it. <?php $datearray=array('Jan','Feb','Mar'); ?> <?php for($d=0;$d<=sizeof($datearray);$d++){ ?> <select title="mm" name="month" id="month" class=""> <option><?php echo $da...
Hello, I tried to access with $this->$arrDataName[$key] on the element with the key $key from the array $this->$arrDataName. But PHP interpretes that wrong. I tried it with { } around the $arrDataName to $this->{$arrDataName}[$key], but it doesn't work. On php.net I found an advice, but I can't realize it. In order to use variable...
Hi, does it matter whether an uppercase or lower case a is used for php arrays? ...