cannot load assembly or dependencies

I got this on a Win2008R2 x64bit server where I’m running a 32bit app.

Details: Could not load file or assembly ‘FIXForge.NET.FIX.Engine-net-4.0.dll’ or one of its dependencies. The specified module could not be found.”

So I figured that all I have to do was load it into the Global Assembly with gacutil /i and I’d be ok. But…

“Failure adding assembly to the cache: This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded”.

How can this be? I was using SDK 6, so I installed SDK 7.1 and tried again with the same result.

However if you switch to the ‘proper’ version of gacutil it will work ok.

Go to C:\Program Files\Microsoft SDKs\Windows\v7.1\Bin\NETFX 4.0 Tools\x64

Now gacutil /i will register your dll.

Use the /l [assembly name] option after too see the reaults (take “.dll”) off the end of the assembly name.

TNS ping

So what does this do?

Given you have your database and server details put in TNSNAMES.ORA, this should will check that your listener is up on the database server

Microsoft Windows [Version 5.2.3790] (C) Copyright 1985-2003 Microsoft Corp.

C:\>tnsping mydb01

TNS Ping Utility for 32-bit Windows: Version – Production on 01-FEB-2 012 15:31:18

Copyright (c) 1997, 2008, Oracle. All rights reserved.

Used parameter files:

Used TNSNAMES adapter to resolve the alias Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = myhost)(PORT = 1234)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = mydb01)))

OK (20 msec)


Ruby on Rails (RoR) and Mysql 5.5

I’ve been trying to install RoR and get it connected to my installation of MySQL 5.5.
To get started I downloaded the intsaller kit from here
I then followed this tutorial

As per the instructions I created my first project

rails new blog

And I updated my database.yml file to make a connection to MySQL in C:\Sites\blog\config\database.yml

 development:   adapter: mysql2   encoding: utf8   database: blog_development   pool: 5   username: root   password:   socket: /tmp/mysql.sock 

and I updated my Gemfile in the project’s root directory

 gem 'mysql2' 

So now all I have to do is to create a database with “rake”…

 rake db:create --trace 

But I get a horrible message!

rake aborted!
uninitialized constant Mysql2

This is an issue with the installation of the MySQL Gem adaptor so lets install it properly
Download and install the C mysql connector
Now run this

gem install mysql2 -- '--with-mysql-lib="c:\Program Files\MySQL\MySQL Connector C 6.0.2\lib\opt" --with-mysql-include="c:\Program Files\MySQL\MySQL Connector C 6.0.2\include"

Notice we make a reference to the newly installed C connector library.

copy libmysql.dll from above to the Ruby bin dir C:\RailsInstaller\Ruby1.9.2\bin

Now we can create our database….

 rake db:create --trace 

We should now have a database using the name from database.yml above.

Reading Values from an Input File

More than occasionally you will find that you need to call the same DOS script with several different parameter values, say a list of names.
Create a looping bat file “LoopTest.bat”.
Note that this script checks thats the file exists and prints a nice dated report header too

 ::-----Init..... @echo off & setlocal  SET day=%date:~0,2% SET month=%date:~3,2% SET year=%date:~6,4% SET DT=%year%\%month%\%day%  @echo Running Loop Script on %DT%  ::-----BatchScript1....   ::-----Check Input File Exists  cd C:\DOS_Scripts  IF NOT EXIST GirlsNames.txt goto :fileDoesNotExist  For /F "delims=" %%i in (C:\DOS_Scripts\GirlsNames.txt) do call :callPrintGirlsNames "%%i"  goto eof  :callPrintGirlsNames  Set "NameOfGirl=%~1"  call C:\DOS_Scripts\PrintGirlsNames.bat %NameOfGirl%   goto eof  ::-----eo BatchScript1....   :fileDoesNotExist @ECHO Input File does not exist, End Program. :eof 

So, for every instance of a girl’s name “%%i” you will call PrintGirlsNames.bat

Heres the code for PrintGirlsNames.bat

@echo %1

Heres some names to put in your GirlsNames.txt file ….

 Joyce Judith Julia Juliana Julianna Julianne Julie Juliet Juliette Julissa Justice Justine Kacie Kaela Kaelyn Kaia Kaila Kailey Kailyn Kaitlin Kaitlyn Kaitlynn Kaiya Kaleigh Kaley Kali Kaliyah Kallie Kalyn Kamryn Kara Kari Karina Karissa Karla Karlee Karley Karli Karlie Karly Kasandra Kasey Kassandra Kassidy Katarina Kate Katelin Katelyn Katelynn Katerina Katharine Katherine Kathleen Kathryn Kathy Katie Katlyn Katrina Katy Kaya Kayla Kaylah Kaylee Kayleigh Kayley Kayli Kaylie Kaylin Kaylyn Kaylynn Keeley  

Call a Stored Procedure

Heres an example of where you might call a Stored Proc that takes a defined date as it’s input and does something with it. Start an iSQL session and …

declare @my_date datetime
select @my_date=CONVERT (datetime,’Jan 18 2011 00:00:000′)
exec myStoredProc @my_date


Copies definitions for specified views, rules, defaults, triggers, or procedures from a database to an operating system file or from an operating system file to a database

defncopy -SmyDatabaseServer -UmyUser –PmyPassword out myStoredProc.out myDatabase myStoredProc

more info on defncopy (12.5)

You’d want to do this to perhaps drop the Stored Proc, alter it in an editor (say vim) and reload it.


Occasionally you might get this error when running sql queries (especially against a “new” database)

ct_connect(): directory service layer: internal directory control layer error:

Which means that there is no details on how to connect to your database (like a tns_names.ora thing).
Short term, you can add a new interfaces file to your profile and use the –I iSQL parameter to override whats in $SYBASE/interfaces.

  master tcp ether 10099
  query tcp ether 10099

isql -UmyUser -SmyDatabaseServer -DmyDatabase –PmyPassword -I/home/users/kieran/tempIfaceFile

But you’ll be wanting to get your Unix admin to update the Inferaces file to provide a permanent link.


iSQL is the Sybase equivalent of Oracle’s SQL+ I guess. It’s handy to know how to use it as you may now have a nice Sybase GUI front end to use.

From unix try
isql -UmyUser -SmyDatabaseServer -DmyDatabase –PmyPassword
set nocount on
Now simply type your sql followed by “go”

This is a handy example of how to read a file of sql commands and spool the result to an output file.

isql -UmyUser -SmyDatabaseServer -DmyDatabase –PmyPassword -i imput.sql -o result.txt -w600

Kieran’s Content Management Page

This is my main page for Joomla Content Management. It’s a bit messy at the moment but the idea is to start collecting all the useful tekkie stuff that I’ve picked up over the last several years.

In that time I’ve worked with Oracle, Sybase, Java, VBA, various Windows and Unix servers, Linux desktop, scripting (Bash, Perl) and various Vendor based commodities trading systems.