![](/i/fill.gif) |
![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
On 8/5/2011 5:42, Orchid XP v8 wrote:
> I was asking, more basically, "how do you do useful stuff with
> COM?"
Oh. You find a COM object that does what you want it to do, and you use it.
> As best as I can tell, COM lets you create "objects" and invoke
> "methods" on them... that's as far as I was able to figure out.
Yes, that's what COM is for. The "methods" are usually implemented in either
system libraries or in applications. So an "object" might be an excel
spreadsheet, and the "methods" would manipulate the cells, set up a graph,
and then copy the image of the graph to the clipboard for you to use.
Asking "what good is COM" is like asking "what good are command line
arguments? All they do is let you give strings to a program, but what do I
*use* them for?"
With COM, you could do something like write a script that reads a database,
sticks the entries in Excel, does a time-value average, finds the entry that
has some maximum value for some property you're interested in, and then fire
up google earth to plot how that property has changed with geography over time.
COM is to stdio like powershell is to CLI. It's an OO way of talking to a
running program and invoking methods inside it.
> I'm fairly sure I tried that [or similar] in Tcl and it didn't work.
I dunno. I used it for years.
> I also figured that the only reason that you can (say) embed an Excel
> spreadsheet in a Word document is because both products are produced by the
> same company.
No no no. That's the whole *point* of COM. That's why there's a standard
interface definition language and such. That's how systems like firefox and
emacs work - custom scripting languages manipulating data structures only
visible within the context of that program. COM lets you talk to the data
structures inside a program without using that program's scripting language.
> I've yet to see a language that can invoke DLLs either...
Maybe you should learn a normal language, then. :-)
> I'd be perfectly happy doing COM from, say, JavaScript. It's not that
> Haskell is the problem, it's that I can't see *anything* that speaks COM.
Tcl, VBScript, WScript, VBA, and C# all have trivial interfaces to COM.
Google up some language you know, and look to see if it has a COM interface
implementation. Didn't you tell me you had written a VBA macro or two?
> I get the feeling that the only way to solve this is to use some
> horrifically awful language like VB...
No, you just have to learn something vaguely normal, and then not give up
when the first thing you try doesn't work.
--
Darren New, San Diego CA, USA (PST)
How come I never get only one kudo?
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
On 8/5/2011 0:35, Orchid XP v8 wrote:
> Now that might actually be useful. I've yet to find any hex editors.
There's this cool technology that was invented a few years that helps you
find things. You may have heard of it. ;-)
--
Darren New, San Diego CA, USA (PST)
How come I never get only one kudo?
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
On 8/5/2011 8:05, Warp wrote:
> I have emacs set so that it shows whitespaces at the end of lines with
> blue background.
git's GUI does the same thing. And I think there's even a switch to prevent
check-ins of code with trailing spaces.
The best fun I had recently was working on a makefile that included
SOURCES = alpha \
beta \
gamma \
delta \
epsilon
Except there was a trailing space after gamma, so delta and epsilon never
got recompiled. Given that a full compile resulted in about 60,000 lines
when stdout was redirected, the problem was not obvious.
Looks like VIM can do this too:
http://vim.wikia.com/wiki/Highlight_unwanted_spaces
Wow. I wish I had thought to actually do that before.
--
Darren New, San Diego CA, USA (PST)
How come I never get only one kudo?
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
On 8/5/2011 5:42, Orchid XP v8 wrote:
> A precondition is a Bool expression which must be true when a code bloc
k is
> entered. If it isn't true, the code block is allowed to malfunction
> arbitrarily badly. But if it /is/ true, then when the code block exits,
the
> postcondition is required to be true.
Yeah. They're a lot less useful when you're talking about functional
languages, because they're really just redefining the function.
> I don't see anything in the above that requires the code blocks to be c
lass
> methods, or even to be proper named constructs. If you were operating i
n
> BASIC, it might just be "when line 1580 is reached, X must contain a
> positive integer", and then "when line 1615 is reached, X must contain
a new
> positive integer larger than the one that was there before".
That would be preconditions and postconditions. It wouldn't be DbC, I don
't
think.
> An invariant looks like it should apply to any data structure of a give
n
> type (e.g., every tree node must contain a value lower than the one in
its
> parent node), or perhaps to a given set of global variables (the nextID
> variable must always be positive and nonzero). Again, I don't see any
> especial reason why it has to apply only in an OO setting.
The invariant only holds while you're not manipulating the data. E.g., wh
ile
you're rebalancing the tree, the invariant needn't hold. Now if you start
cutting global variables up into collections and corresponding blocks of
code that manipulate them, or talking about "the set of all data structur
es
that are manipulated by this particular set of code", I'd say you have so
me
OO design going on there. :-)
> Let me put it this way: It looks a crapload better than Word, Excel,
> PowerPoint, OpenOffice, or the HTML rendering of any browser I've tried
.
That isn't what TeX was written to compete against.
> Whether it looks better than a £20,000 piece of professional publi
shing
> software, I couldn't say. But given that I'm never going to own £2
0,000,
> it's kind of irrelevant.
All you need is something designed by an actual typesetting company, like
Adobe. The very fact that you're looking at TeX output that has been run
thru a PDF is already telling.
>> But it's quite as much there as the
>> jaggies on a 300DPI print-out compared to a 1200DPI print-out.
>
> Then why don't you just, um, increase the resolution? That's the entire
> /point/ of Metafont, after all. Its fonts are completely scaleable.
It was an analogy. Most people wouldn't believe their 300DPI laser printe
r
prints jaggies on their text, until you set it down next to a 1200DPI las
er
printer.
> Has there ever /been/ a Unix that isn't distributed in source form?
Of course.
> In reality, I'm not actually going to change such things, on either sys
tem.
> It would be far too hard. But in principle, it's possible with Linux. (
And
> probably OpenBSD and a few others.) It's not possible with Windows. At
> least, not without paying real money.
It's certainly possible with Windows. You just need to get the source cod
e.
> Of course, "Windows" is a single monolithic piece of software, whereas
> "Linux" (the OS) is a vast array of independently replaceable bits.
Because Powershell is monolithic, and printer drivers are monolithic, and
file systems are monolithic in Windows, and ... wait, what?
What part of Windows do you think is monolithic and can't be fairly easil
y
replaced that *can* be replaced in Linux?
> Well, yeah. Not as random as, say, Shift+Alt+- (I'm looking at you, Ema
cs).
> But it's not the sort of thing you'd try just on the off-chance that ma
ybe
> it does something.
You know, you should google "Windows keyboard shortcuts" and see the doze
ns
and dozens of standard shortcuts. It'll probably make your life easier. I
mean, control-right has worked that way since like Win3.
>> Where I would want to search in a text file to find a word?
>
> Where you'd want a special key to move to the next word on the line. Bu
t
> sure, if you wanna do search instead...
If I'm writing code and I want to move three tokens to the right, you thi
nk
it won't be faster with the shift key?
> The output is 4000 lines line? In what universe...?? O_O
That was the small one. You don't think compiling a Linux distro generate
s
tens of thousands of lines of output?
>> Heck, I have all the names and addresses in a text file. I want to loo
k
>> up my brother's fax number.
>
> See, I would probably use a real database for that.
I used to.
>>> These are all pretty rare, really.
>>
>> I think it depends on what you do with an editor. :-) They're all pret
ty
>> common for me.
>
> What, are you writing C or something?
I write lots of stuff. But yes, C also. Not sure why that matters.
>> The code for emacs doesn't get invoked thru the keyboard mappings, any
>> more than the code for COM does.
>
> And you add some package that makes Alt+R do the same thing as Ctrl+R b
ut
> slightly differently. Oh, I'm sorry, you changed Ctrl+R to be Ctrl+Z? O
h,
> well, nevermind... ;-)
You don't write a package where Alt+R does the same thing as Ctrl+R. You
write a package where Alt+R invokes the same underlying function that Ctr
l+R
does.
> No, the last time I ran Vi was on an early version of RedHat. Apparentl
y Vi
> was the only text editor installed, and I was desperately trying to fin
d
> something to edit the X configuration file so that I could make it star
t up.
You know what? That's *exactly* why you should learn vim. :-)
vi runs in 32K. emacs won't link on a machine with a megabyte address spa
ce.
>>> Being able to invoke all your tools from within your editor and edit
>>> their output is again quite a powerful idea.
>>
>> vi had that too, except it was *all* your tools, with no need to write
>> macros to handle it.
>
> I should have forceen a Holy War. ;-)
No, I'm just saying, normally in vi you highlight some text and run it th
ru
an external script. If you want to indent the next paragraph, it's }!form
at
and if you want to sort it it's }!sort
(Or something like that.)
emacs stuff I've seen is usually implemented in elisp, which means if you
want to reindent your code, you have to fire up the entire emacs
infrastructure to do so.
>>> Not unless you hire a vast
>>> army of C++ programmers to write the necessary hooks and DLLs and God
>>> only knows what else to add the support to VS.
>>
>> Uh, one Bulgarian intern, on the weekends.
>
> Did I mention the part about how it never really worked to everyone's
> satisfaction and was eventually abandoned?
Yeah, I saw that. That's how I know it was a Bulgarian intern on weekends
who decided to abandon it because it wasn't working well.
The point is not "here's a useful plug-in for Haskell", but to show you a
counter-example to your assertion that VS doesn't support third-party lan
guages.
>> That's exactly why Microsoft invented COM, IBM invented REXX, standard
s
>> bodies invented COBRA, etc etc etc.
>
> Accessing COM is nowhere near as easy as throwing together a few lines
of
> elisp. (As far as I can tell.)
You're doing it wrong. See the Tcl example, for example. You keep claimin
g
it didn't work, but since I don't know what you were trying to do or how,
I'm not sure why it didn't work. And of course it's possible it's just
bitrot there too.
--
Darren New, San Diego CA, USA (PST)
How come I never get only one kudo?
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
On 8/5/2011 8:08, Warp wrote:
> Darren New<dne### [at] san rr com> wrote:
>> (What would an invariant look like in C?)
>
> I suppose the closest thing is "assert(a< b);"
That's not really an invariant, tho. C basically doesn't have the facility
to say "any time you're not in one of these N functions, there should be the
following relationship between these collection of values:..."
Primarily because there's no way to express code that's outside any function.
--
Darren New, San Diego CA, USA (PST)
How come I never get only one kudo?
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
Darren New <dne### [at] san rr com> wrote:
> On 8/5/2011 8:08, Warp wrote:
> > Darren New<dne### [at] san rr com> wrote:
> >> (What would an invariant look like in C?)
> >
> > I suppose the closest thing is "assert(a< b);"
> That's not really an invariant, tho. C basically doesn't have the facility
> to say "any time you're not in one of these N functions, there should be the
> following relationship between these collection of values:..."
"In computer science, a predicate is called an invariant to a sequence
of operations provided that: if the predicate is true before starting
the sequence, then it is true at the end of the sequence."
"Programmers often make use of assertions in their code to make invariants
explicit."
--
- Warp
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
On 8/7/2011 8:00, Warp wrote:
> "In computer science, a predicate is called an invariant to a sequence
> of operations provided that: if the predicate is true before starting
> the sequence, then it is true at the end of the sequence."
Well, here's the thing.
assert(a < b) is testing a precondition if you stick it in a function before
any code that changes values of variables.
assert(a < b) is testing a postcondition if you stick it in a function after
all code that changes values of variables.
assert(a < b) is testing an invariant if you have it as a precondition and a
postcondition for every function that reads or writes a or b.
assert(a < b) might even be part of a loop variant rather than any invariant.
In your example, "a < b" might be an invariant. "assert(a < b)" isn't
enforcing an invariant unless you write it at the start and end of every
function.
But sure, assert() is about as close as you can get in C to providing a way
to implement the design pattern of DbC. It is, as you said, "the closest
thing". But that's like saying "function pointers is the closest thing you
have to closures in C." I.e., not very close. :-)
--
Darren New, San Diego CA, USA (PST)
How come I never get only one kudo?
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
On 8/7/2011 8:00, Warp wrote:
> "In computer science, a predicate is called an invariant to a sequence
> of operations
Oh, and yes, if you're talking about DbC, You're basically talking about
OOP, so an "invariant" applies at the class level. Basically, any time the
constructor has finished and you're not inside a method of the instance in
question, that class's invariants should all be true. So a class invariant
is a predicate that applies at the end of the constructor and at the end of
each method and (ideally) at the start of each method. The only reason it
wouldn't apply at the start of each method is if someone changed one of the
objects that instance references. (E.g., your invariant is
this.mystorage.capacity > 100 and someone else goes around your back to set
mystorage.capacity = 50 because they have a reference to the same
"mystorage" instance.)
--
Darren New, San Diego CA, USA (PST)
How come I never get only one kudo?
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
tl;dr
In any case, Warp uses it, so it's clearly not because of elisp. It was once
upon a time very hot among C++ users.
As for your editor, does it have a kill circular ring to quickly and
conveniently select latest extracted text entries? Does it have parametrized
macros to quickly generate text from templates? Have it got automatic buffers
for "jumping" back and forth through the text with ease? Oh, sorry for your
flashy flint tool...
BTW, for a long while now I've been a happy vim user, which is about the same as
emacs.
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
On 8/7/2011 21:20, nemesis wrote:
> BTW, for a long while now I've been a happy vim user, which is about the same as
> emacs.
I think elisp is probably easier to program than vim macros. You really have
to be into programmable calculators to make sense of vim macros. Altho they
are, technically, turing complete. Every time I use something besides vim, I
find I miss the "." command most.
Given that, having something actually integrated with the compiler so you
get stuff like intelisense is often worth the loss of power.
--
Darren New, San Diego CA, USA (PST)
How come I never get only one kudo?
Post a reply to this message
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |
|
![](/i/fill.gif) |
| ![](/i/fill.gif) |
|
![](/i/fill.gif) |