|
I might as well archive the project and attach it But anyways. I don't mind
private System.Byte[] buffer=new Byte[1024];
private void SetupReceiveCallback(Socket _sock)
{
AsyncCallback receive=new AsyncCallback(OnReceive);
_sock.BeginReceive(buffer,0,buffer.Length,SocketFlags.None,receive,_sock);
}
private void OnReceive(IAsyncResult result)
{
try
{
Socket _sock=(Socket)result.AsyncState;
int stop=_sock.EndReceive(result);
String str=System.Text.Encoding.ASCII.GetString(buffer,0,stop);
MessageBox.Show(str);
process(buffer,stop);
SetupReceiveCallback(_sock);
}
catch
{
MessageBox.Show("Out");
this.Close();
}
}
So?
|
|
|
|
|
Hi Guys
Does anyone know an open source library for skinned windows controls written in C#?.
Thanks in advance
Mahmoud Zidan
|
|
|
|
|
I am trying to figure out how to list all user accounts that exist in the SAM. I have figured out how to get the account name of the owner of a file, but not a list of all accounts on the machine.
Thanks for helping.
|
|
|
|
|
You might want to take a look at this article[^].
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
My C# book reads:
In this example, the two-parameter constructor executes before any code in the body of the one-parameter constructor (though in this particular case, since there is no code in the body of the one-parameter con-structor, it makes no difference).
By following through the code it seems that the one-parameter constructor is called first, which in turn calls the two-parameter constructor, so, is this an error, or do you think it might have another meaning?
J.
using System;
using TestConsole.TestClasses;
namespace TestConsole.ConsoleCmds
{
public class TestOne
{
public static void Main()
{
Car myCar = new Car("Proton Persona");
}
}
}
namespace TestConsole.TestClasses
{
class Car
{
private string description;
private uint nWheels;
public Car(string model, uint nWheels)
{
this.description = description;
this.nWheels = nWheels;
}
public Car(string model) : this(model, 4) { }
}
}
Jon
|
|
|
|
|
Hi Jon,
it is the one-parm constructor that gets invoked first, but it is the body of
the 2-parm one that executes before the (empty) body of the 1-parm constructor.
Same prder as the code that says: Car(model) needs "this(model,4)" before it does the "{ }".
BTW if you use <pre>some code</pre> you can show code snippets
that preserve their formatting (mainly indentation). That would be much more readable.
On the other hand, if your post contains special characters (especially <)
they get eaten by the HTML interpreter, then you better would check the "ignore HTML tags"
checkbox below the textbox (but then thr pre command will no longer work either).
|
|
|
|
|
Thanks for your reply.... you mean this is readable?
class Car
{
private string description;
private uint nWheels;
public Car(string model, uint nWheels)
{
this.description = description;
this.nWheels = nWheels;
}
public Car(string model) : this(model, 4) { }
}
Jon
|
|
|
|
|
Hi Jon, you're welcome. Yes, it is much more readable like that.
|
|
|
|
|
Luc Pattyn wrote: if you use
some code you can show code snippets
that preserve their formatting
If I may add, I like to put <code> and </code> tags inside the <pre> tags. Just colors it up nice
"Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus
|
|
|
|
|
I'll try that next time; I once did just <code> and was not happy about the result. Thanks.
|
|
|
|
|
<code> by itself doesn't do much, at least when it comes to preserving indentation.
Here is a simple example of how I do it...
private bool foo(int x)
{
if ( x < 0 )
return true;
else
return false;
}
I like it because it makes the code stand out a bit better.
"Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus
|
|
|
|
|
Oh, it's a dark red color?
I made a test message with and without <code>, and I couldn't see any difference at all.
I made a screen dump and pasted in photoshop, where I could put them in different layers on top of each other so that I could flip between them and see exactly what the difference was, but there was no difference.
Or was it? Maybe there was a slight difference? I had to use the eyedropper to get the color of the text to tell what the difference was...
---
single minded; short sighted; long gone;
|
|
|
|
|
Are you using <code> before or after the <pre> tag? It will make a difference.
"Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus
|
|
|
|
|
The code tag is inside the pre tag.
---
single minded; short sighted; long gone;
|
|
|
|
|
Hi Paul,
the problem with your examples is they show result, not source.
Anyway, I did my little experiment and I observed:
PRE gives non-proportional font, pink background, and preservation of spaces and tabs
CODE gives non-proportional font, red foreground (hardly noticable), and when copying several
lines then newlines are lost.
for both: the optional "lang=cs" does not do anything.
My conclusion:
- I will continue to use PRE without CODE for blocks of code, (so one can copy them easily)
- I will occasionally use CODE without PRE inside a text alinea to quote a piece of
code that fits on a single line (so the newline-not-copied problem isnt relevant).
Does this match your view on things ?
Regards
|
|
|
|
|
This whole thing is strange. I just did <code><pre> and it shows orange background with black text, which is what I think Guffa was talking about; then doing <pre><code> yields orange background with red text.
Luc Pattyn wrote: Does this match your view on things ?
I see your point, and good case you've made with when to use <pre> and <code>.
I think the "lang=cs" is for articles, not 100% sure. as far as new lines go, I haven't seen anything go awry. I tried FF, IE, and Safari and can't really draw a conclusion on my configuration
"Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus
|
|
|
|
|
Paul Conrad wrote: I think the "lang=cs" is for articles, not 100% sure
Yes, I got it from the article manual, but decided to give it a try anyway. Would look
great on discussion forum too...
OK, I am taking this opportunity to add some more test cases:
public void nihil(int a) {
if (a!=0) throw new Exception("Not zero");
}
public void pre(int a) {
if (a!=0) throw new Exception("Not zero");
}
<br />
public void code(int a) {<br />
if (a!=0) throw new Exception("Not zero");<br />
}<br />
public void precode(int a) {
if (a!=0) throw new Exception("Not zero");
}
public void codepre(int a) {
if (a!=0) throw new Exception("Not zero");
}
|
|
|
|
|
Same stuff with "ignore HTML tags":
<blockquote class="FQ"><div class="FQA">Paul Conrad wrote:</div>I think the "lang=cs" is for articles, not 100% sure</blockquote>
Yes, I got it from the article manual, but decided to give it a try anyway. Would look
great on discussion forum too...
OK, I am taking this opportunity to add some more test cases:
public void nihil(int a) {
if (a!=0) throw new Exception("Not zero");
}
<pre>
public void pre(int a) {
if (a!=0) throw new Exception("Not zero");
}
</pre>
<code>
public void code(int a) {
if (a!=0) throw new Exception("Not zero");
}
</code>
<pre><code>
public void precode(int a) {
if (a!=0) throw new Exception("Not zero");
}
</code></pre>
<code><pre>
public void codepre(int a) {
if (a!=0) throw new Exception("Not zero");
}
</pre></code>
Luc Pattyn
try { [Search CP Articles] [Search CP Forums] [Forum Guidelines] [My Articles] }
catch { [Google] }
|
|
|
|
|
See my post I posted at the same time about the CPSyntax. On my laptop anything you have inside the code tags are showing up white/light blue alternating lines. Anything in just the pre tag by itself is showing up with light blue background/red text...
"Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus
|
|
|
|
|
Paul Conrad wrote: I just did
and it shows orange background with black text, which is what I think Guffa was talking about
Nope.
---
single minded; short sighted; long gone;
|
|
|
|
|
What do you get? I think Luc and I are trying to figure it out right now. We have have to ask Chris
"Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus
|
|
|
|
|
If you ask Chris for some clarification and improvements, I'll second that.
Possible improvements:
support copy-with-newlines after code tag;
syntax coloring;
ignore all tags inside pre or code tag (so < and > remain intact inside code).
BTW: on IE6 (the only one I use) I dont see any difference between pre-code and code-pre.
Regards
|
|
|
|
|
Luc Pattyn wrote: IE6
Hmmm, I have IE7, haven't used IE6 since IE7 came out.
The ideas you've mentioned for improvement could work
"Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus
|
|
|
|
|
Paul Conrad wrote: I have IE7, haven't used IE6 since IE7 came out
I am happy with my current set of security holes. Dont need new features/creatures.
|
|
|
|
|
Luc Pattyn wrote: I am happy with my current set of security holes. Dont need new features/creatures.
I've got too much on this machine, nothing terrible or evil, just loads of different 30 day trial tools that need dumping. Might be time for some housecleaning
"Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus
|
|
|
|