Media Centre Pictures

Sorry this took so long (been extremely busy lately), but as promised here are pictures of the media centre during the various stages of being built. Clicking on the thumbnails below, will show you a larger version of the photos.

Also given my previous experience with the MCE, the wife is always very sceptical whenever I say anything about ‘fixing’ the MCE. Moral of the story (as I learned the hard way) the MCE is a ‘production’ class machine which does not get touched without adequate planning with fall back options planned.

Of course since I build this in the summer of 2009, I don’t suppose this is “new” anymore. 😳

[smugmug url=”http://photos.bahree.com/hack/feed.mg?Type=gallery&Data=8166409_fqBhz&format=rss200″ imagecount=”21″ start=”1″ num=”21″ thumbsize=”Th” link=”lightbox” captions=”true” sort=”true” window=”false” smugmug=”false” size=”L”]

Upgraded to WordPress 2.9

I just upgraded to WordPress 2.9 and wow what a pleasant experience compared to Community Server 2007! Excluding backing up the DB and the site, the actual upgrade took only a few seconds and was so painless! Such a different experience from Community Server 2007, which was so much more difficult. Loving WordPress and all the add-ins and the goodness of the communities! :mrgreen:

Eclipse CDT Blues

Sigh, why is Eclipse CDT to flaky? Well, there might be a slight exaggeration in that but nevertheless, I did not have so many issues with Visual Studio / VC++. 🙄

I have uploaded this particular log file here if anyone is interested.

# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0xb263d1f7, pid=20331, tid=3085625024
#
# JRE version: 6.0_16-b01
# Java VM: Java HotSpot(TM) Client VM (14.2-b01 mixed mode, sharing linux-x86 )
# Problematic frame:
# C  [libQtGuiCppIntegration.so.4+0x6531f7]  _ZN16QtCppIntegration12QLineControl18removeSelectedTextEv+0x27
#
# An error report file with more information is saved as:
# /home/amit/hs_err_pid20331.log
#
# If you would like to submit a bug report, please visit:
#   http://java.sun.com/webapps/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0xb263d1f7, pid=20331, tid=3085625024
#
# JRE version: 6.0_16-b01
# Java VM: Java HotSpot(TM) Client VM (14.2-b01 mixed mode, sharing linux-x86 )
# Problematic frame:
# C  [libQtGuiCppIntegration.so.4+0x6531f7]  _ZN16QtCppIntegration12QLineControl18removeSelectedTextEv+0x27
#
# An error report file with more information is saved as:
# /home/amit/hs_err_pid20331.log
#
# If you would like to submit a bug report, please visit:
#   http://java.sun.com/webapps/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#

Pan-Fried Asparagus

Yes I am a foodie (quite surprising, a lot of people find that surprising). 😎

Anyways, this is what I intend to cook tonight among other things. I cannot claim credit for this, I found it online some time back and now its stored on my Wiki at home and I don’t know who to give credit for it anymore.

Ingredients:

  • 1/4 cup butter
  • 2 tablespoons olive oil
  • 1 teaspoon coarse salt
  • 1/4 teaspoon ground black pepper
  • 3 cloves garlic, minced
  • 1 pound fresh asparagus spears, trimmed

Method:

  1. Melt butter in a skillet over medium-high heat.
  2. Stir in the olive oil, salt, and pepper.
  3. Cook garlic in butter for a minute, but do not brown.
  4. Add asparagus, and cook for 10 minutes, turning asparagus to ensure even cooking.

Making sense of primary-expression error

If you are new to C++ then some of the compiler errors can be a bit confusing and daunting at first. For example if the compiler given you an expected primary-expression error (e.g. expected primary-expression before ‘.’ token), at face value it does not make sense.

void RGBViewer::accept() {
	QMessageBox::information(this, "Button Clicked", "You clicked OK", QMessageBox::Ok);

	QColor color = QColor(Ui_RGBViewerClass.spinBoxRed->value(),
			Ui_RGBViewerClass.spinBoxGreen->value(),
			Ui_RGBViewerClass.spinBoxBlue->value(),
			255);

	qDebug() << color;

	QBrush brush(color);
	brush.setStyle(Qt::SolidPattern);
	ui.graphicsView->setBackgroundBrush(brush);
	ui.graphicsView->backgroundBrush();
}

When I compile the above code snippet, I get the following error from the compiler:

rgbviewer.cpp: In member function ‘virtual void RGBViewer::accept()’:
rgbviewer.cpp:19: error: expected primary-expression before ‘(’ token
rgbviewer.cpp:19: error: expected primary-expression before ‘.’ token
rgbviewer.cpp:20: error: expected primary-expression before ‘.’ token
rgbviewer.cpp:21: error: expected primary-expression before ‘.’ token

All this means is that I need to initialize the type ‘Ui_RGBViewerClass’ as the compiler does not understand it. In other words, I need to use a new.

Here is the ‘fixed’ version below of the same code snippet.

Ui::RGBViewerClass ui; //Defined in the header; shown here for completness

void RGBViewer::accept() {
	QMessageBox::information(this, "Button Clicked", "You clicked OK", QMessageBox::Ok);

	QColor color = QColor(ui.spinBoxRed->value(),
			ui.spinBoxGreen->value(),
			ui.spinBoxBlue->value(),
			255);

	qDebug() << color;

	QBrush brush(color);
	brush.setStyle(Qt::SolidPattern);
	ui.graphicsView->setBackgroundBrush(brush);
	ui.graphicsView->backgroundBrush();
}

Allowing remote desktop with blank passwords on Win7

I finally got the time to upgrade my MCE with the RTM bits of Win7 (was running an old RC build until now). Given this is a dedicated MCE with nothing else on it and an on an isolated part of the network, I don’t have a password set for the Account I use to login (of course not a recommended practice). Now, I wanted to RDP to the machine and I realised then that Win 7 does not allow RDP with blank passwords by default (Vista behaves in the same fashion). The workaround is a simple fix – to update the group policy as Dan shows in this post. Even though that post is for Vista, its the same steps for Win 7.

Opening File explorer from a terminal

In Ubuntu if you want to open File Explorer from a terminal (especially as root) then you need to enter the following command: sudo nautilus

If you want this to run as a background process then just add an “&” in the end (without the quotes of course).

Extending WCF Adapters in BizTalk

I know a little bit about WCF 🙂 but never really used it in anger in BizTalk and also did not get an opportunity to extend the adapter.

I was looking for something else and came across this post form Paolo which explains in a lot of detail how does one go about extending and customizing WCF adapters. If you don’t know anything about WCF the first part explains that in general before going in to the BizTalk specific things.

BizTalk Flat File schema optional attribute issue

I encountered this interesting issue and thanks to Colin we were able to resolve it. There will be situations you will encounter when adding additional optional attributes to a Flat File (FF) schema in BizTalk will cause problems. To get around this you basically will need to set the following properties to relax the parsing of the attributes which break.

  • parser_optimization="complexity"
  • allow_early_termination="true"
  • early_terminate_optional_fields="true"

This got me thinking more and wanting to understand what does changing these attributes mean under the covers. Below is what I found out on each of these.

On parser_optimization:

  • Setting the parser_optimization to complex essentially generates a more complicated grammar (it uses both a top down and bottom up parsing); this grammar is then used to parse the FF.
  • The complicated grammar is better when parsing records with more optional nested options – however it still cannot handle all the layout conditions and can still break in some situations.
  • And given the runtime is doing more things, this will be slower than the other option called ‘speed’ (yeah no kidding Sherlock!).
    • The reason the ‘speed’ option is faster is because it uses top-down parsing only.
  • In addition you should also set lookahead_depth to zero (more on this below) to avoid validation failures (against a schema) when there are many optional nodes in the same group/record.

Changing the lookahead_depth itself is trivial but you need to be a little more aware of what this means:

  • This essentially tells the parser when making a parsing prediction how far ahead to look in the token stream.
  • Setting this to Zero essentially means ‘infinite lookahead’ which in turn means more memory will be consumed.
    • Depending on how busy your BizTalk servers are and how much memory pressure you already experience processing various files (and their sizes), this might be an issue.

Basically, the FF parser is a streaming parser and implemented as a leftmost derivation which takes in a CFG. Essentially when we change the lookahead_depth to zero we change do not restrict this and the parser can recognize tokens using DFA perhaps (of course we don’t know the real implementation).

For those old school like me, and have played with yacc – that is a LL(1) parser – essentially parse the grammar with one token lookahead.

On allow_early_termination="true":

  • When working with FF’s BizTalk expects that every line is of the same length (either because of the data contained padded with spaces). However if it finds a newline (CR + LF) character then it breaks and you get an error something along the lines of “Unexpected data found while looking for: \r\n”.
  • Adding the allow_early_termination setting helps fix this. Read more here.
  • Also note that only the right-most positional field is allowed to early terminate.

Lastly, the early_terminate_optional_fields attribute enables early termination of optional trailing fields. A couple of points to note on this:

  • If your schema does not have this annotation and you open that in the BizTalk editor, then it will automatically add this annotation explicitly and set it to the default value of False.
  • This only takes affect if you also have the allow_early_termination annotation set to True.
  • More details on this here.

And in case you were wondering this is a supported option by Microsoft as shown in this KB article.

Want Virtual Snow on your site?

If you want virtual snow (probably nicer than the real stuff as there is no slush left to clean up) then check out Snowstorm: JavaScript snow effect for HTML. Be warned though – this uses a lot of CPU on the computer redendering the page and it will slow things down. Quite cool though.

Redirects setup

After moving the blog to  WordPress, almost all my redirects should work now from the old blog posts to the new one. For example if you click on this old url http://desigeek.com/weblog/amit/archive/2009/10/25/installing-openscenegraph-on-ubuntu.aspx it should redirect you and you see the new and correct url.

Overall it was simple to setup via the .htaccess file and some simple regex. The only thing I found the hard way was that I should be using “RedirectMatch” when setting up the regex rule rather than the “Redirect” which is what I was using. You would use Redirect when trying to redirect without any variables.

So, as in my case I wanted to redirect from the old url (of community server) to the new one (of wordpress)

  • Old: http://desigeek.com/weblog/amit/archive/2009/10/25/installing-openscenegraph-on-ubuntu.aspx
  • New: https://oldblog.desigeek.com/2009/10/25/installing-openscenegraph-on-ubuntu/

So I need to make the following changes:

  • Change the “/weblog” to “/blog”
  • Get rid of “/archive”
  • Get red of the “.aspx” extension

The following rule helped me achieve this:

RedirectMatch 301 /weblog/amit/archive/([0-9][0-9][0-9][0-9])/([0-9][0-9])/([0-9][0-9])/(.*)\.aspx$ https://oldblog.desigeek.com/$1/$2/$3/$4

Of course there are a few more rules I have which I cannot go into details.

Along the way i also discovered a few interesting tools which can help you view the results – one is LiveHTTPHeaders; another good one is http://web-sniffer.net/.

If you are new to this, then a few very good tools online. I would suggest start with this post from Zo and this tutorial on regex.

i still have one outstanding issue where if I want to redirect part of the URL and not the complete thing, I am not sure how to do it. For example if I want to redirect the old url above to just the year/month of the post instead if the actual post, not sure how to go about doing it. So I want the url below to map to the the one below that.

  • URL to Map: http://desigeek.com/weblog/amit/archive/2009/10/25/installing-openscenegraph-on-ubuntu.aspx
  • Should map to: http://desigeek.com/weblog/amit/archive/2009/10/