|
Run it through the debugger and set breakpoints if required (and conditional breakpoints if required too). That's faster than using debug.write and such.
Draw some diagrams on a whiteboard or some paper to get an idea of how the objects are related.
I have been working with some uncommented SQL stored procedures recently and have been using ErgoNotes (hierarchical notes application) to make a nested description of the code. That might not be as useful for object oriented code (especially if it is loosely linked via interfaces and delegates), but it is one more technique you might use where appropriate.
|
|
|
|
|
aspdotnetdev wrote: Draw some diagrams on a whiteboard or some paper to get an idea of how the objects are related.
You can also let the built-in Class Designer in VS show you all the relationships. Add a new Class Diagram to the project, click and drag all the files onto it and it should automatically add all the classes in those files to the diagram.
Not all the class associations are automatically visible, though. You can download the Modeling PowerToys Add-in[^] to expand on the existing Class Designer's abilities, including showing more types of associations. Once you have this add-in, click on the Class Diagrams menu and select View All Associations , and you should have a decent picture of how all the objects are related.
Obviously this won't show you the general program flow or help with threading issues, but it's definitely a start.
DybsThe shout of progress is not "Eureka!" it's "Strange... that's not what i expected". - peterchen
|
|
|
|
|
DotNetMan wrote: I have some winform apps that heavily object oriently designed.
Heavy use of OO techniques is the way to disaster.
DotNetMan wrote: What debugging techniques or tips can you advise in order to get up to speed quickly?
Attach a debugger to the application. Put lots of break points and see how the program flow goes. If your application uses threads, it makes debugging tricky. Take a look at this[^] MSDN article.Best wishes,
Navaneeth
|
|
|
|
|
Thanks for replying all.
So just to recap. Are we in agreement that the old way of dotting the code with
debug/trace statements is how developers figure out how code works and fix bugs?
DotNetMan
|
|
|
|
|
Dear All,
I have windows service build in c# and it does some actions.
it has got a single method which prints text and this method is called from different classes.
now i want to print all the messages as they are printed, in Windows Application.
I can print these messages into EventLog or in Console.WriteLine(string msg)
any ideas how to capture all these message as the are printed into a windows application (WinForm)?Abdul Rahaman Hamidy
Database Developer
Kabul, Afghanistan
|
|
|
|
|
This[^] should probably help.
|
|
|
|
|
Thanks for the reply, link show how to store output or messages to EventLog. but i want how retreive those messages which i am printing in that method.
this I have seen in Sql Sever Agent. as I think SQL SERVER Agent is a service and you can see the messages or the outputs in SQL SERVER Synchronization "Replication" Status.
I want just the same thing to perform in C#. Like i have a service build in C# and when ever a message is printed that should be shown in Winform Application.Abdul Rahaman Hamidy
Database Developer
Kabul, Afghanistan
|
|
|
|
|
Hi all. I have a client-server distributed system. I want to transfer and image from the server to the client. In the server i have converted a .bmp image to byte array as this:
Image imageIn = Image.FromFile("me.bmp") ;
MemoryStream msr = new MemoryStream();
imageIn.Save(msr, System.Drawing.Imaging.ImageFormat.Gif);
byte[] byteIm = msr.ToArray();
ms.Send(byteIm);
The bytes are being transfered okay to the client. The problem is that i don't know how to assemble this byte back to an image to show in a picture box.
That is:
pictureBox1.Image =
Wamuti: Any man can be an island, but islands to need water around them!
Edmund Burke: No one could make a greater mistake than he who did nothing because he could do only a little.
|
|
|
|
|
have a look at this[^] You should never use standby on an elephant. It always crashes when you lift the ears. - Mark Wallace
C/C++ (I dont see a huge difference between them, and the 'benefits' of C++ are questionable, who needs inheritance when you have copy and paste) - fat_boy
|
|
|
|
|
Actually that is where i knew how to convert and image to bytes but the function returning an Image, how will the pictureBox get the URL? Wamuti: Any man can be an island, but islands to need water around them!
Edmund Burke: No one could make a greater mistake than he who did nothing because he could do only a little.
|
|
|
|
|
Why would the picture box want a URL? Just give it the image, or save it to disk and then give it the url as the file location.
From your original code:
MemoryStream ms = new MemoryStream(byteArrayIn);
pictureBox1.Image = Image.FromStream(ms);
You should never use standby on an elephant. It always crashes when you lift the ears. - Mark Wallace
C/C++ (I dont see a huge difference between them, and the 'benefits' of C++ are questionable, who needs inheritance when you have copy and paste) - fat_boy
|
|
|
|
|
Here you go:
MemoryStream memStream = new MemoryStream(imageBytes);
Image image = Image.FromStream(memStream);
|
|
|
|
|
Thanks guys. It worked. Wamuti: Any man can be an island, but islands to need water around them!
Edmund Burke: No one could make a greater mistake than he who did nothing because he could do only a little.
|
|
|
|
|
try following code:
private void Button2_Click(object sender, System.EventArgs e)
{
connection.Open();
SqlCommand command1 = new SqlCommand("select imgfile from myimages where imgname=@param", connection);
SqlParameter myparam = command1.Parameters.Add("@param", SqlDbType.NVarChar, 30);
myparam.Value = txtimgname.Text;
byte[] img = (byte[])command1.ExecuteScalar();
MemoryStream str = new MemoryStream();
str.Write(img, 0, img.Length);
Bitmap bit = new Bitmap(str);
Response.ContentType = "image/jpeg";//or you can select your imagetype from database or directly write it here
bit.Save(Response.OutputStream, ImageFormat.Jpeg);
connection.Close();
}
change your database name, field name, image name, attribute name.
If You Get your answer then please Rating me...
Thanks..
"Are You Ready"
DX-ARMY
|
|
|
|
|
As you have seen system encodings, ASCII or UTF. I want to create my own, like some value for some specific character. So to do that I simple make a Character class and a collection to hold 'em. But when I need to convert a value to char it iterates the collection until that value is found and thats too slow. But I have another idea which I have tried and also reached nearby the same performance as Encoding.GetString.
So any suggestions guys ?
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN%
R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
-----------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
If it is a small set of values then set up an array of translations - index is the character to translate.
If the set gets big, then put the array into a file and read it on start up. You would need two arrays if you want to go both ways.
Memory is not a major problem these days, so that would be the fastest way.You should never use standby on an elephant. It always crashes when you lift the ears. - Mark Wallace
C/C++ (I dont see a huge difference between them, and the 'benefits' of C++ are questionable, who needs inheritance when you have copy and paste) - fat_boy
|
|
|
|
|
thats exactly what I thought but there is a problem, It will be faster from value(index) to char but what about char to value ??
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN%
R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
-----------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
You can also index an array with a char, or isn't that what you meant?
|
|
|
|
|
example ?
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN%
R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
-----------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
inverseArray[someChar]
Where someChar is of the type char and inverseArray is an array of something
|
|
|
|
|
That's why I said "You will need two arrays..." One for each direction? You should never use standby on an elephant. It always crashes when you lift the ears. - Mark Wallace
C/C++ (I dont see a huge difference between them, and the 'benefits' of C++ are questionable, who needs inheritance when you have copy and paste) - fat_boy
|
|
|
|
|
you mean like this ?
short[] values = new short[count];
short[] chars = new short[count];
values[(int)'c'] = value;
chars[value] = 'c';
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN%
R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
-----------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
You don't need to cast the char to an int
|
|
|
|
|
its not dictionary, its an array
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87֦ʻ6ϣN8ȤBcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKQUFK[M`UKs*$GwU#QDXBER@CBN%
R0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
-----------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
It doesn't matter, indexing an array with a char works just as well
|
|
|
|