|
Check the sig
Nothing wrong with GOTO.
I still remember having to write your own code in FORTRAN rather than be a cut and paste merchant being pampered by colour coded Intellisense - ahh proper programming - those were the days
|
|
|
|
|
Gotcha...
|
|
|
|
|
dan neely wrote: but any decent text editor will let you insert the ' via a global insert/replace.
AFAIK, the VBA editor within any MS Office application does have this feature...
|
|
|
|
|
IF so, could you please tell me where? I can't find it in excel 2k7.
Today's lesson is brought to you by the word "niggardly". Remember kids, don't attribute to racism what can be explained by Scandinavian language roots.
-- Robert Royall
|
|
|
|
|
Well, I don't use MS Office 2007...
In 2003 though, it is a button in the "Edit" tool bar (Menu -> View -> Toolbars)
|
|
|
|
|
TY. The VBA editor didn't change except that it uses the same theme color as the rest of office in the menu/toolbar backgrounds. All the dividers/headers elsewhere are still win32 gray. The combination is almost WTF enough to make you think no one in MS cares.
Today's lesson is brought to you by the word "niggardly". Remember kids, don't attribute to racism what can be explained by Scandinavian language roots.
-- Robert Royall
|
|
|
|
|
dan neely wrote: no one in MS cares.
That's probably true, given that MS now recommends using VSTO instead of VBA.
|
|
|
|
|
Not to mention office 2k8 (mac version of 2k7) doesn't support VBA at all. To make it perform well on early/mid 90's level hardware the VBA compiler/interpreters were written with large amounts of assembly code for speed so porting the PPC version to x86 wasn't an option, and the PC/mac versions ended up with very different back end connections for what were good reasons at the time; which meant they couldn't port the wintel version over either. Office for mac doesn't sell enough copies to have a very large team (it's fully funded on it's own sales), and the dev team estimated 2 years to rewrite the VBA engine.
Today's lesson is brought to you by the word "niggardly". Remember kids, don't attribute to racism what can be explained by Scandinavian language roots.
-- Robert Royall
|
|
|
|
|
I cannot find it either. As you have mentioned in the other post, it must be a VSTO thing.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
It's there. Just checked in Word2000 and Word2007. You just have to show the Edit toolbar and it's right there.
Tosch
|
|
|
|
|
Yes, it does have it. When I have to swallow my pride and do any VBA in Access, the search and replace is there and it is useful.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
I'm working on a decompiled version of a pre-compiled ASP.NET 2 web site. While the obscure names are to be expected, I'm not sdo sure that the original code didn't include horrors such as:
if (sQueryType == "NAME")
{
goto Label_00AA;
}
[snip]
Label_00AA:
sQ = sQ + "[Name] LIKE '%" + sQuery + "%'";
goto Label_00EF;
[snip]
Label_00EF:
sE = "";
DataView dvSel = new DataView();
DataView dvNot = new DataView();
[the processing starts here]
<pre> <div style="display:none;" class="CPhogPost"></div>
<div class="ForumSig"> <a href="http://wtfmemes.blogspot.com/">Daily WTF Memes</a> </div>
|
|
|
|
|
That SQL's a tad inefficient! I hope it's not a large table that's being queried...
|
|
|
|
|
Not only that. Think of the SQL injection you could do...
|
|
|
|
|
I don't get it. Where's the horror?
|
|
|
|
|
Goto's used for conditional blocks, mixed in with normal if...then...else blocks.
A SINGLE-PHOTON TURNSTILE, a device in which photons are emitted one at a time under controlled circumstances, has been created by a team of scientists from Stanford (US), Hamamatsu Photonics (Japan), and NTT (Japan). Essentially the researchers use the quantization of electrical conductance to produce a quantization of photon emission. They put together a quantum well (the frontier between two thin semiconductor layers) containing a single electron (other electrons are dissuaded from entering because of a "Coulomb blockade" effect) with a quantum well containing a lone (comparably Coulomb blockaded) hole, and then cycle the voltage across the whole stack of layers in such a way that the lone electron and lone hole meet, mate, and make a lone photon. The resulting device, which operates at mK temperatures, is typically a tiny post some 700 nm tall and with a diameter of 200-1000 nm. (J. Kim et al., Nature, 11 February 1999.)
|
|
|
|
|
But it's decompiled code. You can't expect the same structure that a human coder would produce. Humans code for readability and maintainability. Optimising compilers code for performance. Try looking at the assembler output from a C++ compiler sometime. You can't move for JMP, JNE and JNZ instructions...
|
|
|
|
|
It's still a horror.
A SINGLE-PHOTON TURNSTILE, a device in which photons are emitted one at a time under controlled circumstances, has been created by a team of scientists from Stanford (US), Hamamatsu Photonics (Japan), and NTT (Japan). Essentially the researchers use the quantization of electrical conductance to produce a quantization of photon emission. They put together a quantum well (the frontier between two thin semiconductor layers) containing a single electron (other electrons are dissuaded from entering because of a "Coulomb blockade" effect) with a quantum well containing a lone (comparably Coulomb blockaded) hole, and then cycle the voltage across the whole stack of layers in such a way that the lone electron and lone hole meet, mate, and make a lone photon. The resulting device, which operates at mK temperatures, is typically a tiny post some 700 nm tall and with a diameter of 200-1000 nm. (J. Kim et al., Nature, 11 February 1999.)
|
|
|
|
|
Brady Kelly wrote: It's still a horror.
Still don't see why. The compiler's just doing its job - optimising the code for speed or size as appropriate. It's not supposed to be read by humans, so it doesn't matter in the slightest that it doesn't conform to a human's idea of well-structured code.
|
|
|
|
|
Yuck.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
Sorry Brady, you FAIL. Set Reflector options not to optimize C#. Full of branches/goto's ! In fact you would barely be able to read the non-optimized C# from compilation.
|
|
|
|
|
leppie wrote: Sorry Brady, you FAIL. Set Reflector options not to optimize C#. Full of branches/goto's ! In fact you would barely be able to read the non-optimized C# from compilation.
So I must apply a setting that makes the output barely readable?
|
|
|
|
|
Looks like that might be a good place to test for a SQL injection attack.
|
|
|
|
|
There is way too much code like that, with direct SQL concats. I am only briefed to add two reports to the system, not secure it. Hell, if I were to decode all the decompiled code and use parametrised queries, I could probably buy a new car with the earnings.
|
|
|
|
|
I spotted this gem written by one of our developers that needed to copy an XML node from one XML document (source) into another (target). The variable naming's been changed to make it clearer.
Given 2 XML nodes:
XmlNode sourceNode = source.SelectSingleNode("BOOKS/BOOK[@id='1234']");
XmlNode targetNode = target.SelectSingleNode("COMPANY/BOOKS");
This is the code the developer wrote.
XmlElement bookElement = target.CreateElement("BOOK");
targetNode = targetNode.AppendChild(bookElement);
<big>targetNode.InnerXml = sourceNode.InnerXml;</big>
How performant do you think it would be compared to this?
XmlNode importedNode = target.ImportNode(sourceNode, true);
<big>targetNode.AppendChild(importedNode);</big>
I haven't bothered to do the tests but I guess stringifying some XML and then parsing it back again would be a tad inefficient!
|
|
|
|