|
I still think it's an exotic solution; you'd have to account for the resolution of the current desktop, and copy a part of it without knowing the size of the font under the word.
Bastard Programmer from Hell
|
|
|
|
|
Yep, it is. But I don't know of another way to get the text under the mouse that works with all controls...
|
|
|
|
|
Do any of you use the VS2010 Profiler regularly? If so, in what cases do you use it? I know there are plenty of paid profilers around, as well as free (IIRC, not entirely sure).
I ask because I recently ran into some terribly slow performance in a database-driven application. I did not have access to any 3rd-party profiling applications. So I ran the profiler in VS. It helped me discover that I had mistakenly created a loop which opened the database connection, queried it and the closed the connection for EACH iteration in the loop. This took approximately 27 seconds seeing as how there was close to 2,000 records in the table. The profiler told me that the majority of the time was taken up by DbConnection.Disconnect() inside this method. That's when I found the problem. Once I fixed it I can now run the same code with MORE THAN 2,000 records in the table and it takes ~7 seconds.
I think I should start using the profiler more often. Haha. Any input would be nice. I wasn't entirely sure if this was the correct forum but I develop C# applications.
|
|
|
|
|
I can't comment on the VS profiler as I use the JetBrains profiler. I'm surprised that you saw such a problem though - if your connections were pooled, they should just be returned to the pool (and taken from there), which is not an expensive operation.
|
|
|
|
|
Well, if it makes any difference I am using OLE DB with a Microsoft Access 2007 database. But either way, it happened. I thought it was odd as of last night because I had just recently read a thread here on CP concerning connection pooling and such. But I don't know. I have never developed an application that was entirely database-driven until this one. So I'll take any advice I can get, if you have any for me. :-P
|
|
|
|
|
In the normal sense it isn't possible to pool connections with MS Access because the is no such thing as a 'connection' in terms of network connections possible with that.
Your experience would suggest it isn't pooling any other associated resource either.
|
|
|
|
|
Matt U. wrote: I have never developed an application that was entirely database-driven until this one
Get rid of Access and use SQL Server express. Let me say that with emphasis GET RID OF ACCESS, seriously the absolute best thing you could do for both your application and yourself is move to SQL Server express, there are tools that will help move the structure and data.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
The database is not mine. It belongs to the plant manager. I have pitched the idea, along with numerous advantages, improvements, etc., with using SQL Server Express (including that it is 100% free). However, is there a way to pull SQL Server data into Access? He generates daily, weekly and monthly reports, which he must send to various individuals throughout the company. That is his biggest issue with the idea.
|
|
|
|
|
Matt U. wrote: However, is there a way to pull SQL Server data into Access?
Certainly, I'm not sure of the connection type any more but you could use Access as a front end to a SQL Server database, there is [used to be] a migration wizard. If your current design has 2 MDFs (database and UI) then the change is very simple. If not you may need to refactor some of your Access code.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Use a profiler if you have a problem or if you have time to learn about it.
However don't over optimize.
|
|
|
|
|
I know Luc does not visits Q & A and I really want to learn this thing. I have had brilliant reply from SA but I need more. I am learning greedy. Sorry.
Here[^] is a question of mine if you wich to respond. I totally appreciate if you wish to downvote.
Thanks.
Edit: No disrespect to anyone else who can help me out. I am fan of these guys so I posted this way. Sorry if I offended you.
"The worst code you'll come across is code you wrote last year.", wizardzz[ ^]
modified on Friday, June 17, 2011 4:30 PM
|
|
|
|
|
It's alright. You only want an answer from Luc, so we'll all feel free to ignore this because apparently only SA and Luc know the answer.
|
|
|
|
|
I only post when I want SA to correct me and direct me to his correct post
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
You too huh?
|
|
|
|
|
No disrespect to you Sir Pete and others too but I am a fan of these two guys. My fanhood has dominated here. Sorry for that. You have taught me a lot of things and I wish you could help me more. I totally respect anyone who replies to a post with a decent reply but I am totally a fann of these guys. Sorry if this post of mine meant any disrespect of any of you CPians. Really sorry if you sorry if you feel this way Pete.
"The worst code you'll come across is code you wrote last year.", wizardzz[ ^]
|
|
|
|
|
I appreciate that you didn't mean anything by it, but there have been some really good new posters coming through the forums recently (letting me take more of a back seat - thanks guys and girls), and a post like this could demotivate them.
|
|
|
|
|
Again, really sorry. It's just the respect I have for them. This does not mean I do not consider anyone else. I know what I owe to this community. I know what I was and what I am. Not just technical things but life as well.
Sorry for anyone who feels I am beyond the limits. Please help people regardless of what they feel and say. That's whta makes CP different from other places guys. We are a community and not a random username on the web.
"The worst code you'll come across is code you wrote last year.", wizardzz[ ^]
|
|
|
|
|
So, thrown on the scrapheap; a boy of my tender years.
The best things in life are not things.
|
|
|
|
|
I don't know if ou remember this or not but I had rough time with you and Judah in my initial posts. I really thank you for being gentle after that. I would have ripped off the guy forever if I was you.
"The worst code you'll come across is code you wrote last year.", wizardzz[ ^]
|
|
|
|
|
I tend not to remember these things. I've knocked lots of raw posters into being good posters over the years. Apparently I used to help Luc, but I can't remember it (I've posted a heck of a lot of times).
I only remember the really bad ones - the ones who refused to improve.
|
|
|
|
|
Delegats are references type variable in c# which holds references to method at run time,
Two types of delegate Single cast,Multi cast delegates,
Ex:Coffe vending mechaine which holds reference to method at run time about mix of flavour according to user....
|
|
|
|
|
Well, fork me sideways I never knew that. I really need a dripping sarcasm icon.
|
|
|
|
|
d@nish wrote: Luc does not visits Q & A
Nor do I. But I like delegates.
|
|
|
|
|
Hi.
A couple of days ago i had a similar discussion here:
Days ago i had a discussion here:
http://www.codeproject.com/Messages/3923426/Re-Getting-data-from-host-convert-to-string-and-th.aspx[^]
The user called Luc patyn told me to use this code:
using (NetworkStream nStream = new NetworkStream(getSocket(numsock).getSocket(),true)) {<br />
using (FileStream fs = new FileStream("C:\\Users\\Mauri\\Desktop\\" + item.Name, FileMode.Append, FileAccess.Write)) {<br />
using (BinaryWriter writer = new BinaryWriter(fs)) { <br />
for(;;) {<br />
int len=nStream.Read(myReadBuffer, 0, myReadBuffer.Length);<br />
if (len==0) break;<br />
writer.Write(myReadBuffer, 0, len);<br />
}<br />
}<br />
}<br />
}<br />
But my problem is that the socket never returns "0" so it gives a timeout exception:
Unable to write data to the transport connection: An error occurred during connection attempt because the connected part did not properly respond after a period of time, or failed to established connection and connected host has failed to respond.<br />
in this line:
int len = nStream.Read(myReadBuffer, 0, myReadBuffer.Length);
Thanks
|
|
|
|
|
NetworkStream.Read() blocks until data is available, so is pretty much only good for synchronous I/O when you know how many bytes to expect and when. You can use NetworkStream.DataAvailable to check and see if there's data before calling read, but that may not be what you want, in which case you should probably use some asynchronous I/O method.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|