|
Does anyone knows how to calculate the Norminv (Excel) function in C# ? This function returns the inverse of the normal cumulative distribution for the specified mean and standard deviation.
Thanx a lot ! Joachim.
|
|
|
|
|
private static double inverse(double p)
{
var a = new double[]{-3.969683028665376e+01, 2.209460984245205e+02,
-2.759285104469687e+02, 1.383577518672690e+02,
-3.066479806614716e+01, 2.506628277459239e+00};
var b = new double[]{-5.447609879822406e+01, 1.615858368580409e+02,
-1.556989798598866e+02, 6.680131188771972e+01,
-1.328068155288572e+01 };
var c = new double[]{-7.784894002430293e-03, -3.223964580411365e-01,
-2.400758277161838e+00, -2.549732539343734e+00,
4.374664141464968e+00, 2.938163982698783e+00};
var d = new double[]{7.784695709041462e-03, 3.224671290700398e-01,
2.445134137142996e+00, 3.754408661907416e+00};
var plow = 0.02425;
var phigh = 1 - plow;
if ( p < plow )
{
var q = Math.Sqrt(-2*Math.Log(p));
return (((((c[0]*q+c[1])*q+c[2])*q+c[3])*q+c[4])*q+c[5]) /
((((d[0]*q+d[1])*q+d[2])*q+d[3])*q+1);
}
if ( phigh < p )
{
var q = Math.Sqrt(-2*Math.Log(1-p));
return -(((((c[0]*q+c[1])*q+c[2])*q+c[3])*q+c[4])*q+c[5]) /
((((d[0]*q+d[1])*q+d[2])*q+d[3])*q+1);
}
var q1 = p - 0.5;
var r = q1*q1;
return (((((a[0]*r+a[1])*r+a[2])*r+a[3])*r+a[4])*r+a[5])*q1 /
(((((b[0]*r+b[1])*r+b[2])*r+b[3])*r+b[4])*r+1);
}
|
|
|
|
|
Hello,
I am having a form application as FrmA. On the button click of FrmA, i display another form FrmB. Now i want to access some variable of FrmA in FrmB.
How it is possible.
Can i get the parent object(FrmA) in FrmB.
Thanks
Gajesh
Pune(India)
|
|
|
|
|
In FormB you must change the constructor:
private FormA formA = null;
public FormB(FormA formA)
{
this.formA = formA;
}
In FormA you must create FormB with this way:
FormB formB = new FormB(this);
You can change the string in formA using:
this.formA.StringToBeChanged = "Hello World Again";
|
|
|
|
|
To access a variable in FormA, that variable should be public. To access the FormA in FormB the following code...consider j is the variable in FormA
FormA frm=new FormA(); // Create Object for FormA
MessageBox.Show(frm.j);
// The Value of the varible j(in FormA will be displayed in FormB)
|
|
|
|
|
Hi,
I have a web service and a web service consumer. Whenever i call the function of the web service, i get exception System.Xml.XmlException with message Character 0x12 is not valid in XmlDocument. I know that characters whose code are under 0x20 are not allowed in XML Documents. Actually i am sending encrypted data to the web service that's why when i encrypt, characters under 0x20 also appear in the XML Document. I have searched the net but could not get the work around. Please help me to solve this problem.
Wasif Ehsan.
|
|
|
|
|
Try after all the encrypting (or even do just that) a Base64 encrypter.
It mainly changes all chars to a-z, A-Z, 0-9, =, [And another one I don't remember], so that you can use that anywhere.
Try it.
|
|
|
|
|
Hi,
How does one check if an item in a listbox is selected? Usually I would do it like this if I have multiple items selected:
foreach (ListItem item in lbFacilities.Items)
{
if (item.Selected)
...code here...
}
Is the best way like this (even if the SelectionMode property is not set to Multiple? Or would the following also be appropriate?
if (lbWineries.SelectedValue == string.Empty)
...code here...
Regards,
ma se
|
|
|
|
|
I think the best way to check for selected items is to use SelectedIndex if the selection mode property is One or SelectedIndices if its multiple.
Regards,
Wasif Ehsan.
|
|
|
|
|
Thanks for the reply.
You mean like (for single selection):
if (lbWineries.SelectedIndex == 0)
Is this right?
|
|
|
|
|
for (int i =0;i<=lbFacilities.Items.Count -1;i++)<br />
{<br />
if (lbFacilities.Items[i].Selected ==true)<br />
...code here...<br />
}
|
|
|
|
|
Is this the correct way to check if a single item is selected? Even if the selectionmode is not set to multiple?
|
|
|
|
|
Hello,
I am developing a VC# application, where I am using unbound DataGridView to input data from users. Here, first cell is for ItemCode and Second Cell is for Item Description, and other cells are for other dataentry which are not of much concern here.
If user Right-Clicks first Cell (Item Code) with entering 'A', then List of ItemCode and corresponding Item Description will be displayed where starting charter is 'A' in other window and user can select any one of them, this selected ItemCode and Description will be displayed in First and Second Cell of DataGridView.
My problem starts here,
1. Even after my setting
DataGridview1.rows[0].cells[0].value = 'Abc'
I am not able to view this new value in the datagridview, instead Old entered value i.e. 'A' remains there.
Does anybody have any solution ?
|
|
|
|
|
Tushar Bhatt wrote: DataGridview1.rows[0].cells[0].value = 'Abc'
Modify it with;
DataGridview1.rows[0].cells[0].value = "Abc";
best regards.
|
|
|
|
|
Thanks for your reply.
But actually I am setting value string using textbox.text, so this solution is not relevant here, problem here is setting up of edit buffer, which I am not getting right.
|
|
|
|
|
Hi,
I am using the following code to decrypt an array of bytes:
DESCryptoServiceProvider des=new DESCryptoServiceProvider();
des.BlockSize=blockSize;
des.Key=kDESKey;
des.KeySize=64;
des.Padding=PaddingMode.PKCS7;
des.Mode=CipherMode.ECB;
ICryptoTransform cryptoTransform=des.CreateDecryptor();
MemoryStream mem=new MemoryStream(cipherTextBytes);
CryptoStream cryptoStream=new CryptoStream(mem,cryptoTransform,CryptoStreamMode.Read);
byte[] outputBuffer=new byte[cipherTextBytes.Length];
cryptoStream.Read(outputBuffer,0,outputBuffer.Length);
mem.Close();
cryptoStream.Close();
return outputBuffer;
But the problem is that when i call Read of the cryptoStream, i get System.Cryptography.CryptographicException with the message of "Bad Data". Basically above code is the part of a web service. I am not concerned with the above code. I just want to provide some security feature to my web service. If it can be done through some other easy way, that's also welcome.
Please guide me in this regard...
Wasif Ehsan.
|
|
|
|
|
Hi
I have a Type object which is of type "System.Int32[]" to "System.Int32". I know theres makearraytype(), but how do I do it the other way?
cheers
|
|
|
|
|
What's the point of merging an array of ints into a single int? That makes little sense.
Tell us what you're trying to achieve
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Well the type wouldn't always be an int. That was an example (sorry if I wasn't too clear). Basically I'm getting the parameter of a function through reflection (which will be an array of some Type t) and then casting an Object array to Type t, which I'm told means I need to convert each item individually.
cheers
|
|
|
|
|
|
Hey!
I am having some problem to get the Visual Source Safe 2005 to work over the Internet.
I am using my own computer as web server, this computer runs Windows XP pro.
This is the steps I take:
Create database:
1. Creates a dir on my G drive(G:\SourceSafe).
2. Starts VSS 2005 Administrator
3. File > Open Databas
4. Add > Create a new database
5. Then I browse to my G drive and locate the directory (G:\SourceSafe).
6. Source safe database is now created.
Settings:
1. Starts VSS 2005 Administrator
2. Server > Configure
3. Checks the “Enable SourceSafe Internet for this computer”
Create User:
1. Users > Add User
2. And then I create a user with password
No I open the IIS and brows down to standard webplace. Here I find the SourceSafe created by the VSS 2005 Administrator. It contains the following folders: Data, temp and users, it also contains the files srcsafe.ini and users.txt.
Connect the client:
I am using my own computer again to connect to my web server(my computer).
1. Open Visual Studio 2005
2. Tools > Options > Source Control
3. Choose Microsoft Visual SourceSafe (Internet) from the dropdown box. OK
4. File > Open > WebSite(in this case, have also tried Project/Solution)
5. Choose Source Control > Select Source Control Poject
6. A Open Source Database shows and I choose Add
7. A Wizard starts > Next
8. No I am prompted to enter Address(http(s)://) and folder.
9. I use http://www.myip.dk/ to get my external web adr and enter it in the Address field.
10. My Folder would be SourceSafe.
When I press next I get a Windows standard login window, with name and password. Here I enter the user I created in “Create User:”, but it will not grant me?
I have tried to disabled the local firewall and I have also disabled the router(3com) firewall and placed my computer in DMZ zone just to be sure that none of them is the problem.
What am I doing wrong?
www.znize.se/jimmy
|
|
|
|
|
Hi all.
Can anyb one guide me how to implement an authentication and Authorization application.Authorization is more important.
|
|
|
|
|
I assume this is ASP.NET.
MS has a wonderful book on this subject in their Patterns and Practices section. It's a downloadable PDF, about 500 pages (IIRC).
|
|
|
|
|
Hi leppie.
I want to implement on "Windows application"
|
|
|
|
|
Saeed Rezaey wrote: Authorization is more important.
u can implement Authorization by creating Users (and provide them passwords) and their roles. Based on roles u can authorize a user in windows applications.
Best regards,
|
|
|
|