Tuesday, January 8, 2013

SharpSSH - OpenSSH for .NET and Make-it-so sln to makefile converter




Creating cross platform build automation for compiling C++ code on MSVC (MSBuild) and g++ (GCC) was the task at hand. On the agenda was how to invoke shell commands and scripts on a Linux machine, and how to securely transfer files to and from said machine. The answer is obvious ... SSH (Secure Shell). Well, when working on Linux and UNIX machines SSH is a native tool in your toolbox, this is not so when adjusting a Microsoft Team Foundation Server 2012 to perform these tasks. To the rescue comes SharpSSH , which is a pure .NET implementation of the SSH2 client protocol suite. It provides an API for communication with SSH servers and can be integrated into any .NET application. SharpSSH allows you to read/write data and transfer files over SSH channels using an API similar to JSch's API. In addition, it provides some additional  wrapper classes which offer even simpler abstraction for SSH communication. using this easy-to use library I was able to create a TFS Build workflow code activity and design the build process template to run Bash scripts, send the source code and get the build outputs from the target Linux machine. All this sounds rather simple ... well it wouldn’t had been compete without the icing on the cake ...  Make-it-so, that converts Visual Studio solutions to Linux gcc makefiles. It needed a few tweaks to fit to the format of VS2012 sln format, but it was worth every minute. During my work I used some manual tools to run tests manually like Putty and winscp, and custom executable I wrote from SharpSSH to run manually from PowerShell.
There was only one twitch I found in this, otherwise, us full handy tool. It sets its own default environment variables (like PATH) so things don't run as smoothly as you would have expected like with native ssh. Discovering this was not without its share of trouble, things started to go "south" when I tried using complex commands like sedgrepchmod and other native shell commands. Running the scripts manually turned a different result then via my SharpSSH client and it took me a while to try to look for the reason. In the end I, of course, found and fixed the issue.
Another useful tip when writing scripts for different platforms is that windows text editors hide special characters (like - for end of line and for backspace) and editing Bash scripts with any of those will usually case the script to fail :) (That’s why god invented  vi for). to sum things up, cross platform is as cool and fun as it is interesting and informative.
This solution may prove handy the next time you want to write g++ compatible c++ code and use the comfort of visual studio as you IDE... have the best of both worlds.
'till next time  ... be free
G.
 next ... CodeWeavers CrossOver and eclipse team explorer everywhere plug-in ,or maybe I'll conduct a comparison between remote PowerShell and SSH ... neh ... this is pointless.

Monday, January 7, 2013

Grawcho: searching for out of circulation IKEA product (TRO...

Grawcho: searching for out of circulation IKEA product (TRO...: does any one know of a way to get IKEA products that went out of circulation i bought some curtain rod's to make a  pseudo dark room dryer f...

searching for out of circulation IKEA product (TROLIG)

does any one know of a way to get IKEA products that went out of circulation i bought some curtain rod's to make a  pseudo dark room dryer for family photos.

and IKEA had stopped making them. i need a couple more (even used) to continue my project with them in an esthetically pleasing manner :)
rather then mixing, matching and \ or replacing all of them all together.
if you know of anyone that has one of them and is willing to give it up, please, let me know.
this it how it looks

G.