|
Could some one suggest some way to improve the performance of getting log description. We use FormatDescription() to read the description of the logs and the performance is pathetic.
To put the matter in perspective, if I comment the FormatDescription(), my application of parsing 28000+ logs completes in about 2 minutes, and on adding that line the application takes well over 1.3 hrs!
Regards,
Pitrak
|
|
|
|
|
FormatDescription is well known for being slow - the general recommendation is to drop down to the Win32 APIs instead.
This space for rent
|
|
|
|
|
Hi,
Thanks for the reply; could you please help me with the name of the Win32 API to use.
If you could provide a simple code snippet, that would be really helpful.
I am actually intending to use C# API's to build my application. So, how would I be using the Win32 API's?
Regards,
Pitrak
|
|
|
|
|
Have you found any workarounds for this? I'm actually facing the same issue and don't know what to do.
Regards!.
|
|
|
|
|
Guys,,, please help me to create a TCP connection C# to C++. is it possible to make a code C# SERVER and the Client is C++....please help me guys...thanks
|
|
|
|
|
Jarlo Belledo wrote: is it possible to make a code C# SERVER and the Client is C++
Yes.
Jarlo Belledo wrote: please help me to create a TCP connection
What have you tried?
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
|
|
|
|
|
|
|
TCP is TCP. What you need to do is search for an example of creating a C# TCP client/server and take the server part. Then you look for an example of creating a C++ client/server and take the client part. I suspect the question you are really asking is, what would the payload look like when communicating between them.
This space for rent
|
|
|
|
|
I suspect the question is will someone write this for me?
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I know this isn't a Powershell forum, but the question is about PS in C#..
I have the following Powershell, that clears my languagebar, Setting Norwegian language. Adds Norwegian Apple Keyboard, removes, then Adds back to the end normal Norwegian keyboard:
$li = New-WinUserLanguageList "nb-NO";
$li[0].InputMethodTips.Add("0414:A0000414");
$li[0].InputMethodTips.Remove("0414:00000414");
Set-WinUserLanguageList $li -Force
$li = Get-WinUserLanguageList
$li[0].InputMethodTips.Add("0414:00000414");
Set-WinUserLanguageList $li -Force
This works Peachy when run from the powershell commandline. It updates the Language bar, and
set the Apple keyboard as default.
But when embedding it in C# like this:
string script = "";
script += "$li = New-WinUserLanguageList nb-NO;";
script += "$li[0].InputMethodTips.Add(\"0414:A0000414\");";
script += "$li[0].InputMethodTips.Remove(\"0414:00000414\");";
script += "Set-WinUserLanguageList $li -Force;";
script += "$li[0].InputMethodTips.Add(\"0414:00000414\");";
script += "Set-WinUserLanguageList $li -Force;";
using ( PowerShell ps = PowerShell.Create() ) {
ps.AddScript( script );
var result = ps.Invoke();
foreach ( var item in result ) {
}
}
The language bar does not get updated, although the language IS switched to Norwegian...
Is there any limitations on what kind of ps-scripts you can embed in C#?
(Both the script and the c# code runs as me/current user)...
TIA.
--
Dag.
|
|
|
|
|
Your two scripts aren't identical. The first line doesn't have nb-NO quoted, so try surrounding this with \"nb-NO\" . Also, you are missing $li = Get-WinUserLanguageList from your C#.
This space for rent
|
|
|
|
|
Thanks for commenting...
Thats not it, thou... Just me trying small adjustments.
With or without quotes, and with or without re-getting the newly set list.
Results are the same.
--
Dag.
|
|
|
|
|
Thanks for commenting...
The differences are just me trying small differences. They where the same.
Didn't work in c# when they were identical either...
(But I should of course have posted them equal, to avoid confusion).
--
Dag.
|
|
|
|
|
You might need to set the execution policy:
Set-ExecutionPolicy Unrestricted -Scope Process
This space for rent
|
|
|
|
|
Yeah... It looks like that is where the dog is buried...
Thanks...
|
|
|
|
|
No problem. Glad you got it working (and I like the analogy).
This space for rent
|
|
|
|
|
Its a Norwegian proverb... Don't know where/why... But it is a good one!
Still got some small problems, thou...
I turned on ExecutionPolicy so it looks like this:
$li = New-WinUserLanguageList "nb-NO";
$li[0].InputMethodTips.Add("0414:A0000414");
$li[0].InputMethodTips.Remove("0414:00000414");
Set-WinUserLanguageList $li -Force;
$li = Get-WinUserLanguageList;
$li[0].InputMethodTips.Add("0414:00000414");
Set-WinUserLanguageList $li -Force;
- This creates a new languagelist with Norwegian standard culture,
- Adds the Norwegian Apple input (keyboard).
- Removes the Standard Norwegian keyboard.
- Set the list to be the current one in windows.
- Add back the Norwegian standard keyboard.
- Reapply the list to windows.
The sole purpose of the operation is to set the language bar to "Norwegian, with Apple Keyboard" with Norwegian with std. keyboard as a second option.
And it *ALWAYS* does, when run from Powershell/Command prompt.
When run embedded in c#, it sets Input to Norwegian Standard, and does NOT show Apple keyboard as a first (or second) alternative...
This drives me NUTS!
--
Dag.
|
|
|
|
|
Hi there , I am new to using delegates. How can i display the value 8, after I call t he delegate which calls the method Myfunc which doubles the number ?
using System;
namespace Akadia.BasicDelegate
{
public delegate int SimpleDelegate(int a);
class TestDelegate
{
public int n2;
public static int MyFunc(int b)
{
Console.WriteLine("I was called by delegate ...");
TestDelegate t = new TestDelegate();
t.n2 = b * 2;
return t.n2;
}
public int N2
{
get { return n2; }
}
public static void Main()
{
SimpleDelegate simpleDelegate = new SimpleDelegate(MyFunc);
simpleDelegate(4);
Console.ReadKey();
}
}
}
|
|
|
|
|
You display it exactly the same way as if you had called MyFunc directly i.e.
Console.WriteLine(simpleDelegate(4));
or
int val = simpleDelegate(4);
Console.WriteLine(val);
Cheers,
Mick
------------------------------------------------
It doesn't matter how often or hard you fall on your arse, eventually you'll roll over and land on your feet.
|
|
|
|
|
|
public static int MyFunc(int b)
Check your method has return type 'int' and you have also returned the value in your method but while you have made call to this method by delegate you are not using the value returning from it. You can either get that value in another variable for further processing
int x = simpleDelegate(4);
Console.WriteLine(x);
or print it directly
Console.WriteLine(simpleDelegate(4));
|
|
|
|
|
I had an idea on how to use httpClient, but I don't know if it can support 1000 users for clients. I want a multi threaded application or Web server that employs parallel programming to interact with client requests. What methods could you suggest to get me up and running? I am already reading a PDF on Socket programming that employs TCP/IP and parallel programming! What is your take on this? And if I were to buy such an application, how would I know if it can support 1000 clients or Multiuser functionality at all? This is for a Grammar checker web server, and client question on C language.
|
|
|
|
|
nqioweryuadfge wrote: if I were to buy such an application, how would I know You would ask the people you buy it from.
|
|
|
|
|
They are theives, and don't tell honest! Upwork is one platform where you hire a freelancer only to be told, "We submitted code, now he doesn't want to pay!" When you ask him how to implement or set it up! They refuse, all they talk of is we submitted the code!
|
|
|
|