|
Yes, you are right to doubt the correctness of the answer given the simple but theoretical question.
if there is only a single core and there are no waits (which means no input/output, no disk accesses, and almost no user interface; not an average day-to-day situation) then threading won't help. In fact, without threading it will behave better because:
1) you don't have any threading overhead (order of milliseconds), so overall execution time would be slightly less
2) you get partial results sooner (whereas the interleaved execution will take longer to come up with something since it isn't focusing on a single part of the overall job)
There is one more aspect to the matter: "locality of reference"
Assume a lot of data needs to be handled, RAM memory being slow, and caches (level1 and leven2) being limited in size; then it is very favorable to perform all computations on a subset of the data (not exceeding level2 cache size), then move on to the next load of data, etc. One can hope to get this for free with multi-threading, but that only works well if all the jobs happen to proceed at the same pace (i.e. require the same number of instructions per amount of data). One would better organize for this, with multi-threading plus interthread synchronization, or, much simpler, a single thread and a loop that makes it happen.
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.
|
|
|
|
|
Hello,
I am having a very strange problem.
I created an application in Visual Studio C# 2008 using .net 3.5 SP1.
The application looks perfect in Windows XP, but in Windows Vista, the buttons are a lot larger and don't fit their space.
Here is an exaple :
http://www.sodevrom.net/xp.jpg
http://www.sodevrom.net/vista.jpg
As you can see, in Windows Vista the buttons are very large.
What can be the cause of this ?
Thank you in advance
|
|
|
|
|
It's not just the buttons, but the text overall. Maybe changing the settings in Control Panel could fix it. Not sure, but just an idea
|
|
|
|
|
It is because different version of window that you are using. Different versions of Windows have different UI and Theme settings. So the form ui also changes accordingly.
Regards
Saanj
Either you love IT or leave IT...
|
|
|
|
|
Hi,
Thank you for your reply but it does not help to much.
I don't understand how can the Font size change when I specified an EXACT font from c# : Microsoft Sans Serif, 8.25pt
Any other ideeas ?
Thank you
|
|
|
|
|
hello my friends. Here is my question
I have a form and a table from a database, I show the datas of the table in the from as a datagridview, you know. so i wannt to click a cell and then a messagebox should appear which shows the data from the cell i have just clicked.
this is what i wrote
(producer is the name of the table)
string id = producerDataGridView.CurrentCell.Value.ToString();
MessageBox.Show(id);
it works but it is only shows some cells. for example i click three cells and it shows one of them or two,
is it a bug of visual studio 2008 or did i do something wrong wih the code?
thank you in advance
|
|
|
|
|
Ooops - this is not the ASP.NET forum. Sorry about that.
I suspect the issue is that your events are getting lost, because you show each one individually. What event are you catching ?
Christian Graus
Driven to the arms of OSX by Vista.
"I am new to programming world. I have been learning c# for about past four weeks. I am quite acquainted with the fundamentals of c#. Now I have to work on a project which converts given flat files to XML using the XML serialization method" - SK64 ( but the forums have stuff like this posted every day )
modified on Tuesday, May 19, 2009 7:54 PM
|
|
|
|
|
you are not helping by playing smart my friend. i do a project by using wisal studio 2008 c#. and this option is avaible, so it can be used somehow.I use datasets so the datas are saving in a datatable and i can use this datatable to obtain the datas.Can anyone else help me please?
|
|
|
|
|
private void producerDataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
string id = producerDataGridView.CurrentCell.Value.ToString();
MessageBox.Show(id);
}
this is the code of the datagridview
how can it lost? i stored them in the datatable... and why sometimes is shows the datas and others it doesnt?
|
|
|
|
|
i would change the event to cellclick instead of cellcontentclick.
I would then interrogate e to identify the cell clicked rather than getting the currentcell.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
i am not sure that i am following you, i am newby, i just doubleclicked the datagridview and the code appeared, if i change the code i cant save tha data in a stirng, can you show me a little code, someone?
sorry for being to pressure
|
|
|
|
|
This tells me you are using the cellcontentclick event. there is a similar event called CellClick that may serve you better
private void producerDataGridView_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
string id = producerDataGridView.CurrentCell.Value.ToString();
MessageBox.Show(id);
}
Investigate the DataGridViewCellEventArgs e or sender. sender will be the cell that was clicked
You are using and event and then ignoring the content of the event and checking producerDataGridView.CurrentCell.Value.ToString();
Now the currentcell SHOULD be the cell you clicked but oh wait you trapped the CELLCONTENT event, is this guaranteed to point to the currentcell.
So basically you are peering into a bowl of spagetti and hoping you get the 2 end of the same strand. Use the correct event (this can be difficult to identify) and use the event to identify the cell
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
For certain reasons I have:
a) a server supporting ASP.NET but with VERY minimal monthly bandwidth,
b) a server with no ASP.NET support, but with lots of monthly bandwidth.
Now im trying to figure out the best way to get around having the users uploaded images/videos/files on one server and just hosting the code/db on the other.
I thought about the following:
The user loads the asp page and uploads what they want, this goes onto server A(look above), then server A's code transfers the file to server B via ftp and the link is stored in db which will be read when the user needs the file and directed.
Two problems with that though, 1) Isnt ftp hellishly slow and outdated? 2) Lets say the file was 10mb. It would be uploaded to server A(10mb), then server A would upload it to B(10mb+10mb), then server B would have it(10mb+10mb+10mb). So it would end it 30mb transfer.
I would be very greatfull if someone could give me some ideas about the best way to achieve this.
|
|
|
|
|
What about host the static content in amazon s3 or such
|
|
|
|
|
As I said I have hosting and for various reasons I have to use that.
|
|
|
|
|
I have a a windows application which works great written in C#, and I was wondering what are the steps to take to convert it to a mobile device application? Is the process just a copy and paste process? Or is there more to it?
It would be helpful if you tell me what the difference between the two?
Thanks in advance.
|
|
|
|
|
Star09 wrote: Is the process just a copy and paste process?
Yes
|
|
|
|
|
Just tried it, groupbbox can't be used among many other controls. Is there something I'm missing?
|
|
|
|
|
Star09 wrote: Is there something I'm missing?
No
|
|
|
|
|
A mobile device usually doesn't have XP/Vista/Weven installed. That means that some functionality that's present on your PC won't be present in your mobile.
Start your mobile adventure here[^]
I are troll
|
|
|
|
|
The framework is different - although very similar in many respects.
You will need to research to see what controls are not there / behave differently, and the same for any other inbuilt classes you're using, and redesign accordingly.
Mostly, it's stuff taken out, but there are additions too. Most of the stuff that's not there can be recreated easily enough with some 'googling' and some API calls.
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)
|
|
|
|
|
Scenario:
I have a few sub-folders and files in a folder named MYMAINFOLDER.
I read all those sub-folders and files and load them in a form, but if i want to change the MYMAINFOLDER name through windows explorer I got an exception saying that files are being used.
Thing I have tried out:
1). I get no exception if I were to change the subfolder and files names through windows exploere.But as soon as i try to rename the MYMAINFOLDER i get exceptions.
|
|
|
|
|
I guess you can't rename the folder cause it's locked for use. Maybe you are running an executable that resides in the folder, or something similar.
2+2=5 for very large amounts of 2
(always loved that one hehe!)
|
|
|
|
|
Your app, or something else, has files that are still open in that folder.
In order to change the name of the folder, ALL of the files in that folder, and any subfolders must be closed.
|
|
|
|
|
Thanks for answering guys, but here are few more detailed I found out and never knew.
I drilled down to the lowest level while debuggin my apps and found something very interesting point. At Line 5 execution if i were to go rename the foldername through windows explorer no problem but as soon as i were to come in line 7 and then go back on windows exploere to rename the folder then i get the exception.
Could gurus enlightend me with their suggestions.
1) string filename = "";
2) OpenFileDialog openDialog = null;
3) using (openDialog = new OpenFileDialog())
4) {
5) openDialog.InitialDirectory = TempFolderpath ; ---> No problem
6)
7) if (openDialog.ShowDialog(this) == DialogResult.OK)-----> Problem.....
8) {
9) filename = openDialog.FileName;
10) openDialog.Dispose();
11) GC.Collect();
12) }
13)
14)
15) if(openDialog != null)
16) {
17) penDialog = null;
18) }
Folder Structure
----TempFolder
|
|____MYMAINFOLDER
|
|__Folder1
|__Folder2
|__File1.xml
|__File2.html
modified on Tuesday, May 19, 2009 4:55 PM
|
|
|
|