Date: | March 22, 2006 / year-entry #104 |
Tags: | other |
Orig Link: | https://blogs.msdn.microsoft.com/oldnewthing/20060322-24/?p=31823 |
Comments: | 84 |
Summary: | Often, people will not even realize that their solution to a problem merely replaces it with another problem. The quip attributed to Jamie Zawinski captures the sentiment: Some people, when confronted with a problem, think "I know, I'll use regular expressions." Now they have two problems. For example, in response to "How do I write... |
Often, people will not even realize that their solution to a problem merely replaces it with another problem. The quip attributed to Jamie Zawinski captures the sentiment:
For example, in response to "How do I write a batch file that..." some people will say, "First, install <perl|bash|monad|...>". This doesn't actually solve the problem; it merely replaces it with a different problem. In particular, if the solution begins with "First, install..." you've pretty much lost out of the gate. Solving a five-minute problem by taking a half hour to download and install a program is a net loss. In a corporate environment, adding a program to a deployment is extraordinarily expensive. You have to work with your company's legal team to make sure the licensing terms for the new program are acceptable and do not create undue risk from a legal standpoint. What is your plan of action if the new program stops working, and your company starts losing tens of thousands of dollars a day? You have to do interoperability testing to make sure the new program doesn't conflict with the other programs in the deployment. (In the non-corporate case, you still run the risk that the new program will conflict with one of your existing programs.) Second, many of these "solutions" require that you abandon your partial solution so far and rewrite it in the new model. If you've invested years in tweaking a batch file and you just need one more thing to get that new feature working, and somebody says, "Oh, what you need to do is throw away you batch file and start over in this new language," you're unlikely to take up that suggestion. So be careful when you suggest a solution that has a high activation energy. Sure, something could be taken care of by a one-line perl script, but getting perl onto the machine is hardly a one-line endeavor. |
Comments (84)
Comments are closed. |
… ah, if only "find" supported regular expressions …
Try findstr /R.
Another example of "when the only tool you have is a hammer…". My favorite are the deep SQL people – any problem can be solved with SQL. I once needed a little desktop alarm clock/reminder. A SQL person suggested building it around some feature of SQL Server. (I need a wristwatch – I get Big Ben.)
The source of the JWZ quote is the Unix Hater’s Handbook, and it’s actually a reference to "sed", the standard Unix stream editor:
<blockquote>
Some people, when confronted with a problem, think "I know, I’ll use sed." Now they have two problems.
</blockquote>
How about, some people, when confronted with a problem, think "I know, I’ll use a batch file." Now they have two problems.
Seriously.
If only batch language was sufficient for any nontrivial tasks.
Here is a perl script I consider handy.
($pattern, $replace, $options) = @ARGV;
foreach (glob(‘*’))
{
if (m/$pattern/i)
{
$oldname = $_;
eval("s/$pattern/$replace/i$options");
print qq(ren "$oldname" "$_"n);
}
}
Invoked normally, it will show which file names match the given pattern, and what the given replacement will do to them. When the result is satisfactory, pipe the output to cmd.
Now, how do I do that with batch language and findstr…
Thanks for FINDSTR … I use it a whole lot, and avoids me saying "maybe I will install GREP" and then have a new problem.
The analysis it’s incomplete however. It should also take into consideration future problems, based on the analysis of past ones.
Even if perl is absurdly overkill right now, it might be the right choice anyway if it will help the 99% of future problems. On the contrary if it will surely be useless in every future project, avoiding it might be the right choice even if it’s not overkill right now.
The real question is why hasn’t Microsoft provided by default with Windows Perl or Unix utils or even Monad with Vista. No it will not even be included in Vista and such is the state of affairs for 20 years.
Nektar: cscript.exe has been around for a long time. Write your command scripts in JScript or VB.
Windows scripting host is OK, but it has some very significant shortcomings, particularly in the way it handles redirection. Things that you can do easily in Perl or bash are very annoying in WSH. Being able to pipe things to a loop is indispensable. At the very least, someone in MS who handles scripting should really study the Unix utils and see what’s missing that could be added to make WSH more useful.
Also, for little things, it would really be helpful if there was a suffix that Windows would recognize as "run this with cscript" or "run this with wscript". I know I can hack it for my system, but I want it to work without hacking every system.
So you’re suggesting I need to learn another new langauge to perform some task, which I could do quickly using some other tool or langauge I already know, but isn’t installed by default?
"At the very least, someone in MS who handles scripting should really study the Unix utils and see what’s missing that could be added to make WSH more useful."
They did. See Monad development
I finally tried out Regular Expressions in just one such moment of "I hear these help.", followed by a couple of days of "What?" and "Help?" and "Thank goodness for internet tutorials!".
I now find them invaluable, and they’ve saved me a load of time. But they certainly delayed the first project I used them in…
It’s helpful that MS has maintained the batch language
for those of us still running QDOS scripts we wrote
in 1980. However MS has had almost 25 years to ship
a new batch language that, say, is based on
Unix’s sh, (which was written when — in 1972?)
but smart enough to recognize when it’s about to
process a batch file and handle that transparently.
I’ll leave compatibility details as an exercise
for the reader. But whatever happened to the ‘switch’
command that shipped with DOS 3.x?
Microsoft should just ship perl with their system like every other operating system vendor does, but as usual they are too arrogant and suffer from Not Invented Here syndrome.
For Centaur:
@echo off
setlocal enabledelayedexpansion
for %%a in (*) do (
set aaa=%%a
set bbb=!aaa:%1=%2!
if not !aaa!==!bbb! echo ren !aaa! !bbb!
)
Sure, it doesn’t use regular expressions for the patterns to match, but … it’s a batch file, it works, and it’s not exactly hard to follow… uh… if you know batch files, that is.
Here’s an example of a run:
C:>renit vbs foo
ren listusers.vbs listusers.foo
ren listusers.vbs;0 listusers.foo;0
ren searchpad.vbs searchpad.foo
ren searchxt.vbs searchxt.foo
ren datediff.vbs datediff.foo
Then again, do you really want Windows Update to start hosting a CPAN mirror?
Counterpoint:
Yesterday I needed to process a couple hundred files, finding and extracting a value from each and changing two values in each. So I downloaded and installed Perl, refreshed my memory with a couple of tutorials, and was done within about an hour. And now I have a program that will repeat the process in a couple of seconds when I need it again.
Pops: Awesome. What did your legal department have to say about that?
Define:engineer
Someone who will spend thirteen hours building a tool that will allow a twelve hour task to be done in one hour… and will then forget to do the task.
Sorry, "distributed" was supposed to be in quotes in the above post
Actually, Microsoft used to ship Perl on the resource kit cd; they just didn’t install it by default.
With Mac OS X, I get python perl, applescript, and various shells right in the box. No installation necessary. With Windows, I get..uh…"batch files". Disk space is no longer an issue.
Not sure it is appropriate to hit Microsoft for NIH syndrome with respect to Perl, given that they provided substantial funding, as I understand it, for the oneperl effort that converged the Win32 Perl fork with the main Perl sources. I believe this was in response to customer demands that Perl be better supported on Windows. Microsoft itself has provided tools in the past that were implemented in Perl.
As for bundling Perl, at least historically I guess anti-trust issues made it a bit tricky to do so.
Centaur:
> Here is a perl script I consider handy.
That’s odd. I just type ‘echo <pattern>’
Gene:
> Please god, don’t propagate that atrocity any further.
Yeah, it’s Evil, but it’s a useful sort of evil. Way less nasty than batch files.
Just wanting to add..
many companies have the policy of letting free install of well known open source software (perl, apache, vnc, vlc, firefox, putty, cygwin etc etc etc) at least on developers machines.
I hate RegExp. It’s both infinite complex while useless. It cannot handle the simplest task like searching every rows including one word and not including another.
I don’t know what the issues are with using perl. That’s why you have to ask the lawyers. Some IT departments also don’t like it when people run unauthorized software on their work computers.
Some packages may contain restrictions such as "The terms of this license apply to anything produced with the aid of this packages," or "For non-commercial use only." And if you redistribute the packages with your own product, then things get really interesting. (Who is liable if a security hole or patent infringement is found in that package?)
I think at the end of the day, people just need to evaluate more whether "solution A" is better than "solution B". Rather than sticking with the "I have a hammer and everything looks like a nail" mentality.
In one project I wanted to replace the manual build process with NAnt, but was shot down by the management because they wanted to ‘evaluate various build programs and choose one for the entire product line’. I ended up just sticking with batch files for that one project. I was upset at the time, but now looking back, it was probably the right thing to wait. The entire product line is using MSBuild now, does the job that NAnt would have done, but was a lot easier to preach to the non-techie management than this FOSS NAnt.
2c
Ah yes, the useless become-like-me-first answer. These responses always remind me of:
"I’m having trouble finding a seat at the synagogue during Yom Kippur. What can I do?"
"Why don’t you try converting to Christianity, you heathen."
If batch scripting, cscript, etc. were easier to use (and, possibly, cross platform) you’d probably see better usage of them. I know you weren’t trying to toe the MS line here–you’ve got some good arguments–but it sure looks like shilling to those unfamiliar with you.
"I don’t know what the issues are with using perl. That’s why you have to ask the lawyers. "
"Some packages may contain restrictions such as ‘The terms of this license apply to anything produced’…"
MS software contains restrictions, too. The lack of having to track down license restrictions is not an advantage MS tools typically have. Not to mention the fact that it is pretty rare to have an open-source scripting language have restrictions on script products. Certainly the popular ones do not have such restrictions (gee, wonder why?). Not to mention, I can find the restrictions on the root level of the distribution in a clearly labeled LICENSE file that is pretty readable, at least in the beginning. Where’s my MS EULA and distribution rules for cscript scripts? Heck if I know, and it’d be unreadable if I did find it.
"Some IT departments also don’t like it when people run unauthorized software on their work computers. "
True. Can’t argue with you there. The same goes for "high activation energy" I do think IT sometimes gets carried away with preventing rather than enabling.
You forget, though, all these newfangled programs and incredibly fast broadbrand combine to let people get up and running in minutes, not "half an hour".
@Raymond:
> Some packages may contain restrictions such as
>"The terms of this license apply to anything
>produced with the aid of this packages," or "For
>non-commercial use only."
A bit offtopic but I think that this kind of license is non-binding. And I remember that a court in Germany ruled in that way some time ago (granted, I live in France , not Germany…). The point is: these licenses are not contracts since I didn’t sign them (if they think I did, I want to see my signature somewhere) and therefore not enforceable. Don’t blindly trust what I say, IANAL!
Oh but believe me, I know that my company (and I) could certainly get in a lot of trouble given a sufficiently talented (lawyered?) opponent!
Anyway, sometimes I put away theoretical illegality (still within morality) and choose to focus on the actual job being done. Life is nicer that way. Maybe you can’t afford that Raymond, you are certainly more watched than I do…
>And if you redistribute the packages with your
>own product, then things get really
>interesting. (Who is liable if a security hole
>or patent infringement is found in that
>package?)
That is a point I addressed. Of course anything that ships shall be cleared by the legal department. I don’t think anybody would find clever to ship alien code within your company’s product without notifying anyone!
At least I hope so!
Remember there are more languages than batch in Windows. VBS can do RegExp. Also there is no point converting – those Christians just worship Jews. Who has spotted the error in the comment box section.
On Error Resume Next
Set ShellApp = CreateObject("Shell.Application")
ReportErrors "Creating Shell.App"
set WshShell = WScript.CreateObject("WScript.Shell")
ReportErrors "Creating Wscript.Shell"
Set objArgs = WScript.Arguments
ReportErrors "Creating Wscript.Arg"
Set regEx = New RegExp
ReportErrors "Creating RegEx"
Set fso = CreateObject("Scripting.FileSystemObject")
ReportErrors "Creating FSO"
WshShell.RegWrite "HKLMSoftwareMicrosoftWindowsCurrentVersionApp Paths" & Wscript.ScriptName & "", Chr(34) & Wscript.ScriptFullName & Chr(34)
WshShell.RegWrite "HKLMSoftwareMicrosoftWindowsCurrentVersionApp Paths" & Left(Wscript.ScriptName, Len(Wscript.ScriptName)-3) & "exe" & "", Chr(34) & Wscript.ScriptFullName & Chr(34)
ReportErrors "Updating App Paths"
If objArgs.Count = 0 then
MsgBox "No parameters", 16, "Serenity’s ReplaceRegExp"
ReportErrors "Help"
ElseIf objArgs.Count = 1 then
MsgBox "Only one parameter", 16, "Serenity’s ReplaceRegExp"
ReportErrors "Help"
ElseIf objArgs.Count = 2 then
Set srcfile = fso.GetFile(objArgs(0))
ReportErrors "srcFile"
If err.number = 0 then Set TS = srcFile.OpenAsTextStream(1, 0)
If err.number <> 0 then
Msgbox err.description & " " & srcFile.path, 48, "Serenity’s Search"
err.clear
else
ReportErrors "TS" & " " & srcFile.path
Src=ts.readall
If err.number = 62 then
err.clear
else
ReportErrors "ReadTS" & " " & srcFile.path
regEx.Pattern = objArgs(1)
regEx.IgnoreCase = True
regEx.Global = True
If regEx.Test(Src) = True then
Msgbox "Found in " & srcfile.path, 64, "Serenity’s Search"
End If
End If
End If
ReportErrors "Check OK" & " " & srcFile.path
Elseif objArgs.count = 3 then
Set srcfile = fso.GetFile(objArgs(0))
ReportErrors "srcFile"
If err.number = 0 then Set TS = srcFile.OpenAsTextStream(1, 0)
If err.number <> 0 then
Msgbox err.description & " " & srcFile.path, 48, "Serenity’s Search"
err.clear
else
ReportErrors "TS" & " " & srcFile.path
Src=ts.readall
If err.number = 62 then
err.clear
else
ReportErrors "ReadTS" & " " & srcFile.path
regEx.Pattern = objArgs(1)
regEx.IgnoreCase = True
regEx.Global = True
NewSrc= regEx.Replace(Src, objArgs(2))
If NewSrc<>Src then
Msgbox "Replacement made in " & srcfile.path, 64, "Serenity’s Search"
TS.close
Set TS = srcFile.OpenAsTextStream(2, 0)
ts.write newsrc
ReportErrors "Writing file"
End If
End If
End If
ReportErrors "Check OK" & " " & srcFile.path
Else
MsgBox "Too many parameters", 16, "Serenity’s ReplaceRegExp"
ReportErrors "Help"
ReportErrors "All Others"
End If
Sub ReportErrors(strModuleName)
If err.number<>0 then Msgbox "An unexpected error occurred. This dialog provides details on the error." & vbCRLF & vbCRLF & "Error Details " & vbCRLF & vbCRLF & "Script Name" & vbTab & Wscript.ScriptFullName & vbCRLF & "Module" & vbtab & vbTab & strModuleName & vbCRLF & "Error Number" & vbTab & err.number & vbCRLF & "Description" & vbTab & err.description, vbCritical + vbOKOnly, "Something unexpected"
Err.clear
End Sub
Daev:
> "Why don’t you try converting to Christianity, you heathen."
For some reason, I read that with a Jewish accent and it was hilarious.
TrueRegExpHater:
"I hate RegExp. It’s both infinite complex while useless. It cannot handle the simplest task like searching every rows including one word and not including another."
True if pattern FOO does not match, but pattern BAR does:
/(?=^(?:(?!FOO).)*$)BAR/s
So, you were saying?
"Solving a five-minute problem by taking a half hour to download and install a program is a net loss."
This is exactly my objection to the bloated .NET framework. Why add dozens of megabytes of Someone Else’s Code to the mix? It looks like Vista will ship with basically no CLR-based apps, even though its developers are guaranteed they have the .NET framework. I am following their lead.
Sounds like you’re talking about VB and VB.NET. ;o)
Raymond:
I work for a large company and I am often installing tools without asking for permission (all the more if it would be to the legal department).
Why? Because I need to get work done. You can say everything you want about the fact that in theory the EULA may be against corporate policy or maybe it will conflict with some other software etc, but if it is a ‘satellite’ tool I know and know it will help me, then it gets installed.
I consider the EULA irrelevant, I will bear responsibility for any damage the program does (what could it do?) and consider not binding any "you must give us your first born baby"-clause in the EULA.
Note that I am talking about satellite tools, ie tools that helps getting the job done but are not necessary to doing it and, of course, will not be shipped with the product.
Note *also* that I am only talking about public domain/freeware/shareware tools, not pirated copies! (In that case, there is of course a legal question in the matter!)
Otherwise, for source code or tools that we want to include inside or alongside our product, we of course ask the legal department, but that is because they are responsible for what ships, so it’s perfectly logical.
The perennity of the solution is an interesting point and we consider it for other tools, but as I said, I am only talking about satellite tools, not production shell scripts etc.
If my "personally-installed" SmartFTP refuses to run tomorrow, I don’t care, there are other FTP clients available.
Same for PuTTY, cygwin, perl, LinCVS, WinHex, VLC, Firefox, Thunderbird and many many others!
BUT my work would really be slower without them!
Baz, that isn’t a valid regexp syntax according to findstr and VS.
Anyway, if it had worked, don’t you think the syntax is overcomplicated for such a simple and common task?
So, you were saying?
"I now find [regular expressions] invaluable" you missed the point. Yes they can be great, but this is about whether the reg exp facility is available to your program — if it involves an install or could potentially trip over differences in reg exp implementations installed by or borrowed from other components, then it is more of a problem than a solution.
AC: I don’t see how perl solves the problem – it looks like it has the same problem as your custom program.
"Copying PERL.EXE to C:WINDOWS was one easy step, but the dissadvantage is that it’s not the user’s dir (he will certainly forget to copy the PERL.EXE from C:WINDOWS when he changes machine). Alternative would be to make some new dir in user’s folders, add it to the path bla bla bla. When he changes to the new machine he would have to add the path himself."
Pops; The same thing could be done in vbscript in about 30 minutes without installing anything on the machine and can be fully tested with a proper debugger.
"getting perl onto the machine is hardly a one-line endeavor"
apt-get install perl-base
(but in practice that would tell you it’s already the latest version)
"MS software contains restrictions, too."
Yes, the FrontPage 2002 EULA forbid users to write pages that are against Microsoft, MSN, MSNBC etc. Not only is that (imnsho) short-sighted, but unconstitutional.
"If you distribute object alone, then you are doing something the licence hasn’t given you permission for, so you are in breach of copyright"
yes, but you can "Accompany it with a written offer, valid for atleast three years for a charge no more than your cost of physically performing source distribution, a complete machine-readable copy of the corresponding source code…" http://www.gnu.org/licenses/gpl.html
AC, use echo or type to write a VBScript to a file and execute it with cscript. Dirty trick, but should work.
What people ask for and what they want are not always the same thing.
8: There’s probably a "su root" in there somewhere too. And then you have to deploy it to all the systems on your network and add it to the hard drive image that you use on all the machines you acquire.
And the bit about quoting the license agreement only supports my point: You have to read the license agreement and determine whether you (and your company) are okay with its terms. Typically this involves a lawyer.
AC:
set today=%DATE%
set filename=%today:~10,4%-%today:~4,2%-%today:~7,2%
Caveat: I have no idea if this works in non-US locales.
I hate to say this, but this is like saying that one musnt give preference to .Net because of the RTM download and installation issues. Not that I disagree with the previous statement, but the difference between .Net 1.1 and 2.0 is so huge that I must think twice before starting off on a .Net 2.0 based project.
Oh, I dont have a choice either.
So the problem is that of writing a framework/API that comes bundled with the OS and doesnt require a lot of support and maintenance behind it. What’s more important is failsafe silent installation.
Indeed, installing .NET to print the date is overkill. You have to balance the benefit against the activation energy. My point is that many people ignore cost of the the activation energy.
You really have to love an argument about the legalities of software licencing that includes commentary such as describing a software licence as being "unconstitutional".
The Constitution (at least, in the USA, which I think is where the author "8" was referring to) restricts what the government can do. Microsoft, not (yet?) being the government is not bound by the Constitution.
Clearly, I’m not a lawyer either, so I think that neatly draws us back to Raymond’s original point – that you should get approval from your company’s legal department before you go approving software for use.
TrueRegExpHater:
"Baz, that isn’t a valid regexp syntax according to findstr and VS."
That regexp works perfectly fine here in Perl :) What? findstr/VS/whatever-M$-regexp-engine-you-are-using doesn’t support negative lookahead assertions? Now there’s a surprise.
"Anyway, if it had worked, don’t you think the syntax is overcomplicated for such a simple and common task?"
I would suggest that the syntax is only overly complicated if you don’t understand it.
So, you were saying?
Raymond, I think you went overboard with the reply to AC’s perl vs custom simple programs and cmd example. There is no manually copying PERL.EXE into C:WINDOWS or such. The perl install program takes care of adding the perl binary directory to your path.
Nawak:
I believe that currently, law works on the fact that you have to make a copy in order to run any software. When you install it, you make a copy to your hard drive. When you run it, you make a copy into ram, etc. In order to have the legal ground to make these copies, you need to have a license that grants you the rights. Remember that the default copyright license is "All Rights Reserved," which means that the copyright holder has to explicitly grant you rights, and any rights not explicitly granted are not allowed.
IANAL, but I have done a fair amount of reading.
Codejoe: So that doesn’t solve the other problems of how to get perl installed when you move machines. That’s even more work than copying a single EXE.
I have a beautiful example — my coleague wanted to perform some kind of daily routine using .cmd files. So he needed to name the resulting files in the form YYYY-MM-DD-something.
Such a simple task is a major pain to make in .cmd. Especially since you can’t guess the format of the output of DATE /T.
He didn’t want solution which included the step of installing Perl.
So I wrote the small C program which just printed predictable date, used that output in cmd and that
was acceptable for him. The only detail — the cmd was supposed to work in different dirs (wherever he copies it) so the EXE had to be in the PATH.
Anyway… Copying EXE to C:WINDOWS was one easy step, but the dissadvantage is that it’s not the user’s dir (he will certainly forget to copy the EXE from C:WINDOWS when he changes machine). Alternative would be to make some new dir in user’s folders, add it to the path bla bla bla. When he changes to the new machine he would have to add the path himself. Now imagine that he has a few more demands — more new EXE files.
Now compare this with: "here’s dostuff.pl and you just have to install Perl (click click and that’s all). When you change computer, just copy your dostuff.pl and install Perl again (click click and that’s all).
Installing Perl sounds *simpler* to me.
Btw, how can you produce YYYY-MM-DD in cmd without the external EXE?
Alun said: The US Constitution restricts what the government can do. Microsoft is not bound by the Constitution.
Umm, no.
The Constitution allows what the government can do, rather than the other way around.
The Constitution, being the supreme law of the country, binds every company operating in the US, including MSFT.
Do a full perl installation for a user to run his/her perl script on the machine of their choice (the one where you just installed perl)?
People here were arguing about that the other day. In regards to a perl script that I’d written.
And then I remembered something. Oh! There are all kinds of tools that will take a perl script and turn it into a standalone EXE. No perl installation. No PATH either.
Admittedly, neither of the options that came with perl worked (perlcc and pp).
But this did:
http://www.indigostar.com/perl2exe.htm
And it was done in a trice. We can move the result (EXE) anywhere we want with impunity.
There are others – I plan to check this out as well:
http://www.activestate.com/Products/Perl_Dev_Kit/?tn=1
pat
I might add that we’re not a software firm and that all our software is for internal consumption.
I seem to remember reading that tech-industry IT jobs represented something less than 10% of the IT labor market.
Meaning, it would appear, that most software is not written to be sold.
pat
@Dave Harris:
I think you’re right about the licenses: without them, the rule is the law. What I was saying when I wrote "these are not contracts" was that since the law doesn’t forbid me to use a program somebody voluntarily gave me (via their web server) and since the license/EULA is not a contract, I am not ‘forced’ to do what it tells me. "Not for commercial use"? Well at run-time I think it is too late! I did not infringe any copyright since *they* distributed the program, and no law forbids me to run what I want on my computer (or my company’s).
SNAL (Still Not A Lawyer)
@Coderjoe:
Well, doesn’t loading an exe into RAM fall under fair-use or is fair-use already dead, as Lawrence Lessig warned it would happen?
(Lessig’s main point was that now, and it will get even more true in the future, *everything* is a copy. Computer pass their time copying things (from a website to your disk, from your disk to your ram etc.) and that protecting fair-use for these copies was therefore *essential*)
Actually, Microsoft does ship ksh, tcsh, perl, grep, sed, awk, gcc etc…
It’s all a part of the "new" POSIX subsystem called Interix aka The Subsystem for Unix-based Applications nee Windows Services for UNIX. Interix is a derivative of OpenBSD and System V and was acquired from Softway Systems to replace the useless POSIX.1 implementation that originally shipped in Windows NT but was removed as of Windows XP. I think the only point of the original psxss was was to meet DoD procurement guidelines.
Since it’s a Microsoft product and Microsoft is already an approved vendor, the legal department should lay off.
SFU 3.5 here:
http://www.microsoft.com/technet/interopmigration/unix/sfu/default.mspx
Subsystem for Unix-based Applications (SUA/Interix 5.2) http://www.microsoft.com/windowsserver2003/r2/unixinterop/default.mspx
Vista will have it, too.
So now you can install SFU/SUA/Interix an have a whale of a problem. (But actually it’s a fantastic product.)
Baz and TrueRegExpHater…
Baz, you fell into TrueRegExpHater’s trap. The problem with regexs is that they are more powerful than they are legible. The way to avoid the problem is to use them with care.
TrueRegExpHater, don’t be silly. This is perfectly possible to do simply in regular expressions. Suppose you’re looking for lines that contain at least one lowercase letter, but no numbers:
Perl: perl -ne "print if /[a-z]/ and not /[0-9]/" < data.txt
Findstr: findstr "[a-z]" data.txt | findstr /V "[0-9]"
The trick is not to spend time developing a combination hammer/screwdriver, but just use a hammer and a screwdriver.
Coderjoe:
> I believe that currently, law works on the fact that you have to make a copy in order to run any software. When you install it, you make a copy to your hard drive.
Nope, it’s been determined that copying incidental to the normal usage of the software is allowed. Regardless, if you bought it shrinkwrap, you own it, so Copyright doesn’t really restrict what you do with it so lons as you don’t distribute it.
This is a fun discussion.
I largely agree with the original point.
One of the things that I’ve always disliked about the toolkit approach (despite its undeniable achitectual power) was that each tool was optimized for a narrow band of problems and my problems always seemed to span or shift these bands. So I’d start writing a script in CSH (OK – you can start throwing rocks now :-) and then end up needing to do a bunch of stuff in awk and sed and then often just throwing it all away and doing it from scratch in TCL or C. Ditto with CMD.exe, VBSCRIPT and C++.
The other problem was that each of these tools required their own learning curve.
As a team, we all had similar experiences and resolved to address this issue as we designed Monad. We knew that when we shipped, no one would know what Monad was and that it would require every single person to invest their time to learn our tool and get it installed on all their machines.
We took that "ask" very seriously and dedicated ourselves to making that investment a worthwhile one.
For one, we adopted a (sometimes manical) focus on consistency. I was inspired by my VMS experience which I hated for the first 20 minutes until I relaxed, learned the model (regular syntax, very strong naming guidelines, very consistent semantics), and was then delighted to realize that I could make a prediction about what to do and that that predication was almost always correct. (The joke used to be that someone could attach a fishfinder to the VAX and you’d know how to manage it).
The other thing we did was to give the language/environment an incredibly wide dynamic range so that it didn’t fail you when you needed it, forcing you to switch tools. That has 2 dimensions:
1) Experience level. We aim to have a good experience for
COMMAND-LINE OPERATORS,
SIMPLE SCRIPTERS BASH-style scripting – unnamed, untyped parameters, etc )
SOPHISTICATED SCRIPTERS (think Perl,Ruby,Python towards C#,VB.NET – named, typed variables, lambdas, access to any .NET object, etc)
2) Type of data/instrumentation. MONAD supports text/string processing, OLE automation/COM, WMI, ADSI, XML, ADO, as well as any .NET object.
So yes, Monad asks you to make an investement of your time to learn it and get it installed (it will be installed by default in a future OS release). We appreciate the magnitude of that request and have worked feverishly to ensure that it will be an investment you’ll never regret.
Now all that said, Monad a V1 technology and "the proof of a pudding is in the eating" so only you folks can tell whether we’ve achieved this or not but at least you know what we were trying to accomplish. Actually, now that you know what we are trying to accomplish, I’d really appreciate any rocks you’d like to throw at us pointing out where we have not as well as we could have. I’ll try to get them addressed for V2.
Cheers!
Jeffrey Snover
Monad Architect
Saturday, March 25, 2006 8:24 AM by Jeffrey Snover
> (The joke used to be that someone could
> attach a fishfinder to the VAX and you’d
> know how to manage it).
My fishfinder disagrees. She said to remind you that managing cats is like herding senior programmers.
Ummmmmm, some of my VAX experience disagrees too, because some of my VAX experience had Unix running on them. Of course many accurate Unix manual pages exist just like many accurate MSDN pages exist, but the existence of manual pages doesn’t mean you’ll be able to predict what to do without finding which pages to read.
Interix is nice, but it doesn’t like being run as a scheduled task.
Sigh. So many threads.
Constitution: The constitution is the surpreme law of the land, and is binding in whatever it says. (In theory. The surpreme court says otherwise sometimes. I’d tend to say the surpreme court is wrong in those cases, but it’s probably better all in all if we abide by their decisions anyway.) However, the constitution doesn’t try to bind what private individuals say in contracts much. In purticular, the first amendment says "congress shall make no law…", which doesn’t keep contracts from regulating speech. Otherwise, everyone could freely ignore NDAs.
Software licenses: As far as I know, this is untested in court. If I’m wrong, please give me references, I’d love to read them. The GPL (which is one of the two licenses available for perl, on a your-choice basis) is a nice example of a license that is hard to find anything wrong with, since it makes no restrictions whatsoever on normal use, since it doesn’t try to exploit technicalities to do things a license can’t do. Perl modules, of course, are free to have any license they want, but most are under the same terms as perl itself. A quick read of the documentation that comes with the module will tell you what the license is, and 99% of the time, it’s totally straightforward. Liability for bugs is a complete red-herring, as everybody will disclaim to the same amount if they have half a brain — the maximum amount allowed by law. If you don’t like that, I’m sure you can buy insurance.
Original post: The first problem with your argument is that if you keep looking at only this problem, installing and learning a real language like perl might not be worth it. You can work around the evil of batch files, or change the file associations to make using js or vbs usable, and deal with those languages. But next week you’re going to have this issue again. You can pick up a copy of activestate perl fairly quickly on a reasonable connection, and keep hitting next, and perl is quite a good language, for a reasonable programmer. If you disagree, there are any number of other languages which also have "just hit next" installers for win32.
You need to interoperate with batch files
PingBack from http://blogs.msdn.com/oldnewthing/archive/2006/05/22/603788.aspx
PingBack from http://o9y.net/archives/2006/05/24/divide-and-conquer-not/
PingBack from http://blogs.msdn.com/oldnewthing/archive/2006/08/29/730002.aspx
Your IT department is in charge.
I’m reviewing the source code for a rather large project this week and I wanted to update my Facebook…
PingBack from http://blog.visualizehistory.com/?p=22
PingBack from http://www.robyconte.netsons.org/2008/10/08/jamie-sawinski/