|
Hi,
you called the function Moon too many times. Try it using e.g. distanceToMoon = 380, then it will work.
You should use e.g. a for loop.
Kind regards
|
|
|
|
|
Shorter distance or lop, the algorithm is wrong!
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
It's because you are not folding the paper at all, you are just stacking papers on top of each other.
When folding a paper the thickness will double each time, you are just adding a single sheet of paper each time.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Hi, thanks for your answer. I hadn't seen it that way. But, are you sure the paper's thickness will double? The first time you do it, sure, but the second time in my head the paper's thickness will be three times the thickness at the beginning, isn't it like that?
|
|
|
|
|
No, the number of layers will double each time.
Try it out with a piece of paper. Fold it once, then again. Count the number of layers that you have, and you see that it's four, not three.
Despite everything, the person most likely to be fooling you next is yourself.
|
|
|
|
|
Why do you have to use recursion at all? I'm fairly sure you could use a logarithm to get a better answer, then round it up
x = by
y = logb(x)
380000000000 = 0.1n-1
n-1 = log0.1(380000000000)
n = log0.1(380000000000) + 1
Something like that should do the trick (although I'm rubbish at logarithms, so this might give you the wrong answer, the method should be okay)
|
|
|
|
|
I have to use a recursive function. It's an assignment.
|
|
|
|
|
hi i am beginer of .net
i am facing a problem of disabiling a menustrip in a child for.
when ever i click a confirm button in a child form my menustrip shall be enabled which is of parent mdi form.untill then itt should be disable.
|
|
|
|
|
how are you calling your child form?
something like FormChild.ShowDialog() ?
If so then you can simply do...
if(FormChild.ShowDialog() == DialogResult.OK)
{
this.menuStrip.Enabled = true;
}
Need it in one line?
this.menuStrip.Enabled = FormChild.ShowDialog() == DialogResult.OK;
Life goes very fast. Tomorrow, today is already yesterday.
|
|
|
|
|
Hi
i want use digital pen (or optical pen) in my app which to be written in c#, can anybody help me and give some articles and examples about this issue ?
thanks
|
|
|
|
|
hi
im krishna
did u got any inforamtion or usefull stuffs to
develop an c# application to use the digital pen.
|
|
|
|
|
hi krishna
you can handle mouse_move event.
|
|
|
|
|
Hello to all
How can I use the light pen on the Mvc or the web app?
|
|
|
|
|
I Had to cancel the printing given.
For this I had used
Code Snippet: Sandeep Aparajit playing around with the System.Management.Net namespace.
#region CancelPrintJob
/// <summary>
/// Cancel the print job. This functions accepts the job number.
/// An exception will be thrown if access denied.
/// </summary>
/// <param name="printJobID">int: Job number to cancel printing for.</param>
/// <returns>bool: true if cancel successfull, else false.</returns>
public bool CancelPrintJob(int printJobID)
{
// Variable declarations.
bool isActionPerformed = false ;
string searchQuery;
String jobName;
char [] splitArr;
int prntJobID;
ManagementObjectSearcher searchPrintJobs;
ManagementObjectCollection prntJobCollection;
try
{
// Query to get all the queued printer jobs.
searchQuery = "SELECT * FROM Win32_PrintJob" ;
// Create an object using the above query.
searchPrintJobs = new ManagementObjectSearcher(searchQuery);
// Fire the query to get the collection of the printer jobs.
prntJobCollection = searchPrintJobs.Get();
// Look for the job you want to delete/cancel.
foreach (ManagementObject prntJob in prntJobCollection)
{
jobName = prntJob.Properties["Name" ].Value.ToString();
// Job name would be of the format [Printer name], [Job ID]
splitArr = new char [1];
splitArr[0] = Convert.ToChar("," );
// Get the job ID.
prntJobID = Convert.ToInt32(jobName.Split(splitArr)[1]);
// If the Job Id equals the input job Id, then cancel the job.
if (prntJobID == printJobID)
{
// Performs a action similar to the cancel
// operation of windows print console
prntJob.Delete();
isActionPerformed = true ;
break ;
}
}
return isActionPerformed;
}
catch (Exception sysException)
{
// Log the exception.
return false ;
}
}
#endregion CancelPrintJob
The code line prntJob.Delete() is not executing in other PC's which had .Net framework and all other things same as my Syatem.
What may be the problem? Can anyone say something to solve this?
|
|
|
|
|
Hi,
I have three AsyncCallback delegates. how can i put these three AsyncCallback in three threads, so messages corresponding to the delegate can process at any time even when the other delegate is busy.
eg: I opened three ports. Continous messages will come to these three ports. I create delegates for each ports. All delegates should be ready to recive messages at any time without making a message queue.
How cani do this using multi thread?
Thankyou
YPKI
|
|
|
|
|
I don't know! What exactly do you want? What's wrong with a message queue?
There are async methods (with callbacks) for sockets, is that what you're looking for?
Do you want to start a new thread from the delegate? (could give trouble)
|
|
|
|
|
I am using AsyncCallback, but if the number of message increse the messege queue will go long and the replay get slow.
i want make it fast.
Will the AsyncCallback can handle any number of clients at a time with out delay??
I am trying to use multi thread in delegate for handling messages.
Will it work?
Thankyou
YPKI
|
|
|
|
|
It depends. It's possible to make it work without being delayed by other messages (of course you can not make it take zero time), up to a certain limit of course. The messages you send over the internet will never go in parallel, but the processing of them can. If your callback immediately starts a new async operation and only Then processes the message, that should be OK (I think.. test first)
|
|
|
|
|
Hi,
AFAIK all async callbacks (such as supported by Dns.BeginGetHostEntry) and other async operations (such as SerialPort.DataReceived event) execute on the ThreadPool, which holds a collection of Threads (25 or more) ready to execute your code. You can't (or shouldn't?) modify the behavior of those threads (priority, IsBackground, ...)
If you don't like/trust the ThreadPool, don't use async callback, just create your own threads and let them to whatever it is you need in a synchronous way.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
so you mean async callbacks have its own thread pool(its already work when we use async callbacks...ryt ??? ).. no need to create our own thread
So better, not to create thread for speeding up message queue process..
Thankyou
YPKI
|
|
|
|
|
Not sure you got my drift. AFAIK all callbacks use the existing ThreadPool (which gets created very early in the startup of a .NET app). And using your own threads, so you can control them any way you like, only requires you to create threads once, say one Thread each time you open a SerialPort.
FWIW some info on ThreadPool: http://www.ddj.com/hpc-high-performance-computing/216500409[^]
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Dear sir,
i am Nidish, traineee .NET developer for Forthought pvt Ltd, Bangalore, India. I would like to to know the method to Programmatically send email using outlook Express 6.0. I have the code to access Microsoft outlook but failed to find method to access outlook express 6.0. please be free to send reply to my Email id : nidi2999@gmail.com
|
|
|
|
|
hi, Nidi i'm also searching same thing
|
|
|
|
|
Not very hard it would seem clickety[^]
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I love circular references. I followed the link, then clicked on the first item returned. It was this question.
"A Journey of a Thousand Rest Stops Begins with a Single Movement"
|
|
|
|