384
questions
0
votes
1
answer
77
views
Destructuring in a Ruby block when using index
Without using index I was able to destructure the first and second elements of an Array of Arrays like so:
[ [ 1, 2 ], [ 3, 4 ] ].each do |first, second|
puts second
end
#=> 2
#=> 4
I then ...
3
votes
1
answer
81
views
Does the use of an iterator imply a heap object?
Does the creation of an object of type IEnumerable<T> (such as the numbers object of type IEnumerable<int> in the below code example) imply the creation of an object on the heap that has ...
1
vote
0
answers
21
views
COM object output saved to variable in PowerShell cannot be reused after first access [duplicate]
I have a question regarding COM object output saved to a variable in PowerShell:
$netShare = New-Object -ComObject HNetCfg.HNetShare
$connections = $netShare.EnumEveryConnection
$connectionsProps = $...
0
votes
0
answers
35
views
How can I create an XBRL report which will show me error message that contains "enum2ie:InvalidEnumerationValue"?
I've created an XBRL report where I chose in the enumerator2 one element "K000Member". What should I change (spoil) so the program will notify me with message that contains this "...
3
votes
1
answer
225
views
In C#, my IEnumerator is reset / created anew when entering a method / local function. Why? [duplicate]
Consider this example:
List<int> l = [1, 2, 3, 4, 5];
void DoSomethingWith(IEnumerator<int> e) {
Console.WriteLine(e.MoveNext());
Console.WriteLine(e.Current);
}
using(var e = l....
0
votes
1
answer
131
views
The most elegant way of applying several filters in Ruby #select
I have a query object in my application that filters data with Array#select method
class QueryObject
def call(filters)
data = get_data # returns array
data = by_param1(data, filter[:param1])...
3
votes
2
answers
210
views
HashTable enumeration with unexpected results
This may be a dumb question so please be kind LOL. I'm trying to wrap my head around something I just ran into.
First
I have a HashTable that I can enumerate using the following:
$ht = [hashtable]@{&...
1
vote
1
answer
87
views
Swift enumerators: how is it implemented for empty collection?
I'm implementing a few custom enumerators for my data model, e.g.
struct Land {
// …
let council: Council
let size: Int
}
extension Collection<MyModel> {
func lands(in council: Council, ...
0
votes
1
answer
273
views
FOR EACH LOOP Container working in SSIS but failing as an SQL Job or in SSISDB Integration Service Catalogs, Even after providing correct File path
I am transferring data from folder(contains CSV Files) to SQL Server database using FOR EACH LOOP Container in SSIS. That works well in SSIS but it is giving me an error while running as SQL Jobs or ...
1
vote
3
answers
82
views
Unable to cast to object
I had a code:
var result = BOBase.Search(Mapper.SourceBrowserType, searchCriteria);
var list = new List<IBO>(result.OfType<IBO>());
But I need to be able to add many elements in a list. I ...
3
votes
1
answer
79
views
Ruby method to compose Enumerator with function
If you have an enumerator and some callable (proc/lambda/method) it is sometimes handy to compose them to create a new enumerator, like this
class Enumerator
def compose func
Enumerator.new do |...
0
votes
1
answer
267
views
Use Enumerators in Rails 7 with MongoDB
I'm building a new project with Rails 7 and MongoDB 8. And I wanted to use enumerators for multiple fields ( states etc .. )
I wanted to use the gem mongoid-enum but it doesn't work with Mongo 8.
Is ...
1
vote
1
answer
170
views
C# parallel mapping iterator retaining order
I have an Enumerator<T> as input, a mapping function that converts a T to an S, and I want to deliver an Enumerator<S> containing the results of the mapping. The mapping function is ...
0
votes
1
answer
82
views
Access value from a Netsuite hash, Enumerator
Hi I am trying to extract a value from a Netsuite hash inside custom fields, and some others, which typically look like this - `
"custbody_delivery_ticket_number"=>
{
"script_id&...
1
vote
1
answer
150
views
Ruby enumerator not returning next value
I'm trying to create a generator in Ruby that always returns the next value.
For example
def all_numbers
Enumerator.new do |yielder|
number = 0
count = 1
loop do
number += count
...
0
votes
0
answers
145
views
Implementing an Enumerator for a collection using a simple iterator block
Looking at the source code for many collections it seems that they always have a dedicated Enumerator class with a lot of code written to assure the enumeration goes smoothly without problems.
My ...
0
votes
1
answer
172
views
C#: Renaming files on the result of `Directory.EnumerateFiles` causes infinite loop
I have a folder contains a lot of files(>100000),
and I want to write some code to perform a batch renaming.
I use Directory.EnumerateFiles rather than Directory.GetFiles since the former does not ...
0
votes
1
answer
82
views
How does enumerators created with code block actually runs
It's just a simple question, how is y.<< method is able to halt the code-block mid execution ??
I have expected the code block to run only once and never halt in the middle :/
e = Enumerator.new ...
0
votes
2
answers
201
views
Ruby: How to create a custom iteration method for a Enumerator Object - with enum_for?
Lets say, we have an Array of Strings named words and I want to instantiate a special Enumerator using eunum_for on it which only counts Strings with the length != 3. Here is my proposal:
def words....
-2
votes
1
answer
162
views
How can we enumerate list inside list of sublist?
I have there two list
list_ =
[['CORAM: ThaneBench1'],
['1', 'CC006000000196545', 'P99000007726', 'Jennifer Nilesh Joil', 'Viva Homes Pvt. Ltd.', '30/10/2021 @ 11:00 AM', 'For Appearance'],
['2', '...
1
vote
2
answers
86
views
How to check the parameters without enumerating infinite source in c# extension method
I'm trying to write an NUnit test to check that my extension method throws an exception when called with a negative parameter, what i want is to execute the first two if condition to check the ...
2
votes
1
answer
890
views
What does a HashSet Enumerator do?
I'm not used to write C# code, only Java and Python.
Now I found some code example for an algorithm which is only available in C#.
There is one structure I don't understand, it is the Enumerator.
...
5
votes
2
answers
267
views
How does Ruby Enumerators chaining work exactly?
Consider the following code:
[1,2,3].map.with_index { |x, i| x * i }
# => [0,2,6]
How does this work exactly?
My mental model of map is that it iterates and apply a function on each element. Is ...
2
votes
2
answers
269
views
How to detect empty IEnumerator function calls during unit testing?
I'm working with Unity's play mode test unit that run on Enumerator function (aka. Coroutine).
Inside the test, they will call more sub routines, some of them are ordinary function, some of them are ...
3
votes
0
answers
2k
views
Why do enumerators need to be disposed? [duplicate]
According to the accepted answer to Enumerator disposal when not using using, foreach or manually calling Dispose() enumerators in C# must be disposed when finished with, whether you let foreach do ...
-1
votes
1
answer
814
views
(Java) Static member accessed via instance reference with enumerators
I just started learning Java. IntelliJ is giving me a warning "Static member accessed via instance reference" on line 4. Is it bad, should I fix it, somehow, or should I just ignore it?
Here ...
0
votes
1
answer
73
views
My conditional minimum search fails. How can i solve this? C++
I have an input.txt that looks like this:
(in this order: angler, contest, fish, weight)
JACK random3030 fish 10 fish 12.6
JOHN random3030 fish 5.3 fish 4.5
THOMAS xyz0501 carp 2 carp 5 fish 3 carp 6
...
0
votes
1
answer
954
views
Loading Excel files with SSIS with different names. Getting error 0x80004005
I have an SSIS package that looks through excel files with a date at the end of each file. I have watched many vidoes but can't find an answer. If I move the "original file" that I used with ...
0
votes
1
answer
70
views
How do you overload operator+ in a subclass of an abstract superclass?
So I am doing some tinkering with inheritance and abstract classes. In the instance I am programming I have created an array of pointers to Shape, my abstract base class. After filling the first 2 ...
0
votes
0
answers
640
views
Why is FastDirectoryEnumerator so fast but handling its exceptions are so slow?
I had an issue where the following was checking for files that existed but not alerting me to the fact it was skipping over directories (stemming from root _rootDirectory) that don't exist:
...
0
votes
0
answers
165
views
ssis truncate table in ForEach ADO Enumerator
I have been trying to truncate a number of tables in 1 DWH.
after setting my object parameter ,going into the loop
my sql statement is :
truncate table ?
after executing the following error :
[...
0
votes
1
answer
51
views
conversion of enumerator in overloading function
====================================Edited question===========================
I have read in a book that the conversion of enumerator depends to the number that the enumerator is initialized to.
for ...
2
votes
1
answer
375
views
Output of -1L < 1U and -1L > UL is different when -1L, 1U and -1UL are symbolic constant than when they are declared as enum constant
B&R say in their book "The C Programming Language"- Enumerations provide a convenient way to associate constant values with names, an alternative to #define with the advantage that the ...
1
vote
2
answers
88
views
Parsing a enumerator with a random to determine left or right by using a ternary operator c#
Hello stackoverflow community,
I'm working on a project and am stuck on the following. What I have is a public enum HorizontalDirection class that determines Left or Right. What I need to do is call ...
0
votes
2
answers
225
views
How to reverse the contents of an enum element in java
So here is my enum structure.
public enum DictionaryEnum {
ARROW(
"Arrow",
new String[] {
"noun"
},
...
5
votes
2
answers
929
views
CS8176: Iterators cannot have by-reference locals
Is there real reason for this error in given code, or just It could go wrong in general usage where the reference would be needed across interator steps (which is not true in this case)?
IEnumerable&...
1
vote
3
answers
1k
views
Using bitwise or operator in switch case
I have enum,
enum ENUM_MSG_TEXT_CHANGE {COLOR=0,SIZE,UNDERLINE};
void Func(int nChange)
{
bool bColor=false, bSize=false;
switch(nChange)
{
case COLOR:bColor=true;break;
case ...
1
vote
2
answers
285
views
What is the use of "_version" within collections? [duplicate]
I was curious about collections and was looking at the source code for many of the popular ones (List, Dictionary, etc). I've noticed that a lot of them (all of them?) use an integer called "...
2
votes
1
answer
2k
views
SSIS: How can you enumerate through files in Azure Storage and load each file into SQL Server
I would like to do something that seems straightforward, but I am not having much joy. I want to build an SSIS Package using the For Each Loop container configured for the Foreach Azure Blob ...
1
vote
3
answers
476
views
Enums in Constructors in C++
I am very new to Constructors and OOP in C++ and I encountered the following problem.
I try to make the following class, but apparently something is wrong with the enumerators.
Also I was wondering if ...
6
votes
1
answer
577
views
Why does enumerating an empty array does not allocate on the heap?
Consider the following benchmark:
[MemoryDiagnoser]
public class EnumerableBenchmark
{
private IEnumerable<string> _emptyArray = new string[0];
private IEnumerable<string> ...
4
votes
4
answers
221
views
How to create a "clone"-able enumerator for external iteration?
I want to create an enumerator for external iteration via next that is clone-able, so that the clone retains the current enumeration state.
As an example, let's say I have a method that returns an ...
1
vote
1
answer
440
views
Create Enumerable In Place Slice Of Array in Ruby
I'm looking to find a way to take an array in ruby, two indices in that array and return an enumerable object which will yield, in order, all the elements between and including the two indices. But ...
4
votes
2
answers
439
views
How does Ruby enumerator terminate iteration?
Friends, please I need help with this explanation: In the Ruby code below, what condition termites the loop do? It's supposed to be an infinite loop, but, how does it terminate?
# Ruby code
fib = ...
2
votes
1
answer
126
views
How to dry up an Enumerator in Ruby
My class has a File in it and I want to implement each_line with the same feature as File#each_line so it can be called with a block or without a block. When called without a block, an Enumerator is ...
2
votes
1
answer
2k
views
Foreach calls MoveNext in Enumerator first, Current second
My issue is basically in order of the functions/property called. I have a custom linked list, circular one. So I made a custom enumenator and all. The issue is, the foreach cycle actually calls the ...
3
votes
1
answer
483
views
Is the enum inside a class static?
In the bellow, the values of enum inside the class can be accessed by the name of the class.(I didn't even instantiate the class!)
class Shifting
{
public:
enum Value: char
{
UP, RIGHT, DOWN, ...
3
votes
1
answer
4k
views
Difference between Iterator and Enumerator object
The enumerate() function takes an iterator and returns an enumerator object. This object can be treated like an iterator, and at each iteration it returns a 2-tuple with the tuple's first item the ...
0
votes
2
answers
29
views
I want to print out the enumerator data in columns or as a list
SO...I have this piece of code here.
class secondary
{
enum DocDetails
{
DrHowlett(500, "Orthopedist"),
DrMurdock(300, "ENT specialist"),
DrNarendra(1000, "...
2
votes
2
answers
134
views
Linq list of enumerators seem to be recreated when accessed through linq [duplicate]
I am trying to understand what goes wrong in the following piece of code.
var signals = new List<List<double>>
{
new List<double> {1, 2, 3},
new List<...