|
Why not use the standard .NET Profile Provider? It's not just for ASP.NET.
|
|
|
|
|
I have a windows application in C#. On click of a button i want to open windows Explore and navigate to one folder. How can i do that?
|
|
|
|
|
System.Diagnostics.Process.Start("C:\\Inetpub");
|
|
|
|
|
This should work for you:
System.Diagnostics.Process.Start(@"explorer.exe", @"C:\Windows");
Remember, google is your best friend!
Richard
may your code be error free.
(okay, maybe two lines.)
|
|
|
|
|
Hello Friends,
I am developing an windows application in C#.NET now i want that when i install that application in any machine then write into registry. If user wants to install it again then it check whether its entry is in registry or not if it found in registry then user unable to install it again.
Means once installed then unable to reinstall again until unless registry entry are removed....
|
|
|
|
|
Please let me know when find the answer because I need that feature in my app!
may your code be error free.
(okay, maybe two lines.)
|
|
|
|
|
I think you can write custom actions when creating installation package. This[^] blogs says something similar.
|
|
|
|
|
Make a setup of your application using VS IDE and use Registry Editor ...
|
|
|
|
|
Nouman Bhatti wrote: Make a setup of your application using VS IDE and use Registry Editor ...
can you elaborate on this?
|
|
|
|
|
as u said u r making your application in c# and hopefully for that u r using visual studio.
so in that same Visual studio there's a new project type "setup wizard" or "setup project" make your setup and when u done with it... there a option in that setup project with the name of Registry editor. u can add your required registry keys there.
|
|
|
|
|
If you do not want to create an actual setup project you can manipulate the registry the hard way through the Microsoft.Win32 namespace using the class Registry. Check the registry when the program starts.
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my homepage Oracle Studios[ ^]
|
|
|
|
|
Could someone help me out with this program?
Draw the circle on a sheet of paper. Remember how big the paper is (how high & how wide, which gives us the total area), and how big the circle is.
2. Randomly pick points on the paper (say, by throwing darts). For each point we randomly pick, we'll do the following:
a. If the point is inside (or on the line of) the circle, we'll increment our counter that keeps track of the number of points that landed inside the circle.
b. If the point isn't inside/on the circle, and you need to, and increment another counter to keep track of that.
c. Either way, increment your "How many times did I pick a point?" counter
d. Darts that fall outside the paper are ignored entirely.
Even better would be to find a way to make sure that your randomly selected points never end up outside the paper in the first place.
3. Once you're done throwing all the darts in step 2, figure out what percentage of the darts fell inside the circle.
As an example, let's say you threw 1,000 darts, 534 of them landed inside/on the boundary of the circle, and 466 landed outside the circle, but on the paper. Thus, 53.4% of the darts landed in the circle.
4. Figure out how big the sheet of paper is (what the total area is).
As a continuing example, let's say that the paper is 100 inches wide, and 200 inches tall, for a total area of (100x200=20,000)
5. Estimate that the area of the circle to be the size of the paper, multiplied by the percentage of points that were inside the circle.
As a continuing example, we'll estimate that the size of the circle is 53.4% of 20,000, or (20,000 * .534=) 10,680 square inches.
The downside is that this is computationally intensive (i.e., you can't really do this by hand). The upside is that this works for *ANY* shape, no matter how complicated. For this homework assignment, we'll stick with circles, and only circles.
Your task is to write a program that will demonstrate how accurate this method is, depending on how many points you randomly select. Basically, you're going to go through, and use the Monte Carlo method to estimate the area of the circle, then use the real formula to find the actual area, then compare the two. The 'error' here will be measured as the percentage difference between the estimated & real circle (so if the circle is 314 units in size, and the estimate is 0, then the error is -100%, meaning that we're 100% below the real size. If the estimate is 345.4 units, then the error is +10%, meaning that we're 10% over the actual size).
An example of the output is given below. Everything that's highlighted in gray is optional output – your program isn't required to produce this output, if you don’t want to. The rest of it is required output. Make the columns of the table line up as best you can.
In addition to accomplishing the above objective, you have two additional, technical goals:
1. Use functions and methods in order to modularize your code as much as possible. If you know how to, and want to create classes here, that would be great.
2. You want to minimize the amount of code you copy-and-paste, so use an array to store the number of points to randomly select each time, and iterate through that. In the below example, there's an array that holds 1, 10, 100, 500, 1000, 5000, 10000, 50000, 100000. The objective here is that by adding numbers to / removing numbers from this array, we can quickly & easily try different numbers of points. The program should run correctly for different numbers of points, even if the only thing changed between runs are the numbers in that array. Similarly, in order to make sure that you could test out many different sized circles (and on different sized sheets of paper), make sure to set up your code so that you can change the size of the paper by changing just one (or maybe two) variables (instead of simply writing in '100' everywhere for the size of the paper), and that you can change only a few variable(s) if you want to change the location or size(radius) of the circle.
Example Output
Welcome To The MonteCarlo Circle Area Estimator!!
Max X: 100
Max Y: 100
Total Area of Surrounding Space: 10000
Basing our estimate on 1 randomly selected points
% of Randomly Picked Points Inside The Circle: 0
Estimated Total Area Of the Circle: 0
Actual Total Area Of the Circle: 314.159265358979
The estimate was off by 314.159265358979, which is -100% of the real circle
************************************************************
Max X: 100
Max Y: 100
Total Area of Surrounding Space: 10000
Basing our estimate on 10 randomly selected points
% of Randomly Picked Points Inside The Circle: 0
Estimated Total Area Of the Circle: 0
Actual Total Area Of the Circle: 314.159265358979
The estimate was off by 314.159265358979, which is -100% of the real circle
************************************************************
Max X: 100
Max Y: 100
Total Area of Surrounding Space: 10000
Basing our estimate on 100 randomly selected points
% of Randomly Picked Points Inside The Circle: 0
Estimated Total Area Of the Circle: 0
Actual Total Area Of the Circle: 314.159265358979
The estimate was off by 314.159265358979, which is -100% of the real circle
************************************************************
Max X: 100
Max Y: 100
Total Area of Surrounding Space: 10000
Basing our estimate on 500 randomly selected points
% of Randomly Picked Points Inside The Circle: 0.026
Estimated Total Area Of the Circle: 260
Actual Total Area Of the Circle: 314.159265358979
The estimate was off by 54.1592653589793, which is -17.2394295922144% of the rea
l circle
************************************************************
Max X: 100
Max Y: 100
Total Area of Surrounding Space: 10000
Basing our estimate on 1000 randomly selected points
% of Randomly Picked Points Inside The Circle: 0.024
Estimated Total Area Of the Circle: 240
Actual Total Area Of the Circle: 314.159265358979
The estimate was off by 74.1592653589793, which is -23.6056273158902% of the rea
l circle
************************************************************
Max X: 100
Max Y: 100
Total Area of Surrounding Space: 10000
Basing our estimate on 5000 randomly selected points
% of Randomly Picked Points Inside The Circle: 0.0262
Estimated Total Area Of the Circle: 262
Actual Total Area Of the Circle: 314.159265358979
The estimate was off by 52.1592653589793, which is -16.6028098198468% of the rea
l circle
************************************************************
Max X: 100
Max Y: 100
Total Area of Surrounding Space: 10000
Basing our estimate on 10000 randomly selected points
% of Randomly Picked Points Inside The Circle: 0.0301
Estimated Total Area Of the Circle: 301
Actual Total Area Of the Circle: 314.159265358979
The estimate was off by 13.1592653589793, which is -4.18872425867901% of the rea
l circle
************************************************************
Max X: 100
Max Y: 100
Total Area of Surrounding Space: 10000
Basing our estimate on 50000 randomly selected points
% of Randomly Picked Points Inside The Circle: 0.03042
Estimated Total Area Of the Circle: 304.2
Actual Total Area Of the Circle: 314.159265358979
The estimate was off by 9.95926535897934, which is -3.17013262289088% of the rea
l circle
************************************************************
Max X: 100
Max Y: 100
Total Area of Surrounding Space: 10000
Basing our estimate on 100000 randomly selected points
% of Randomly Picked Points Inside The Circle: 0.03225
Estimated Total Area Of the Circle: 322.5
Actual Total Area Of the Circle: 314.159265358979
The estimate was off by 8.34073464102067, which is 2.65493829427249% of the real
circle
************************************************************
Max X: 100
Max Y: 100
Radius of Circle: 10
Num Points Off by (%)
1 -100%
10 -100%
100 -100%
500 -17.2394295922144%
1000 -23.6056273158902%
5000 -16.6028098198468%
10000 -4.18872425867901%
50000 -3.17013262289088%
100000 2.65493829427249%
|
|
|
|
|
Can you post your teachers email? We might have some questions to ask...
|
|
|
|
|
Mark Churchill wrote: Can you post your teachers email?
BTW, I have downloaded Diamond Binding from your site. Honestly speaking it is the best one. But I haven't seen a method to use Stored Procedures as we did in LINQ.
|
|
|
|
|
Thanks Glad you like it!
The basic answer is that we don't support object persistance through stored procs.
The long answer is that we don't think it is necessary for a few reasons. Diamond Binding queries the database differently depending on what you are doing - say you are retrieving a Customer record, it may choose to bring back the Address object that Customer.Address references in one query by joining the table on. Additionally the query API (FindByProperty, etc) will obviously generate different queries. CRUD stored procedures would be less flexible and lead to worse performance for the query strategies that Diamond Binding uses.
Generally speaking we provide a level of abstraction from the database so you don't have to worry about the query mechanics - as it says on the tin, we take over between the database and the domain objects
|
|
|
|
|
Hi All,
I implemented a C# class library and registered it to be visible for COM objects, then i used it from VB6 application and it works fine. Now the problem is that i want to raise an event in the .NET COM and pass it as an event in VB6. i.e. when the .NET COM catched an exception i want it to raise event in the VB6 application to log the event (because the logger works there). Any ideas?
Thanks,
Mayy
modified on Wednesday, February 06, 2008 5:44:05 PM
|
|
|
|
|
Is using underline in C# names a bad idea?
I think per_user_quote is more readable than PerUserQuote especially when your eyes are looking at a lot of them at once. And even your editor can read per_user_quote without a problem but PerUserQuote looks like an invalid statement to it (This is happening as I am typing this and editor is showing a red line under PerUserQuote!).
Kaveh Shahbazian
|
|
|
|
|
Technically it's not a bad idea but it goes against the coding conventions that various people are following (i.e. the ones set out by Microsoft).
It's quite common though to use private variables for properties named such:
private int m_Id;
public int Id
{
get { return this.m_Id; }
set { this.m_Id = value; }
}
|
|
|
|
|
|
It doesn't make sense to use one standard for personal coding and one for business. You will cause unnecessary work when you forget and use your personal standard when working on business code, then have to go back and correct it. It's easier to remember and use one standard, practice it and it becomes habit.
only two letters away from being an asset
|
|
|
|
|
Kaveh Shahbazian wrote: showing a red line under PerUserQuote!).
Sounds like you're using Word.
|
|
|
|
|
No! I was not using word! I was just typing directly into 'THIS' editor of www.codeproject.com!
Kaveh Shahbazian
|
|
|
|
|
hi there:
how can i read araic text from text file????
best regards
|
|
|
|
|
The same way you read English, except right to left
only two letters away from being an asset
|
|
|
|
|
Member 3584153 wrote: how can i read araic text from text file????
TextReader fstream = new StreamReader("myfile.txt");
string s = fstream.ReadToEnd();
led mike
|
|
|
|
|