Thoughts From My Life

Advice from someone who does not know everything.

Category: General

A* Pathfinding Algorithm

I have been messing around with my Nintendo DS again and trying to write some simple programs. Hello World that can be dragged and dropped on the screen somewhere is as far as I have advanced.

I have been learning the A* algorithm however. I have implemented it in Java and now I am working on C/C++ versions. I think I will also try to do a demo version in javascript to what how it works visually.

Continue reading

Replacing The Tailpiece On My Mandolin

I unfortunately broke a piece of the tailpiece off on my mandolin the other day. I was restringing it and was putting on some old strings (they hadn’t been used) I purchased a few years ago. I don’t know if that was the problem or not, but one the little pegs in the tailpiece that the eye of the string holds onto snapped off.

I didn’t know what to do, so I phoned around to a number of places in Calgary and no one wanted to deal with it. Replacement tailpieces were selling upwards of $100 on eBay so that didn’t look very good either.

I ended up phoning Long & McQuade here in Calgary (Calgary Long & McQuade) and they said to bring it by and they would take a look. Anyhow, I walked in and they have a replacement tailpiece of the exact same shape and size for $20. I couldn’t believe my luck. It was the same size as my original so I could use my Kentucky tailpiece cover on it as well. It wasn’t even stored in the back. It was a plastic wrapped item on a display shelf.

I own a Kentucky KM200S teardrop style mandolin. I purchased it back around 1995 or so. It is a pretty nice little instrument so I want to keep it in good repair.

Replacing A Mandolin Tailpiece

Replacing it is really simple:

  1. Remove the cover of the tailpiece.
  2. Remove any strings connected to the tailpiece. Either remove them from the Mandolin completely or loosen them enough that you can slip the string eyelets off of the tailpiece pins.
  3. Remove the screw for the knob you connect your strap to.
  4. Remove the 3 screws holding the tailpiece onto the bottom of the mandolin.
  5. Hold the new tailpiece in place where the old one was. The angle of the mandolin tailpiece might not quite be right, so bend it a little so that it is touching flat on the bottom side of the mandolin and the on the top.
  6. My old tailpiece had a piece of felt along the edge that the strings dug into, but the new one didn’t have this. I removed the felt and superglued it onto the new tailpiece.
  7. Replace the 3 screws to hold the taipiece on.
  8. Replace the strap knob and screw.
  9. String up your guitar and put your tailpiece cover back on.

Overall, it was super simple, only cost me $20, took half and hour of work including the restringing, and I was able to keep on my original tailpiece cover.

I’m Back

This blog has been offline for a number of years, but I have decided to start back up again. Mainly to just keep up with my writing skills and document more of my personal experiences.

I will put back up some of my older and more popular posts from the past. Likely some may need some updating.

OpenGL and Visual Studio Express 2008

I recently set up Visual C++ 2008 Express Edition and OpenGL on my Windows XP and Windows Vista computers. I had a few issues, but it is working now. I have a step by step tutorial below and also outlined some of the issues I had.

This is also a guide on just setting up your development environment on Windows for OpenGL programming. If you are like me, I am starting out doing game programming and want to add OpenGL graphics.

The OpenGL tutorials I am using are from NeHe’s Website and here is a Visual C++ 2008 and OpenGL Guide I used.

Getting OpenGL to Work With Visual C++ 2008

Follow each step, unless you have already done one of these steps.

1. Install Visual C++ 2008 Express Edition

This is a free C++ IDE from Microsoft that is an excellent tool to start with, if you are interested in programming on a Windows environment.

You can find Visual C++ 2008 on the Visual Studio Express download page on Microsoft’s site. It only works on Windows XP and up. If you have an older version of windows you might want to find Visual C++ 2005 and then use this Visual C++ 2005 and OpenGL tutorial.

2. Install Windows SDK for Windows Server 2008 and .NET Framework 3.5

This is the equivalent to the Windows? Server 2003 SP1 Platform SDK that Visual C++ 2005 users installed. It contains the main OpenGL libraries. You can download the Windows SDK for Windows Server 2008 and .NET Framework from the Microsoft website.

The installation will take a little while.

Dell Canada Inc

3. Install the GLUT Libraries

These are additional libraries that come in handy down the road. Some code samples you find may use them, so I find it best to just have them around right off the bat.

GLUT itself is a bit old, but there is another one called freeglut that is a little more actively maintained. I install both of them. Download freeglut from the freeglut SourceForge page. I download the original GLUT from Nate Robins’ site.

