How use LINQ in C++\CLI managed codes [duplicate] - arrays

This question already has answers here:
Best way to convert some C# codes with Lambda Expressions to managed C++\CLI [closed]
How to use LINQ in C++/CLI - in VS 2010/.Net 4.0
(2 answers)
Using C# extension methods from managed C++/CLI
(1 answer)
Closed 6 years ago.
There is a simple managed code in C++\CLI :
cli::array<String^>^ ar= gcnew cli::array<String^>{"Stack","Over","Flow", "Over" };
Now i want to sort this array using with LINQ.
How use LINQ in C++\CLI managed codes?
In regular .net & c# language programming way we act like this :
string[] ar = new string[] {"Stack","Over","Flow", "Over" };
string[] ar_sort = ar.OrderByDescending(s => s).ToArray();
int count = ar_sort.Where(s => s.Contains("Over")).Count();
Now i want convert them to C++\CLI managed :
cli::array<String^>^ ar= gcnew cli::array<String^>{"Stack","Over","Flow", "Over" };
... What about this line????
... And What about this line????
Based on this link :
How to use LINQ in C++/CLI - in VS 2010/.Net 4.0
C++/CLI does not support LINQ syntax.
But this link is for 2011 year & related to VS 2010.
My VS version is 2015.
So This Question is not duplicate.
Please don't vote to close.

Related

Table control alignment issue in winforms rdlc [duplicate]

This question already has answers here:
Windows Forms Graphic Issue on Windows 10 OS
(1 answer)
How to configure an app to run correctly on a machine with a high DPI setting (e.g. 150%)?
(6 answers)
Closed 1 year ago.
I am trying to render rdlc in winforms with
Me.ReportViewer1.ProcessingMode = Microsoft.Reporting.WinForms.ProcessingMode.Local
I am getting table control alignment issue when rendering
but when printing it is displaying properly
below is the code I am using for render rdlc in winforms
Me.ReportViewer1.ProcessingMode = Microsoft.Reporting.WinForms.ProcessingMode.Local
Dim LocalReport = Me.ReportViewer1.LocalReport
LocalReport.Refresh()
LocalReport.ReportPath = Application.StartupPath + "\\MessageReports\\Report2.rdlc"
Dim dsReportDataSource = New Microsoft.Reporting.WinForms.ReportDataSource()
dsReportDataSource.Name = "DataSet1"
dsReportDataSource.Value = dtCancelMessage
LocalReport.DataSources.Add(dsReportDataSource)
Me.ReportViewer1.RefreshReport()
I am using using dotnet framework 4.8
Is this the known issue or am I doing anything wrong

return whole nested array in mongo document in pymongo [duplicate]

This question already has answers here:
How to select a single field for all documents in a MongoDB collection?
(24 answers)
Closed 3 years ago.
I am probably going nuts but I can't find anyway to return a whole array (not just specific element) from a document.
Here is a document:
> {'_id': ObjectId('5c82a442338325bcc71a9872'), 'sg_id': 'sg-12341234',
> 'ingress_rules': {'port': 22, 'cidr ': ['172.22.36.0/24',
> '172.22.4.0/24']}}
What I want is to return whole of cidr array.
I am using mongo 3.2, and pymongo (Python3.7)
I got it.
I assumed that I needed to specify an array on the find path and not on the filter path.
Something like this:
db.collection.find({ports}});
However that was incorrect, the right way to do this is put it in filter like this:
db.collection.find({}, { port : 1});
I misunderstood how the initial part of filtering works.

How to set constants from file once for app working session [duplicate]

This question already has answers here:
Read in file for constants #java
(2 answers)
Closed 4 years ago.
I have javafx application. What i want to do:
When application starts, it reads some file with userConstants (email data, phone data etc) and save it somewhere and uses those constants all time during application working session. So where do i need to store this data? Some special class, or enum? I don't want to read this file every time, when other classes needs those constants.
I hope you understand my question )
public class ConstantsClassName{
public static final String MAXARRAYSIZE;
static{
// read your file and store the data in;
MAXARRAYSIZE = valueRetrievedFromFile;
}
}
Solution found! From here

Reflection error when using F# sprintf "%A" on Windows Phone

