|
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"
|
|
|
|
|
Oops - it never occurred to me to follow it any deeper, I'm glad there were a few more than just this one.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
one more reason to google before asking here.
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.
|
|
|
|
|
Hi,
I am doing geocoding using Google Map API but the problem is,
if i pass Lat (25.093369) and Lon (121.5669693) points of Taiwan to Google Map API then it gives me address in following way,
西安里 Neihu District Taipei City Taiwan 114
but i need the whole address in Chinese Language
Can anyone help me?
thanks in advance
|
|
|
|
|
Yeah, Google. They wrote the API and they support it. I suggest dropping them an email or looking for the support forum for it.
|
|
|
|
|
Lets say you have to do 4 things,
void f1()
void f2()
void f3()
void f4()
Alt 1: Run them like this
f1(); f2(); f3(); f4();
Alt 2: Run them each one with a separate thread
Thread t1 = new Thread (f1); t1.Start();
Thread t2 = new Thread (f2); t2.Start();
Thread t3 = new Thread (f3); t3.Start();
Thread t4 = new Thread (f4); t4.Start();
(the functions just read resources, they dont write, so dont worry about threading sync)
Alt 2 should take less time than Alt 1???
I tried to test this but I'm doubting of the results because at the beginning I had one result (threading is faster) and then anoter (same times)
Logically thinking.. the threading solution shouldnt be faster because in reality they arent running at the same time.. they are being switched ( thats why there is only 1 CurrentThread when one calls Thread.CurrentThread static method )
Please help.
|
|
|
|
|
Hi!
This highly depends on what your f1-f4 are doing.
When each one can run through all the time, without having to wait for anything, I'd guess the 2 solutions run equally fast (at least on a 1 processor system and neglecting the overhead of thread creation).
But as soon as one of them has to wait for a result (network, file, ...), the scheduler can assign the waiting thread's time slice to another thread, making the whole program running faster.
Hope this helps...
Regards,
mav
--
Black holes are the places where God divided by 0...
|
|
|
|
|
Adding to mav's response, if you have a multi-core processor, the multi-threading solution may run faster.
But my advice is don't use threads unless there's a convincing reason to do so. They can introduce all sorts of subtle, difficult-to-debug problems.
|
|
|
|
|
That depends on what each of these methods is doing. Creating and starting a new thread is an expensive operation, so if it doesn't take very long to execute the method, just starting one thread can take longer than executing the 4 methods sequentially.
|
|
|
|
|
Hi,
if two or more of the jobs (f1...f4) have an execution time that is (or may be, depending on circumstances) noticeable for the user (i.e. more than 30msec), put them in separate threads/ThreadPool/BackgroundWorker so they can
1) execute in parallel (when your system has hyperthreading, or multiple cores, or multiple processors)
2) self-organize their execution (i.e. when one has to wait some other can continue)
OTOH if you do it all sequentially and your Task Manager shows the CPU is fully loaded (which means there are no waits and the number of cores does not exceed the number of running threads) then you won't gain anything by adding threads.
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.
|
|
|
|
|
Well, this question was due to a question I had on a test:
It said something like:
"Some people are not happy with their statistics software because of the performance.. What would you do to try making it better"
And the code is like
"...
info = SomeClass.Load ( file )
Analyzer.AgeAnalysis( info )
Analyzer.SexAnalysis( info )
Analyzer.RaceAnalysis( info )
..."
1. Can't have access to the package that contains Analyzer and SomeClass
2. Therefore can't know what those methods do (but it says explicitly that they can run in different orders so there is no "wen one has to wait some other can continue")
And the solution was to make them run in different threads ..but i'm doubting that would improve the performance...
If there isnt dual core, hyperthreading, etc. in the system, and there isn't need to self organize.. then why would them run faster? If
f1 does f1.1, f1.2, f1.3
and f2 does f2.1, f2.2, f2.3
Without threads they would run like
f1.1
f1.2
f1.3
f2.1
f2.2
f2.3
And with threads, they just would run mixed, for example:
f1.1
f2.1
f1.2
f2.2
f2.3
f1.3
And that isnt running faster.. just in different order
Do you think ambiguous the question?
|
|
|
|
|
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.
|
|
|
|