|
Tnx, I'll try it...
_____________________________
...and justice for all
APe
|
|
|
|
|
Look into regular expressions. That is all I can say. I must go now.
/\ |_ E X E GG
|
|
|
|
|
Hi, one of my project uses log4net. I add reference to log4net assembly (which is installed in GAC). I built the project and encountered no problem. However, when I run it console app, I keep getting:
<br />
log4net:ERROR XmlHierarchyConfigurator: Could not create Appender [rollingFile]<br />
of type [log4net.Appender.RollingFileAppender,log4net]. Reported error follows.<br />
System.IO.FileNotFoundException: File or assembly name log4net, or one of its dependencies, was not found.<br />
File name: "log4net"<br />
... bunch of stuff...<br />
LOG: Policy not being applied to reference at this time (private, custom, partia<br />
l, or location-based assembly bind).<br />
LOG: Post-policy reference: log4net<br />
LOG: Attempting download of new URL file:ng/bin/log4net.DLL.<br />
LOG: Attempting download of new URL file:ng/bin/log4net/log4net.DLL.<br />
LOG: Attempting download of new URL file:ng/bin/log4net.EXE.<br />
LOG: Attempting download of new URL file:ng/bin/log4net/log4net.EXE.<br />
I resolved the problem by changing Copy Local from False (which is default for GAC's assemblies) to True
Any idea why this is happenning? I have another console application which references log4net also, but does not requires "Copy Local" = True.
Thanks in advance!
Norman Fung
|
|
|
|
|
we are doing project "Video conferencing".In which the file is send on the network perfectly,But when we recieve the file on the client side,File size and data is perfectly recieved but format is not showing.plz kindly tell me the default encoding technique which show exact format on client side.
I m waiting for ur positive response.
best regards
shumyla
|
|
|
|
|
How can I convert a string of bits to a byte[] array.
Example "01010001" to a Byte[] array (not as an UTF or ASCII byte encoded ). I guess it would be false true false true false false flase true .....and then converted to a Byte Array but I figure out how to do it.
I figured out how to convert a Byte[] array to a string of bits using:
public string GetStrinRepresentation(Byte[] allBytes)
{
BitArray myBits = new BitArray(allBytes);
string tempStr=null;
string tempStr2=null;
for (int j=0; j <= myBits.Length-1; j++ )
{
/* if bit is true print "1" if false print "0" */
if (myBits[j])
{
tempStr2 = tempStr;
tempStr = "1" + tempStr2;
}
else
{
tempStr2 = tempStr;
tempStr = "0" + tempStr2;
}
}
return tempStr;
}
But I cant figure out how to do the opposite
Help Please?
Gordsh
|
|
|
|
|
The simplest way is take 8 bits at a time and convert them from binary to decimal. Something like
private byte[] GetByteArray(string binaryText)
{
byte []arr = new byte[binaryText.Length / 8];
for (int i = 0; i<binaryText.Length; i+=8)
{
string currentByte = binaryText.Substring(i, 8);
arr[i%8] = Convert.ToByte(currentByte, 2);
}
return arr;
}
This does assume that the binary text's length will be a multiple of 8, if not, you have to pad the first byte with 0s.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Just another possible solution:
private byte[] GetByteArray(string binaryText)
{
char[] c = binaryText.ToCharArray();
binaryText = new string(Array.Reverse(c));
BitArray ba = new BitArray(binaryText.Length);
for (int i = 0; i < binaryText.Length; i++)
ba[i] = binaryText[i] == '0' ? false : true;
byte[] result = new byte[binaryText.Length / 8];
ba.CopyTo(result, 0);
Array.Reverse(result);
return result;
}
|
|
|
|
|
Thanks a million. They both worked. I find that depending on what I am doing sometimes I dont have to reverse the bits. Anyhow this was a big help as I was stuck.
Thanks again
SAG, CANADA
|
|
|
|
|
I have a main form, call it A, which spawns another form B. When B spawns I want it brought to the front (easy), but if another program gets the focus, then the user switches back to A, I want B to be brought to the top if it was focused when the user switched to another program. Any easy way to do this? I have tried using the Enter/Leave/Activated/Deactivated events but it doesn't seem to work the way I think it should. If anything is unclear let me know. Thanks.
|
|
|
|
|
can't you just use ShowDialog? that should make B be active even if you select A.
Rob
--
There are 10 kinds of people. Those who understand binary and those who don't.
|
|
|
|
|
Rob Tomson wrote:
can't you just use ShowDialog?
I need to have access to A while B is open, otherwise I would.
|
|
|
|
|
Its a tricky problem because u dont want the form snapping back to B when ur only activating A and not an external app.
Still, i think u can do it this way (havent tried it but it looks pretty sound):
Create a timer in the B Form with a low interval. 1-10 miliseconds will do.
When B looses focus (deactivates), start timer and in the Tick handler check for the static member Form.ActiveForm and stop ur timer. If ActiveForm is FormA then dont do anything. If ActiveForm gives u Null then the active window is no longer part of ur app and u should set a property in ur A Form, for example SnapBackToB to true.
Whenever A handles and Activate event, check for _snapBackToB and if true, activate Form B.
That should do it.
Oh, one other thing, when Form B activates, it should always check for SnapBackToB in form A and set it to False.
GL, and if things dont work at all as I/u expect please let me know :p
P.D. Its important u stop the timer after first tick because, even if it doesnt harm the algorithm, a timer running with that small interval may not let windows detect correctly ur idle app and u might have issues with power management, screensavers, etc.
|
|
|
|
|
Could you elaborate on the ActiveForm static member? Should this be in A or B, and how/where should it be set/unset? Or are you referring to ActiveControl? Thanks.
|
|
|
|
|
U dont set Form.ActiveForm to anything. Its a read only property so u can't set it anyways. U read its value to know which form in ur application is the Operating System's active window. If the value u read is Null that means the active window is an external window to ur application or it could be that there really is no active window.
System.Windows.Forms.Form.ActiveForm[^]
When ur timer in Form B (which has started when Form B has been deactivated) triggers the Tick event for the first time, the event Handler which u should include in Form B should check for the static memeber Form.ActiveForm as I posted before.
After that its just a question of style. U can either make a public get/set property in either FormA (SnapBackToB) or in FormB (SnapBackToMe) or whatever. In the first case, when A activates it would: 1) Check if Form B is open 2)check its own property and if true it would give focus to Form B. On the other hand if property was in FormB, FormA would check when it activates: 1) If Form B is open 2) If FormB's SnapBackToMe is true, it would give focus to B. As I said before, this is a question of style and there are many many ways to implement this.
Of course there r some details i havent touched like handling correctly what happens when Form B is closed and not only loosing focus (remember that the Deactivate event triggers when closing a form too) and u dont want ur SnapBackToX property to remain true when ur form B is closing....but u should be able to sort that out without too many problems.
|
|
|
|
|
Haha, for some reason when you said "static variable" I didn't put 2 and 2 together and was looking for an instance variable, which is why I couldn't find it. Thanks for the reply, I'll go about implmenting it today and I'll let you know it turns out.
|
|
|
|
|
Thanks for the code. It all works ALMOST the exact way I wanted it to. For some reason if I tried to save the last active window (IE on return to the app, either make the main window the active one or the message window the active one depending on which was activated last) it would go back and forth between the two and then settle on the main window. So instead I just brought the messagewindow in front upon returning to the app (although I might change it around). Thanks again for the Time suggestion, I doubt I would have thought of it.
|
|
|
|
|
I want to show an xmlnode in text box. Currently it shows the xmlnode with it's child nodes in one staight line like <a attrib="attr"><b>Some text</b></a>
I want to show it as
<a attrib="attr">
<b>Some text</b>
</a>
Thanks
|
|
|
|
|
|
It seems to be a read only property.
|
|
|
|
|
Following a link from that doc, I found this:
(reader is an instance of XmlReader)
reader.WhitespaceHandling=WhitespaceHandling.Significant
|
|
|
|
|
|
Load that XML you have into the DOM, using the XmlDocument class like this...
string XML="<this is="" your="" text="" xml="">";
//now load it into the dom
XmlDocument doc=new XmlDocument();
doc.Load(new StringReader(XML));
//Now it's in the DOM, just save it as an XmlNode
XmlNode node=doc.SelectSingleNode("a");
now just go
textBox.Text=node.OutterXml;
and there you have it. I just typed this out of my head so there might be small errors, but that's the general idea.
/\ |_ E X E GG
|
|
|
|
|
i need a textbox with body transparent.
I've found one here on codeproject.com but it constain some bug.
Can you show me another one?
Tnx.
|
|
|
|
|
Possible approaches
1. try to fix the bug
2. write to the author about the bug, first checking the forum on the article for prior reports
3. keep looking for more free code instead of looking at the partially working code you have in front of you, in case you may learn something along the way.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I'm beginer and I'd like to draw cube or sizalble voxel with DirectX.
Please help me!!!
|
|
|
|