I made you an attempt to display your need. You can setup the number of items by Row (currently at 3) You'll have to link this code with your result query. If you query result is different --> modify $row[number] . $array_test = array( array("2012-11-23", "Liverpool - Man City", 2),...

In your array, the first element: Array ( [0] => youtube#channelListResponse Is not an array. So the foreach loop is attempting to loop through that, and it's causing an error. Do a simple check to make sure the element you're attempting to loop through is an array: foreach($jfo3 as $lv1)...

I believe you're looking for the with binding. The with binding creates a new binding context, so that descendant elements are bound in the context of a specified object. This should work for you <!-- ko with: FacetResults()[0] --> <span data-bind="text: Term"></span> <ul data-bind="foreach: Values"> <!-- do something --> </ul>...

You can use a regular foreach loop which treats one array as an associative array, and just get the value corresponding to the key from the other: foreach ($users as $key => $value) { echo '<option color="' . $new[$key] . '"value="' . $key . '">'. $value . '</option>'; } ...

IMO is not good idea to set ID of form to numer: first standards: ID and NAME tokens must begin with a letter ([A-Za-z]) and may be followed by any number of letters, digits ([0-9]), hyphens ("-"), underscores ("_"), colons (":"), and periods ("."). but, maybe in Your case is...

As your foreach is printing duplicates , it means that your array $csv_tbl contains duplicate values, you can remove duplicate values from array using array_unqiue But also by looking at the screenshots i can see that the callid is different for every record. do your csv contain duplicates?:: $k =1;...

Glad you found an answer. Here is something I was working on while you found it. // SET START DATE $startDate = new DateTime($dateStart); $nextBill = new DateTime(); for($i=1;$i<$countDays;$i++){ switch(true){ case ($startDate->format('j') > $days[2]): // go to next month $nextBill->setDate( $startDate->format('Y'), $startDate->format('m')+1, $days[0]; ); break; case ($startDate->format('j') > $days[1]): //...

forEach takes a callback that accepts 3 arguments, the array element, the index, and the array. You only need the first. Wrap your call to draw() in an anonymous function and invoke it on the element from the function call. arr.forEach(function(elem) { elem.draw(); }); ...

Why dont you simply do this $array[0][3] = //your value; $array[0][4] = //your value; and if you want to change all value of $array[1]: foreach ($array[1] as $key => $value) { $array[1][$key] = //your value; } EDIT to do all this with a foreach : foreach ($keys as $key) {...

It looks like your cURL request is to blame, you're not telling cURL you're expecting a response, so cURL just passes back a boolean success for your initial request, it sent it successfully. From the PHP curl_exec page. Returns TRUE on success or FALSE on failure. However, if the CURLOPT_RETURNTRANSFER...

If it isn't a requirement to keep the ValuesAddX separated, you could have an array of arrays, and foreach over that: public static string[][] ValuesAdd = { new [] { "a", "b", "c" }, new [] { "1", "2", "3" }, new [] { "x", "y", "z" }, }; public...

When you build the array of users[] here: while($row = $result->fetch_assoc()) { $users[] = $row['username']; } $users is an array, but when you return it, wrapping it in array() means you are returning an array of arrays which is not what you then process. Solution is just return $users....

It's hard to tell what you're trying to do exactly (you mention transforming to CSV, but your XSLT is outputting XML) without an example of your desired output. However, you should be able to move the contains() to the ID element in your xsl:if test... <xsl:if test="$BenefitsExtractEmployeeNode/Benefit_Elections/Covered_Dependents[ ID/@type ='Dependent_ID']/ID[contains(@type, Dependents/Dependent_ID[ID/@type='Dependent_ID']/ID/@type)]">...

You need to perform the GET request on the controller, not on the view. I.e. the URL which you see in browser's address bar must be the servlet URL, not the JSP URL. This way the servlet's doGet() will be invoked. First move the testPost.jsp file into the /WEB-INF folder...

Yes, it's perfectly safe. From [class.temporary]/4-5: There are two contexts in which temporaries are destroyed at a different point than the end of the fullexpression. The first context is when a default constructor is called [...] The second context is when a reference is bound to a temporary. The temporary...

Under the first "foreach" loop you should reset your $subs array to make sure it's empty. Otherwise it gets down to the second loop, sees the old "$subs" from the previous loop, and loops through it again: foreach ( $menuitems as $item ) { $subs = array(); if ($item ['submenu'])...

Where's the problem? You need an X variable. After 15 rows you reset Y and increment X. After 30 rows you reset X and Y, add a new page, obtain a new XGrap for that page and make a fresh XTextFormatter and continue this until the list is done. A...

The so-called foreach loop looks for the begin() and end() in the scope they are needed. So, if your class implements begin() and end() with iterator interface you may use new foreach loop. As @NathanOliver said, you should avoid calling this loop as foreach loop because you may confuse it...

There are some problems in your code: First, your modal code should not be inside the tr element, put it out of the table or inside another td element. Second, each modal should have its unique id and the button of each row will use that modal id in data-target...

From this section of the Java Language Specification about enhanced for-loops: The enhanced for statement has the form: EnhancedForStatement: for ( {VariableModifier} UnannType VariableDeclaratorId : Expression ) Statement EnhancedForStatementNoShortIf: for ( {VariableModifier} UnannType VariableDeclaratorId : Expression ) StatementNoShortIf Note that the type declaration UnannType must be present in the for...

You try access to t variable without block where declared. case MenuScreens.Playing: { // This is allowing the player to go back to // The main menu by pressing the escape key. KeyboardState keyState = Keyboard.GetState(); if (keyState.IsKeyDown(Keys.Escape)) { menuState = MenuScreens.MainMenu; } //Updating the player1 and player2 p.Update(gameTime); p2.Update(gameTime);...

If you made the if statements equivalent, I'd say the top version is more generic and better for more complex statements due to the following: If you had multiple if - continue statements, the first approach would allow you to list them in order without nested indentation which could keep...

You cannot echo an array. Try using print_r($deductions) or var_dump($deductions). Also, the following line is likely incorrect: $deductions=array(subtract($r, $value)); This line will keep replacing the previous $deductions variable so you only end up with one value in your array (6) because 9-3 is 6. If you are wanting to create...

As arkascha said, htmlspecialchars and real_escape_string both return strings, it's kind of implied in the function of both. If you want ints, floats ect ect to return with the original datatype you'll just need to not perform the cleaning on them. It doesn't really make sense to try to escape...

Using indexOf is not correct, if your ArrayList x contains more than one value of i, your sort method will behave incorrectly. For example, this case: [5, 5, 1] After running your program, return [5, 5, 1] Plus, using indexOf, as mentioned by tucuxi, will slow down your program....

Try this one: http://jsfiddle.net/kzzphmrp/ Looks like there were some issues with your code: You seem to use a string for the ID, but compared with a number in the javascript loop You have a superfluous loop, if you are doing foreach, you get the arrays single elements in your callback,...

This is, because you use $array as keys of your combined array and each key has to be unique, so the last one with the same key will be in your array. The other ones, will get deleted (Simple example to reproduce). To solve your problem you could use array_map()...

The warning is occuring on line 29 (so at foreach($row['posted'] as $time)). The reason is that $row['posted'] is not an array. Change the loop to this for($i = 0; $i < count($result); ++$i) { $result[$i]['posted'] = strtotime($result[$i]['posted']) * 1000; } ...

The main problem is that you're not enclosing the body of the foreach loop in curly braces. Because %dopar% is a binary operator, you have to be careful about precedence, which is why I recommend always using curly braces. Also, you shouldn't use c as the combine function. Since svm...

handleReaderLoad will be called in an asynchrounous fashion. You can keep track of the number of files and log in the onload when the file count is complete var data = []; var fileCount = files.length; var currentCount = 0; $.each(files, function(index, file) { var reader = new FileReader(); reader.onload...

It's changing the first found element because of id selector that you used to identify your cell. There are multiple ways to do it, I'll give some examples, and you choose what's closer to your overall architecture/convention. You can add an identifier to you cell <td class="feed-name" id='<c:out value="${feed.id}" />'...

Assuming that your departments are specified on the first column, you could achieve that by creating a dictionary of differences. Please check the code below as an example and modify it to fit your needs. Sub Problem() Dim shtSheet1 As String Dim shtSheet2 As String Dim departmentColumn As Long shtSheet1...

If you want to access the first element, then simply do that instead of looping: $('#testfield').append('<p>' + result.weather[0].main + '</p>'); // ^^^ // access the first element in result.weather ...

/^h/ is not bound to anything, so the match happens against $_. If you want to match $var, you have to bind it: if ($var =~ /^[#U]/ || $var !~ /^h/) { Using || with two matches could probably be incorporated into a single regular expression with an alternative: next...

It looks like you are overwriting the max id each time in the loop, if you want to return them all it would be like this: $maxIds = []; foreach ($categorys as $category) { $sth = $this->conn->prepare("SELECT MAX(data_id) FROM bcc_data WHERE data_category = '" . $category['bcc_data_category_name'] . "'"); $sth->execute(); $id...

Solved it,simply by using (($csvRow[$this->_csvColumnJournalDate]) == $csv_ied_journal_date) ) instead of (($csvRow[$this->_csvColumnJournalDate]) === $csv_ied_journal_date) ) now works like a charm! == for same value === same data type type and value...

You create new TD for each member. The nested foreach has to be: <td> @foreach($user as $mem) {{ $mem->name }}<br> @endforeach </td> The result will be: <td> Name 1<br> Name 2<br> Name 3<br> </td> I don't know the template engine you used, add inside a loop condition and don't put...

Also if you want it to look more nice and readable you can do something like this that will spit it out in a table: $body += "<body><table width=""560"" border=""1""><tr>" $bodyArray[0] | ForEach-Object { foreach ($property in $_.PSObject.Properties){$body += "<td>$($property.name)</td>"} } $body += "</tr><tr>" $bodyArray | ForEach-Object { foreach ($property...

If you can't use ToList() or ToArray() directly, create a new list and add items from users to it, then use that new list in the foreach loop Though it is obious that your users implement IEnumerable interface (otherwise you wouldn't be able to use it in the foreach loop),...

I think the problem is the k in $scope.delivery_items[k][i].push(val); change it to v and see what happens. EDIT: Ok, after looking at your question again, I thought this might work better: if ($scope.categories_norm) { $scope.delivery_items = {}; // create empty object //get categories angular.forEach(data.item_categories.normal_categories, function (v, k) { var catagery...

Cells.Select selects the cells of the currently active sheet. This selection doesn't change within the For Each loop You want to work on the cells of the worksheet provided by the For Each construct, i.e. Sub wsLoop() ' Declare Current as a worksheet object variable. Dim ws As Worksheet '...

You are trying to log $scope.infos without waiting until requests complete and push loaded response data to array. The answer here is using Promises for providing callback to fire once all requests resolve and push their respective data: app.controller('mainController', function($scope, $http, $q) { var url = 'https://api.twitch.tv/kraken/channels/'; $scope.channels = ["freecodecamp",...

Yes, it's PDFone. Is the .Contains property case sensitive? String.Contains is case-sensitive (like most methods in the .NET framework). You have to use String.IndexOf if you want to ignore the case: If fold.IndexOf("pdf", StringComparison.InvariantCultureIgnorecase) >= 0 Then MSDN mentions it here: this method performs an ordinal (case-sensitive and culture-insensitive)...

Assuming this is Entity Framework accessing a SQL Server View: A common issue with views in EF is primary key confusion. EF tends to attempt to determine what is a truly unique value from a view by the datatypes it can see in metadata. I recommend tweaking your view to...

Each iteration of the outer loop is only producing a single $votes array , seemingly for a single candidate, in this line: $votes = array("vote" => $vote, "candidate" => $candi); If you want to capture multiple entries in that array for each row, you need to make it a multi-dimensional...

forEach() is an array function which loops over your array elements and provides data element and it's index in callback. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach call() -- called on a and is used to execute a function. Solution for your question assuming data is some array. data.forEach(function(item,i){ if(window.location.href.indexOf(data[i].url) > -1){ slt = data[i].id; if(slt.length)...

You can use active record as below. $arrResult = $this->db ->where('id','foo') ->where_in('result',array(1,2)) // alternative to above condition //->where('(result = 1 OR result = 2)') ->get('mytable') ->result_array(); foreach($arrResult as $result){ // run code based on $result; } ...

I think you only need one for loop, to loop through every wrappingType input, and then get the corresponding eggsize input and use it in your update query. public function update_document($document,$order_id) { $eggSizeInputs = array(); if($this->input->post('eggsize')) { $eggSizeInputs = $this->input->post('eggsize'); } $eggSizeIndex = 0; if($this->input->post('wrappingType')) { foreach($this->input->post('wrappingType') as $wrappingType) {...

Inside $data['process'] you need to have category ID and Inside $data['category'] also then only you can match both ,For example the foreach loop will be like following <?php foreach ($category as $c) { echo "<li>" . $c->CategoryName . "</li>"; foreach ($process as $r) { if($r['cat_id']==$c['id']){ echo "<li><a href=\"" . base_url()...

You're over-writing all the content in your target selector .feed-name when you use .text() If you want to target the link, you'll need to do something like this: $('.feed-name[id="' + id + '"] > a').text(name) ...

You might as well do the calculation in the DB as well: SELECT a.date, a.rate x, e.rate f, e.rate/a.rate f_over_x FROM tbl_usd_aud a JOIN tbl_usd_eur e ON e.date = a.date WHERE a.date >= CURDATE() - INTERVAL 40 DAY N.B. I prefer CURDATE() to NOW() as it involves less implicit conversion...

Java reference types include classes, interfaces and enums (as well as arrays, but they are a bit different). All of them are pieces of code that define behavior, and therefore need to be imported for your program to know which methods are available in them, etc. So an interface such...

The issue is that grunt.task.run does not run the task immediately, it just pushes it to the list of tasks to run later, while grunt.config.set executes immediately. So you end up with a list of 4 times the same task to execute. You can get what you want by defining...

If you want to define your own infix operator, it must begin and end with %. This is so the parser knows how to properly pass the parameters to the function since it not the usual way code is parsed. Also, use the backtick to escape the percent signs in...

From top foreach you can get the question id I feel. In $average_student_result array you are getting particular student answered questions array like $average_student_result['question_id'] = 'answer average or answer'; //any value So we can avoid the inside foreach like $average_student_result[$row->question_id]. So you are getting both per student wise as well...

Instead of foreach try with Select, ForEach iterate over all the list but is a void, it doesn't return any result. But with select you can do a projection to return processed values. s.Tags = s.Tags.Select(t => TagCleaner.foo(t)).ToList(); ...

You need to use date and strtotime for this:- <td>'.date('H:i:s', strtotime('+15 mins'.$row['date_add'])).'</td> As you comment earlier, try like this:- $value = 10; '<td>'.date('H:i:s', strtotime("+$value mins".$row['date_add'])).'</td>'; you can change $value dynamically.thanks....

Yep, you need to do the adding within the loop. I'd use a List<string> as it supports LINQ: XmlNodeList skillNameNodeList=SkillXML.GetElementsByTagName("name"); List<string> skills = new List<string>(); foreach (XmlNode skillNameNode in skillNameNodeList) { skills.Add(skillNameNode.Attributes["value"].Value); } ...

To generate a list of four unique non-zero decimal digits, use shuffle from List::Util and pick the first four Like this use strict; use warnings; use 5.010; use List::Util 'shuffle'; my @unique = (shuffle 1 .. 9)[0..3]; say "@unique"; output 8 5 1 4 There's no need to seed the...