Re:Design patterns and Lisp
on
Bitter Java
·
· Score: 2
As written above, myfile's scope is limited to the try block, so it is not valid within the finally block.
Thank you. I originally wrote the code with myfile above the try block, but thought that the Java designers might have made it convenient for a catch/finally clause to get at local variables in the try block. They already made a "convenient" decision that the scope of exception object bindings goes beyond the catch statement: try { ... } catch (Exception e) { ... } ...
try { ... } catch (Exception e) { ... }
The compiler will spit at the second catch - the first declaration of Exception e is still in scope. Bleah!
Re:Design pattern vs. implementation pattern
on
Bitter Java
·
· Score: 2
... the file is closed automatically when the file object becomes unreferenced = when the myFile variable drops out of scope = you exit the current function.
Yes on options two and three, but I wouldn't rely on option #1 if I were you. Consider the following: //filesToMung is a String[] array for (int i = 0; i < filesToMung.length; i++)
processFile(new FileInputStream(filesToMung[i]);
A new FileInputStream is created every time around the loop, passed to processFile(), and then becomes unreferenced. The compiler cannot immediately reclaim the stream (processFile might spin a thread to hold onto it), so it has to let the GC do it. If the GC is a reference counter, like vanilla Python's GC, this loop will work reliably. If it's anything more reliable or modern (mark-sweep, stop-and-copy, generation scavenging), this will fail randomly if filesToMung gets big enough, as unclosed, uncollected streams pile up between GC sweeps.
There is a difference between finalizatiion and storage reclamation, and it's a real bad idea to mix the two.
Re:Design patterns and Lisp
on
Bitter Java
·
· Score: 4, Informative
I think there seem to be fewer patterns in Lisp, because Lisp needs them less. Lispers tend to dismiss patterns because of presentations like this one by Peter Norvig, in which he shows that roughly two-thirds of the patterns in the Gang of Four book deal with techniques that are unnecessary in Common Lisp.
Lisp does have patterns, but Lisp hackers tend to implement them as macros, automating their application rather than forcing everyone to know and re-enter them to use them. That's the difference between: // Please forgive any Java errors here // I don't use this pattern enough to get it right // without a compiler to check it... try {
FileInputStream myfile = new FileInputStream(filename); // Mess with file... } finally {
myfile.close(); }
and (with-open-file (myfile filename) ;; Mess with file... )
They do the same thing - guarantee that myfile gets closed no matter what - but the Lisp way requires less typing and is less prone to errors.
I suspect you and I have different definitions of OO. The problem is that damn near everyone has a slightly different definition of OO. Go read this article by Johathan Rees, then come back and tell us what you mean by a "real OO system", and why you can't do it properly in CLOS.
The FTC has an email address for people to report spam (uce@ftc.gov). Anybody see any reason why they shouldn't create virgin email addresses, wait for spam to them that says "this was sent to you because you opted in" , and then haul the bastards in for fraud?
Private citizens can create spamtraps and use them to report the spammers to the authorities - why not cut out the middleman?
What are they going to do, use my shopping habits to make my food more expensive? I don't think so.
Actually, that's exactly what they might do. Don't forget, the ultimate reason for all this data gathering is for the gatherers to keep more of the customers' money. They could do it by tracking your purchases and showing you ads for similar stuff. They could also do it by noticing that you buy the same product at different stores for different prices, so it's safe to raise the price on that product.
Rather than a coercive tax levied by the Government, citizens should have an easy way to directly fund NASA. I'd throw a few bucks at such a thing if I knew doing so would definitely help NASA, rather than being diverted who knows where.
There is already a way to give extra money to the Government as a whole (the additional payments line on for 1040), but that just goes to the general fund, and there are check-off boxes to redirect some of your taxes to funding the Presidential election. Why not a check-off for NASA? Hell, check-offs for everything!
Using iMovie and a digital camera, I've seen disk usage of about 12 GB per hour of imported raw video. This is presumably completely uncompressed, consumer-grade camera video. Uncompressed broadcast-quality video has got to be bigger.
Yourdon's one good book: "Death March"
on
Byte Wars
·
· Score: 2
The reason "Death March" is a good book is that he wrote it by asking a bunch of his hacker-manager buddies about the nature of impossible-to-complete projects, and wrapped some text of his own around the results. This polling-the masses approach added a reality check that he clearly needs (vis. any of his other books that make predictions about the future - the ones that are uniformly wrong).
even use an interestingly shaped chamber (can't remember the name, dammit!) to turn a stream of pressurized air into two streams -- one very chilled and one very hot -- using nothing more than the shape of the cylinder.
This
is probably what you vaguely remember. They are unspeakably cool, aren't they?
Look, buddy, for real, proprietary Unix is indeed dead.
I guess Mac OS X is the exception that proves the rule, then. It's not Linux, it's not GPL, and it will soon be running on more machines than all other Un*x variants combined.
The biggest problem with a mandated content control regime is that we all know the mandated scheme won't follow ALL the rules of copyright.
The content owners are all over the requirements regarding limiting of copying. They make noises about respecting fair use (we know they're lying, but let that go for the moment).
But, I haven't heard ANY proposal that deals with the Constitutional requirement that copyright is for a LIMITED time, and therefore any scheme for automatic digital rights enforcement MUST have an automatic expiration - there must be a way to disable the protection when the copyright expires.
This expiration mechanism must be built in at the same level as the copy-protection mechanism, because BOTH of them are required by the Constitution.
What do you think the chances are that a mandated content control scheme will simultaneously prevent copying, allow fair-use copying, allow unlimited copying when the copyright expires, and be uncrackable? And if it can't do all those things at once, guess which ones will be dropped as infeasible.
The whole HP-Compaq merger thing is a typical example of how high-level executives who understand "business" think:
- They have to "do something" to justify their compensation.
- They don't understand the technology, so they don't have a clue as to how to make use of the innovations their employees generate (Xerox comes to mind immediately, but they're just the most obvious example).
- They do understand high-level finance, and how to fire people to create short-term gains.
So, they do what they understand - move big pieces around on the board, construct complex financial objects that obscure the connection between their actions and company performance, and fire people whose functions are superficially redundant.
In fact, my first inclination is to try to use the Beowulf stuff rather than Pooch simply because such a detailed work exists and is available for Beowulf clusters, but I don't know if any such information exists for Pooch.
My first inclination (if I was just getting started in cluster computing) would be to try Pooch and see if it meets my needs. If it doesn't, I've wasted an afternoon. If I try the Beowulf option first, I may do more work than necessary to get the results I want. If I try Pooch, and it works, but I need more horsepower, that's the time to dive into the Beowulf option.
Remember, "Linux is free (as in beer) if your time has no value".
But, will it continue to grow at that rate? Which will peter out first, computer power or bio data accumulation? Moore's Law has worked for 35 years so far, and Moore himself thinks we've got at least another 15 years from now.
Remember, most of the breathless prose about the huge, enormous, gigantic, [favorite-bigness-adjective] amount of information in DNA was written years ago, by biologists. Moore's law has been in effect for some time since then, and the human genome hasn't gotten any bigger in the meantime.
For an example of what can happen to you even if you haven't done anything wrong, go look here at what happened to Jamie Zawinski. During their monopoly trial, Microsoft subpoenaed the contents of the bad-attitude and really-bad-attitude internal blow-off-steam newsgroups at Netscape. I never heard of anything that came up in court as a result of it, but the privacy of the users of that list was violated, big-time.
I would like to register my objection to the proposed settlement in the United States vs. Microsoft case.
The biggest problem I see is that the settlement is not a structural remedy. Oversight remedies have been tried against Microsoft in the past, and they have coded arounded them, lobbied over them, and legally maneuvered past them every time. The only thing that hasn't been tried yet, and that has a hope of working, is to break them up.
Breaking Microsoft up into OS/Applications/Other divisions wouldn't break their monopoly, but it would make it more difficult for them to use their OS monopoly to create new monopolies in other areas, which they are doing with Windows XP even as I type this.
Thank you. I originally wrote the code with myfile above the try block, but thought that the Java designers might have made it convenient for a catch/finally clause to get at local variables in the try block. They already made a "convenient" decision that the scope of exception object bindings goes beyond the catch statement:
try {
}
catch (Exception e) {
}
...
try {
}
catch (Exception e) {
}
The compiler will spit at the second catch - the first declaration of Exception e is still in scope. Bleah!
Yes on options two and three, but I wouldn't rely on option #1 if I were you. Consider the following:
//filesToMung is a String[] array
for (int i = 0; i < filesToMung.length; i++)
processFile(new FileInputStream(filesToMung[i]);
A new FileInputStream is created every time around the loop, passed to processFile(), and then becomes unreferenced. The compiler cannot immediately reclaim the stream (processFile might spin a thread to hold onto it), so it has to let the GC do it. If the GC is a reference counter, like vanilla Python's GC, this loop will work reliably. If it's anything more reliable or modern (mark-sweep, stop-and-copy, generation scavenging), this will fail randomly if filesToMung gets big enough, as unclosed, uncollected streams pile up between GC sweeps.
There is a difference between finalizatiion and storage reclamation, and it's a real bad idea to mix the two.
I think there seem to be fewer patterns in Lisp, because Lisp needs them less. Lispers tend to dismiss patterns because of presentations like this one by Peter Norvig, in which he shows that roughly two-thirds of the patterns in the Gang of Four book deal with techniques that are unnecessary in Common Lisp.
// Mess with file...
;; Mess with file...
Lisp does have patterns, but Lisp hackers tend to implement them as macros, automating their application rather than forcing everyone to know and re-enter them to use them. That's the difference between:
// Please forgive any Java errors here
// I don't use this pattern enough to get it right
// without a compiler to check it...
try {
FileInputStream myfile = new FileInputStream(filename);
}
finally {
myfile.close();
}
and
(with-open-file (myfile filename)
)
They do the same thing - guarantee that myfile gets closed no matter what - but the Lisp way requires less typing and is less prone to errors.
I suspect you and I have different definitions of OO. The problem is that damn near everyone has a slightly different definition of OO. Go read this article by Johathan Rees, then come back and tell us what you mean by a "real OO system", and why you can't do it properly in CLOS.
... the more bootlegs will slip through their fingers.
The FTC has an email address for people to report spam (uce@ftc.gov). Anybody see any reason why they shouldn't create virgin email addresses, wait for spam to them that says "this was sent to you because you opted in" , and then haul the bastards in for fraud?
Private citizens can create spamtraps and use them to report the spammers to the authorities - why not cut out the middleman?
Actually, that's exactly what they might do. Don't forget, the ultimate reason for all this data gathering is for the gatherers to keep more of the customers' money. They could do it by tracking your purchases and showing you ads for similar stuff. They could also do it by noticing that you buy the same product at different stores for different prices, so it's safe to raise the price on that product.
Safeway is a business; it's not your friend.
Go read this paper by Philip Wadler. Particularly look at pages 6 and 8.
.sig below.
For the short form, take a look at my
Rather than a coercive tax levied by the Government, citizens should have an easy way to directly fund NASA. I'd throw a few bucks at such a thing if I knew doing so would definitely help NASA, rather than being diverted who knows where.
There is already a way to give extra money to the Government as a whole (the additional payments line on for 1040), but that just goes to the general fund, and there are check-off boxes to redirect some of your taxes to funding the Presidential election. Why not a check-off for NASA? Hell, check-offs for everything!
They even mention Minneapolis as the place where they got the idea. You do have to read past the first page to see that, though.
Using iMovie and a digital camera, I've seen disk usage of about 12 GB per hour of imported raw video. This is presumably completely uncompressed, consumer-grade camera video. Uncompressed broadcast-quality video has got to be bigger.
The reason "Death March" is a good book is that he wrote it by asking a bunch of his hacker-manager buddies about the nature of impossible-to-complete projects, and wrapped some text of his own around the results. This polling-the masses approach added a reality check that he clearly needs (vis. any of his other books that make predictions about the future - the ones that are uniformly wrong).
This is probably what you vaguely remember. They are unspeakably cool, aren't they?
... or maybe a pure Java-based IDE. This would at least look similar to the IDEs they're used to.
It could be worse, PR-wise. They could have called it "hackerPAC".
The best article I've seen on this subject is by Jonathan Rees - go look at it on Paul Graham's web site here.
People who say "Java isn't OO" really mean "Java doesn't have the features I like in other OO languages". Please say what you mean.
For the record, I'm a Lisp/CLOS hacker and I don't like the style of OO Java promotes.
The biggest problem with a mandated content control regime is that we all know the mandated scheme won't follow ALL the rules of copyright.
The content owners are all over the requirements regarding limiting of copying. They make noises about respecting fair use (we know they're lying, but let that go for the moment).
But, I haven't heard ANY proposal that deals with the Constitutional requirement that copyright is for a LIMITED time, and therefore any scheme for automatic digital rights enforcement MUST have an automatic expiration - there must be a way to disable the protection when the copyright expires.
This expiration mechanism must be built in at the same level as the copy-protection mechanism, because BOTH of them are required by the Constitution.
What do you think the chances are that a mandated content control scheme will simultaneously prevent copying, allow fair-use copying, allow unlimited copying when the copyright expires, and be uncrackable? And if it can't do all those things at once, guess which ones will be dropped as infeasible.
The whole HP-Compaq merger thing is a typical example of how high-level executives who understand "business" think:
- They have to "do something" to justify their compensation.
- They don't understand the technology, so they don't have a clue as to how to make use of the innovations their employees generate (Xerox comes to mind immediately, but they're just the most obvious example).
- They do understand high-level finance, and how to fire people to create short-term gains.
So, they do what they understand - move big pieces around on the board, construct complex financial objects that obscure the connection between their actions and company performance, and fire people whose functions are superficially redundant.
My first inclination (if I was just getting started in cluster computing) would be to try Pooch and see if it meets my needs. If it doesn't, I've wasted an afternoon. If I try the Beowulf option first, I may do more work than necessary to get the results I want. If I try Pooch, and it works, but I need more horsepower, that's the time to dive into the Beowulf option.
Remember, "Linux is free (as in beer) if your time has no value".
Very impressive!
But, will it continue to grow at that rate? Which will peter out first, computer power or bio data accumulation? Moore's Law has worked for 35 years so far, and Moore himself thinks we've got at least another 15 years from now.
My money is still on the computers.
Remember, most of the breathless prose about the huge, enormous, gigantic, [favorite-bigness-adjective] amount of information in DNA was written years ago, by biologists. Moore's law has been in effect for some time since then, and the human genome hasn't gotten any bigger in the meantime.
For an example of what can happen to you even if you haven't done anything wrong, go look here at what happened to Jamie Zawinski. During their monopoly trial, Microsoft subpoenaed the contents of the bad-attitude and really-bad-attitude internal blow-off-steam newsgroups at Netscape. I never heard of anything that came up in court as a result of it, but the privacy of the users of that list was violated, big-time.
I would like to register my objection to the proposed settlement in the United States vs. Microsoft case.
The biggest problem I see is that the settlement is not a structural remedy. Oversight remedies have been tried against Microsoft in the past, and they have coded arounded them, lobbied over them, and legally maneuvered past them every time. The only thing that hasn't been tried yet, and that has a hope of working, is to break them up.
Breaking Microsoft up into OS/Applications/Other divisions wouldn't break their monopoly, but it would make it more difficult for them to use their OS monopoly to create new monopolies in other areas, which they are doing with Windows XP even as I type this.