Eclipse: Zoom in on text with Ctrl+ 2013-01-28

This is quick post to inform people how to get zoom in and out of text in eclipse, since alot of coders want it, but it is not easily found.

Well, here is your holy grail: There is a project from a guy called 'tarlog' that made a plugin for eclipse at this, you can find information about it in this StackOverflow question.

It has some other features for eclipse, amongst which is Ctrl++ and Ctrl+- to change the font size, it's frickin' awesome.

Happy coding!

Custom resources in Visual Studio Test projects 2013-01-24

Many times, you need custom resources for your test projects, and these resources might be needed in several test projects.

Now, you could simply copy all of these resources (files) to all your projects and 'include them' in the .csproj file, but you know this would break DRY principle, which is a good idea to abide to.

Anyway, normally if you want to copy a resource to the output directory you do this:

  <Target Name="CopyResources" DependsOnTargets="Build">
    <Exec Command="CALL ..\my\resources\generator.bat $(OutputPath)" />
  </Target>

Note: I am assuming you have a script that generates resources and then puts them on a path you give it.

When you build your solution in your computer and execute the tests with some of the major test runners, it might work, but not with all of them; and it might fail in some cloud hosted environments, like for example AppHarbor.

The solution is simple, instead of using $(OutputPath), use $(OutDir), and this will work in local and hosted environments.

  <Target Name="CopyResources" DependsOnTargets="Build">
    <Exec Command="CALL ..\my\resources\generator.bat $(OutDir)" />
  </Target>

IronRuby and the Dreaded Method not found error 2013-01-12

This post is related to this StackOverflow question.

UPDATE: This is fixed in the master branch if IronLanguages repo, check the footer note.

Maybe you've had it, and maybe not, but if you have, then you know how horrible it is when IronRuby gives you this totally unrelated error, for no apparent reason:

To put things in context imagine you create a very basic IronRuby application, a very simple Ruby script:

obj = Object.new

And then Boom! You get something like this:

Method not found: 'Microsoft.Scripting.Actions.Calls.OverloadInfo[] 
Microsoft.Scripting.Actions.Calls.ReflectionOverloadInfo.CreateArray
(System.Reflection.MemberInfo[])

WTF is going on? It seems IronRuby 1.1.3 came with a strange bug where you can't call Object.new even though if you run ir.exe it says System::Object clearly has a .new class method:

IronRuby 1.1.3.0 on .NET 4.0.30319.17929
Copyright (c) Microsoft Corporation. All rights reserved.

>>> Object.methods
=> [:Equals, :ReferenceEquals, :allocate, :clr_constructor, :clr_ctor, :clr_new, :new, ...]

Introducing Dependency Locator 2012-12-18

What is Dependency Locator?

Dependency Locator is an implementation of the Service Locator pattern with a twist (aren't they all?). Dependency Locator uses a C# API for setting up dependencies (no more hundreds of XML configuration for your dependencies).

Features

  • Fluent C# API for Dependency configuration
  • It can setup Singletons
  • It can setup Configuration values
  • It can setup Lazy evaluated Dependencies, Singletons or Configuration values
  • It can setup Named dependencies
  • It understands generic interfaces and implementations

What are its advantages?

  • Almost no XML configuration (the example given here is your template, you just have to change 1 line)
  • Uninvasive changes necessary to refactor out dependencies
  • Can be used for integration testing, by setting up a combination of dummy and real implementations under test
  • Promotes the use of modularity in the system structure
  • Its perfect for refactoring legacy code
  • Its perfect for making legacy code more testable

WinRDBI Syntax Highlighting on Notepad++ 2012-12-18

In this small guide, you will be guided in the steps to add Syntax Highlighting and Auto-Complete features for WinRDBI Relational Algebra for Notepad++.

Step 1: Create a new file called userDefineLang.xml in %APPDATA%\Notepad++\, and add to it the content of this gist.

Step2: Create a new file called winrdbi.xml in %PROGRAMFILES%\Notepad++\plugins\APIs\, and add to it the content of this gist.

Step3: If your background is white, the highlighting will look ugly, for that you need a dark theme for notepad, in order to activate a theme compatible with this Syntax Highlighter, you’ll have to create a file called Obsidian_mod.xml in %PROGRAMFILES%\Notepad++\themes\, and add to it the content of this gist.

Then enable Obsidian_mod in Notepad++: Settings -> Style Configurator -> Select theme: Obsidian_Mod