The engineer’s new bike

June 7th, 2009

From Slashdot Poll | Best kind of engineering: …

Re:Not ‘Civil’. (Score:5, Funny)

by tygerstripes (832644) on Thursday June 04, @04:31AM (#28206721)

Sadly true - as a field and as people.

A civil engineering student was walking through campus when he happened upon his friend, who was riding an impressive motorbike.

“Wow, where’d you get the cool bike?” he enquired.

“Funny story,” replied his friend. “I was on my way to survey a site, when a young woman pulled up on her bike, took off all her clothes, stood naked in front of me and said: Take whatever you want…

“Yeah, good choice,” came the response. “The clothes probably wouldn’t have fit.”

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Types of Engineer

June 7th, 2009

From Slashdot Technology Story | How Software Engineering Differs From Computer Science

Before we get all sweaty about terms (Score:5, Funny)

by symbolset (646467) on Saturday June 06, @02:38AM (#28230631)
Journal

If you’re an X Certified Y Engineer, you’re a technician.

If you can be counted on to design a system that reliably works without killing people, you’re an engineer.

If you can observe phenomena, reliably document previously unobserved phenomena, and from that produce useful but not mathematically precise practices or products you’re a scientist.

If you can gather observed facts into a sheaf of postulates and a system of symbols that can predict unobserved phenomena, you’re a mathematician.

If you can’t do any of the above, you can always check bags at LAX for $150K a year.

If you can’t get bags from the trunk to the belt, you might consider a position in middle management.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

One reason Java has garbage collection

May 30th, 2009

From Slashdot Technology Story | Java Gets New Garbage Collector, But Only If You Buy Support

Re:Forgive my ignorance WAS:re: Garbage collector? (Score:5, Insightful)

by Thomasje (709120) on Friday May 29, @03:49PM (#28142801)

The reason why Java has garbage collection has nothing to do with programmer convenience; it is needed in order to make Java’s security model work. Without garbage collection, a thread could allocate a chunk of memory and then free it, while hanging on to the pointer — and then periodically take a look at what shows up in the memory area where the previously freed block used to be. Any Java process running in the same VM would be at risk. This kind of deliberate use of “dangling pointers” is easy to prevent if using garbage collectors, very difficult to prevent otherwise.

Protecting processes running in the same VM from each other may not seem terribly useful now, but Java was originally designed to be used in embedded controllers, where the JVM would *be* the operating system, and where processes had to be protected from each other without the help of a hardware memory management unit.

FWIW, I also beg to differ about the difficulty of manual memory management. In C++ it is usually very easy, as long as you’re consistent about doing deallocations in destructors. I once had to write a 40,000+ line C++ program, with lots of dynamic memory management going on; once development was complete, I ran a complete test suite under Purify, and found 5, yes, five, memory leaks. Considering that most leaks are the result of mis-handled object ownership, which is an issue that garbage collection does not eliminate in general, you should be careful about your design, *and* use memory analyzers like OptimizeIt, even when developing in a GC environment.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

The myth of LISP superiority

May 27th, 2009

From Slashdot Technology Story | World’s “Fastest” Small Web Server Released, Based On LISP

Re:”functional programming languages can beat C” (Score:4, Interesting)

by stonecypher (118140) <stonecypher@gma i l .com> on Monday May 25, @07:09PM (#28088725)
Homepage Journal

That you believe several books over the course of six years constitutes a resurgence, especially given the historic nature of the language, kind of goes a pretty long way towards proving my point about its nearly non-extant market share.

Don’t get me wrong, I think LISP is a wonderful language. But, let’s not do ourselves the disservice, please, of pretending that it’s been a major player since the 1960s. If you look at the list of supposedly dead languages that majorly outpace LISP in real world usage measured either as new code or maintained code (eg Delphi, Clipper, Fortran, Cobol, PL/I, Ada, Forth, ANSI Pascal, Object Pascal, ColdFusion, pre-.NET ASP, all on both metrics) you get a clearer idea of where things actually stand.

If LISP is so amazing, and if LISP has first mover advantage over anything the average programmer has ever heard of, why is it so resoundingly a bit player?

There are downsides to LISP. Lots of them. Serious ones. It hasn’t stayed this dead for 60 years because it’s the tragic forgotten child of programming; every freshman who wants to sound educated thumps it at their first opportunity, frequently without ever having written a line (which is not to call you a freshman, just to point out how not-unknown it is.)

It’s a little like SICP. If it’s been that free, that well known and that easily accessable for 20 years, how come it’s being discarded by the university that published it for curriculum, and how come its design principles are largely unseen even in the work of people who have read it?

There’s a lot to be said for academic languages and academic exercises; they open our eyes to many new approaches to problems.

But don’t kid yourself. They died for a reason. Why is it that all the supposedly awful languages and design strategies are dominant?

It’s because they work. For all their warts, for all their maintenance problems, for all the infrastructure you have to write, they work.

New practical languages are occurring which adopt many of the lessons of LISP. Ruby got a lot of LISP’s problems removed, though it’s still got a lot of problems of its own; Haskell can say the same. Erlang’s got most of those problems cleared up, and is a practical real world language for a lot of things.

But dude, if the most impressive thing you can find is the application of graph search to a complex web form with credit card processing that the typical college sophomore could throw together in about a month, I mean, I’m really not sure what to tell you. Orbitz is ridiculously slow for the amount of data it processes, its user interface is awful, it copes poorly with unexpected things like uncommon use of the browser back button, and I usually have to go to it first so that I can check everywhere else and then by the time I’m done everywhere else maybe Orbitz has finally finished its first search.

What Orbitz does that’s impressive is their ability to negotiate ticket prices. I go there because they get the bottom dollar bid. If that’s your idea of something you can hold up to show the success of LISP, I’ve got to ask you: why have you gotten down to rare occasional me-too projects as your shining beacon?

Yahoo! Stores was lisp too. (Note the past tense.)

Big whoop.

When it gets down to it, you should actually try writing something like that some time in LISP. Then try writing it in another language. It’s not really all that different. It’ll be maybe the dollar sign instead of the parentheses whose ink wears off on your keyboard, and the whatever other language you write will probably be somewhat bulkier (though if you’re working in a language like Erlang, Haskell, Mozart-Oz or Forth, it’ll be substantially shorter).

Meh. Ten extra letters to get a three line algorithm done. Trade that for real exceptions and a strong type system, and you’ve chosen C++. Trade that for the pi calculus (which is hella more expressive than the lambda, and typically completely foreign to the LISPers who preach syntax superiority) and native clustering, and you’ve chosen Erlang. Trade it for a rich browser integration and trivial forms, and you’ve chosen Rails. Trade it for integrated COMET, and you’ve chosen Dojo. Trade it for the ability to deploy on basically any hosting on earth, and you’ve chosen PHP.

People say they choose LISP for the things it lets them do, how it lets them express ideas. That’s great. I know languages like that. They’re awesome, and there are lots of them. Typically the LISPer who talks about how superior LISP is doesn’t know many (or any) other exotic languages; other languages (including other members of the LISP family tree like clojure) have long since moved past LISP in expressiveness. Even C++ offers nearly everything that LISP does at this point; other than live code tree modification through macros, which aren’t anywhere near as powerful as C++’s algorithm and container library IMO, LISP has even lost the expression gap to C++ at this point.

And I know, boo hiss, how could you ever say that, it’s C++ which is the devil’s stepchild; rah rah rah.

Prove me wrong with examples, if you’re going to do it at all.

Am I saying that there’s anything wrong with LISP? No, not at all. But when LISPers tell me how amazing their toy is and how it wouldn’t be possible in any other language, I generally have to laugh sadly to myself, because it’s almost always pretty damned straightforward in other languages too.

Yahoo! Stores could have been implemented in other languages too; that was just what Paul knew. There’s a long history in the LISP movement of confusing infamiliarity with other languages and ignorance of what other languages offer combined, along with a delusion that macros are Christ’s Only Key To Power, with a viable observation that other languages are dead in the water. This is nearly always followed by a tremendously shallow observation of some minor issues in either C++ or Java’s syntax, then a confusing grammar issue, then declaring the three languages which together account for 60%-and-growing of Ohloh’s measured development as obvious retarded backwaters.

And sure, there was a time at which science believed in the theory of Aether, too. But if you look at the numbers, there’re a hell of a lot more people pushing pseudoscience than science under the label “everyone else is dumb.”

LISP is a fine language. If it was better than every modern language, then it should have won. It’s been free and available and well known since the early 1990s, when it turned into every programmer’s masturbatory fantasy of having a secret unknown knwoledge of the mastery of true power, in very much an illuminatus-but-bragging sort of way.

And then they point to (cough) a ticket booking website and a once-dominant web store structure as proof. Because, y’know, Yahoo! Stores isn’t ridiculously weak compared to the open source PHP web stores out there (and surely with large corporate backing, the one true language would have allowed this power disparity to emerge).

The only reason it hasn’t happened to Orbitz is that setting up a national ticket broker requires major business savvy and as such isn’t reasonable for the small time entrepreneur. There isn’t a ticket broker which has anything even beginning to resemble impressive technology, but if I had to pick someone, it sure wouldn’t be them.

So, c’mon. Is orbitz and a handful of books over six years really why you believe LISP isn’t obviously a fallen hero?

LISP is dead. If you really need a LISP, move to a modern LISP such as Clojure or Scala, or a modern near-lisp like Ruby. You’ll learn a lot about what LISP had kept from you.

Even Scheme is a step forward, TBH. And Scheme’s just as dead of old age by now.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

First rule of program optimisation

May 25th, 2009

From Slashdot | Old-School Coding Techniques You May Not Miss

Premature optimizations (Score:5, Informative)

by IntentionalStance (1197099) on Thursday April 30, @03:29AM (#27769343)

This is one of my favourite quotes:

“The First Rule of Program Optimization: Don’t do it. The Second Rule of Program Optimization (for experts only!): Don’t do it yet.” - Michael A. Jackson

That being said, when I hit the experts only situation I can usually get 2 orders of magnitude improvement in speed. I just then have to spend the time to document the hell out of it so that the next poor bastard who maintains the code can understand what on earth I’ve done. Especially given that all too often I am this poor bastard.

Re:Quicksort (Score:5, Insightful)

by fractoid (1076465) on Thursday April 30, @10:07AM (#27772217)
Homepage

Um, I’m pretty sure quicksort is still the go-to sort simply because it’s the implementation that’s built into almost every single programming environment. Then again honestly, I’d say that from the point of view of a pragmatic programmer… it doesn’t matter. There’s a built-in fuction (whether it’s qsort() in the C standard library, or Arrays.Sort() in Java, or whatever) that will take your array and return it, sorted. If your app runs too slow and you profile it and it turns out the speed problem is in the sorting AND you can’t find a better algorithm that doesn’t depend so much on sorting… THEN you look at optimising it. Never forget the two cardinal rules of optimising:

1) Don’t optimise.
2) (Experts only:) Optimise later.

Or as I once read it eloquently expressed:
1) Make it work.
2) Make it work right.
3) Make it work fast.

Re:Some, not all… (Score:5, Insightful)

by Aceticon (140883) on Thursday April 30, @04:46AM (#27769753)

Maybe you guys are frozen in time - or maybe you’re some kind of elitist-coder types.

From where I stand, the most relevant optimizations have to do optimizing the data flows between systems - the most typical of which are appServer-database and GUI-appServer and between storage and memory. We’re talking about shaving hundreds of miliseconds, maybe even seconds per-operation: not nanoseconds.

Even if you work in standalone, small size applications, were knowing the basic principles of algorithms can be more important, hand-coding your own is not only useless (there are plenty of libraries out there with good implementations) it’s actually counter productive (it introduces a complex piece of code which is often not properly tested and might be even slower than the library ones)

Understanding the basic principles = important.
Being able to code your own = only important for those who never evolved beyond just-a-coder.

Self-modifying code has been a lose for a decade. (Score:5, Informative)

by Animats (122034) on Thursday April 30, @12:59AM (#27768465)
Homepage

Self-modifying code

Yup, I actually write asm code.. plus he mentions “modifying the code while it’s running”.. if you can’t do that, you shouldn’t be wielding a debugger.

Code that generates code is occasionally necessary, but code that actually modifies itself locally, to “improve performance”, has been obsolete for a decade.

IA-32 CPUs still support self-modifying code for backwards compatibility. (On most RISC machines, it’s disallowed, and code is read-only, to simplify cache operations.) Superscalar IA-32 CPUs still support self-modifying code. But the performance is awful. Here’s what self-modifying code looks like on a modern CPU:

Execution is going along, with maybe 10-20 instructions pre-fetched and a few operations running concurrently in the integer, floating point, and jump units. Alternate executions paths may be executing simultaneously, until the jump unit decides which path is being taken and cancels the speculative execution. The retirement unit looks at what’s coming out of the various execution pipelines and commits the results back to memory, checking for conflicts.

Then the code stores into an instruction in the neighborhood of execution.
The retirement unit detects a memory modification at the same address as a pre-fetched instruction. This triggers an event which looks much like an interrupt and has comparable overhead. The CPU stops loading new instructions. The pipelines are allowed to finish what they’re doing, but the results are discarded. The execution units all go idle. The prefetched code registers are cleared. Only then is the store into the code is allowed to take place.

Then the CPU starts up, as if returning from an interrupt. Code is re-fetched. The pipelines refill. The execution units become busy again. Normal execution resumes.

Self-modifying code hasn’t been a win for performance since the Intel 286 (PC-AT era, 1985) or so.
It might not have hurt on a 386. Anything later, it’s a lose.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Photo sniper - telescopic scope on a camera

May 17th, 2009

From Slashdot | Tactical Camera

Re:Photo Sniper (Score:5, Informative)

by Lumpy (12016) on Tuesday May 05, @06:09PM (#27838687)
Homepage

Yup applying gun parts to cameras is old hat. I find it funny as kids “discover” new things that us old geezers have done for decades.

Like a shotgun sight on the top of your SLR. works awesome for fast action or sports shots, you can shoot without looking through the lens and with both eyes open. I get perfect shots every time with it. and I dont get killed by that motorcycle that was 20 feet in the air and is now coming down wher I am standing.

The fresh new hires for the local news look at my camera with questions, and then say “you cant get a good photo that way”.

I ask to look at their camera, they dont even have a focus prism. None of these “photographers” coming out of college know how to take photographs or how to use a camera. They all rely on autofocus and program modes.

Athough IS lenses area godsend for still life or low motion zoom shots. but they are worthless for action shots where you are panning trying to catch a bike doing 200mph around a track.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Why we shoudn’t try to make the world totally safe for children

May 17th, 2009

From Slashdot | Bill Would Declare Your Blog a Weapon

Re:Covered By Twenty Percent of the Bill of Rights (Score:5, Insightful)

by Anonymous Coward on Tuesday May 05, @03:38PM (#27836161)

I will say now and I have always said it, this is an adult’s world. I am tired of our elected officials, and these parent groups trying to turn the real world into some giant fucking playpen. I love how politicians upon election catch a tick that forces them to compulsively think of the children and try to legislate away our rights so that we can protect snot nosed little assholes. I’m sorry, your kid may be cute to you, your kid may be your pride and joy but they are also becoming an obstacle to the ideals of this country. Look at what is being done all over the United States to shelter kids from the air everyone else breathes. Phys Ed is started to take on a “no loser” policy where everyone must engage in an activity where there are no losers and everyone is a winner because of some need not to make a child feel bad. Do people honestly think that is in the child’s best interest. Look at parent groups like the PTC trying to take anything and everything that aren’t mindless programming off the air because a kid might see it. Now we have this cyberbulling bullshit because some kid(s) with emotional problems offed themselves.

Every generation of adults look at the world around them and realize that it is the same shitty world their parents inherited (just with newer technology) and thinks that if they shelter their children, they will grow up to create a perfect world. Doesn’t seem to work like that. You keep a kid away from the feelings of losing, sadness, stress, and fear and when those feelings finally hit you have just created a generation of mal-adjusted assholes. Being a child is not some magic state that becomes undone on somebody’s 18th birthday. A kid is just an adult in training and we (society AND parents) should keep that in mind. Having said that, fuck your children, they are your problem. I won’t go out of my way to harm a child but I am also not going to curtail my rights and liberties because some kid might cry.

Re:Covered By Twenty Percent of the Bill of Rights (Score:5, Insightful)

by Psmylie (169236) * on Wednesday May 06, @09:38AM (#27844751)
Homepage

It’s easier, better, and more effective in both the long and short run to world-proof a child than it is to child-proof the world. I agree with you 100%.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Arabic world’s role in scientific discovery

May 17th, 2009

From Slashdot | Classic Books of Science?

Re:One Resource (Score:5, Interesting)

by MrNaz (730548) * on Tuesday May 05, @11:20AM (#27831331)
Homepage

You may be interested to read about the role that the Middle East played in the development of modern science. While they are not very mainstream (hey, history gets written by those on top at any point, which at the moment happens to be Western nations), there are many books that deal with the advanced science that was being carried out in that region. Here are some tidbits to get you started:

Modern optics was pioneered by the discoveries of Ibn Sahl (who discovered Snell’s law 800 years before Snellius renamed it [wikipedia.org]).

In the 9th century, 500 years before Europeans started arguing whether the world was round, Al-Battani and his ilk calculated the circumference of the Earth at 40,253km. Correct to within 200km!

Al-Jabr [wikipedia.org] is the Arab mathematician who discovered (or invented, whichever way you lean on that topic) algebra. It is still named after him.

Good luck with this. Scientific history is fascinating!

(Full disclosure: I am a Muslim, which is why I find this topic so interesting.)

Re:One Resource (Score:5, Informative)

by LotsOfPhil (982823) on Tuesday May 05, @11:33AM (#27831557)

In the 9th century, 500 years before Europeans started arguing whether the world was round, Al-Battani and his ilk calculated the circumference of the Earth at 40,253km. Correct to within 200km!

Eratosthenes calculated the circumference of the Earth 1000 years before that. “Recent scholarship finds that since about the 3rd century BC, virtually no educated person in Western civilization has believed in a flat Earth.” link. [wikipedia.org]

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

You aren’t really running out of memory on Linux

May 17th, 2009

From Slashdot Poll | How often do you reboot your …

Re:Firefox memory leak (Score:5, Informative)

by pablomme (1270790) on Monday May 11, @11:26PM (#27917407)

Leaked memory is associated with the process, and is released by the kernel when you quit, and that is true of more or less all modern OSs.

If you think that you’re not getting the memory back, it probably means that you are not aware of the fact that the Linux kernel uses free memory as cache with a policy of filling the RAM to the brim whenever possible, and only drop cached stuff when programs need the space. Memory appears full in most reports if you don’t subtract the cache.

Re:Firefox memory leak (Score:4, Informative)

by TheRaven64 (641858) on Tuesday May 12, @08:46AM (#27920507) Homepage Journal

This is the same on most operating systems. On a classic UNIX system, you allocated memory with brk() to increase the data segment and sbrk() to increase the stack segment. Modern UNIX tends to use mmap() to allocate pages and the malloc() C library function allocates space within these pages. The mmap() call is also used to map other files into memory.

When you allocate some memory in a *NIX process, you are really mapping a region of an anonymous file. As a simple efficiency hack, this may not actually be associated with a real, on-disk, file until it actually needs to be swapped out.

The unified buffer cache idea means that the same policy is applied to deciding whether to swap out a page, irrespective of whether it’s in swap or in the filesystem (although an implementation my choose to prioritise evicting pages backed by devices with low access times).

When you think about low-level operations, it makes very little difference whether something was allocated with mmap() or malloc() (you than think of read() as roughly equivalent to mmap(), malloc(), and memcpy()). If the data that is needed is available, the operation will be fast. If not, it will be slow. Prioritising memory that the program malloc()’d when it launched and then never touched again over data read recently or frequently from the disk would make no sense.

Re:Firefox memory leak (Score:5, Informative)

by QuoteMstr (55051) <dan.colascione@gmail.com> on Tuesday May 12, @10:59AM (#27922247)

Don’t comment on things you don’t understand. The kernel keeps track of all resources allocated on behalf of each process — file descriptors, sockets, memory regions, you name it. When a process terminates, no matter how, the kernel frees its associated resources.

Every virtual-memory operating system works this way. Come on, this is really basic stuff.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]

Sheepdogs and Wolves

May 12th, 2009

From Slashdot | German Gov To Ban Paintballing After Shooting

Re:Haven’t these people learned? (Score:5, Interesting)

by pipingguy (566974) * on Saturday May 09, @01:09AM (#27885707)
Homepage

As far as I’m concerned the only possible solution is to keep these people from acquiring the weapons that allow them to inflict high numbers of casualties or to allow people carry sufficient protection to put one of these people down when they snap

By LTC (RET) Dave Grossman, author of “On Killing.”

“Most of the people in our society are sheep. They are kind, gentle, productive creatures who can only hurt one another by accident. Most citizens are kind, decent people who are not capable of hurting each other, except by accident or under extreme provocation. They are sheep.

I mean nothing negative by calling them sheep. To me it is like the pretty, blue robin’s egg. Inside it is soft and gooey but someday it will grow into something wonderful. But the egg cannot survive without its hard blue shell. Police officers, soldiers, and other warriors are like that shell, and someday the civilization they protect will grow into something wonderful.? For now, though, they need warriors to protect them from the predators.

“Then there are the wolves and the wolves feed on the sheep without mercy.” Do you believe there are wolves out there who will feed on the flock without mercy? You better believe it. There are evil men in this world and they are capable of evil deeds. The moment you forget that or pretend it is not so, you become a sheep. There is no safety in denial.

“Then there are sheepdogs,” he went on, “and I’m a sheepdog. I live to protect the flock and confront the wolf.”

If you have no capacity for violence then you are a healthy productive citizen, a sheep. If you have a capacity for violence and no empathy for your fellow citizens, then you have defined an aggressive sociopath, a wolf.

But what if you have a capacity for violence, and a deep love for your fellow citizens? What do you have then? A sheepdog, a warrior, someone who is walking the hero’s path. Someone who can walk into the heart of darkness, into the universal human phobia, and walk out unscathed.

Let me expand on this old soldier’s excellent model of the sheep, wolves, and sheepdogs. We know that the sheep live in denial, that is what makes them sheep. They do not want to believe that there is evil in the world. They can accept the fact that fires can happen, which is why they want fire extinguishers, fire sprinklers, fire alarms and fire exits throughout their kids’ schools.

The sheep generally do not like the sheepdog. He looks a lot like the wolf. He has fangs and the capacity for violence. The difference, though, is that the sheepdog must not, can not and will not ever harm the sheep. Any sheep dog who intentionally harms the lowliest little lamb will be punished and removed. The world cannot work any other way, at least not in a representative democracy or a republic such as ours.

Still, the sheepdog disturbs the sheep. He is a constant reminder that there are wolves in the land. They would prefer that he didn’t tell them where to go, or give them traffic tickets, or stand at the ready in our airports in camouflage fatigues holding an M-16. The sheep would much rather have the sheepdog cash in his fangs, spray paint himself white, and go, “Baa.”

Until the wolf shows up. Then the entire flock tries desperately to hide behind one lonely sheepdog.

[Slashdot] [Digg] [Reddit] [del.icio.us] [Facebook] [Technorati] [Google] [StumbleUpon]