C# List inside where clause

I would like to create a query with where clause which will go through every element in the list. But I get "Operator '==' cannot be applied to operands of type 'int' and 'List'. var result = (from n in School.Teacher whe...
more »

2017-11-05 19:11 (2) Answers

PHP Json decode object exist

how can i get all "steamids" from Players where "gameid" exist and have the value "730"? it Shows: NOTICE Undefined property: stdClass::$gameid on line number 31 because "gameid" doesnt exist in every element Code: $players = json_decode(file_ge...
more »

2017-10-21 17:10 (1) Answers

Odoo 10 report table foreach line

Here is python code: @api.depends('employee_id') def create_employee_report(self): count = 0 employee_data = {} for employee in self.env['hr.employee'].search([]): if employee.socialsecurityno: ...
more »

2017-09-26 14:09 (2) Answers

How to stop looping on success

I have a script which loops through my kendo-grid when an article-id is submitted, this script adds +1 to the quantity when a match is found. After a match is found I want my script to stop looping since the same article-id can have more than 1 row i...
more »

2017-09-25 15:09 (3) Answers

Combine foreach output data

I´m working on a project where depending on the situation, I need to combine some output data into a single variable. *$array contains different user information $array[]= array( 'ts3_uuid' => $value['client_unique_identifier'], 'ch...
more »

2017-09-09 14:09 (2) Answers

PHP echo all subfolder images

I have a directory with subfolders containing images. I need to display all these on one page, and also their folder name, so something like this: echo Subfolder name echo image, image, image echo Subfolder2 name echo image2, image2 , image2 etc...
more »

2017-09-07 18:09 (1) Answers

split foreach loop based on some column value

I have a table with a column name type,how can i show results based on its column values in one query ? Tags id|name|type //type can be fixed,price Tag::orderBy('id', 'desc')->get(); Now i want to show price and fixed in two different parti...
more »

2017-08-26 01:08 (2) Answers

Combining json output from multiple foreach loop

I have php script which returns video streams as output. Output contains multiple unique streams. I am trying to encode output into json but because of multiple foreach loop its not giving proper output Code : <?php if (isset($_GET["id"])) ...
more »

2017-08-20 19:08 (2) Answers

Alternative to using ref in foreach?

I have a modifying method with a signature like private bool Modify(ref MyClass obj); that will make modifications to obj and indicate succes with it's return value. Modify is not reassigning the reference (I know that this wouldn't work), just mo...
more »

2017-07-28 20:07 (2) Answers

List<T>.AddRange and the yield statement

I am aware that the yield keyword indicates that the method in which it appears is an iterator. I was just wondering how that works with something like List<T>.AddRange. Let's use the below example: static void Main() { foreach (int i in...
more »

2017-07-26 04:07 (3) Answers

Nested Foreach loop runs too many times - C#

I have 2 foreach loops, 1 nested inside the other. There are 115 total items in 2 collections. What I'm wanting to do is have the first item from the first collection written to the console and then the first item from the second collection written t...
more »

2017-07-24 14:07 (2) Answers

Parallel.ForEach with tuple return c#

Based on this example I'm trying to make a parallel foreach with tuple return. double min = double.MaxValue; object syncObject = new object(); Parallel.ForEach(collection, () => double.MaxValue, (item, loopState, localState) => { ...
more »

2017-07-22 21:07 (2) Answers

javascript foreach find and update

Let say I have an array of tree type data [ { 'id': 1, 'name': 'root', 'parent_id': 1 }, { 'id': 2, 'name': 'level 1', 'parent_id': 1 }, { 'id': 3, 'name': 'level 2', 'parent_id': 1 }, { 'id': 4, 'name': 'level 2.1', 'parent_id': 3 } ] is it...
more »

2017-07-05 18:07 (3) Answers