\Microsoft was unexpected at this time

I just spent two days tracking this problem down.

I received my new development machine with Windows7 x64 only a week ago. It all was just pefect – quad core CPU could compile the world in almost no time, and brand new Visual Studio 2010 was just as good as it gets. By the way, I am the Linux guy and prefer vim, automake and gcc any other IDE, so if I call Visual Studio perfect, it means something.

Neverthless, everything good has an end. Yesterday I tried to build bcp.exe tool I needed to dissect boost, and I faced very nasty and very unclear problem. I simply could not. Every time I started the build process, it would fail with the most weird message I ever seen:

\Microsoft was unexpected at this time

Well, I mentioned I am the Linux guy, but I am not a religious fanatic. I just thought that there was a problem of some sort in the boost’s build script and used another machine to build bcp.

Next day I became really concerned. I realized that I could not use “Visual Studio Prompt” from VS 2010 and VS 2008. Every time I tried to start them, they would have that message about unexpected microsoft on them; and environment variables were not set. So I could not build anything! Sadly, this was rather a major problem for me as we had quite a few makefile projects and not being able to set the correct environment for build process was that kind of present I could happily live without.

I spent next four hours to find that this or similar problem was already mentioned several times; but nobody offered a solution that would work and nobody explained what was causing that. Some said that Windows SDK installation could break the batch file vcvars32.bat; some thought there was a bug in the batch file itself. Strangely,  it all worked perfectly on the the neighbor’s machine. I even compared the files and found no difference at all.

The solution came at the end of the day when all my hopes were gone. One guy mentioned that the problem was caused by the parentheses in vcvars32.bat:

@if not "%WindowsSdkDir%" == "" (
	@set "PATH=%WindowsSdkDir%bin\NETFX 4.0 Tools;%WindowsSdkDir%bin;%PATH%"
	@set "INCLUDE=%WindowsSdkDir%include;%INCLUDE%"
	@set "LIB=%WindowsSdkDir%lib;%LIB%"
)

He mentioned that as he found out, one of the directories where SDK was had braces in the name as well, and that broke the statement above completely as batch processor would find nested parentheses in the folder’s name and consider them as the end of the statement.

Needless to mention, may machine had some paths that had braces in them. C:\Program Files (x86). And, needless to mention, it is exactly where Visual Studio is installed. And it also exists in %PATH% environment variable.

By itself, it does not break the script. As I mentioned, it worked perfectly on the other machine which was the biological twin of my PC. But, what if one of the PATH’s members is encolsed in double quotes? (to check how your PATH looks like, type echo %PATH% in command prompt). I checked and that’s what I found:

c:\winutils;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;
C:\Windows\System32\WindowsPowerShell\v1.0\;
c:\Program Files (x86)Microsoft SQL Server\100\Tools\Binn\;
c:\Program Files\Microsoft SQL Server\100\Tools\Binn\;
c:\Program Files\Microsoft SQL Server\100\DTS\Binn\;
"C:\Program Files (x86)Microsoft Visual Studio 9.0\Common7\IDE\";
C:\Program Files (x86)Microsoft Team Foundation Server 2010 Power Tools\;
C:\Program Files (x86)Microsoft Team Foundation Server 2010 Power Tools\Best Practices Analyzer\;
c:\cygwin\bin

Bingo! I found that one entry of PATH was indeed enclosed in double quotes. And, not surprisingly, it had that nasty (x86) in it. It was pointing somewhere inside VS 2008 installation tree, so I think one of VS 2008 tools I have installed recently indeed screwed this up.

So, I simply removed those double quotes. Immediately after that, both VS 2010 and VS 2008 command prompts were fixed.

So, the fist thing you should do if you’re having the same problem: look at your %PATH% environment variable and check if anything is enclosed in double quotes.

Finding this just cost me two days of work, and I hope it it helps you sorting it out much faster.

\Microsoft was unexpected at this time

Plenty of rocks, not so much water

I was hoping there would be more water in Somersby falls.

But this is nice anyway

Somersby falls

Visual Studio 2010: Not so nice improvements in TR1