I have a set of F# record types like this:
type Course =
{ Id : int
Title : string
Instructor : string
Duration : string
StartDate : string
IconUrl : string
Url : string
LectureSections : LectureSection list }
and LectureSection =
{ Title : string
Completed : bool
Lectures : Lecture list }
and Lecture =
{ Title : string
VideoUrl : string }
and at some point I call
sprintf "%A" course
where course is an instance of the Course record
On a regular .NET project this works fine, but on a Windows Phone 7.1 / Silverlight 4 F# project (I'm using Daniel Mohl's templates), I get this error:
Late bound operations cannot be performed on types or methods for which ContainsGenericParameters is true.
The problem seems to be the lists. Does anyone know of any way around this problem?
The templates should come with a custom built FSharp.Core.dll that disable features that are not available on Windows Phone. Are you sure you are compiling against this dll, and not the Windows PC one?
I had similar problems with Xbox360 and XNA. The F# team sent me a dll suitable for use for the Xbox360, along with some brief instructions on the settings used to build the dll.
Here is the propertygroup we've used to compile FSharp.Core:
<PropertyGroup Condition="'$(TargetFramework)'=='Xbox360\CompactFramework\3.7'">
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
<XnaFrameworkVersion>v4.0</XnaFrameworkVersion>
<XnaPlatform>Xbox 360</XnaPlatform>
<XnaProfile>HiDef</XnaProfile>
<XnaCrossPlatformGroupID>a8d70e6b-9a75-4aec-80f8-62cf373f7368</XnaCrossPlatformGroupID>
<XnaOutputType>Game</XnaOutputType>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<DefineConstants>$(DefineConstants);FX_NO_ARRAY_LONG_LENGTH;FX_NO_DEBUG_PROXIES;FX_NO_EXIT;FX_FSLIB_IOBSERVABLE;FX_NO_WEB_CLIENT;FX_NO_WEB_REQUESTS;FX_NO_CHAR_PARSE;FX_NO_DEFAULT_DEPENDENCY_TYPE;FX_SIMPLE_SECURITY_PERMISSIONS;FX_NO_TRUNCATE;FX_NO_CULTURE_INFO_ARGS;FX_NO_REFLECTION_MODULE_HANDLES;FX_NO_OPERATION_CANCELLED;FX_NO_TO_LOWER_INVARIANT;FX_NO_EXIT_CONTEXT_FLAGS;FX_NO_BASED_ARRAYS;FX_NO_DOUBLE_BIT_CONVERTER;FX_NO_BINARY_SERIALIZATION;FX_NO_ASCII_ENCODING;FX_NO_DEFAULT_ENCODING;FX_NO_FILE_OPTIONS;FX_NO_NONBLOCK_IO;FX_NO_COMMAND_LINE_ARGS;FX_NO_ENVIRONMENT;FX_NO_PROCESS_START;FX_NO_APP_DOMAINS;FX_NO_PROCESS_DIAGNOSTICS;FX_FSLIB_STRUCTURAL_EQUALITY;FX_FSLIB_LAZY;FX_FSLIB_TUPLE;FX_NO_REFLECTION_EMIT</DefineConstants>
<Tailcalls>false</Tailcalls>
<!-- It would be better to use MSBuild resolution here, but the TargetFrameworkIdentifier etc. aren't set up quite correctly as yet -->
<OtherFlags>$(OtherFlags) --simpleresolution -r:"C:\Program Files\Microsoft XNA\XNA Game Studio\v4.0\References\Xbox360\mscorlib.dll"</OtherFlags>
</PropertyGroup>
and the new .targets we use:
<Import Project="$(MSBuildExtensionsPath)\Microsoft\XNA Game Studio\Microsoft.Xna.GameStudio.targets" Condition="'$(TargetFramework)'=='Xbox360\CompactFramework\3.7'"/>
The dll they sent me was working fine, and I never had to use these instructions, but they might be useful to someone who wants to build an FSharp.Core.dll for a new platform. Note in particular the DefineConstants part.

Salesforce - Newbie to Apex

I could use some general assistance with a simple bit of Apex code. Just so you know I am a newbie to Salesforce.com, but not to web application programming (12 years but with Coldfusion and some Perl and am used to the MVC architecture), although I have not been exposed deeply to Java or C#.
So I am working on a simple controller that I'll use in a simple VF page. I'd just like to return the value and display it on the page but Im running into some syntax issues during compile. Here's my code so far:
Controller - mytest.cls
public with sharing class myTest {
public class addNewFolder {
String tmpFolderName = 'MyTestFolder';
String tmpObjectID = '22K22';
String tmpResult = 'Whoo-hoo!';
System.debug('XIX|' + tmpResult);
return tmpResult;
}
}
Error
Description Resource Path Location Type
Save error: expecting a right parentheses, found 'XIX|' mytest.cls /PREPROD/src/classes line 15 Force.com save problem
As I understand
addNewFolder
is a METHOD. So instead of writing
public class addNewFolder
you must write
public string addNewFolder() {... return tmpResult;}
I hope it will help you.
It looks like the | character is causing the error. You could try escaping the | character like this:
System.debug('XIX\\|' + tmpResult);
Or, you could use a different character:
System.debug('XIX-' + tmpResult);
Update: Upon looking more carefully at your code, I realized superfell is right (see his comment on your question above).

Resources