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
N

N a v a n e e t h

@N a v a n e e t h
About
Posts
6.8k
Topics
254
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Controling Video files
    N N a v a n e e t h

    Look at ffmpeg[^], OpenCV[^] etc. Not sure if there is a C# port available. But it won't be hard to call these libraries from C#.

    Best wishes, Navaneeth My blog

    C# csharp com

  • Thread.Sleep is NOT evil
    N N a v a n e e t h

    devvvy wrote:

    THUS FAR there isn't ONE SINGLE argument that justify against use of Thread.Sleep against SCENARIO 2.

    As Pete already told, you are ignoring the comments that we made for Scenario2. See my answer.

    Best wishes, Navaneeth My blog

    C# database com question discussion career

  • Thread.Sleep is NOT evil
    N N a v a n e e t h

    Pete O'Hanlon wrote:

    Errm. Yes, we have posted arguments against, you're just choosing to ignore them.

    I second that. He don't have the maturity to understand what people are saying. So no point in discussing further. :)

    Best wishes, Navaneeth My blog

    C# database com question discussion career

  • Setup Package for C# Windows application
    N N a v a n e e t h

    Look here[^].

    zead wrote:

    I was developed a c# windows application and now I want to create a setup package for it that contains the SQL SERVER and .NetFramework and the application itself.

    I don't think you can package SQL server with your application. Not sure if the license allows to do this.

    Best wishes, Navaneeth My blog

    C# csharp database sql-server sysadmin help

  • CLOSING FORMS
    N N a v a n e e t h

    Process won't quit till the main form and all foreground threads finishes executing. If you close the Form1, it should get closed properly. Is that happening?

    Best wishes, Navaneeth My blog

    C# csharp visual-studio help java tutorial

  • c# 64 bit .net c++ dll reference problem
    N N a v a n e e t h

    peter462 wrote:

    the Default cpu settings is anycpu,when i change it to x64,the result is the same.but when i change it to x86 it can work well.

    Where are you changing? In the C# project?

    Best wishes, Navaneeth My blog

    C# csharp help c++ tutorial announcement

  • How to read out whole static text present on external application's Input boxes or message boxes in C#
    N N a v a n e e t h

    sham bhand wrote:

    Is there any way to read out this message programmatically??

    I don't think there is way to do this completly using .NET classes. You have to work with native windows functions to do this. The idea is 1 - Get the window handle for the textbox you need to read. You can use FindWindow()[^] or FindWindowEx[^] to get a window handle. 2 - use SendMessage and send WM_GETTEXT to the handle to get the text.

    Best wishes, Navaneeth My blog

    C# tutorial csharp question

  • Thread.Sleep is NOT evil
    N N a v a n e e t h

    Simon_Whale wrote:

    What would you recommend as a better method of doing the same as thread.sleep inside a thread?

    If you want to run a job which executes in every 'n' minutes, you can use System.Threading.Timer. If you want to wait till another thread finishes execution, you can use WaitHandle. If you just want to sleep, use Thread.Sleep() :)

    Best wishes, Navaneeth

    C# database com question discussion career

  • Thread.Sleep is NOT evil
    N N a v a n e e t h

    Thread.Sleep() is not EVIL if you know how it works and if that's the behavior that you really want to accomplish. The reason people say it is evil because they use it wrongly without understanding how it works.

    devvvy wrote:

    SCENARIO 2 - humble timing while loop: I'm not hearing any reason not to use it. As indicated

    If your application doesn't care about accuracy of the execution ineterval, then Thread.Sleep() is alright to use. Let us say you need to execute some task every minute and you start the application at 10AM. It is supposed to execute at 10.01, 10.02, 10.03 etc. You'd write something like,

    while(!exit)
    {
    // Do your job
    Thread.Sleep(10000);
    }

    What happens if your job takes more than 1 minute? Then the next run which was supposed to happen at 10.01 won't happen. This delays the next execution too. With this design, it will be hard to tell when the next run will happen. If this behavior is alright for your application, there is no problem in using Thread.Sleep(). To workaround this problem, you can use System.Threading.Timer to schedule the job. It gives a better scheduling capabilities and executes the job exactly at the interval that you specify. Timer callback method can be executed simultaneously by multiple threads if the job takes more time than the interval. This increases parallelism and makes the processing faster. It is also logical to think that why do you need to waste a thread by just sleeping? The wastage could be minimal, but it is a wastage. Where System.Threading.Timer uses thread pool threads and thread pools are more optimized for better usage of resources. Thread pools are initialized with a set of threads when the application domain starts.

    devvvy wrote:

    This is an over discussed subject, gives people wrong impression this is actually complicated, that Thread.Sleep is really evil.

    It's about maturity. If you know how Thread.Sleep() works then you'd probably use it correctly and use alternatives where Thread.Sleep() is not the right solution. Any statement which says Thread.Sleep() is evil without understanding the context where it is used is STUPID.

    Best wishes, Navaneeth

    C# database com question discussion career

  • web service keep a process open
    N N a v a n e e t h

    What process is active?

    Best wishes, Navaneeth

    ASP.NET csharp wcf sysadmin help tutorial

  • harvesting social images for bi concept image search
    N N a v a n e e t h

    Read this[^]. Point #2 specially.

    Best wishes, Navaneeth

    .NET (Core and Framework) tutorial lounge

  • WebMatrix-Following
    N N a v a n e e t h

    Bram van Kampen wrote:

    The C# system I'm faced with, generates dozens of files, and lengthy tutorials. Unlike MFC, it does not appear to have a meaningful Help System. If I double Click a 'System' class name and press F1, I get a list of Tutorials(if anything at all) instead of a Help file which explains the class, and what methods are available.

    System is not a class but a namespace. I never used to look for local help instead always check in online MSDN. They are pretty good and well documented. Try this[^]

    Bram van Kampen wrote:

    There is no short explanation anywhere I can find,about which file does what, or how it glues together. It is to me totally unclear whether to start a Website or a Project. Does a Project contain many Websites, or does a Website contain many projects. What is the format of the End Product. An .exe or .dll file,as in MFC, a .cgi File, or what else.

    A project can contain several C# files which will be compiled together. Output of the compilation depends on the type of project created. If the type is a class library, you get a DLL and an executable file when the project type is Console or Windows or WPF application. Usually, you will start with creating an empty solution. Then add projects into the solution. So all the componenets in your project can be separate Visual studio projects contained in a single solution file (.sln). Now you can specify the project dependencies and how they reference each other. Let us assume that you are building a website. You will create an empty solution, add a class library to it which contains your websites core logic which don't have any dependencies with web related components. This project could contain wrapper classes to your C++ library. Then you can add a ASP.NET project to the solutuion wich references the assembly from the class library project.

    Bram van Kampen wrote:

    I fully understand Machine code and assembler code. I am fully aware how the CPP Compiler and Linker work, and how the lot comes together at run time. MFC has Header Filesand Libraries, and pragma's to include a DLL. It istotally unclear to me what happensin C#,

    In C# it is simple. No header files. Just a bunch of file

    C# c++ csharp visual-studio sysadmin security

  • calling a method in c++ from c#
    N N a v a n e e t h

    I wrote a blog post which covers the topic in detail. Take a look at this[^].

    Best wishes, Navaneeth

    C# csharp c++ sharepoint question

  • Parsing a web page to get just the <p> inner text.
    N N a v a n e e t h

    What you have done is BAD. Ideal way to handle this is to use a HTML parser and traverse the DOM to get the text that you need. Look at HTML Agility[^] project. If you are sure that you will always have a wellformed input, you could easily do this with regular expressions. Here is a working example.

    public static List<string> GetAllParagraphValues(string input)
    {
    List<string> values = new List<string>();
    Regex r = new Regex("<p[^>]*>(?<value>.*?)</p>", RegexOptions.IgnoreCase);
    foreach (Match match in r.Matches(input))
    {
    values.Add(match.Groups["value"].Value);
    }
    return values;
    }

    Best wishes, Navaneeth

    C# javascript css debugging json code-review

  • WebMatrix
    N N a v a n e e t h

    No. Probably it should go to Web development discussions.

    Best wishes, Navaneeth

    C#

  • WebMatrix-Following
    N N a v a n e e t h

    I don't see a good reason to use WebMatrix here. You should probably stick to ASP.NET alone.

    Bram van Kampen wrote:

    In MFC I stored all this in a C Structure (packed to byte alignment). Do the C# and C++ structures align. Do allignment pragma's exist in C#, How does C# allign DWORDS.(Big End, Little End, or Machine Dependent)

    In C#, you can add a StructLayout attribute and with a kind Explicit to the structure. Something like,

    [StructLayout(LayoutKind.Explicit)]
    public struct Example
    {
    [FieldOffset(0)]
    public int foo;
    [FieldOffset(4)]
    public int bar;
    }

    This allows you to take finer control over alignment. If you write a wrapper to your native code in C++/CLI, you don't have to worry about structure alignment in C#. Just work with managed objects.

    Best wishes, Navaneeth

    C# c++ csharp visual-studio sysadmin security

  • calling a method in c++ from c#
    N N a v a n e e t h

    bonosa wrote:

    the compiler doesn't like (void*)&ret_vals....

    Add a method to HdfCallVars so that it can give you the underlying native struct.

    Best wishes, Navaneeth

    C# csharp c++ sharepoint question

  • Web development using C++
    N N a v a n e e t h

    I don't think you can use C++ for doing ASP.NET development. You can have libraries that is written using C++, but the ASP.NET application has to be written using C# or VB.NET.

    Best wishes, Navaneeth

    .NET (Core and Framework) csharp c++ asp-net algorithms question

  • calling a method in c++ from c#
    N N a v a n e e t h

    bonosa wrote:

    But do I need to make Channel Vars a wrapper class also?

    If that is something which user has to create, you need to make it a managed class. All your internal structures don't need to be wrapped because you handle the creation of those inside your main managed object.

    Best wishes, Navaneeth

    C# csharp c++ sharepoint question

  • forcing users to use English language
    N N a v a n e e t h

    This would be tricky. If you just want to ensure script used is English, it is easy. Just scan every character in the input and make sure all the characters are valid English letters. But user can write another language using the English script. Detecting this would be tough and you need to use some natural language processing libraries.

    Best wishes, Navaneeth

    C#
  • Login

  • Don't have an account? Register

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