Skip to content

Implementing Your Own ‘foreach’ Hack in C++ for Fun and Time-wasting

Last night, I was trying to compile some C++ code that used an undefined _foreach(item, vector) macro, as shown below, to iterate over elements in an STL std::vector, C++’s standard “array” object type.

For example:

typedef std::vector<struct foo *> foovector;

foovector getItems();

            if (whatever)
                _foreach(item, getItems()) {
                    printf("name: %s\n", item->name);

C++11 extends the language to include a “for each” construct, and prior to that Visual Studio had its own extended syntax, but I got obsessed with trying to figure out if this could be implemented in pre-C++11 standard C++, or at least using the older GCC 4.0 compiler that I have on my computer. Also, I wanted to avoid changing the existing code, so using the std::for_each template was not an option.

Vote For Beer In Texas

So I have joined a grassroots organization in Texas called Open the Taps.  The prohibition era laws on TX are incredibly unfair to local breweries when compared to similar provisions allowed local wineries.  If you care about beer in/from Texas please take a moment to join and/or donate to the cause.  You don’t have to be from the Lone Star State to support the great breweries and beer that are produced here.

We Want Beer

We Want Beer

Some laws that are being worked on include:

  • Getting a comprehensive bill passed that will allow all breweries in the state to sell a portion of their beers direct to the public.
  • Getting a comprehensive bill passed that will allow all brew pubs in the state to distribute their beers to wholesalers, liquor stores, etc.
  • Getting a bill passed that will change the way out of state (and out of country) breweries are licensed.  Updating these permits will make it easier for smaller breweries (if they so chose) to enter into our state.
  • Getting a bill passed that eliminates the 24 oz ‘Happy Hour’ law at beer festivals.  This will make it easier to have more successful beer festivals in the state which will help drive beer tourism and helps the economy.
  • Getting a bill passed that will allow a consumer to import a greater quantity of beer for personal consumption.  This is not allowing someone to bring in kegs and kegs of beer, but instead allowing a consumer to visit great breweries out of state and bring in more than a case back without facing penalties.
  • Getting a bill passed that will allow bars that carry liquor licenses to sell growlers of beer.  Currently growler sales are limited to places that have a beer and wine license only.
Open the Taps Member Survey Shows Members United

Open the Taps Member Survey Shows Members United

If you happen to live in Texas please take time to check out their voting guide.  Even if you aren’t the type of person to email/FB/twitter your elected official much less any potential candidate it would still be worth your time to be educated about which candidates support freedom for beer in Texas.

We Need To Build Computers For The Masses, Not The Classes

R.I.P. Jack Tramiel.

I think I speak for both the Sloth (Atari) and myself (Commodore 64), you had a huge influence (MOS 6502) on both of our childhoods and ultimately our adult careers.

MOS 6502 microprocessor in a dual in-line pack...

MOS 6502 microprocessor in a dual in-line package, an extremely popular 8-bit design (Photo credit: Wikipedia)

The Onion: Generating Revenue By Mentioning The New iPad?

In it’s usual brilliant style, painting a vivid picture of reality The Onion, America’s Finest News Source, leads me to believe I can generate ad revenue just by mentioning the new iPad.  It’s on the internet so it must be true right?

English: Apple iPad Event

Image via Wikipedia

As the article states:

At press time, new iPad, new iPad, new iPad, new iPad, new iPad, new iPad, new iPad, new iPad, new iPad, new iPad.


Fun Fact: Fossil Fuels

Fossil fuels are a renewable energy source.  Unfortunately humanity probably won’t be around to witness it.


I have long been wanting to buy a copy of the game Khet.  It’s been on my Amazon Wishlist forever.  A few days ago I ran across the website for Vat19 when seeing a youtube video about their 32,000 calorie, 26 pound Gummy Bear.

I also noticed they had both the base version of Khet along with the expansion.  After checking prices they seemed on par with most and even a little less than other places so I decided to finally get it.


Khet (Photo credit: nachof)

I also wanted to give some props to the customer service at Vat19.

I have been noticing for the better part of a month that when I get gas and use my debit care I was not able to use it as “credit” because the zip code verification always failed.  I just assumed that it was because the card is incredibly old (expires in about 5 months).

After submitting my order at Vat19 I received and email withing about 5 minutes stating there was a problem with my credit card and they asked for assistance in resolving it.  I went out and checked my account at Wells Fargo and realized that for some odd reason they reverted the address associated with the card to my 4+ year old Nebraska address.  I responded to the email I received from Vat19 explaining the problem, gave them the correct (although still wrong) address and within minutes the owner(!) had responded that the update fixed the issue and my order would be processed and shipped same day.

Shipping the same day is their policy as long as the order is completed prior to 1400 central time.  I was not necessarily expecting it to still go out after the issues even though they were resolved prior to 1400.  Add to that, by luck of where I live, the product is showed up on Friday, roughly 48 hours after I ordered it, through UPS Ground.

While the shipping time is a bonus what really impressed me was the customer service I received.  All too often it’s easy to bitch about bad service.  I know I do it all of the time.  But at the same time I think we should give props when a company does well too.  That rarely happens.  So good job Vat19.  While your products are unusually “kitch” I don’t have any problem recommending your site for anyone in the market for that type of thing.

Bootstrapping the Earth

I often think that modern software systems are overly complex, and I am troubled by the vast network of dependencies between their constituent components. For example, a modern operating system has an unbelievable number of layers and components; it exceeds an individual’s ability to understand them all. Guaranteeing that the system is free of errors is impossible. The thought of bootstrapping one from scratch is daunting.

But then today I was thinking about how software compares to the “real world,” and it seems that the same layering/dependency problem exists there too—what if every structure, machine, and tool on the Earth was destroyed and we had to rebuild everything from scratch? Even if the associated knowledge was somehow preserved, I wonder how long it would take us to get back to having supertall skyscrapers, fly-by-wire jumbo jets, and smart phones.

Perhaps the situation with software isn’t so bad after all, or at least the real world is no better off (depending on how you look at it).

Étoilé OS: “Get Yourself Together, or Fall Apart”

Once the last, great hope for a modern, usable, GNUstep desktop, the future of the Étoilé project now appears to be in doubt. After at least 5 years of development, it seems that the developers have lost their focus and have allowed themselves to be consumed by endless futzing around with low-level aspects of the platform and other diversions, at the expense of putting something usable in the hands of users. In their own words,:

As it stands now…most user-visible development…[has] been put on hold…. We have no working theme…our current window manager Azalea is now unsupported.

Let’s face it: without a usable desktop environment available, nobody cares if you have managed to take a foreign programming paradigm and bolt it onto Objective-C or make Objective-C code (sort of) run on the Javascript runtime. This is how projects fail, or at least manage to forever languish in obscurity.

I hate to say it, but the fate of the Étoilé project now seems doomed to follow that of the GNUstep project itself, which, while technically impressive, has repeatedly failed to produce a practical system for users, despite nearly 20 years of ongoing software development (sound familiar?). As it stands today, the GNUstep UI is basically an imperfect clone of the outdated 25 year old NeXT UI, even though it’s still not nearly as usable or solid as the NeXT was in 1992 (I know, support for themes is in the works, but it doesn’t appear to be of practical use today).

Don’t mistake my point here—I would love to be proven wrong. I have been hoping to see GNUstep succeed for the past 15 years (and for a while there at the end of the 90′s, when OPENSTEP was poised to enter the mainstream, I actually thought it had a very good chance). But I have grown very weary of waiting for a utopia that has never materialized.

What do I think Étoilé/GNUstep need to do to succeed? It’s simple. (Continued)

Linux on NVIDIA Tegra 2: Open Source on a Closed System

So I recently laid out about $260+shipping for a Trim-Slice Value plus fit-VGA adapter from CompuLab. This is a compact desktop computer based on the much-hyped NVIDIA Tegra 2 System-on-a-Chip (SoC). Sporting two Cortex-A9 processors running at 1GHz, it seemed like a more attractive product than existing ARM-based development boards, such as the Cortex-A8 based BeagleBoard or the diminutive Gumstix boards.

After learning that Linux and U-Boot had been ported to the Trim-Slice and reading about CompuLab’s commitment to open source, I was very excited about this system as an ARM-based target for low-level boot loader and operating system development projects.

However, my excitement quickly changed to dismay this week, when I received my Trim-Slice and set out to gather the tools needed for low-level software development. What I found is that while CompuLab may be committed to open source, NVIDIA clearly is not. (Continued)

Damn You All To Hell…Or Not

So an interesting discussion came up at the Friendly Atheist today titled Can’t Christians Just Admit Anne Frank is in Hell? In it he discusses yet another article by Rachel Held Evans called Did Anne Frank go to hell?

It’s an interesting question.  If you are truly a believer in Christ, and in Christianity on the whole, then your answer must be a resounding YES!  And not just for Anne Frank, you must also include the 6 million slaughtered by the Nazi’s in WWII,  Rabbi Shmuley Boteach, Sammy Davis Jr., Howie Mandel, George Burns, The Beastie Boys, the list goes on and on.  Jews do not believe that Jesus was the Messiah and do not “accept Him as their Lord and Savior”.  Both of those points are the central to all of Christianity.  You could go as far, and it wouldn’t be a stretch, to say that without accepting those two points you can’t be a Christian and you can’t be saved.  Period.

A kettle full of Jews (with white hats) burnin...
Image via Wikipedia

Yet as Hermant points out, and you can verify for yourself in the comments to Ms. Evans’ post, most “Christians” completely sidestep the question.  Rather than standing up for what they have been taught, for what they claim they believe in, what they tell me personally when they find out I am an atheist, that yes, because Jews don’t accept JC as their Savior they will all be dining in the fire, they waffle and resort to vague statements about “I can’t say, God decides.”

How disingenuous is that?  I, as an atheist, am going to hell because I don’t believe in and worship Christ but if you are a Jew with the exact same belief you get some vague, politically correct, “don’t call me an anti-Semite”, BS response.  The fact of the matter is, if you are a Christian, a true Christian, if you believe in the Bible, it’s teachings, then you are, you must be, at least a little anti-Semitic.  At least if you class “knowing” all Jews are going to hell as anti-Semitic.

In the end, no matter how you look at it, Jews, Buddhists, Muslims, atheists, etc., are ALL equally damned in the eyes of Christians.  They do not, by definition, “accept Jesus Christ as their Lord and Savior” and do not believe he is, was, or ever will be, the Messiah.

So for everyone who worries about my “eternal soul” and wants me to “let Christ into my heart” I have only one response for you, assuming you are right, then just like the Jews, God decides who gets into heaven and apparently that is NOT based on the basic cornerstone of your religion.

Contact Us SEO Powered by Platinum SEO from Techblissonline