Just moments after installing VS 2010 I found very nasty bug in its implementation of TR1 libraries:

            typedef struct sTestStruct
            {
                char* pName;
                char* pOtherName;
                sTestStruct* pNext;
            } sTestStruct;

            sTestStruct Struct1 = {"blah", "mlah", 0};

            char* pChar = bind(&sTestStruct::pName, _1)(&Struct1);            // Compiler is happy here

            bind(_stricmp, "blah", bind(&sTestStruct::pName, _1))(&Struct1);  // bang happens here

The error message is simply astonishing:

\microsoft visual studio 10.0\vc\include\functional(447): error C2440: ‘return’ : cannot convert from ‘char *’ to ‘char *&’

What is interesting, should I switch C++ toolset to version 9.0 (essentially switching back to VS 2008), the problem went away.

If I could I would suggest that something went horribly wrong when MS were working on rvalues (or were they lvalues?) references business, but there is simply no point guessing around. I just wonder how long will it take MS to fix the problem. Obviously, problems like this could mean that this new version of VS 2010 is not ready to be used in production yet.

Also, reporting bugs to MS has always been not so easy quest.

Petrol tanker on F3: epic FAIL

I am officially pissed off.

Did not think that I will ever go on the wrong side on a freeway. Driving on the opposite site of F3 isn’t clearly the best way to get to feel yourself like being in Europe. In any case, the way officials handled the accident wasn’t quite European too.

I left Gordon yesterday at 10:00 pm  only to hit the tail of the most giant traffic queue I ever seen at 10:15. And, I am sure, traffic just started to barely move then. There were plenty of cars with people sleeping in them at the side of the road – they obviously decided not to bother for some more hours.

An guess what? Today’s morning TV news only said that contra-flow was implemented “several hours later”. Please note – it is the true, but there is a catch. This truth is short of some interesting details like while accident happened before noon, the contra-flow was opened only at 8:30 pm. And it was the working Monday. And all peak-hour traffic was in standstill for I don’t even want to know how many hours. See the difference? Most online news sites were citing the same bullshit, at least in the morning. Like nothing serious happened, just a bit of slow traffic on one local country road. Now, when shit finally hit the fan, they all screaming loud that “blame game has started“. Good timing, guys!

So, the F3 was still pretty much the carpark 10 hours after the accident. I would call it “The incompetence”. Obviously, someone also just did not want to take a decision.

What should have been done? I reckon, after an hour or two when it became obvious that there is no way they could move the tanker without unloading it, they should have left it alone for time being. I assume, the tanker itself was safe, but in today’s “news” they said there actually was a small leak!  The peak hour was approaching, and with huge delays already in place, opening the freeway for traffic should be their priority number one. They should have isolated the accident,  put temporary barriers and open as many lines as possible (according to photos, the tanker was only taking one line!), just to let people trough.  Also, the contra-flow had to be operational at 3:00pm the latest!

That would not only help bringing people home, it would also leave them with the whole night to do whatever they were going to do to remove the tanker without having thousands of angry and tired motorists around.

Why it did not happen – I don’t know yet. But, mind you, every incident has the first name and the last name.

P.S. I wonder if everyone who lost money because of the accident (late childcare fees,  extra petrol, you name it) should send the invoices to the RTA.

Ubuntu Linux. No DMA on CD/DVD drive

Some time ago I built myself home media center on MythBuntu 8.04. It works exceptionally well… well, with one exception, if I may be excused. I could not watch my absolutely legally purchased DVDs at all – playback was choppy and jumpy, making watching movies anything but enjoyable.

If you found this post on google, you, probably, are about to give up. I was too. But I found a solution that worked for me. So, if you, like me, have seen zillions of webpages discussing the problem but none of solutions worked for you, keep reading (and please comment if this post helps you to solve your problem).

So the problem was that CD or DVD driver has no DMA enabled and hdparm would report an error:

 HDIO_SET_DMA failed: Operation not permitted

when trying to enable DMA.

I have Intel-based HP desktop with SATA HDD and IDE DVD combo drive. No problem with HDD, but DVD got stuck in PIO mode and hdparm is no help anymore. I have modules ata_piix and libata loaded.

After scanning though many discussions and FAQs, I finally found the most accurate description of the problem that offered a way to fix it. So I did exactly what they told:

# echo options libata atapi_enabled=1>/etc/modprobe.d/atapienable
# update-initramfs -u

and added

combined_mode=libata

