Archive for December, 2009

A tricky situation..

There is an awesome syntax error in the the following snippit. Either line 4 or line 5 has the error, see if you can spot it.

int main() {
  int value = 0;
  int othervalue = 1;
  (50 + value – 1) / othervalue;
  (50 + value - 1) / othervalue;
}

Here’s the error message from g++.

a.cpp:4: error: stray ‘\342’ in program
a.cpp:4: error: stray ‘\200’ in program
a.cpp:4: error: stray ‘\223’ in program

MSVS’s error message was something along the lines of:

expected `)' before numeric constant

So what’s the answer? The – on line 4 isn’t a -.

A

Leave a Comment

Programmatically set borderStyle in flex

To set a borderStyle on a canvas you can do:

<mx:Canvas x="332" y="329" width="264" height="44" borderStyle="solid">

To set borderStyle and other styles in code you can use the setStyle method…

package com.devbaldwin.borderedCanvas
{
	import mx.containers.Canvas;
	public class borderedCanvas extends Canvas
	{
		public function borderedCanvas()
		{
			super();
			this.setStyle("borderStyle", "solid");
		}
	}
}

A

Leave a Comment

error MSB4175: The task factory “XamlTaskFactory” …

Ran into the following, trying to use CUDA in Visual Studio 2010 beta 1:

error MSB4175: The task factory "XamlTaskFactory" could not be loaded from the assembly "Microsoft.Build.Tasks.v4.0". Unable to create Xaml task. Compilation failed.
error MSB4175: Unrecognized escape sequence

NVIDIA doesn’t currently support VS 2010 with CUDA. See this post.

One fix for the escaping issues is to turn the backslashes into forward slashes in the directory paths.
After fixing these you’ll probably have the build abort and complain about not supporting VS 2010. I stopped at this point and used 2008.

A

Leave a Comment

Sparklines / RMagick installation woes

Problem 1:
gem install rmagick
was getting the following errors:

undefined method `fill' for (no primitives defined):Magick::Draw (NoMethodError)
undefined method `stroke' for (no primitives defined):Magick::Draw (NoMethodError)

ended up compiling RMagick from source

While doing that I ran into problem 2…

Problem 2:

checking for wand/MagickWand.h... no
Can't install RMagick 2.12.2. Can't find MagickWand.h

On Ubuntu, resolved it with the following:

apt-get install libmagickwand-dev

On CentOS I ended up compiling ImageMagick from source, and then set the cppflags to compile RMagick

export CPPFLAGS=-I/usr/someotherdir/ImageMagick

A

Leave a Comment