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
A

Ami Bar

@Ami Bar
About
Posts
60
Topics
15
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • 32-Bit application runs faster than 64-Bit, any ideas?
    A Ami Bar

    Hi Luc,

    Luc Pattyn wrote:

    So if your 64-bit app is slower, something definitely is wrong. Are you comparing equal things (e.g. both release builds, identical jobs)?

    It is the exact project (Release mode), the only difference is the target CPU x86 or x64.

    Luc Pattyn wrote:

    If you have been trying to optimize things by using multiple threads, then maybe the two systems you compare are not equally happy about your threading approach. If this applies, it has to be looked at more thoroughly... As a first measure, you could reduce to one thread and compare these (again expecting equality).

    I am using some multithreading, I'll try to do it in one thread and check the results. Thanks for the advice. Ami

    .NET (Core and Framework) question csharp

  • 32-Bit application runs faster than 64-Bit, any ideas?
    A Ami Bar

    Hi, The common type is double, which is 8 bytes long. The application does a lot for number operations (simple adding, multiplying, etc.) I expect the x64 version to run at least as fast as the x86 version. I am using C#. Ami

    .NET (Core and Framework) question csharp

  • 32-Bit application runs faster than 64-Bit, any ideas?
    A Ami Bar

    Hi, I have a .net application that does a lot of number crunching and I run it on a 64-Bit machine with quad CPU. The machine has 4GB RAM.:) When I compile the application to explicitly target x86 machine the application runs faster than when I compile it to target x64 machine. The difference is around 50% !!!:confused: I don't change anything in the application except the target machine. The application is a pure .net application. Any idea, what is the reason for this? Ami

    .NET (Core and Framework) question csharp

  • Unreliability of the FileSystemWatcher
    A Ami Bar

    Hi, You have to set the InternalBufferSize property of the FileSystemWatcher, or else you loose events. Look at the MSDN for more information. Ami

    C# database c++ lounge

  • dynamic_cast changed behavior in VS5
    A Ami Bar

    Correct. Ami

    Clever Code help csharp c++ visual-studio oop

  • dynamic_cast changed behavior in VS5
    A Ami Bar

    I already know what should be done. The point is the behavior of the dynamic_cast. Ami

    Clever Code help csharp c++ visual-studio oop

  • dynamic_cast changed behavior in VS5
    A Ami Bar

    My bug was not revealed, because Microsoft missed a check. In VS05 they fixed it. Ami

    Clever Code help csharp c++ visual-studio oop

  • dynamic_cast changed behavior in VS5
    A Ami Bar

    I got into this case during migration of C++ code from VS03 to VS05. class BaseClass { ... }; class DerivedClass : BaseClass { ... }; Very simple code, when you'll try to cast DerivedClass to BaseClass: DerivedClass *d = new DerivedClass(); BaseClass *b = d; The compiler will fail with an error. (Stop here and try to understand why) Gave up, the compiler will fail with and error: error C2243: 'type cast' : conversion from 'DerivedClass *' to 'BaseClass *' exists, but is inaccessible. If you will try to do: DerivedClass *d = new DerivedClass(); BaseClass *b = dynamic_cast(d); The compiler will show a warning: warning C4540: dynamic_cast used to convert to inaccessible or ambiguous base; run-time test will fail ('DerivedClass *' to 'BaseClass *') The reason for this is that the default inheritance access is private, this means that DerivedClass definition is equal to: class DerivedClass : **private** BaseClass { ... }; Which means that DerivedClass cannot be cast to BaseClass. To fix this we need to change the code and explicitly state that the derivation is public: class DerivedClass : **public** BaseClass { ... }; It is little complicated to show it here, but you can build a code that uses the dynamic_cast and doesn't show the warning or an error. It involves in using a dll that implements the classes, and an exe that uses these classes with forward declaration, and a virtual clone method, very ugly, but this is how our code is written. Now I am getting to the point. Assume you have code like the following, that doesn't show any error or warning during compilation. BaseClass *foo(DerivedClass *d) { BaseClass *b = dynamic_cast(d); return b; } When this code is compiled with Visual Studio 2003, d will be cast to the BaseClass successfully at run-time and b will be a valid pointer. When this code is compiled with Visual Studio 2005, b will be NULL at run-time. For years we didn't see that there was a missing 'public' in that inheritance, because everything worked. Note that the original application doesn't rely on the dynamic_cast, it only uses it in an assert statement to check that a casting is correct.

    Clever Code help csharp c++ visual-studio oop

  • Select User dialog
    A Ami Bar

    Ok I found it, there is even an article about this: Using the Windows 2000/XP Object Selection Dialog[^] Thanks, Ami

    C / C++ / MFC tutorial json question

  • Select User dialog
    A Ami Bar

    Thanks, but I already found this API and if I won't have a choice I will use it. I thought that if the API CredUIPromptForCredentials asks for a user name and password, there must be a similar API that does what I need. Ami

    C / C++ / MFC tutorial json question

  • Select User dialog
    A Ami Bar

    It has to be a Windows common dialog or something. Ami

    C / C++ / MFC tutorial json question

  • Select User dialog
    A Ami Bar

    When you change a security permission for file, registry key, etc. You can choose a user/group to add to the DACL by a Select user dialog. I am looking for a Windows API that open this dialog. Ami

    C / C++ / MFC tutorial json question

  • Select User dialog
    A Ami Bar

    I am looking for the Windows API that opens the Select User dialog. Can anyone give a reference or an example on how to do this ? Thanks, Ami

    C / C++ / MFC tutorial json question

  • Folder Protection..
    A Ami Bar

    The File System is responsible to protect files and folders. The access limitation is defined by account (Windows' users and groups) and permissions (read, write, delete, etc.). You cannot set access permission by application. Not every file system supports file access protection. NTFS supports, FAT doesn't. Ami

    C# question tutorial

  • Threading Question
    A Ami Bar

    I did something similar when I implemented my SmartThreadPool. Check my article: http://www.codeproject.com/cs/threads/smartthreadpool.asp[^]. I implemented a special queue that items are queued FIFO, but waiters queue LIFO. You can change the code to get what you want. Ami

    C# data-structures question

  • Building strings
    A Ami Bar

    I checked it on .NET 1.1, it still optimize the strings. Ami

    Clever Code csharp

  • Building strings
    A Ami Bar

    What I am saying is that in your example the string.Concat is not used. Maybe it is used during the compilation time (Translating the code to IL) by the compiler, however in the IL the string.Concat is not used. At runtime there is no string.Concat either. Ami

    Clever Code csharp

  • Thread taking maximum CPU time-
    A Ami Bar

    You can use a synchronizer, like semaphore to avoid the CPU usage of the ComportThread(). The ComportThread will wait on a semaphore. The producer will signal the semaphore when an object is queued. This way the ComportThread will wake up only when it is needed. Ami

    C# question data-structures help

  • Building strings
    A Ami Bar

    You are correct, but your examples are wrong. string a = "My " + "new " + "string"; is compiled into: string a = "My new string"; You can see this with the Reflector. To correct your example use variables in the string: string a = "new "; string b = "My " + a + "string"; Ami

    Clever Code csharp

  • Environment Variables not Updating
    A Ami Bar

    If you have WinForm application you can override the WndProc method:

    public class Form1 : Form
    {
    private const int WM_SETTINGCHANGE = 0x001A;

    public Form1()
    {
        InitializeComponent();
    }
    
    protected override void WndProc(ref Message m)
    {
        // This is a message code that is sent when system-wide setting is changed
        if (WM\_SETTINGCHANGE == m.Msg)
        {
            if (m.LParam != IntPtr.Zero)
            {
                // Convert the LParam to string 
                string whatChanged = System.Runtime.InteropServices.Marshal.PtrToStringAuto(m.LParam);
    
                // Check if an Environment variable was changed 
                if (null != whatChanged && "Environment" == whatChanged)
                {
                    // Here goes the code that updates your application
                    MessageBox.Show("Environment variable changed");
                }
            }
        }
        // Don't forget to execute the message so the GUI will work.
        base.WndProc(ref m);
    }
    

    }

    Ami

    C# tutorial csharp help question announcement
  • Login

  • Don't have an account? Register

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