Thursday 4 November 2010

Testing Embedded code

It's taken a little while but I've managed to get the excellent SyntaxHighlighter to work on my blog. So you will now be able to see all my code in it's true multi colour goodness.

#include <qtgui/qapplication>
#include "MainWindow.h"

int main(int argc, char *argv[])
{
  // make an instance of the QApplication
  QApplication a(argc, argv);
  // Create a new MainWindow 
  MainWindow w;
  // show it
  w.show();
 // hand control over to Qt framework
 return a.exec();
}



#!/usr/bin/python
To=[0,0,0]
From=[5,5,5]
# Get the direction vector 
# to do this we subtract each of the list elements using a lambda function
# this is the same as doing the code below I will leave it to you as to which you
# find more readable
#direction =[To[0]-From[0],To[1]-From[1],To[2]-From[2]]
 
direction = map(lambda x,y : x-y , To,From)

No comments:

Post a Comment