option to kernel line in grub’s menu.lst

After reboot DVD drive was finally in UDMA mode!

MuthTV sluggish when buttons pressed on remote?

Recently I built myself a media center of old HP/Compaq computer and MythBuntu. It all worked as a top and I spent weeks learning about great features it has.

This week I was hoping to put some finishing touches on it. The last missing piece arrived – so-called “Vista Rock Remote”.

7.jpg

According to MythBunty HOWTO, this MCE-compatible remote should work out of box, despite some reviews saying it would only work with Vista. Don’t know if it works with Vista though, but it worked in MythBunty just fine. I only had to enable it in Mythbuntu control center. And restart MythTV frontend, of course.

Funnily enough, I noticed the big problem straight away. Every time I put recorded TV show on and tried to use volume up/down buttons on remote, the picture was getting sluggish and jumpy for noticeable time. Actually, it felt so weird I even thought that I might be only one who had that problem. I was not right – there were plenty of similar reports on Internet. And there was a workaround proposed also.

The root cause of the problem is that MythTV pokes X screensaver every time button on remote is pressed. It does not have to do so when you use keyboard, but must do it when you use remote as screensaver has no idea about it. MythTV kicks the screensaver by invoking “gnome-screensaver-command” with parameter –poke, and there are reports it does it twice every time you press the button. It isn’t itself a problem, the problem is that when this command is called often (and it exactly what happens when you try to put volume up or down) XOrg CPU usage jumps to 100%, which causes that unwanted “special effect” in your video.

This bug, however, has already been reported (here and here)  and the fix will probably be included in next MythTV release. For now, the only workaround was to disable screensaver and create a symbolic link to /bin/true with name gnome-screensaver-command somwehre in one of PATH’s directories that comes in front of where the original program resides. Say, if your PATH looks like

/usr/sbin;/usr/bin;/usr/local/bin

and gnome-screensaver-command is in /usr/local/bin, you can stop it from being called by creating link to /bin/true in either/usr/sbin or /usr/bin:

ln -s /bin/true /usr/bin/gnome-screensaver-command

But it would only work if you decide to disable the screensaver. You can try not to, but once display goes to sleep, you won’t be able to wake it up by using remote. So I decided to invent something more sophisticated.

Of course, I could  download sources, fix the bug and build MythTV myself, but I decided to leave it to mythbuntu team. Instead, I written small program that simply does not allow screensaver to be poked more often than once in a minute, which fixed the problem.

The good news: you can download it from this site: Mythtv screensaver proxy

The bad news: you must build it yourself. So, installing build-essentials first would be a good idea.

Download cpp file above somewhere in your home directory and then follow simple steps described in file header:

/*
 * Usage:
 *      1. execute "which gnome-screensaver-comand"
 *      If output is different from what you find below in
 *      DEF_PROGRAM, modify this macro accordingly.
 *
 *      2. build the program:
 *      g++ myth-screensaver-proxy.cpp -o gnome-screensaver-command
 *
 *      3. Find what directory original gnome-screensaver-command is in
 *              (/usr/bin/ by default).
 *
 *      4. Look at your PATH settings (printenv | grep PATH).
 *
 *      5. copy binary buld on step 2 to any of the directories that
 *      come in PATH before original gnome-screensaver-command directory.
 *
 */

A coolest gadget I ever heard of.

It seems ViewSonic wants to grab some of the pie already shared by Asus, Acer and MSI. They just announced a new netbook

I bet this computer will not leave any chances to competitiors in Russia. Its name “VieBook” sounds somewhat between “I will rock you book” and funny statement of intentions of sexual character.

Another example why global market can be a pain in the ass for marketologists.

New airport for Sydney in Somersby. Is it for real?

A few years ago we became proud owners of a book called “Sydney Region Outline Plan”. The book, printed in 1968 is nothing else but a large 111-page report about what Sydney and surroundings looked like back then and how they were expected to look today. Surprisingly enough, that was rather interesting reading.

In “Transport” chapter a few paragraphs were focused on that by 2000′ a second airport should be built in Sydney. No doubts it should have already happened. But it did not. I remember how amused I was when I learnt that the largest and busyiest air hub in southern hemisphere is closing for any flights every night. Well, to be honest, I could hardly imagine a modern city with the airport nearly in its center before!

