|
kod3brkr wrote: I'm merely suggesting that it won't be fun looking for the reason it's turning into a component all the time
As I already said, is it affecting the way your application looks or functions? If not, quit worrying about it because it is just a minor bug in Visual Studio.
kod3brkr wrote: the client is waiting for the end result, I'd like to give them something that's secure enough to use without worrying about what's going on behind the scenes.
So, you have lots of unit tests to ensure the correct functioning of your application? If not, then how do you ensure the quality of your code?
kod3brkr wrote: let me know if you understand what's going on
Well, I understand that the compiler runs in a separate process that visual studio launches, so fretting about some minor display issue in VS (or which there are many more) is a bit pointless. It would be like fretting because Notepad didn't colour your source code if you loaded it in there.
|
|
|
|
|
Hi,
I guess this is not exactly what you want, but adding the following line just above the class statement turns a component into regular code, so double-clicking it in the solution pane opens up the code editor:
[System.ComponentModel.DesignerCategory("Code")]
Using some of it and google may bring you the solution.
|
|
|
|
|
Hi,
If can, Could you please tell me how?
Thanks!
Charith Jayasundara
|
|
|
|
|
You can't. Reflection tells you what is already there, it doesn't allow you to change the shape of the type.
|
|
|
|
|
You can however do that using Mono.Cecil opensource library, the trick is that cecil doesn't load the assembly into AppDomain, so you can make changes.
Here is a code snippet for example:
FieldDefinition field = new FieldDefinition("TestField", sometype, FieldAttributes.Private);
sometype.Fields.Add(field);
This adds a private field of type sometype to sometype.
Unfortunately there is no documentation for cecil, but you can ask questions in the Mono Cecil Google Group[^]
Regards,
Lev
|
|
|
|
|
"the trick is that cecil doesn't load the assembly into AppDomain"
How this will affect the other stuff?
Thanks!
Charith Jayasundara
|
|
|
|
|
What do you mean "other stuff"?
You can edit the assembly using cecil, save it, and then do whatever you want to do with reflection (unless you get charmed by cecil and want to switch to it )
Regards,
Lev
|
|
|
|
|
Hi,
I have dataset that is bound to a DataGridView. In my DataSet I have column "name" (string) and column "sex" (int). So far so good.
My problem is:
Now I need to convert "sex" to a comboBox type with values 0-> male, 1->female.
any ideas?
tnx
|
|
|
|
|
Hi,
If you want to do it the hard way, you could choose to set VirtualMode[^] to true. And use a DataGridViewComboBoxColumn[^]. However then you have to manage your datastore manually and all other related functions (including drawing the datagridview). This offers a great deal of flexibility, but is rather complex (though the msdn does give a very nice example).
You could also try to replace the column from the datagridview with a DataGridViewComboBoxColumn, but I don't know how to link the dataset to your column then.
Greets,
basambora
|
|
|
|
|
I've created a DataGridViewComboBoxColumn named "cbx". Added 0->"male",1->"female" to it's items;
I've added the "cbx" to my GridView as "sexA" column and for each row I "sexA".value = "sex".value;
i used this line:
gridview.Rows[0].Cells["sexA"].value = gridview.Rows[0].Cells["sex"].value;
Just as a remainder, "sex" is int type and also the "cbx" value is int type.
thought the results should be to show the displaymember on "sexA" by the value of "sex" it doesn't show anything on "sexA". Although later on I can edit and select a new value to "sexA" but can't do that using code!
it's seems like it doesn't update the gridview.
I tried GridView.Refresh().
Any ideas?
tnx
|
|
|
|
|
Iam making a calculator and have this aproximation errors, when I use the Pi constant and make Sin(pi) the answers I got is 3,23108510433268E-15 when it should be zero. ¿Someone knows how to fix this?
|
|
|
|
|
Hi,
floating-point numbers and calculations have a finite precision, and they must balance between speed and accuracy. Transcendental numbers such as pi cannot be represented exactly. And the result of floating-point operations can also depend on the hardware used. I am getting 1.2E-16 for
double x=Math.PI;
double y=Math.Sin(x);
output("sin(pi)="+y);
on an Intel T8300.
If you are not satisfied by some function, you can try and improve it by:
- using a smaller range of it
- replacing it completely.
For periodic functions, reducing the range is the obvious first attempt;
you could rely on identities such as sin(pi-x)=sin(x) and sin(pi/2-x)=cos(x) to reduce all values of x to the interval [0, pi/4] for which one could hope the Math class gives the most accurate results.
|
|
|
|
|
As Luc said, floating point is not exact due to computers storing numbers in binary. You do realize that 3,23108510433268E-15 is pretty darn close to zero, right?
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
Paul Conrad wrote: As Luc said, floating point is not exact due to computers storing numbers in binary
I didn't say that at all. I did not even mention binary; if computers were to store things in decimal, their value for pi or SQRT(2) or any other transcendental or irrational number would be equally wrong.
Paul Conrad wrote: 3,23108510433268E-15 is pretty darn close to zero
That is a matter of opinion.
The integer number 323108510433268 is also pretty close to zero in that there are many more integers larger than it, than there are integers between it and zero...
|
|
|
|
|
Luc Pattyn wrote:
floating-point numbers and calculations have a finite precision
That is what I was meaning.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
Paul Conrad wrote: You do realize that 3,23108510433268E-15 is pretty darn close to zero, right?
How can it be ? Look at all those numbers.... :P
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
That's what I was thinking!
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Christian Graus wrote: Look at all those numbers....
3,23108510433268E-15 = 0.00000000000000323108510433268, close enough to zero for my line of work. If I were writing heavy duty scientific apps, then yes, that would be a completely different matter.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
Hello,
I'm trying to make a HTTP POST request in multipart/form-data to simulate the upload of a file to a web server.
But I've a problem, the class only send Headers and don't send data.
My query is like this :
[root@localhost rapha]# python server.py
IP : ('127.0.0.1', 32851)
POST / HTTP/1.1
User-Agent: FilesApi/FilesAPI v0.1 (Unix 2.6.27.7)
Referer: [url]http:
Content-Type: multipart/form-data; boundary=-------------------906641065
Content-Length: 1845
Expect: 100-continue
Connection: keep-alive
Host: 127.0.0.1
But normaly, it will be like this :
[root@localhost rapha]# python server.py
IP : ('127.0.0.1', 32851)
POST / HTTP/1.1
User-Agent: FilesApi/FilesAPI v0.1 (Unix 2.6.27.7)
Referer: [url]http:
Content-Type: multipart/form-data; boundary=-------------------906641065
Content-Length: 1845
Expect: 100-continue
Connection: keep-alive
Host: 127.0.0.1
-------------------906641065
Content-Disposition: form-data; name="fichier1"; filename="icon.png"
Content-Type: application/octet-stream
[I](contenu de l'image)[/I]
---------------------906641065Content-Disposition: form-data; name="nb_fichiers"
1
---------------------906641065
Content-Disposition: form-data; name="votes"
on
---------------------906641065--
My sources :
string Boundary = "-------------------" + (new System.Random()).Next();
string Data = Boundary + "\r\n";
int FichierNo = 0;
foreach(string Fichier in this.FilesList) {
FichierNo++;
System.IO.FileInfo FileInfos = new System.IO.FileInfo(Fichier);
Data += "Content-Disposition: form-data; name=\"fichier" + FichierNo + "\"; filename=\"" + FileInfos.Name + "\"\r\n";
Data += "Content-Type: application/octet-stream\r\n\r\n";
Data += (new System.IO.StreamReader(Fichier)).ReadToEnd()+ "\r\n";
Data += "--" + Boundary;
}
Data += "Content-Disposition: form-data; name=\"nb_fichiers\"\r\n\r\n";
Data += FichierNo + "\r\n";
Data += "--" + Boundary;
if(this.EnableVotes) {
Data += "\r\nContent-Disposition: form-data; name=\"votes\"\r\n\r\n";
Data += "on\r\n";
Data += "--" + Boundary;
}
if(this.Email != null) {
Data += "\r\nContent-Disposition: form-data; name=\"check_email\"\r\n\r\n";
Data += "on\r\n";
Data += "--" + Boundary + "\r\n";
Data += "Content-Disposition: form-data; name=\"email\"\r\n\r\n";
Data += this.Email + "\r\n";
Data += "--" + Boundary;
}
Data += "--\r\n";
byte[] DataBytes = (new System.Text.ASCIIEncoding()).GetBytes(Data);
System.Net.HttpWebRequest Request = (System.Net.HttpWebRequest) System.Net.WebRequest.Create("http://127.0.0.1/");
Request.Method = "POST";
Request.UserAgent = this.Agent;
Request.Referer = "http://api.files.getwebb.org";
Request.ContentType = "multipart/form-data; boundary=" + Boundary;
Request.ContentLength = DataBytes.Length;
System.IO.Stream PostData = Request.GetRequestStream();
PostData.Write(DataBytes, 0, DataBytes.Length);
PostData.Close();
I've the same problem with the code from the MSDN : http://msdn.microsoft.com/en-us/library/system.net.httpwebrequest.method(VS.80).aspx
I've tried with Mono and with .NET, but nothing change.
Note : To intercept data, I've make a Python server who listen on the port 80, but with Fiddler, a HTTP debug proxy, I don't see data too.
Thanks
|
|
|
|
|
ok, at the risk of pointing out the bleeding obvious, it looks like the error is within your foreach(string Fichier in this.FilesList) loop ... you seem to know this, given you know what you have vs what you expect
so, what happens if you start debugging through that, checking the contents of FilesList etc ?
you should be able to isolate that code or single step it and see if the file is being opened and its contents being appended to 'Data' - yes ? (or have I missed something ?)
'g'
|
|
|
|
|
is there any way to change the font of Values in PG ? because it everytime appears in BOLD that looks very weird
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)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
there is any explicit property but through the reflection you may change it.
|
|
|
|
|
would you like to explain little more or any article ?
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)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
i want to save a DataTable in Properties.Settings. All just works fine untill i restart the app.
here is code on forms Load
if (Properties.Settings.Default.Limits_DT != null)
{
main_DT = Properties.Settings.Default.Limits_DT;
}
else
{
main_DT = new DataTable();
}
and another one is
private void LE_FormClosing(object sender, FormClosingEventArgs e)
{
Properties.Settings.Default.Limits_DT = main_DT;
Properties.Settings.Default.Save();
}
it works but only if application keep running. I dunno why Save() is not working. I use Settings often but this time i need a DT
any idea... ?
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)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-iTV.C\y<pjxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
Do you really need a datatable, or do you just need the data it contains ? What if you stored the data as XML ?
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|