DOSBox auto mounting a directory from conf file

April 7th, 2013

It is possible to get DOSBox to autmatiacally mount a directory from the config file.

# Lines in this section will be run at startup.
mount d "C:\Documents and Settings\f15ijp\My Documents\Dropbox\Radio\ProgrammingFiles\"

This line will mount the directory specified as a D: drive in DOSBox

DOSBox using a serialport

April 7th, 2013

In order to allow DOSBox to use the serial ports of the computer you need to change the settings.

I do this in the conf file to have it in one location

# serial1-4 -- set type of device connected to com port.
#              Can be disabled, dummy, modem, nullmodem, directserial.
#              for directserial: realport (required), rxdelay (optional).
serial1=directserial realport:com1
serial3=directserial realport:com34

So this example setting means that com1 of my computer (Windows) is com1 in DOSBox and com34 of my computer is com 3 in DOSBox

Git replacing the editor for commit messages

February 14th, 2013

The man page says

The editor used to edit the commit log message will be chosen from the GIT_EDITOR environment variable, the core.editor configuration variable, the VISUAL environment variable, or the EDITOR environment variable (in that order).

So in order to make nano our default editor we can do

git config --global core.editor "nano"

--global means this will become a default setting for all of git (leaving it out would only affect the current git repo you are running the command from)

SSMS Invalid Column name

December 21st, 2012

Sometimes the Cache of SSMS gets “corrupted” or fails to update, this can lead to Red squiggles under column namnes, table names, basiacally anything (Also SSMS will claim the name does not exist with for instance the error message invalid column namn).
When this error lies in SSMS, then refreshing the cache is the solution, and this is done with “Ctrl-Shitf-R

MS SQL Truncating seconds (and milliseconds) from a datetime

December 19th, 2012

By converting a DateTime to a char(16) the seconds and milliseconds are truncated from the DateTime.

DECLARE @d datetime
SELECT @d, CONVERT(CHAR(16), @d, 121)
--2012-12-04 11:50:42.160	2012-12-04 11:50

Visual Studio 2012 and Razor 1.0 (opening an older project in 2012)

December 17th, 2012

VisualStudio 2012 assumes we are using the latest and greatest (version 2) when it comes to the Razer view engine. However when we are opening a project that was created using version 2010 then we were using 1.0 and that is the reason that 2012 is telling us about all the errors it believes we have with our project.

The solution is to edit the web.config file and under “appSettings” tell VisualStudio that this project is using version 1.0

<add key="webpages:Version" value="1.0" />

vb.NET inserting a file to a Binary field in the Database

December 14th, 2012

In order to store Binary data in a table, all that is needed is to upload the bytes from the file, one way to do this is to use File.ReadAllBytes

Dim fileName As String = "C:\testfile.txt"
dbCommand = New SqlCommand("UPDATE FileTable SET BinaryFile=@BinaryFile WHERE FileId = @FileId", dbConnection)
dbCommand.Parameters.AddWithValue("@BinaryFile", File.ReadAllBytes(Filnamn))
dbCommand.Parameters.AddWithValue("@FileId", FileId)

.NET what path is the application running from?

December 12th, 2012

In order to get the Directory the application is running from we can use the AppDomain.CurrentDomain.BaseDirectory property

Dim runningFrom As String = AppDomain.CurrentDomain.BaseDirectory

VirtualBox modifying what networking interface is the bridgeadapter

December 10th, 2012

If a guest is setup to use a bridged adapter but we later need to change which adapter of the Host to use then we just have to tell VirtualBox what device to use

VBoxManage modifyvm my-guest-name --bridgeadapter1 eth3

VirtualBox set Guest interface as a bridged adapter

December 10th, 2012

A bridged adapter means that the Guest adapter is bridged to the Host adapter i.e. it can see the whole network (request address from DCHP server etc)

VBoxManage modifyvm my-guest-name --nat1 bridged
VBoxManage modifyvm my-guest-name --bridgeadapter1 eth3

nat1 is the first interface of the Guest machine.