|
It's a BeginInvoke call, which only blocks (very) briefly while the work item is queued to the dispatcher. The dispatcher in turn will execute a brief delay at some point executing the 'empty' work item.
Software Zen: delete this;
|
|
|
|
|
D'Oh! I wasn't paying attention and thought it was an Invoke call. Yeah, BeginInvoke has absolutely no value
We can program with only 1's, but if all you've got are zeros, you've got nothing.
|
|
|
|
|
Aaaahhh!, nothing like a do nothing instruction early in the morning...
|
|
|
|
|
I forget exactly what the purpose was, but I've seen something very similar done in WPF. The purpose was something like forcing the rendering to refresh. Though, I thought some "priority" (or something like that) was necessary for it to work.
I know, vague, but there could be a real purpose (that they apparently didn't leave a comment for).
|
|
|
|
|
WPF has the same constraint that you had under Win32 and MFC: you can only modify UI objects from the UI thread. I think the intent here was to promoted a UI change to the UI thread. Unfortunately, this code appeared in handlers that are already guaranteed to be called from the UI thread.
Software Zen: delete this;
|
|
|
|
|
That's a pretty special no-op.
As for using Invoke/BeginInvoke though, unless it's really really obvious that it can only be called in the dispatch thread (e.g. it's in an event handler or something), perhaps it used to be used from multiple threads, or the author couldn't be sure?
|
|
|
|
|
BobJanova wrote: it can only be called in the dispatch thread (e.g. it's in an event handler Got it in one. I explained this fact to the guy a number of times, and it still didn't seem to sink in.
Software Zen: delete this;
|
|
|
|
|
I created a Windows Forms Control Library in one of my projects, and VS2012 displayed the 'Designer Error' page with the message that no classes in the user control could be designed.
Strangely, VS showed all references as missing. Changing the target framework to 4.0 then back to 4.5 fixed the issue.
I don't know what happened, but it startled me.
Gryphons Are Awesome! Gryphons Are Awesome!
|
|
|
|
|
Brisingr Aerowing wrote: I don't know what happened You DO use source control, don't you?
'I'm French! Why do you think I've got this outrrrrageous accent?' Monty Python and the Holy Grail
|
|
|
|
|
There were 2 projects in the solution, neither one had any real code (I like to lay out my projects before I start working). From what I dug up, it is a VS bug that has been there for a while. (Too lazy to pull up a link)
Gryphons Are Awesome! Gryphons Are Awesome!
|
|
|
|
|
We have multiple data stores at my company. In one of the databases, there is a view of a table of a view of a table that was copied from another data store. So, the chain is something like this:
Primary Data Store (PDS)...
Dump Table Of PDS (DTP)...
Complex View of DTP (CVD)...
Dump Table of CVD (DTC)...
Complex View of DTC
The actual names of each of those are even more esoteric. And I'm pretty sure there are further derived tables of the final view shown above.
|
|
|
|
|
throw new BrainNotFoundException();
Gryphons Are Awesome! Gryphons Are Awesome!
|
|
|
|
|
Found this in a sp, not sure why it was done this way, @fileLength and @userId are passed in, and i've changed the names of the tables so i could post this, so i realize the tables may not make sense(they do in the real code).
DECLARE file_Cursor CURSOR FOR SELECT Length
FROM Files f
INNER JOIN User p
ON p.UserId = f.UserId
INNER JOIN Playlist pm
ON pm.ListId = p.DefaultListId
WHERE p.UserId = @userId
AND pm.FileNumber <> -1
OPEN file_Cursor
FETCH NEXT FROM file_Cursor INTO @length
WHILE @@FETCH_STATUS = 0
BEGIN
SET @fileLength = @fileLength + @length
FETCH NEXT FROM file_Cursor INTO @length
END
CLOSE file_Cursor
DEALLOCATE file_Cursor
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
DBA should be shot for having allowed this to persist in his/her server!
|
|
|
|
|
we dont have an offical dba, we were trusted to check our own stuff once we proved we were doing things right (small shop). obviously nobody ever checked the proc this was in regardless of my recomending they do so.
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
Well, that's probably what sum(length) would do anyway...
Sigh. Good find, good fix.
|
|
|
|
|
Because he/she was bored or they get paid by the number lines of code produced.
|
|
|
|
|
SomeGuyThatIsMe wrote: Found this in a sp, not sure why it was done this way
People new to SQL who are use to standard declarative languages don't realize how sets work. They find it difficult to think that way even presuming they know that it exists.
So they create loops.
|
|
|
|
|
I wouldnt have posted, well ok maybe i would have, if this was a new or junior person. If they were still around i would have tried to help them. This was written near the end of their time with the company, maybe that explains it. This person also spent a lot of time trying to prove how much smarter they were than everyone else.
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
SomeGuyThatIsMe wrote: I wouldnt have posted, well ok maybe i would have, if this was a new or junior
person
I said "new to SQL" and not new to programming.
And that is what I meant. Someone new to programming might be more likely to do it correctly because they don't already have expectations of how it 'should' be done. But these days either is likely to due a google search an implement it using the first example they find because neither has the necessary knowledge to filter it out.
|
|
|
|
|
Wow, talk about doing it the hard (and wrong) way. I suspect that this is a symptom of the state of on-the-job training in the programming world. It usually goes like "hey here's a new programmer, do this." But I still don't see how one becomes a programmer without learning the basics of SQL. No one likes code reviews, but it's useful for things like this.
Also, I love how @@FETCH_STATUS is global. I once saw an expensive production system blow-up due to a legacy code time bomb in the form of a SP using a global variable like this.
|
|
|
|
|
@echo off
for /L %%I in (1,1,100) do call :FizzBuzz %%I
goto :EOF
:FizzBuzz
set I=%1
set /a T3=I %% 3
set /a T5=I %% 5
set /a T35=T3 + T5
if not %T35%==0 goto FizzBuzz5
echo FizzBuzz
goto :EOF
:FizzBuzz5
if not %T5%==0 goto FizzBuzz3
echo Buzz
goto :EOF
:FizzBuzz3
if not %T3%==0 goto FizzBuzzEcho
echo Fizz
goto :EOF
:FizzBuzzEcho
echo %I%
goto :EOF Apparently I wrote this back in 2007. I have no memory of doing so, or why I did it .
Software Zen: delete this;
|
|
|
|
|
And that is because you got selected?
Happy Programming
|
|
|
|
|
No. I've been at my current position for 23 years.
Software Zen: delete this;
|
|
|
|
|
Well, that's a pretty decent FizzBuzz implementation.
|
|
|
|