For both downloads, unzip them and do the following:

  1. Copy all the .h files into the C:\Program Files\Microsoft SDKs\Windows\v6.1\Include\GL folder. This should be glut.h, freeglut.h, freeglut_ext.h, and freeglut_std.h.
  2. Copy all the .lib files into the C:\Program Files\Microsoft SDKs\Windows\v6.1\Lib folder. This should be freeglut.lib and glut32.lib.
  3. Copy all the .dll files into the C:\Windows\system32 folder. This should be freeglut.dll and glut32.dll.

4. Create Your First Project

Create a project in Visual C++ with whatever name you like and set the template as Win32 Project. Click OK.

Click Next on the following screen and you will be taken to Application Settings. Check on Empty Project and then click OK. Your new project has been created.

Declare the dependencies for your project.

  1. Click on Project -> [project name] Properties.
  2. Expand Configuration Properties.
  3. In the Configuration dropdown, select All Configurations.
  4. Select Linker -> Input.
  5. In the Additional Dependencies field, enter in GlU32.Lib OpenGL32.Lib freeglut.lib glut32.lib. Then click OK.

5. Create Your First Source File

I recommend a .cpp file. I recommned downloading the source code from NeHe’s Lesson 2 and copying into the file you just created.

Press F7 to compile it and F5 to run it.

It should be working at this point. If not, post a comment and I will try and help out.

Problems Setting Up OpenGL and Visual C++ 2008 Express Edition

Character Set Error

When I try to compile the project, I get the following error:

------ Build started: Project: Test, Configuration: Debug Win32 ------Compiling…main.cppc:\documents and settings\neil galloway\my documents\visual studio 2008\projects\test\test\main.cpp(87) : error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char [29]' to 'LPCWSTR'        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style castc:\documents and settings\neil galloway\my documents\visual studio 2008\projects\test\test\main.cpp(92) : error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char [34]' to 'LPCWSTR'        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style castc:\documents and settings\neil galloway\my documents\visual studio 2008\projects\test\test\main.cpp(99) : error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char [31]' to 'LPCWSTR'        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style castc:\documents and settings\neil galloway\my documents\visual studio 2008\projects\test\test\main.cpp(105) : error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char [24]' to 'LPCWSTR'        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style castc:\documents and settings\neil galloway\my documents\visual studio 2008\projects\test\test\main.cpp(109) : error C2664: 'UnregisterClassW' : cannot convert parameter 1 from 'const char [7]' to 'LPCWSTR'        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style castc:\documents and settings\neil galloway\my documents\visual studio 2008\projects\test\test\main.cpp(111) : error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char [28]' to 'LPCWSTR'        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style castc:\documents and settings\neil galloway\my documents\visual studio 2008\projects\test\test\main.cpp(147) : error C2440: '=' : cannot convert from 'const char [7]' to 'LPCWSTR'        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style castc:\documents and settings\neil galloway\my documents\visual studio 2008\projects\test\test\main.cpp(151) : error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char [37]' to 'LPCWSTR'        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style castc:\documents and settings\neil galloway\my documents\visual studio 2008\projects\test\test\main.cpp(169) : error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char [94]' to 'LPCWSTR'        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style castc:\documents and settings\neil galloway\my documents\visual studio 2008\projects\test\test\main.cpp(176) : error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char [24]' to 'LPCWSTR'        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style castc:\documents and settings\neil galloway\my documents\visual studio 2008\projects\test\test\main.cpp(209) : error C2664: 'CreateWindowExW' : cannot convert parameter 2 from 'const char [7]' to 'LPCWSTR'        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style castc:\documents and settings\neil galloway\my documents\visual studio 2008\projects\test\test\main.cpp(212) : error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char [23]' to 'LPCWSTR'        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style castc:\documents and settings\neil galloway\my documents\visual studio 2008\projects\test\test\main.cpp(241) : error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char [34]' to 'LPCWSTR'        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style castc:\documents and settings\neil galloway\my documents\visual studio 2008\projects\test\test\main.cpp(248) : error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char [35]' to 'LPCWSTR'        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style castc:\documents and settings\neil galloway\my documents\visual studio 2008\projects\test\test\main.cpp(255) : error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char [27]' to 'LPCWSTR'        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style castc:\documents and settings\neil galloway\my documents\visual studio 2008\projects\test\test\main.cpp(262) : error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char [37]' to 'LPCWSTR'        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style castc:\documents and settings\neil galloway\my documents\visual studio 2008\projects\test\test\main.cpp(269) : error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char [41]' to 'LPCWSTR'        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style castc:\documents and settings\neil galloway\my documents\visual studio 2008\projects\test\test\main.cpp(281) : error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char [23]' to 'LPCWSTR'        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style castc:\documents and settings\neil galloway\my documents\visual studio 2008\projects\test\test\main.cpp(358) : error C2664: 'MessageBoxW' : cannot convert parameter 2 from 'const char [42]' to 'LPCWSTR'        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style castBuild log was saved at "file://c:\Documents and Settings\Neil Galloway\My Documents\Visual Studio 2008\Projects\Test\Test\Debug\BuildLog.htm"Test - 19 error(s), 0 warning(s)========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

This can be fixed by doing the following:

  1. Project -> [projectname] Properties
  2. In the Configuration dropdown, pick All Configurations.
  3. Expand Configuration Properties.
  4. Select General.
  5. Change the Character Set to be Use Multi-Byte Character Set.

The errors should go away the next time you compile.

Can’t Include glaux.h

The first time I compiled, I received the following error:

—— Build started: Project: Test, Configuration: Debug Win32 ——
Compiling…
main.cpp
c:\documents and settings\neil galloway\my documents\visual studio 2008\projects\test\test\main.cpp(12) : fatal error C1083: Cannot open include file: ‘gl\glaux.h’: No such file or directory
Build log was saved at “file://c:\Documents and Settings\Neil Galloway\My Documents\Visual Studio 2008\Projects\Test\Test\Debug\BuildLog.htm”Test – 1 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

This is because the glaux.h has not been added to the include folder. You can do this if you want, but the glaux.h library is old and out dated based on most user comments on the internet. A lot of the examples, especially from NeHe, do not even use the code inside it anymore. I can usually just comment out or remove the

#include 

from the code and it will be fine.

Set Up Dependencies For The Project

When the dependencies are not there, I received the following error trying to compile:

------ Build started: Project: OpenGLTest, Configuration: Debug Win32 ------Compiling…WinMain.cppCompiling manifest to resources…Microsoft (R) Windows (R) Resource Compiler Version 6.0.5724.0Copyright (C) Microsoft Corporation.  All rights reserved.Linking…WinMain.obj : error LNK2019: unresolved external symbol _gluPerspective@32 referenced in function "void __cdecl ReSizeGLScene(int,int)" (?ReSizeGLScene@@YAXHH@Z)WinMain.obj : error LNK2019: unresolved external symbol __imp__glLoadIdentity@0 referenced in function "void __cdecl ReSizeGLScene(int,int)" (?ReSizeGLScene@@YAXHH@Z)WinMain.obj : error LNK2019: unresolved external symbol __imp__glMatrixMode@4 referenced in function "void __cdecl ReSizeGLScene(int,int)" (?ReSizeGLScene@@YAXHH@Z)WinMain.obj : error LNK2019: unresolved external symbol __imp__glViewport@16 referenced in function "void __cdecl ReSizeGLScene(int,int)" (?ReSizeGLScene@@YAXHH@Z)WinMain.obj : error LNK2019: unresolved external symbol __imp__glHint@8 referenced in function "int __cdecl InitGL(void)" (?InitGL@@YAHXZ)WinMain.obj : error LNK2019: unresolved external symbol __imp__glDepthFunc@4 referenced in function "int __cdecl InitGL(void)" (?InitGL@@YAHXZ)WinMain.obj : error LNK2019: unresolved external symbol __imp__glEnable@4 referenced in function "int __cdecl InitGL(void)" (?InitGL@@YAHXZ)WinMain.obj : error LNK2019: unresolved external symbol __imp__glClearDepth@8 referenced in function "int __cdecl InitGL(void)" (?InitGL@@YAHXZ)WinMain.obj : error LNK2019: unresolved external symbol __imp__glClearColor@16 referenced in function "int __cdecl InitGL(void)" (?InitGL@@YAHXZ)WinMain.obj : error LNK2019: unresolved external symbol __imp__glShadeModel@4 referenced in function "int __cdecl InitGL(void)" (?InitGL@@YAHXZ)WinMain.obj : error LNK2019: unresolved external symbol __imp__glEnd@0 referenced in function "int __cdecl DrawGLScene(void)" (?DrawGLScene@@YAHXZ)WinMain.obj : error LNK2019: unresolved external symbol __imp__glVertex3f@12 referenced in function "int __cdecl DrawGLScene(void)" (?DrawGLScene@@YAHXZ)WinMain.obj : error LNK2019: unresolved external symbol __imp__glBegin@4 referenced in function "int __cdecl DrawGLScene(void)" (?DrawGLScene@@YAHXZ)WinMain.obj : error LNK2019: unresolved external symbol __imp__glTranslatef@12 referenced in function "int __cdecl DrawGLScene(void)" (?DrawGLScene@@YAHXZ)WinMain.obj : error LNK2019: unresolved external symbol __imp__glClear@4 referenced in function "int __cdecl DrawGLScene(void)" (?DrawGLScene@@YAHXZ)WinMain.obj : error LNK2019: unresolved external symbol __imp__wglDeleteContext@4 referenced in function "void __cdecl KillGLWindow(void)" (?KillGLWindow@@YAXXZ)WinMain.obj : error LNK2019: unresolved external symbol __imp__wglMakeCurrent@8 referenced in function "void __cdecl KillGLWindow(void)" (?KillGLWindow@@YAXXZ)WinMain.obj : error LNK2019: unresolved external symbol __imp__wglCreateContext@4 referenced in function "int __cdecl CreateGLWindow(char *,int,int,int,bool)" (?CreateGLWindow@@YAHPADHHH_N@Z)
MSVCRTD.lib(crtexe.obj) : error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartupC:\devkitPro\projects\OpenGLTest\Debug\OpenGLTest.exe : fatal error LNK1120: 19 unresolved externalsBuild log was saved at "file://c:\devkitPro\projects\OpenGLTest\Debug\BuildLog.htm"OpenGLTest - 20 error(s), 0 warning(s)========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

