Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
U

uusheikh

@uusheikh
About
Posts
82
Topics
22
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Modify Collection using LINQ
    U uusheikh

    Thanks, now i understand.

    C# question tutorial csharp database linq

  • Modify Collection using LINQ
    U uusheikh

    I have a simple question, but i don't know how to do it. I have a collection of data, and would like to query it using LINQ. Then, i want to modify the resultant collection, which updates the original collection For example i have the following collection int[] data = { 0, 1, 2, 3, 4, 5 }; I want to select all data larger than 3 (thus 4 and 5), and then modify them by multiplying them with 10. My final collection should look like this. (This is a simple example, in reality, i will be using a complex object) data = {0, 1, 2, 3, 40 , 50}; I tried this; but doesn't update the original collection. Does ToList() return a copy of the collection? How do i go about doing this?

    int[] data = { 0, 1, 2, 3, 4, 5 };

            var a = from n in data
                    where n > 3
                    select n;
    
    
    
            List<int> b = a.ToList();
            for (int i = 0; i < b.Count(); i++)
            {
                b\[i\] = 10\*b\[i\];
                Console.WriteLine(b\[i\]);
            }
    
            for (int i = 0; i < data.Count(); i++)
                Console.WriteLine(data\[i\]);
    

    Data still contains 0,1,2,3,4,5 instead of 0,1,2,3,40,50,which is what i want. Please help, many thanks.

    C# question tutorial csharp database linq

  • C++ return value from function
    U uusheikh

    Oh yes, comma is used in for loops. It's so common! I didn't realize it! Thanks!

    C / C++ / MFC question c++ testing beta-testing

  • C++ return value from function
    U uusheikh

    If so, what is the use of the comma operator? Is there real use for it?

    C / C++ / MFC question c++ testing beta-testing

  • C++ return value from function
    U uusheikh

    Hi there, i was testing this the other day, and it compiles fine. int Test(int a, int b, int c) { return a,b,c; } doing this; printf("\n %d", Test(10,20,30)); will always give 30. Can anyone explain what is actually happening in the code above, and why it is even possible to compile such a code? what does return a,b,c actually implies? I never seen any code that does that, (all codes return 1 value), but if this code can compile, what does it mean? (Tested using VC++2008)

    C / C++ / MFC question c++ testing beta-testing

  • A simple question regarding String
    U uusheikh

    Ok, i understand. Thanks.

    C# question

  • A simple question regarding String
    U uusheikh

    Hi, i'm confused. If String is a reference type, why b does not change if a is modified, since b is just referring to a? E.g.

    String a = "Hello";
    String b = a;

    a = a.ToUpper();

    Console.WriteLine(a);
    Console.WriteLine(b);

    HELLO
    hello

    Thanks

    C# question

  • Passing CString between DLLs
    U uusheikh

    :) Maybe I should..

    C / C++ / MFC csharp c++ visual-studio question

  • Pointer - Protection from deletion
    U uusheikh

    Thanks.. I get the picture now. There is simply no way.. Have to trust the programmer :)

    C / C++ / MFC question

  • Pointer - Protection from deletion
    U uusheikh

    I'm looking at smart pointers, auto pointers. Can it be used?

    C / C++ / MFC question

  • Passing CString between DLLs
    U uusheikh

    What about sending std::string? Is it also NOT safe?

    C / C++ / MFC csharp c++ visual-studio question

  • Pointer - Protection from deletion
    U uusheikh

    I didnt mean 'accidentally deleted' in that way, what i meant was that, if i pass a pointer to a function, i dont want the function to take 'ownership' and delete it etc (due to bad programming on the function side, which i have no control of it). If I allocated the pointer, only i will have the ability to delete it. Other consuming functions can only process, read/write and not delete. Can it be done?

    C / C++ / MFC question

  • Pointer - Protection from deletion
    U uusheikh

    Is there anyway I can protect a pointer from being deleted by a function, but at the same time allow the function to operate on the pointer? In other words, I want to protect the pointer from accidentally being deleted by the consuming function.

    C / C++ / MFC question

  • Passing CString between DLLs
    U uusheikh

    I have a DLL created in Visual Studio 2005, and going to use it in Visual Studio 2008. The function in the DLL takes CString as a parameter. Is it safe to send CString from VS08 to VS05/VC6 DLL? I think different versions of VC++ will have different internal implementation of CString and it would not be safe. Whats the best way?

    C / C++ / MFC csharp c++ visual-studio question

  • high-contrast color array generation
    U uusheikh

    In image processing, high contrast colors are often used to display labeled images. That is, image that has gone thru the labeling/connected component process. In that case, to display the resultant image, we use something called "Binary Color Table", which consists of 15 different colors, that are completely different with each other. These are the colors; byte bSize = 15; // Binary palette has 15 colors, cycled 15 times. byte r[] = {255,0,0,255,255,0,255,255,127,127,0,0,255,127,127}; byte g[] = {0,255,0,255,0,255,127,0,255,0,127,255,127,255,127}; byte b[] = {0,0,255,0,255,255,0,127,0,255,255,127,127,127,255};

    Algorithms data-structures

  • How to switch to Form Designer for inserted Form.h?
    U uusheikh

    Thanks!!! It works! I have tried, and it works great. Except, that you need to rename the namespace so that it is the same in the new project. Great tip! Thanks again.

    Managed C++/CLI question c++ dotnet tutorial

  • How to switch to Form Designer for inserted Form.h?
    U uusheikh

    Hi, i tried that too, but its just the same. I cant switch to form designer.

    Managed C++/CLI question c++ dotnet tutorial

  • How to switch to Form Designer for inserted Form.h?
    U uusheikh

    I have designed a Winform Form, lets say Form1.h. I can switch to its Form designer and drop components etc. Now, if i insert this Form1.h in a different solution/project, i can compile, call the Form, but i cannot switch to the form designer. It's like a plain .h file. How can i make VS2008 understand that this is a form, so that i can edit it visually? I'm using VS2008 C++/CLR. Thanks

    Managed C++/CLI question c++ dotnet tutorial

  • Problem redistributing C++/CLR App
    U uusheikh

    Hi, i developed a C++/CLR App using Visual Studio 2008. The following are the settings 1. Developed using VS2008, Featurepack was installed but not used(april) (x86 machine Vista SP1) 2. /clr:pure, pure .NET, no native code. 3. Target framework set to 2.0 4. I used cliext STL/CLR in the project. 5. Release mode When i try to distribute the compiled exe on a Windows Xp SP2 PC, i tried the following and the program would not run. 1. I copied the exe to target machine 2. Installed .NET framework 2.0 3. Ran the app, and an error occurs - "The application failed to start because of configuration incorrect..." I then tried to install 4. Install VCredist 2008 5. Ran the app, the app launches but a new error occurs "System.IO.FileNotFoundException: Could not load file or assembly 'Microsoft.VisualC.STLCLR, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The system cannot find the file specified. File name: 'Microsoft.VisualC.STLCLR, Version=1.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' ...." I then installed .NET framework 3.5 and the app finally runs perfectly. What i dont understand is, 1. Why do i need the VS2008 redist? I thought this was only for native code. I didnt use any native code in my assembly, in fact i compiled as /clr:pure! Checking the .exe using dependecywalker shows that the exe only depends on MSCOREE.DLL, no MFC,CRT etc. 2. Why did the compilation proceeded even in VS2008 when i selected the target framework to be 2.0. I used STL/CLR in my app, why didnt the compiler tell me that STL/CLR is part of .NET 3.5 and produce an error during compilation? 3. I was expecting it to run properly with .NET framework 2.0 installed only, just like any other C# code targetted for this framework. I didnt expect vcredist and .net 3.5 required.. Can anyone clarify this? Anyone had this problem, or my approach was incorrect? Thanks

    Managed C++/CLI c++ csharp dotnet help announcement

  • Redirection in command line "&lt;"
    U uusheikh

    Ok, thanks man. That's a better idea.

    C / C++ / MFC c++ question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups