|
Bogdan Rechi wrote:
optimally?
performance-wise?
I guess get pointers to arrays' bases and use them (the array sizes too) with the memcpy function, accessible from C++ (i think it's in memory.h ).
Simplicity?
Create a big array and copy inputs into it with the Array.Copy(Array, int, Array, int, int) method
there are no facts, only interpretations
|
|
|
|
|
Use a memory stream:
byte[] arr1 = new byte[] {1,2,3,4};
byte[] arr2 = new byte[] {9,8,7,6};
byte[] arrFin;
using (MemoryStream ms = new MemoryStream())
{
ms.Write(arr1, 0, arr1.Length);
ms.Write(arr2, 0, arr2.Length);
arrFin = ms.ToArray();
}
Grim (aka Toby) MCDBA, MCSD, MCP+SB
SELECT * FROM user WHERE clue IS NOT NULL
GO
(0 row(s) affected)
|
|
|
|
|
Grimolfr wrote:
ms.ToArray()
I used GetBuffer and it returned an array larger then the actual number of bytes inside (it grows by doubling the current size).
Thank you!
"though nothing
will keep us together
we can beat them
for ever and ever"
rechi
|
|
|
|
|
I hvae a webmethod in my webservice, when I debug it, a xml format file is benn make. I want to out put the xml file on my webmethod, For example, At last line my webmethod add a some code.Because when I debug the webmethod, it can work normally. But when I call it at my webapplication, it has a error that There is an error in XML document (421, 39). I think that this is error what data xml have some special characters.
|
|
|
|
|
Have you looked into creating a SoapExtension for debugging purposes? Can be helpful.
This posting is provided "AS IS" with no warranties, and confers no rights.
Alex Korchemniy
|
|
|
|
|
Hi everyone,
Could you please tell me what the best and error-prone way to sign and verify XML files exists? Which CSP provider exists on all 2K and XP machines? What is the optimal key-length so that it works with all localized Windows versions?
The only constraint I provide is the ability to sign with the private key and to check with the public key.
Thanks in advance.
Regards,
Serge (Logic Software, Easy Projects .NET site)
|
|
|
|
|
Serge Lobko-Lobanovsky wrote: best and error-prone way
|
|
|
|
|
Your smile shows you have no practical experience in this subject and do not understand that there are problems with both 1.0 and 1.1 crypto API implementation. So I am really sorry for the traffic you've wasted when posting your smiley.
Novichek?
Regards,
Serge (Logic Software, Easy Projects .NET site)
|
|
|
|
|
Yo, I wasn't answering your question. I was just making a joke out of "error-prone". By definition error-prone means "capable of making an error". I'm sure that's not what you are looking for.
|
|
|
|
|
By default Katakana charactor (in Japanese) takes two bytes, but it can also be displayed using one byte(that reduces charactor width). Is there any standard way to convert two byte Katakana charactors in to one byte charactor in a given string that may have Kanji and Katakana in it.
Please guide.
|
|
|
|
|
No there isn't. You'll have to use some customized compression technique on the strings. But, when you wanted to do ANYTHING with them, like display them or manipulate the strings in any way, you'd have to decompress what your using.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
hi , i click button1 to open form1. if i click the button1 again, i don't want to open a new form1 BUT focus on the already opened form1. i tried for1.focus() but is not working. why?
Chris
|
|
|
|
|
Create Form1 as Singleton class. this will solve the problem
|
|
|
|
|
|
Try this.
<br />
private Form Frm;<br />
private void button1_Click(object sender, System.EventArgs e)<br />
{<br />
if(Frm!=null)<br />
{<br />
Frm.TopMost=true;<br />
Frm.Activate();<br />
<br />
}<br />
else<br />
{<br />
Frm=new Form();<br />
Frm.TopMost=true;<br />
Frm.Show();<br />
}<br />
<br />
}
Sreejith Nair
[ My Articles ]
|
|
|
|
|
Hi, all.
I am working on a C# code that can retrieve system log by using WMI.
However, the code is working fine under windows 2000, but got error messages
under Windows XP.
The erro message is :
Unhandled Exception: System.Management.ManagementException:Access denied.
at System.Management.Management.Exception.ThrowWithExtendedInfo(ManagementStatus errorCode)
at System.Management.ManagementEventWatcher.Start()
Part of my code is like following and I believe this is where the problem at:
----------------------------------------------------------------
public static ManagementEventWatcher getWatcher(string comp, string LogName)
{
ConnectionOptions co;
ManagementPath mp;
ManagementScope ms;
WqlEventQuery EventQuery;
ManagementEventWatcher watcher;
string wql;
string wqlAnd;
co = new ConnectionOptions();
co.Timeout = new TimeSpan(0, 0, 60);
co.EnablePrivileges = true;
mp = new ManagementPath();
mp.NamespacePath = @"\root\cimv2";
mp.Server = comp; // comp is the computer you are connecting to
ms = new ManagementScope(mp, co);
Console.WriteLine("host is" + comp +"Logname is "+LogName);
switch(LogName.ToUpper())
{
case "ALL":
wqlAnd = "";
break;
case "SECURITY":
wqlAnd = " AND TargetInstance.Logfile ='Security'";
break;
case "SYSTEM":
wqlAnd = " AND TargetInstance.Logfile ='System'";
break;
case "APPLICATION":
wqlAnd = " AND TargetInstance.Logfile ='Application'";
break;
default:
wqlAnd = "";
break;
}
wql = "select * from __instancecreationevent where targetinstance isa 'Win32_NTLogEvent'" + wqlAnd;
EventQuery = new WqlEventQuery(wql);
watcher = new ManagementEventWatcher(ms, EventQuery);
Console.WriteLine("end of first watcher");
return watcher;
}
---------------------------------------------------------
Could any of you tell me how to solve this problem?
Thanks a lot.
|
|
|
|
|
|
Thanks for replying.
the code is running under admin privileges.
|
|
|
|
|
Is this code running with full trust on both machines? According to the docs, ManagementEventWatcher.Start requires full trust to run, so if you're running it across your network with the default code access security settings, it won't work.
Charlie
if(!curlies){ return; }
|
|
|
|
|
Ever hear to try/catch blocks
Ex:
public void Example()
{
try
{
}
catch(Exceptopn){}
catch(Excetion e)
{
Console.WriteLine(e.ToString());
}
}
One part of my progs
<br />
#region Constructor<br />
private Game(Control cTarget)<br />
{<br />
try<br />
{ <br />
this.target = cTarget;<br />
this.target.GotFocus += new System.EventHandler(this.Restore);<br />
<br />
this.graphics = new GraphicsHandler(this.target);<br />
this.sounds = new SoundHandler(this.target);<br />
this.keyboard = new InputHandler(this.target);<br />
<br />
this.presentState = new GameState();<br />
this.previousState = new GameState();<br />
this.presentData = new GameData();<br />
this.presentDataTemp = this.presentData.DeSerialize();<br />
<br />
this.physics = new GamePhysics();<br />
<br />
this.InitGame();<br />
<br />
Timer.Init();<br />
}<br />
catch(Exception e)<br />
{<br />
MessageBox.Show("ERROR WHILE INITIALIZING GAME " + e.ToString());<br />
return;<br />
}<br />
<br />
this.presentState = GameState.Initialized;<br />
this.previousState = GameState.Initialized;<br />
<br />
this.GameLoop();<br />
}<br />
#endregion<br />
cdmlb
|
|
|
|
|
To add to what Charlie said, and he's got the most likely answer to your problem, ...
He, and I, are both assuming that your running your application from a network share. Even though your logged in under an admin account, the .NET Framework will not give your application Full Trust to run. Read up on Code Access Security here[^].
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Hi!
As you know,even though there is not any card in the socket of the cardreader,when we attach the cardreader to
the PC,the OS can show us how many drivers this cardreader
has,such as:CARD(G),CARD(H),etc. And,as far as I know, the message WM_DEVICECHANGE must be broadcasted when the
cardreader attached to the PC,but after this,when you insert the card(s)(such as CF,MS,MFC,etc.) into the socket(s),I suppose there is not any message be broadcasted.Am I right?If I am wrong,then can you tell me which kind of message(or something else which can inform us that card(s) arrived) will be broadcast when the card(s) be inserted the socket(s) of the cardreader? If I am right,then can you tell me how can I know the card arrival and leaving?
Thanks!
Best wishes!
momer
|
|
|
|
|
Ask in the correct forum please. This doesn't have anything to do with .NET.
This posting is provided "AS IS" with no warranties, and confers no rights.
Alex Korchemniy
|
|
|
|
|
How can I let my .net program run after clicking my custom menu in IE contextMenu?
Assuming I know how to modify the register
me
|
|
|
|
|
Jason Xie wrote:
How can I let my .net program run after clicking my custom menu in IE contextMenu?
Assuming I know how to modify the register
Your question is rather nebulous; could you please clarify or post some code? Did you write an IDocHostUIHandler for an embedded IE control? More information will be helpful in answering your question.
- Nick Parker My Blog | My Articles
|
|
|
|