Follow Slashdot blog updates by subscribing to our blog RSS feed


Forgot your password?

Journal Journal: Boost UBLAS matrix iterators and templates - Solved

UPDATE: I had a look around, figured I would try substituting a std::vector<std::vector<double> > for the uBLAS matrix<double>, still got the same error. So I started looking better into templates (no, I'm not quite done with vol2 of "Thinking in C++") and found out about typename. Seems to fix the problem.

I know I should probably post this to stackoverflow or the Boost/UBLAS mailing list, but I figure there are plenty of smart people here at slashdot.

Let's say you are using UBLAS from Boost and you want to implement a cumulative summing function for matrices. Here's what I think is a fairly straightforward way to do it:

// For boost::numeric::ublas::matrix<>.
#include <boost/numeric/ublas/matrix.hpp>

// For std::partial_sum().
#include <numeric>

template<class T>
boost::numeric::ublas::matrix<T> cumSum
(const boost::numeric::ublas::matrix<T>& input_,
const bool& colWise_ = true)
using namespace boost::numeric::ublas;
using namespace std;

matrix<T> result_(input_);

if (colWise_)
for (matrix<T>::iterator2 colIter = result_.begin2();
colIter < result_.end2();
for (matrix<T>::iterator1 rowIter = result_.begin1();
rowIter < result_.end1();

return result_;

For now, I'm ignoring completely templatizing this to make the row-wise/column-wise distinction disappear in the code and focusing on just getting it working. Only it doesn't work; won't compile. Couldn't figure out why, but g++ kept saying it was expecting a ';' before colIter and rowIter. I had a hunch and replaced one of the iterator's 'T's with 'double' and it stopped complaining about that one. Am I missing something, or does UBLAS not implement iterators properly?What am I missing?


Journal Journal: Phygg: Reader Voted Prepublication Academic Papers

There's a new site called that is a cross between the arxiv physics feed and in that you can read papers up for prepublication and then vote them up or down. I think this poses an interesting new step in peer review and academic journals in that it gives the public a chance to participate in reading and voting on papers. From there, the journals can separate the wheat from the chaff. While it's not exactly innovative (digg + arxiv = phygg), it'll be interesting to see if people take to it and how good the general public will be at reading lengthy physics papers. MIT's Tech Review has a short blog on the launching.


Journal Journal: Arcade Fire's HTML5 Experience

There's a neat site for Google Chrome users that shows how artists will be able to liberate themselves from Flash and use HTML5 when the standard is finalized and browser independent (if ever that happens). If you're bored and have five minutes and have speakers/headphones, I hope your childhood address shows enough up on here to make it worth your while. My parent's farmhouse had nothing but my hometown had a couple images that brought me back.

Of course prior to this we would have to use flash to enjoy the Aracade Fire's sites.

Hope someone else enjoys this as much as I do.
User Journal

Journal Journal: Tragic Love Story Junkies anonymous 4

Hi, my name is Nat^H^H^HJim, and I admit, I have a problem: I'm addicted to tragic love stories.

It started simply enough with "Romeo and Juliet", but then I saw "Crouching Tiger, Hidden Dragon", and I was hooked, because it had not one, but TWO sets of star-crossed lovers.

Next was "Moulin Rouge", which even my gay brother despises. But it holds a special place in my heart.

I was okay for a while, high on such movies as "Fight Club". But then that bastard Chris Nolan had to make "Memento" (I'm particularly drawn to stories about men who have lost the woman they love). For some odd reason, the "Star Wars" prequels didn't really strike a chord, although they were close.

Then I got married, and I thought I was doing better. Then along comes "Inception". Oh sure, everyone hypes it for being "mind-bending" (what? it wasn't like it was "Primer"), but I secretly believe that Nolan knows how to make an excellent tragic love story, and it shows in not only "Memento" but "Inception".

As I sit here listening to the final track of the "Inception" soundtrack CD (the music from baggage claim to the credits; my favorite by far), I find myself hungry for more. I'm not even sure how to find more, as it's hard to describe. Some other stories I'm acquainted with touch close on similar feelings: the ending to "Lord of Light" by Zelazney, "Permutation City" by Egan (and even further off track, but still close in tone "Diaspora"). "The Fountain" by Aronofsky is definitely another movie that meets the criterion, as well as "Chasing Amy" by Kevin Smith.

I guess I could at least take a stab at some adjectives: a sense of loss, a longing for those truly special people we will never meet again, a feeling of mystery and awe; stories that end with catharsis. So, could you do a junkie a favor and find him one more fix? Thanks :)

User Journal

Journal Journal: Fucking Microsoft 4

You know why I hate Microsoft? They can't follow standards. Or they declare themselves a de facto standards body, even over things they have no rights to dictate standards on. Like C++. I had forgotten that MSVS has a broken version of std::copy(). It doesn't work on simple char arrays. Works fine on VxWorks and Linux. Fucking Microsoft.


Journal Journal: Futurama is Back!

Tonight on Comedy Central, the first two episodes of the sixth season of Futurama were shown. It's been highly anticipated on Slashdot and as a fan I was satisfied with the return to television. I really liked the first episode and found the second episode mediocre.

*Spoiler Alert*

The first episode, Rebirth, had a lot of elements that Futurama episodes of yore contained that made me love it: social commentary, extrapolation of current technology into future technology, apparent deaths, sci-fi twists and a bit of character development. The trivial elements are certainly present like Fry's homeresque stupidity and cheap jokes but that's not something that distinguishes Futurama from other comedies. I think that the professor's quirky inventions and old age behavior remain strong in this series and for some reason never loses its humor with me. The professor can (and often does) invent anything that is necessary for the plot as well as sending the crew anywhere in the universe to deliver a package. Rebirth has a lot of those classic elements when the professor plays god with bringing the crew back to life as well as going to the cyclophage habitat planet to sacrifice Leela. If this sort of predictable formula annoys your or bores you, Futurama probably got old a while ago but for me the high quality of animation, music and voice acting really make willing to belly up for every contrived new world that is conjured. Rebirth also addresses Fry and Leela's loneliness and isolation but has a cheap cop out (the ones in love turn out to be robots) at the end to avoid any permanent character development at the end.

Episode Two, In-a-Gadda-Da-Leela, was less satisfactory for me because it dealt with an old card: Leela engaging in coitus with the Zapper (and his insecurities). While some parts made me smile, it just wasn't as funny or memorable as the older episodes. Some parts had their moments (Obi Wan Kenobi GPS with a different voice saying the wild cards was a favorite) but the overall story and plot didn't really pass muster for me. I enjoyed the cheesy black and white "The Transcredible Exploits of Zap Brannigan" (reminded me of many MST3K episodes) and of course you have to love Zap heavy episodes with his ill formed sentences and logic. But aside from that, we get a cookie cutter invention from the professor and nothing too impressive with the explanation and resolution of the V-Giny death sphere. I think a lot more could have been done with that.

All in all, not bad. I was hoping for more secondary characters that I've loved from the first four episodes like Roberto or Scruffy. These secondary recurring characters have always been a favorite of mine and a strength of the show. I guess I can't expect them to put one in every episode but I was disappointed there weren't a whole lot from the movies and none from these two episodes. Definitely worth my time to watch and for those of you outside the United States, you can find torrents out there online by searching for Futurama S06E01 and S06E02. I hope they make it all the way through this sixth season and I also hope Comedy Central ponies up for a lot more after that. If there's one show with usable potential, it's Futurama and its endless possibilities. I mean with the amount of money being dumped on other crappy shows, you'd think a fraction of that could be afforded for a show with a highly devoted following. Then again Firefly is long gone.
User Journal

Journal Journal: Public digital libraries and the law

The advantages of a digital library over a traditional book repository are tremendous. No more need for multiple copies of popular books, no reason to have late fees, due dates, charges for lost or damaged books, or indeed the entire system built around library cards and records for tracking who has which books and when they are due. Anyone could download a copy of anything, anytime, and do so without interfering with anyone else's access. Stacks and shelves filled with tons of paper books would all be replaced with computers. This would take less space, and perhaps less maintenance. And it would allow all sorts of extra functionality, such as the ability to search, and have hyperlinks to related works. Card catalogs and cumbersome indexes of magazine and journal articles would not be needed. Also, can handle different sorts of data, such as books and movies, with the same system. Cities could save a bundle.

Currently, though technically doable, this magnificent vision is politically impossible. Copyright law stands squarely in the way. I cannot see any way to have a digital library that is freely accessible, and copyright law. It is the ability to copy any info quickly that makes a digital library so much more powerful, useful, and cheaper than a print library. We should abandon copyright law, and compensate and encourage artists with other means. The benefits of public digital libraries, and of the free exchange of ideas they could promote, are worth much more than copyright law. But because we do have this antiquated legal regime, the few digital libraries that exist are mostly behind paywalls or are private, and contain very small, highly specific collections, and we cannot see the full benefits. Copyright law must be retired.


Journal Journal: Dear slashdot 3

The foe/friend limit is ridiculous, even with subscription. 400 friends/foes is simply not enough to foe all the people who post baseless assertions and get modded to +5, and simultaneously friend people who who get modded troll for posting an informative link that blows the moderators' beliefs out of the water. Pls fx, kthxbye.

User Journal

Journal Journal: Profiling 3

No, not the racial kind. This has to do with code efficiency. I was recently writing patch acceptance guidelines, and was trying to explain that maintainability matters far more than efficiency. I was trying to be polite about people who harp on "efficiency", but my basic feelings boil down to: "People who talk about software efficiency, yet aren't familiar with software profiling, are idiots." Discuss.

User Journal

Journal Journal: Rare earth metals 3

Just a quick thought before I have to go into work today: so China is possibly looking at cutting back their rare earth metal exports, but that doesn't seem to stop them putting them in children's toys and/or jewelry. So, why not this: don't chastise China for bad behavior; just buy up all the heavy metal toys as they are imported and melt them down! Heck, it even says in the article that the jewelry "easily sheds" cadmium.

I mean, lead was one thing, we're not in need of that (apparently we use something else for our pipes now). But cadmium? Last I checked, that was good for electronics, and we *always* need more of those.

User Journal

Journal Journal: Copyright and patent law must be replaced!

Some people instead advocate reforms such as limiting the length of these monopolies (to something like 5 years), not granting so many frivolous patents, not allowing the patenting of software, and reducing the penalties for violations. All those are good reforms to Intellectual Property (IP) law. But I think they don't go far enough, and the root of the problem can be summed up with one word: monopoly. Anti-trust efforts aim to eliminate monopolies, not mitigate them.

Even very short duration monopolies are enough to retard progress. That still provides grounds for expensive lawsuits and threats over alleged violations. By removing patents and copyrights altogether, we remove all basis for these complaints, and save us all a lot of legal expenses. We also save hugely on enforcement and the costs of a larger justice system. If anything should anger us, it is the misuse of our own police forces, paid for by us, in support of these businesses highly dubious ends. And most of all, we stop what has become the primary uses of IP, the blocking of competition and the robbery and extortion of the disadvantaged. People who want less government should support the abolishment of current IP law. As matters stand, many businesses have realized that building a portfolio of patents for defensive purposes is less costly than having an "IP gap". The quality of the patents does not matter, all that matters is that they have some of this peculiar form of currency, and so the quality has lately been poor. The least costly route is total disarmament, where no one need budget for patent portfolios.

Supporters of IP display a blind religious fervor that these laws are a net benefit, that they achieve the intent of advancing science and promoting art enough to justify the costs of these monopolies. I have never seen a reasoned argument, with honest statistics, in support of this position. Of the rational studies I have seen, most focus on one aspect, and conclude that the status quo is indeed bad. We need a study of the real costs and benefits of the current system, versus some alternatives.

What replacements do I propose? Nothing, or patronage. Nothing is of course the easiest, but the intent of the patent system was to buy off inventors-- give them something in exchange for revealing their secrets, and if there is no incentive of any sort for that, many will keep as many secrets as possible. A worse outcome is that people won't bother inventing or creating art. This fear is perhaps overblown. Nevertheless, we can strike a balance to encourage the creating of as much art as we can stomach. A patronage system can provide the incentive. A payment is a far less damaging thing to give inventors and artists than a monopoly. The next problems are valuation and collection. We can surely work out ways of figuring compensation amounts that are as fair as possible, given the huge difficulties in guessing how valuable an idea will turn out to be. Collection is the other big problem, with the first notion being a tax. But there are other ways. A levy can be agreed upon. And it need not be government that does the collecting, valuation, or disbursement, nor the people who pay directly, it could be quasi-governmental private entities managing the system. And paying into it would be advertisers and manufacturers of equipment that benefited from the knowledge, and charities.


Journal Journal: Google's Exit Announcement as Covered in China's News

When it comes to understanding what the Communist Party of China is thinking, it seems one of the few inputs we have is two of China's state run news sites (their English mouthpieces): China Daily and (the official press agency of the PRC) Xinhua. What follows is a brief news analysis of articles from these two sites over the past two days (note I do not speak Chinese and am therefore only digesting news from China in English).

From an article on the fourteenth Jiang Yu, a spokeswoman for the Foreign Ministry, is quoted as saying:

"China's Internet is open," said Jiang. "China has tried creating a favorable environment for Internet," said Jiang while responding to a question on Google's possible retreat.

"China welcomes international Internet companies to conduct business within the country according to law," she said. "China's law prohibits cyber crimes including hacker attacks."

And also on that day, they seemed to write off the hacker attacks on Google as a global problem while quoting an unnamed 'senior Chinese information official' (later given only as 'Wang') as saying:

"China's Internet is open to the world.... China is a victim of and firmly opposes cyber attacks," he said, noting the number of overseas cyber attacks on Chinese mainland websites in 2008 had increased by 148 percent over the previous year.

This last article is quite interesting in that it shifts the attention back to pornography and illicit materials, blaming those squarely on other countries. It is assumed this is to reinforce their stated right to enforce censorship on Google. And even placing the onus on other countries to:

"take active and effective measures to strengthen management of the Internet and make sure their problems do not affect other countries' cyber order."

Of course, the China Daily article ends with verbage like 'providing a favorable environment for the healthy development of minors' and calls on the government to 'ensure that information flow on the Internet is smooth and timely, and secure and orderly.'

Now, on to today, the fifteenth of January. It seems the goal here is to deflate the impact that Google's exit would have. China Daily has a story of none other than Steve Ballmer's compliance saying:

"I don't understand how that helps anything. I don't understand how that helps us and I don't understand how that helps China," Ballmer said.

Earlier on Thursday, Ballmer told CNBC Microsoft had no plans to exit China: "We've been quite clear, we're going to operate in China, we're going to abide by the law."

Really, this article is a consolidation of American news reports on Microsoft's plans in China. A clear sign that Microsoft is willing to play ball, why can't Google?

Then later, the Ministry of Commerce attempts to take the wind out of Google's sails by saying that not only have they not heard anything from Google yet but:

"Foreign investors should have confidence in China's market as China has the world's biggest Internet population," said Yao. "Any decision by Google to withdraw from China will not affect Sino-U.S. trade relations."

China Daily also appears to call Google's bluff and curiously offers new quotes from the prior day's briefing with Jian Yu:

"Relevant measures taken by the Chinese government are consistent with international conventions."

China Daily paraphrases experts as saying that the 'government will by no means compromise.' Another news article shows no support from the twenty other victims of the attack (aside from Yahoo, who hasn't been mentioned until now) that Google reported and they wrap that up with concerns that an exit from China will hurt Google's stock.

The best part might be the sour grapes editorial from a reader that claims ' simply cannot compete with its main domestic rival,' which is completely true in search. But overlooks the previous day's comments from users as saying they were concerned about their Google mail, their access to Google Maps, Google docs and the slough of other services Google provides aside from search.

All of this sounds like a pretty firm "We're shocked you would consider this and don't understand why you are making such a mistake. We will continue to censor to protect our citizens and will not budge an inch for you. Ball's in your court." Well? Will Google act, stall or fold?

User Journal

Journal Journal: We're hiring. 1

I'm looking for skilled java engineers. Are you talented, and looking for stable work? My company had its most profitable year yet in 2009, and is way behind on hiring. Please contact me here, and I'll work to get you into our interviewing process.

Silicon Valley area (Foster City).

GNU is Not Unix

Journal Journal: Stable API Nonsense 2

Recently there was a discussion about how Linux cell phones are basically DOA, and within that discussion was a thread on a stable driver interface in Linux. Rather than respond to every comment as to why this is a bad idea, I figured I would just post the original response to this request for a stable driver API which was put together the first time people noticed it was hard to ship binary drivers for Linux:

Let me just point out that this approach *works* and *has worked* quite well for quite sometime. These days, when I buy a new piece of hardware, I throw out the driver CD without even looking at it. I plug in the hardware to my Linux box fully expecting it to work; if it doesn't, I figure it's broken. Occasionally, it's not broken hardware but rather I have made a mistake and invested in a piece of hardware from a company that has not seen the light and open sourced their drivers. I make a point never to buy from that company again, and I get a refund for the hardware. I might point out that this is a very rare occurrence. Most of the time there is support for hardware out of the box under Linux - no driver CDs, no install and no reboot required - just plug and go.

Implementing a stable API for drivers would lead to bloat, insecurity and instability; we've seen it happen in Windows, and even starting to happen with binary drivers under Linux! The technical argument is that Linus (and his kernel devs) reserve the right to rip out or reimplement anything they please in the kernel, with no regard whatsoever to backwards compatibility. This model has worked very well so far, as evidenced by the fact that you can plug in 99% of hardware into a Linux box and have it just work, no driver CD, download or install required.

Still, some people argue this is a political issue, not a technical one. I would agree, on one point: the hardware vendors are the ones making this a political issue. By refusing to release their source code, they limit how well their device can be supported. For what purpose do they need to keep their drivers closed? They sell hardware, not software, therefore they don't even have an economical reason. The arguments for releasing source are legion: support in ALL distros on ALL architectures by default; more stable and better tuned drivers; no need to ship driver CDs; no worry about having to support your drivers as they are now in the kernel, etc. I can think of no reason other than petty greed to keep drivers closed. And it's greed that doesn't even function properly at that, as it doesn't gain the greedy companies anything.

Is there any *technical* reason to keep drivers closed source? Please elucidate, and remember that even if there is, it must somehow outweigh all the benefits of having the same driver as an open source driver in the kernel in order to argue that there should be a stable driver API. This isn't an ideological, or even political issue; open source drivers have been shown *in practice* to work better, and provide all of the benefits I've listed. Why should we throw out one model that works for one that has been shown to not work nearly as well?

Slashdot Top Deals

"Paul Lynde to block..." -- a contestant on "Hollywood Squares"