|
I didn't get your point? Do you want to hide the application from Task Bar or what?
cheers,
Abhijit
CodeProject MVP
|
|
|
|
|
A better explanation of your question will be much appreciable....
Have a Happy Coding.....
|
|
|
|
|
Hi,
How many thread can i use in a page?
eg:
i have 10-15 for loop to execute at a time. Can i able that much of thered?
What is the limit of thread in a page?
Thankyou
YPKI
|
|
|
|
|
You can use unlimited Thread in your application. It depends on what is your system configuration because
Thread takes Memory and CPU Usage.
Best Regard
Anubhava Dimri
mailto: anubhava.prodata@gmail.com
|
|
|
|
|
The optimum thread count you should use depends on your process, it's design, but more importantly the CPU and hardware you have. Launching a thread allocates a minimum of 1MB of memory, so for your 10 to 15 threads, you just commited 10 to 15MB of RAM to your app as well. AND, on a dual core system, only 2 of those threads would be running, at most, at any point in time. Threads only give the illusion of code running faster. In the majority of cases, they don't actually make a process run faster. Keep the threads you need to a minimum.
|
|
|
|
|
hello
QUESTION 1: is it true that .NET framework will automatically enlist help from Distributed Transaction Coordinator?
<br />
try {<br />
IDbConnection oConn1 = new SqlConnection("Data Source=Server1;Initial Catalog=myDataBase;User Id=myUsername;Password=myPassword;");<br />
<br />
<br />
IDbConnection oConn2 = new SqlConnection("Data Source=Server2;Initial Catalog=myDataBase;User Id=myUsername;Password=myPassword;");<br />
<br />
IDbTransaction oTx1 = oConn1.BeginTransaction();<br />
IDbTransaction oTx2 = oConn2.BeginTransaction();<br />
<br />
<br />
... oConn1 db access ...<br />
... oConn2 db access ...<br />
<br />
oTx2.Commit();<br />
oTx1.Commit();<br />
} catch(Exception ex)<br />
{<br />
oTx2.Rollback();<br />
oTx1.Rollback();<br />
} finally {<br />
...<br />
}<br />
QUESTION 2: There's no "TransactionScopeOption" for IDbTransaction.BeginTransaction?! It's always TransactionScopeOption.New?
QUESTION 3. How can you join transaction without use of TransactionScope? Is there such thing as joining multiple transaction..?
<br />
IDbTransaction oTx = oConn1.BeginTransaction();<br />
oConn2.EnlistTransaction(oTx);<br />
<br />
oTx.Commit();
Thanks
dev
modified on Sunday, April 12, 2009 10:03 PM
|
|
|
|
|
This.Text1.Text = DateTime.Now()
The statement above gives error, how to correct it please?
|
|
|
|
|
Glen Villar wrote: how to correct it
That greatly depends on the error that you are getting.
Why is common sense not common?
Never argue with an idiot. They will drag you down to their level where they are an expert.
Sometimes it takes a lot of work to be lazy
Individuality is fine, as long as we do it together - F. Burns
Help humanity, join the CodeProject grid computing team here
|
|
|
|
|
The others have answered it right, thank you.
|
|
|
|
|
This.Text1.Text = DateTime.Now().toString();
|
|
|
|
|
This
Glen Villar wrote: This.Text1.Text
expect a string input
and this
Glen Villar wrote: DateTime.Now()
return CTime
How can thise 2 be equal??
You need to convert CTime to string, using ToString.
My advise is you need to read through a basic C# book, it will definitely help you a lot.
*12Code
|
|
|
|
|
Read the documentation on DateTime.Now!
|
|
|
|
|
this.Text1.Text = DateTime.Now.ToString();
|
|
|
|
|
My app needs to maintain an awareness of whether the machine has a working internet connection.
How do I test for a good internet connection?
|
|
|
|
|
This is what I use, based on P/Invoke:
public static bool Connected() {
LP_InternetConnectionState description=0;
return InternetGetConnectedState(ref description, 0);
}
public static string ConnectionName {
get {
LP_InternetConnectionState description=0;
StringBuilder sb=new StringBuilder(512);
InternetGetConnectedStateEx(ref description, sb, sb.Capacity, 0);
return sb.ToString()+" ("+description.ToString()+")";
}
}
[DllImport("wininet.dll")]
static extern bool InternetGetConnectedState(ref LP_InternetConnectionState lpdwFlags,
int dwReserved);
[Flags]
enum LP_InternetConnectionState : int {
Configured=0x40,
LAN=0x02,
Modem=0x01,
OffLine=0x20,
Proxy=0x04,
RAS_installed=0x10
}
|
|
|
|
|
Hello all,
I'm Working on project using DiectX component.
the question is :
how to handle microphone and use it?
in another form :
What is the specific code that begins connection with microphone ?
thanks.
|
|
|
|
|
Pick up the mic with the left hand, activate the mic by turning it on, make sounds with mouth within the pickup range of the mic.
Learn to look for information yourself, I found this in abut 10 seconds CP atricle[^]
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
I know how to overload operators for my own classes. My question is whether it's possible to overload operators for built-in value types. For example, can you overload the ^ operator in such a way that:
int result = 2 ^ 3; // Sets result to a value of 8
Thanks!
|
|
|
|
|
No. You cannot modify existing classes.
You can inherit from a class and override the overloaded operator IF that option is available, but for many types that option is not available. For example, some types are sealed (meaning you can't inherit from them), don't have virtual overloaded operators (so you can't override the existing behaviour) and if it is a value type (like an int) then you can't be inherited anyway.
|
|
|
|
|
The previous advice was correct, you can't change or derive from the built in types such as Int32 . You can however provide a wrapper around them, for example:
public class MyInt32
{
private Int32 _Value;
private MyInt32(Int32 value)
{
_Value = value;
}
public static implicit operator Int32(MyInt32 value)
{
return value._Value;
}
public static implicit operator MyInt32(Int32 value)
{
return new MyInt32(value);
}
public static MyInt32 operator ^(MyInt32 valueA, MyInt32 valueB)
{
return 8;
}
} Now just make sure one of the values is an MyInt32 and your implemtation will be used
MyInt32 a = 2;
MyInt32 b = 3;
Console.WriteLine(a ^ 3);
Console.WriteLine(2 ^ b);
Console.WriteLine(a ^ b);
DaveBTW, in software, hope and pray is not a viable strategy. (Luc Pattyn) Visual Basic is not used by normal people so we're not covering it here. (Uncyclopedia) Why are you using VB6? Do you hate yourself? (Christian Graus)
|
|
|
|
|
Hi
i have a main form which set it's IsMdiContainer to True (MDI Form), and second form which set MaximizeBox,MinimizeBox to False and wrote this code to display it in MDI form :
this.frm = new Form2();
frm.MdiParent = this;
this.frm.WindowState = System.Windows.Forms.FormWindowState.Maximized;
this.frm.MaximizeBox = false;
this.frm.MinimizeBox = false;
frm.Show();
but when i run application, the MaximizeBox and MinimizeBox already exists (even when i click on MaximizeBox, it back to normal mode!) which i don't want to user interact with it. where does my problem and how to solve it ?
Thanks
|
|
|
|
|
Dear go to properties and turn off the maximize button
regards
sajid salim khan
|
|
|
|
|
Hi
as u can see above code, the maximize button and minimize button has been turned off.
can anybody help me ?
|
|
|
|
|
Following explanation is from msdn document
The Monitor class does not maintain state indicating that the Pulse method has been called. Thus, if you call Pulse when no threads are waiting, the next thread that calls Wait blocks as if Pulse had never been called.
If not threads is wating then pluse is ignored??
I have following code ...it starts 3 threads and enques 12 tasks before even 3 threads finished work that means for next 9 pulses there are not threads waiting. Still all the tasks get processed. According to documentatiion next 9 pulses should be ignored as if they never happened. Did I misunderstood the documentation.
using System;
using System.Threading;
using System.Collections.Generic;
namespace ThreadingConsole
{
public class TaskQueue : IDisposable
{
object locker = new object();
Thread[] workers;
public Queue<string> taskQ = new Queue<string>();
public TaskQueue(int workerCount)
{
workers = new Thread[workerCount];
// Create and start a separate thread for each worker
for (int i = 0; i < workerCount; i++)
(workers[i] = new Thread(Consume)).Start();
}
public void Dispose()
{
// Enqueue one null task per worker to make each exit.
foreach (Thread worker in workers) EnqueueTask(null);
}
public void EnqueueTask(string task)
{
lock (locker)
{
taskQ.Enqueue(task); // We must pulse because we're
Console.WriteLine("START : " + task + " " + DateTime.Now.ToString()); // Perform task.
Monitor.Pulse(locker); // changing a blocking condition.
}
}
void Consume()
{
while (true) // Keep consuming until
{ // told otherwise
string task;
lock (locker)
{
while (taskQ.Count == 0) Monitor.Wait(locker);
task = taskQ.Dequeue();
}
if (task == null) return; // This signals our exit
Thread.Sleep(10000); // Simulate time-consuming task
Console.WriteLine("END : " + task + " " +DateTime.Now.ToString()); // Perform task.
}
}
public void Start()
{
string[] sTasks = GetNewWork();
Console.WriteLine("Start Enquing Tasks : " + DateTime.Now.ToString());
foreach (string s in sTasks)
this.EnqueueTask(s);
Console.WriteLine("Finished Enquing Tasks : " + DateTime.Now.ToString());
}
string[] GetNewWork()
{
return new string[] { "AAAAA", "BBBBB", "CCCCC", "DDDD", "AAAAA1", "BBBBB1", "CCCCC1", "DDDD1", "AAAAA2", "BBBBB2", "CCCCC2", "DDDD2", "AAAAA3", "BBBBB3", "CCCCC3", "DDDD3" };
}
}
}
class Program
{
static void Main(string[] args)
{
using (TaskQueue queue = new TaskQueue(3))
{
queue.Start();
Console.ReadLine();
}
}
}
kyus
|
|
|
|
|