To set up OpenGL dependencies for a project, refer to the declaring the dependencies section in Create You First Project section above.

That should fix the problem, try recompiling now.

Change the Application Type

I have also experienced the following error when I compile:

------ Build started: Project: OpenGLTest, Configuration: Debug Win32 ------Linking…MSVCRTD.lib(crtexe.obj) : error LNK2019: unresolved external symbol _main referenced in function ___tmainCRTStartupC:\devkitPro\projects\OpenGLTest\Debug\OpenGLTest.exe : fatal error LNK1120: 1 unresolved externalsBuild log was saved at "file://c:\devkitPro\projects\OpenGLTest\Debug\BuildLog.htm"OpenGLTest - 2 error(s), 0 warning(s)========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

This was caused by not picking the right application type when I created the project. In this example, I chose Win32 Console Application at the startup. To change it, I did the following:

  1. Click on Project -> [project name] Properties.
  2. Expand Configuration Properties.
  3. In the Configuration dropdown, select All Configurations.
  4. Select Linker -> System.
  5. Change the Subsystem field to be Windows (in the case it was Console or try the opposite if it already is Windows). Click OK.

Buying A Used Car

My wife’s car has just about had it and I am looking at used vehicles in Calgary. It has been awhile since I purchased a vehicle. The last time I puchased one, it was through the old faithful Buy and Sell guide at the local gas station. This is my second time buying a used car in Calgary.

It has really changed now. I am using a number of different sites to find stuff now. Basically, it is the used listing sites and the car dealer sites for Calgary.

Don’t take my advice as I haven’t purchased yet, but I have done a fair bit of looking.

Used Listing Sites

The ones I am finding the best selection with right now are:

  • Calgary Kijiji – A great free site.
  • UsedCalgary.com – Another great free site.
  • Calgary CraigsList – Not as flashy, but free and a ton of people use it.
  • BuySell Classifieds – This one isn’t free, but you get a ton of listings. It comes out on-line a bit later than the print version I believe, so it is harder to get a deal if you just look on-line and the vehicle goes quickly.
  • Auto Trader – Not as many pictures posted and it is the same story as the BuySell. Paper print comes out on Thursday and it is released on the Internet on the Monday.
  • Autohound – This is a Canadian site speciailizing in used vehicles through participating dealers. Very handy to sort and find what you are looking for. There appears to be some basic buying guarantees offered as well.
  • eBay – Old faithful is still a very useful tool and you can find deals all over. More U.S. vehicles are on here, but a lot are from dealerships so it is fairly legit. You only have to pay a small deposit and can pay the remainder when you go take a look at it.
  • classifiedextra.ca – These are the classifieds from select newspapers (Calgary Sun is one of them).
  • autocatch! – It has some interesting ways to search for vehicles.
  • autoHunter.ca – Few different search methods and you can browse be dealer as well.

Dealer Sites

