Showing posts with label how to. Show all posts
Showing posts with label how to. Show all posts

Wednesday, 3 August 2011

How to do a backtrace, trace, step, and more in CLISP

To do a backtrace

> :bt

To enable a trace

> (trace factorial)
> (factorial 3)

To disable a trace

> (untrace factorial)
> (factorial 3)

To enable trace indentation

> (setq *trace-indent* t)

To disable trace indentation

> (setq *trace-indent* nil)

To do stepping

> (step (factorial 3))
> :s

To display the current directory

> (cd)

To display the contents of the current directory

> (dir)

To display the load paths

> *load-paths*

To quit

> (quit)

To get out of debug

> :a

NOTES

* CLISP version 2.49

* Backtracing is not that useful

* Stepping can be tedious but it helps to illustrate what's going on in the background

* Trace is the best all rounder, especially when you enable indentation

Tuesday, 2 August 2011

How to fix SVN "could not connect to server" and "authorization failed: Could not authenticate to server: rejected Basic challenge"

ERROR MESSAGE 1

svn: OPTIONS of 'http://crossroadscorp.unfuddle.com/svn/crossroadscorp_agi': could not connect to server (http://crossroadscorp.unfuddle.com)

I got this message because my wired internet access at a university has a firewall.

Friday, 22 April 2011

How to Build Boost 1.45 BJam with MinGW

Go to,
  • E:\agi\dep\boost_1_45_0\tools\build\v2\engine\src
Enter,
  • build.bat gcc
The result, bjam.exe, will be in,
  • E:\agi\dep\boost_1_45_0\tools\build\v2\engine\src\bin.ntx86

Friday, 26 November 2010

How to Build freeglut on Windows XP with MinGW


1) Download and extract freeglut 2.6.0.

I placed freeglut in:
C:\binh\tools\freeglut-2.6.0

Friday, 19 November 2010

How to Move Your iTunes Media File Library

iTunes Version - 9.0.2.25
Operating System - Windows XP

Step 1 - Change Your iTunes Media Folder Location

Monday, 5 April 2010

My DVD Drives Disappeared

http://www.crazedconcepts.com/product_images/s/xb_360_dvd_drive__86797.jpg

My DVD drives disappeared a few days ago. I don't know why they disappeared. I could access them when I used Ubuntu but they just were not accessible from Windows XP. I had been putting off fixing them until I needed a DVD drive to play a game with my brother last night.

Luckily Microsoft provided a solution which requires going into the registry.

Windows XP
  1. Click Start, and then click Run.

  2. In the Open box, type regedit, and then click OK.

  3. In the navigation pane, locate and then click the following registry subkey:

    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Class\{4D36E965-E325-11CE-BFC1-08002BE10318}

  4. In the right pane, click UpperFilters.

    If you do not see the UpperFilters registry entry, you still might have to remove the LowerFilters registry entry. To do this, go to step 7.

  5. On the Edit menu, click Delete.

  6. When you are prompted to confirm the deletion, click Yes.

  7. In the right pane, click LowerFilters.

    (I only had UpperFilters.)

  8. On the Edit menu, click Delete.

  9. When you are prompted to confirm the deletion, click Yes.

  10. Exit Registry Editor.

  11. Restart the computer.
I wish there was a program that could do this for me automatically.

I almost lost it when the DVD drive on my brother's computer also did not work. Luckily it was only because I had forgotten to connect a power cable when I was doing some fiddling with it a few weeks ago.

Wednesday, 31 March 2010

Boost Unit Test Tutorial

I've been struggling with how to use the Boost Unit Test Framework with different files.

You should be able to see that pattern so I'll keep this tutorial sweet and short.

Note that I've been using Boost Unit Test 1.34.1.

In TestMain.cpp:

#define BOOST_TEST_DYN_LINK
#define BOOST_TEST_MODULE Master Test Suite
#include <boost/test/unit_test.hpp>

In TestGenome.cpp:

// boost
#include <boost/test/unit_test.hpp>

class
Genome
{

public
:
Genome( void )
{

size = 2;
}

int
size;
};


// The name of the suite must be a different name to your class
BOOST_AUTO_TEST_SUITE( GenomeSuite )

BOOST_AUTO_TEST_CASE( size )
{

Genome genome;
BOOST_CHECK_EQUAL( genome.size, 2 );
}


BOOST_AUTO_TEST_SUITE_END()

In TestBrain.cpp

// boost
#include <boost/test/unit_test.hpp>

class
Brain
{

public
:
Brain( void )
{

numNeuron = 4;
}

int
numNeuron;
};


// The name of the suite must be a different name to your class
BOOST_AUTO_TEST_SUITE( BrainSuite )

BOOST_AUTO_TEST_CASE( numNeuron )
{

Brain brain;
BOOST_CHECK_EQUAL( brain.numNeuron, 4 );
}


BOOST_AUTO_TEST_SUITE_END()

In Makefile:

#VPATH =

CXXFLAGS = -g \
-
Wall \
-
D_REENTRANT

LIBS = -lboost_unit_test_framework

SOURCES = TestMain.cpp \
TestBrain.cpp \
TestGenome.cpp

OBJECTS = $(subst .cpp,.o,$(SOURCES))

all: $(OBJECTS)
g++ $(CXXFLAGS) $(OBJECTS) $(LIBS)
./
a.out --log_level=test_suite

-
include $(subst .cpp,.d,$(SOURCES))

%.
d: %.cpp
g++ -MM $(CXXFLAGS) $< > $@.$$$$; \
sed 's,\($*\)\.o[ :]*,\1.o $@ : ,g' < $@.$$$$ > $@; \
rm -f $@.$$$$

clean:
rm $(OBJECTS) *.d a.out
Just add your source files to the group SOURCES. The rest of the Makefile gibberish generates dependencies or is there to reduce repetitive parts.

Let me know if you need a Makefile that allows for multiple files in multiple directories. That was also something that took me a long time to figure out.

Note that there are some errors with the Makefile because spaces and tabs don't come out properly in HTML.

Thanks go to Jasper for the C++ to HTML converter.

Tuesday, 4 August 2009

How to set the default subtitle language in vlc

This is for vlc 0.9.6.

tools > preferences > subtitles & osd > preferred subtitles language > english