Anyway, that book pointed a few options where second airport could have had been built. Of course, we already heard of options like “somewhere on West” or “in Richmond” but there was another interesting option – they were also talking about Wyong shire and even considered it as one of the prefferred options. Never happened though. Yet (?).

Well, this is all about a front cover of today’s “Central Coast Sun Weekly” – it says that the government is once again revisiting plans to build a new airport for Sydney and there  are “many feasible reasons” why it should be build in Somersby. Not far away from Wyong, but nothing new – they already shortlisted in in 1969 and there was a 500-people demonstration against it back in 1971 (see aph.gov.au).

I am not quite sure how feasible is it really – from my impression landscape here on Central Coast is anything but suitable for airports. I am not airport architect and I don’t know all the details – may be Somersby plateau is large enough for long runways required for A380, but that besides the point. Even the fact that some businesses have already backed the proposal (which is understandable) so as that it is not know yet how would it change the face of Central coast and affect the enfironment are not important yet. I rather curious about whether they decide or not finally? This discussion already seems to last for over 50 years.

Pause for X seconds in batch file?

Everyone who ever tried to automate routine tasks in windows knows that there is no sleep() program or its analogue. At least in default windows installation.

But there is quite an unexpected workaround:

ping -n 2 127.0.0.1 > nul

will stop batch execution for 2 seconds. (Replace 2 with your number for longer pause.)

Very simple and neat. Or is it?

Internet censorship in Australia?

I feel like it is the time to start collecting the list of politicians who obviously don’t want to retain their seats after next elections.

I mean mostly those incompetent professors of blah-blah-blah science who back internet censorship project. As an IT professional I do not need any explanations why it will not work (and it won’t indeed!), I rather more interested in real reasons what is their interest in it.

At a first glance, this comedy seems to be heated by those alternatively gifted persons who, should they get into WWW, see only porn there. That say, you get what you want. But guys, try to see the doctor, they say such sexual disorders are no longer lethal.

I use internet all the time, I’d say I do it for living, but I haven’t seen any porn for years. Probably, because I am not interested. Okay, what then I am worried about if porn (and, I assume, many of other things those politicians hide behind the word “illegal content”) isn’t in my area of interests?

Well, there are quite a few reasons. At first, the more you have, the more you want. Today they lock “illegal” contents, tomorrow they’ll want to read your email, day after they’ll want you to jump on one leg if they ask to. At second, I am also sure that some sites which were perfectly legal and did not promote any euthanasia or other stuff they want to block today will suddenly fall into filter black list and become unacessible.

But there is more and I suspect that may be the main reason: they may want to control people’s downloads. That’s right – they want to be sure nobody downloads “newest coolest song of Britney Spears” or “another one blockbuster” from famous Hollywood shit-writers and shit-producers for free. I would not worry about that as I can (and do) live without that crap, but if I am right, this would only mean that those greedy Hollywood’s shit-makers want to keep their hairy hands deep in our pockets and they try to lobby the means that will bring a lot of pain to us, legitimate internet users! Event more, if that plan is applied, we may lose P2P networks in an instant. Needless to say that today’s P2P networks aren’t synonyms of “piracy”, a lot of Open Source products use them as transport – compared to huge file servers, they cost almost nothing to run, are reliable, and very, very fast. Last time I downloaded Ubuntu install disk, I had it on my hard disk 15 minutes after download has been started.

Sad thing is they are comitted to spend more than 100 millions on this. Our millions. Instead of fixing public transport, building new hospitals or provide better education they want to screw the network that was created by community and works perfectly. Of course, there are many different things that can harm in internet. But there are many potentially deadly things in every kitchen – so let’s ban all knives and frame thier owners!

P.S. Here is the transcript of questionary where Senator Conroy failed to answer any reasonable questions regarding internet cersorship and especially ignored the question why he lied about countries like as Sweden, UK, Canada and NZ already having mandatory internet filtering in place. Nice, isn’t it?

7 visitors online now
7 guests, 0 members
Max visitors today: 10 at 04:20 am MST
This month: 30 at 09-01-2010 12:31 am MST
This year: 41 at 01-23-2010 03:43 am MST
All time: 41 at 01-23-2010 03:43 am MST