|
Aisha sharma wrote: plz explain with example
...plz explain with question
Do you mean actual CD/DVD or Drives?
And what do you mean by 'reset these properties'?
Illogical thoughts make me ill
|
|
|
|
|
yes i want get information about actual cd and dvd e.i.
cd/dvd readable or writable
and want to give rights to user so that he can block
readOnly or writeOnly accesstypes
|
|
|
|
|
Hi there,
I've got a real annoying issue with an extremely simple .net application (C#, .net3.5).
What I have is a simple program (comparable to Hello World) which launches a thread to periodically read an xml file and stores some values into memory which are used by the main app thread. The main application thread just looks for mouse events on a traybar-icon which open a webbrowser with a specific url. That's it.
What the problem is, is that on my dev-machines and home computers the app runs nicely for hours/days straight. On my work-pc, the application seems to enter in a blocked state on the main execution thread or it enters a deadlock/filelock or something after a few minutes and stops responding and the process has to be killed via the taskmanager. This only happens on my work-machine which is Windows XP with .net4.0 installed. All other machines are also windows XP (any flavor) with .net3.5 installed. No error windows or logging present.
I'm at a total loss here. I ran through the code numerous times and checked all IO/Threading routines, but no loose ends found. Any ideas what it might be? Could it be the 4.0 runtime? (which I seriously doubt)
A good programmer is someone who always looks both ways before crossing a one-way street. (Doug Linder)
|
|
|
|
|
there is insufficient information.
is it a WinForm app? if so, is another thread trying to access some of the Controls?
do you have proper exception handling? are all exceptions caught and logged? are you swallowing some?
when it blocks, is the CPU load near zero? or rather near one fully occupied core?
Helfdane wrote: an extremely simple .net application
so why not show all relevant code?
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
Fair questions, my bad for the insufficient info. I can't access the sources from this machine and I'm not going to type it over
It's a windows application. The values read from the xml are used to populate a context menu on a traybar icon. So, there is the main app-thread which reads values from a class (GetValues()) and uses those values to build a contextmenustrip. There is one thread which reads an xml-file and stores the values into memory (properties of the value-class). (polls an xml file for updates)
Cpu load is 0% at all times, the application is too small to notice it on a dualcore. Memory usage is 21kb.
But if this was a logic-issue, I should have problems on all machines, not just one of the 5. The only thing different between those machines is that the one machine which hangs the app has .net4.0 runtime installed, the others are still on 3.5. So, hence my question
A good programmer is someone who always looks both ways before crossing a one-way street. (Doug Linder)
|
|
|
|
|
As you are not touching any GUI parts from a thread other than the main thread, it sounds like a deadlock; you seem to have a producer-consumer relation between two threads, possibly there is insufficient synchronization. Maybe you are sharing several data items, and a thread switch occurs when the shared data is in an inconsistent state. Maybe you allowed for a compiler optimization that isn't correct (e.g. lacking a volatile keyword).
OTOH there have been some synchronization changes in .NET 4.0, IIRC they had to adapt a few things to cope with some potential deadlock the way things used to be handled internally. There also is a new "cancellation model". I don't have a reference, and I never saw an actual victim of the old ways. This[^] is something a quick Google brought up, not sure it is related though.
I would consider it more likely the problem is in your code itself. It working properly all the time on some machines, and quite some time on the one, does not prove a thing. Bugs don't have to show themselves all the time, that would be too easy...
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
Thanks for the tip. I'll take a look at it.
A good programmer is someone who always looks both ways before crossing a one-way street. (Doug Linder)
|
|
|
|
|
Helfdane wrote: I can't access the sources from this machine and I'm not going to type it over
Post a relevant snippet demonstrating the problem when you do have access. I'm not going to hunt for something without a map.
Helfdane wrote: But if this was a logic-issue, I should have problems on all machines
Why? Some logical errors only become visible under specific circumstances.
Helfdane wrote: The only thing different between those machines is that the one machine which hangs the app has .net4.0 runtime installed, the others are still on 3.5.
Is the app also compiled against 4.0, or is it running on the 3.5 framework?
Are you by any chance using WM_NCHITTEST on the trayicon?
I are Troll
|
|
|
|
|
Hi,
In my application am providing the access to the user to export the data from Grid to Excel,
After exporting the data to excel, it will save that file in user desktop and providing a option to open the file in my application by displaying a message in message box...
My question is, suppose if the user dont have excel installed in his machine and he clicks on open the downloaded file through my application, it will through an exception..
In that occasion i have to display message to the user to install the required application before opening the machine, in case if he dont have that application in his machine...
So could u tell me, how to do it....
|
|
|
|
|
Check the registry. In HKEY_CLASSES_ROOT, there should be an entry for the extension, and one or more sub-keys for the "type" (e.g. ".xls" with sub-key "Excel.Sheet.8"). Then look at the key for "Excel.Sheet.8", you will should see a sub-key "Open" and there a sub-key "command". If one of those keys cannot be found, a suitable application is not (correctly) installed.
|
|
|
|
|
Hi,
Am using the below code to check whether the excel is present in user machine or not...
if (MessageBox.Show(
"Data Exported to File " + strFileName +
" at location MyDocuments. Do yo want to view the saved file?",
"Work Done",
MessageBoxButton.YesNo,
MessageBoxImage.Information) == MessageBoxResult.Yes)
{
Type officeType = Type.GetTypeFromProgID("Excel.Application");
if (officeType == null)
{
MessageBox.Show("Please Install MS Excel 2007 or above version to view this file", "Liquidity Risk Management");
}
else
{
oXl.Visible = true;
}
}
Now, suppose if the user having lesser version of excel like excel 2003,he can able to see the see the file downloaded under the version on excel 2007, means irrespective of the excel version, it has to open the file if the user have a excel installed in his machine..
How to do it...
|
|
|
|
|
Or you can show the Open with dialog box:
Process p = new Process();
p.StartInfo.FileName = "rundll32.exe";
p.StartInfo.Arguments = "Shell32.dll,OpenAs_RunDLL " + filename;
p.StartInfo.WindowStyle = ProcessWindowStyle.Normal;
p.Start();
|
|
|
|
|
Hi all,
I am trying to execute this line of code but it not providing me the values
ManagementObjectSearcher pd = new ManagementObjectSearcher("SELECT Name, MediaType, MediaDescription from Win32_PhysicalMedia");
foreach (ManagementObject mp in pd.Get())
richTextBox3.Text += mp["Name"] + " " + mp["MediaType"] + " " + mp["MediaDescription"];
Can anybody please tell me what i am doing wrong or if i need to include something in this...
mainly i want to find media type...
Thanks in advance
|
|
|
|
|
Try "select * from Win32_PhysicalMedia" and see if that returns values. I'm surprised the code even compiles because mp["Name"] will return an object. Try. mp["Name"].ToString(), mp["MediaType"].ToString()...
Also don't forget to dispose of the ManagementObjectSearcher pd.
"You get that on the big jobs."
|
|
|
|
|
Hello Everybody,
I am trying to develop an application for Internet Access Watcher( URL Monitor).For that i am Listening socket.
it returns some data but i m not able to convert it read only (URL Address) format.
so please help...
byte[] input = BitConverter.GetBytes(1);
byte[] buffer = new byte[4096];
Socket s = new Socket(AddressFamily.InterNetwork, SocketType.Raw, ProtocolType.IP);
s.Bind(new IPEndPoint(IPAddress.Parse("192.168.5.6"), 0));
s.IOControl(IOControlCode.ReceiveAll, input, null);
int bytes = 0;
do
{
bytes = s.Receive(buffer);
if (bytes > 0)
{
Console.WriteLine(Encoding.ASCII.GetString(buffer, 0, bytes));
}
} while (bytes > 0);
Thanks
If you can think then I Can.
|
|
|
|
|
eg_Anubhava wrote: it returns some data
What data? How do you expect anyone to figure out what you are receiving and what you expect to receive from reading the above?
I must get a clever new signature for 2011.
|
|
|
|
|
I want the URL which is currently displayed in browsers address bar.
Like : www.google.com
If you can think then I Can.
|
|
|
|
|
eg_Anubhava wrote: I want the URL which is currently displayed in browsers address bar.
Then I think you will have to hook into the browser and read the text out of that field. There are many articles on this process here on CodeProject.
I must get a clever new signature for 2011.
|
|
|
|
|
Since every browser has a different control layout and does not expose the same programming interface, if at all, you have no choice but to implement your own proxy server to monitor what each client is doing. Or, just use one off-the-shelf.
|
|
|
|
|
I have tested ToString() on a few decimal and it looks nice with no trailing zero, i.e.
1m.ToString() => 1
1.1m.ToString() => 1.1
1.0001m.ToString() => 1.0001
Yet, in my app, I have some decimal.ToString() looking like 5.00000000000000 (many useless trailing 0) which crops up all over the place!
Any idea as to why!?!
[Edit]
mmm.... in fact I was wrong! decimal store the number of decimal value it has been created with a display them!
i.e.
1.0m.ToString() => 1.0
(1.0m * 1.0m).ToString() => 1.00
User error, oops...
A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station....
_________________________________________________________
My programs never have bugs, they just develop random features.
|
|
|
|
|
Insufficient information! Show us the code and values that lead to your conclusion, and don't forget to include the relevant declarations.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
dunno, those decimal value come from the database!
mm... maybe I should check the values in the database...
but they do get displayed as "5.0000000000000000", anyway I just write a utility method which remove trailing 0
A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station....
_________________________________________________________
My programs never have bugs, they just develop random features.
|
|
|
|
|
that is not the solution, as later on you will perform a search with a "WHERE field = 5" and the result set will not be what you expect. IMO when you have a problem you should try and understand and solve it, rather than hide it.
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
mm.... there is some sense in that, let's roam this damn database!!!
A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station....
_________________________________________________________
My programs never have bugs, they just develop random features.
|
|
|
|
|
Hey, by looking at the database I just got some idea!
while
1m.ToString() => 1
decimal.Parse("1.0000000").ToString() => 1.0000000
how strange....
but thankfully
1m == decimal.Parse("1.0000000") => true
mmm.... in fact I was wrong! decimal store the number of decimal value it has been created with a display them!
i.e.
1.0m.ToString() => 1.0
(1.0m * 1.0m).ToString() => 1.00
User error, oops...
but the conclusion: it's ok to remove the 0!!!
A train station is where the train stops. A bus station is where the bus stops. On my desk, I have a work station....
_________________________________________________________
My programs never have bugs, they just develop random features.
|
|
|
|