Basically pull up the sites for any of the dealers that you know of that sell new or used vehicles. They will have tons of listings and contact information to use. I think you are less likely to find a deal here, but it is a good reference point and you might just find exactly what you are looking for in terms of the specs as well.

Getting The Car Book Value for Free

There is that handy little black book to get the trade-in values for used vehicles or what some people call the “trade in” price. Quite often you have to pay for this book periodically or pay an on-line fee to get access to it. I found a handy way of getting a quote.

On the GMC website there is an Appraise Trade In tool that will let you punch in information and then give you a range of what your vehicle is approximately worth. This is more for the trade-in value, so chances are it will sell for higher privately.

What Costs Might Be Upcoming

When looking at a used vehicle, take note of the service work that has been done to it. Sometimes a little research on-line can tell you what has been a typical problem for that vehicle or things that might need to be replaced soon. Tires, brakes, fluid changes, and more are good to take note of. It is a cost that will have to be done anyways, but it is nice to know if you will be doing it within the year or if it is a couple years away.

A lot of cars have major service at various mileages. For example, the next major service for a 2005 Matrix is at 192,000 km. If you are looking at a Matrix that is already at 160,000 you will be thinking about soon. If you are under 100,000 you have a longs ways to go.

Automatic or a Standard

Also called a manual transmission, a standard is usually $1,000 cheaper off the new sticker price. A lot of the cheaper used vehicles you see will be a standard. If you don’t want a stick-shift, pay attention to that.

Factor In Taxes

When comparing vehicle costs, the taxes can be significant as well. 5% GST will add $500 for every $10,000 you are putting into it. If you buy privately, you may not have to pay GST. I believe you are supposed to, but it is difficult to enforce. If you buy from a dealer, you will be paying the GST.

Also consider that province or state that you are buying it in. They may other applicable taxes depending on where you are from yourself.

Acer Extensa 5420 Black Screen On Startup

Well I have already screwed up my Acer laptop, but have managed to recover it (somewhat).Note: In November of 2009 I did have a power jack problem with my Acer Extensa.I have been installing applications and I decided to upgrade to the latest ATI drivers for my ATI Mobility Radeon HD 2400XT video card that is inside. I went to the ATI website and searched through their drivers sections. This is where I went wrong.

ATI’s Site Does Not Provide Laptop Drivers

I was searching around for drivers and could not find the 2400 series drivers in the Mobility section so I downloaded the ones from the regular Radeon area. If I had read the fine print in the Mobility section, I would have seen that they do not provide drivers for laptops. The laptop manufacturer is responsible for this.Anyhow, after I installed the driver package I downloaded, the laptop would only boot to a black screen. After some messing around I decided I would just to the restore from the hidden partition (feature on Acers) since I didn’t have much on the laptop yet.Note: After going through my steps below, I realized some things take a long time and I am wondering if I just let the laptop sit at the black screen for awhile if it would have finished something it was doing. You can try this if you want.

Restoring From The Hidden Partition

It is pretty simple.

  • At the Acer screen on bootup, press F2.
  • In on of the screens there is a D2D option. Make sure it says Enabled.
  • Save your settings and exit.
  • At the Acer screen on bootup, press Alt-F10.
  • You will prompted from here on where you want to restore or not.

Notes About Restoring the Acer Extensa

The actual restore was only 7 minutes, but everything else seemed to take a long time. There were not a ton of screens to fill in, but there is a few. I let my laptop sit and chunk away through various parts for a few hours.There are initial users to set up, some registration info, license agreements to accept, and some locale settings.The most unnerving was that even after I rebooted and logged in for the first time, the screen was black except for a command prompt window that was up and running. I hit Ctrl-Alt-Del and went into Task Manager to see what was going on. The CPU was running around 50% and it did this for quite some time (2o minutes), but eventually I was logged in. I think it was some sort of initial setup.

Getting Acer Extensa Drivers

Rule of thumb for the video card: DO NOT DOWNLOAD VIDEO CARD DRIVERS FROM THE ATI WEBSITE. GO TO ACER’S SITE.NOTE: I have not yet done the steps below because I am still restoring my laptop.I found the Acer Support website and if you are looking for any drivers, start with the Acer Drivers page. I had Windows Vista so I went into Vista and then Drivers to get the file VGA Driver_ATI_v8.402_Vista.zip, but there is also another version (for XP users?) at VGA 20ATIv.2.8.383.zip.There is a more viewer friendly version with their FTP viewing page. Just find Extensa and work your way into the drivers section from there.Explore this site. You will find a digital copy of your manual and there is BIOS software as well.