mounting VirtualBox shared folders - Windows guest

October 23rd, 2009

This will define the drive X as the shared foldernet use x: \\vboxsvr\<folder> where <folder> has been defined using the virtual box  guess additionswhile on the subject of VirtualBox  - this shows how to shrink the vdihttp://kakku.wordpress.com/2008/06/23/virtualbox-shrink-your-vdi-images-space-occupied-disk-size/

Removing ads for MSN messenger

February 8th, 2009

This explanation works well

 http://blog.leidegren.se/2007/06/ad-free-windows-live-messenger.html

 in a nutshell:

  • edit %SystemRoot%\system32\drivers\etc\hosts
  • add 0.0.0.0         rad.msn.com at the end
  • close MSN Messenger if open
  • from the command line: ipconfig /flushdns
  • open MSN Messenger

 enjoy.

Compiling OpenSSL programs with Visual Studio

October 21st, 2008

First, download the win32 OpenSSL development libraries for win32 from http://www.openssl.org
Then, add the relevant include and library paths to the project

Add the required libraries to the Linker->Input->Additional Dependencies. Specify Ws2_32.lib and the OpenSSL you’ll be using, e.g libcrypto.a libssl.a etc.

If you compile now, you’ll receive the following linker errors:


1>libcrypto.a(err_prn.o) : error LNK2019: unresolved external symbol __alloca referenced in function _ERR_print_errors_cb
1>libcrypto.a(cryptlib.o) : error LNK2001: unresolved external symbol __alloca
1>libcrypto.a(sha512.o) : error LNK2001: unresolved external symbol __alloca
1>libcrypto.a(bn_prime.o) : error LNK2001: unresolved external symbol __alloca
1>libcrypto.a(b_print.o) : error LNK2019: unresolved external symbol ___umoddi3 referenced in function _fmtint
1>libcrypto.a(bn_word.o) : error LNK2001: unresolved external symbol ___umoddi3
1>libcrypto.a(b_print.o) : error LNK2019: unresolved external symbol ___udivdi3 referenced in function _fmtint

This is because you also need to add  libgcc.a to the linker’s Additional Dependencies. You can get libgcc.a by installing mingw on your system (http://www.mingw.org). Don’t forget to add the path to libgcc.a in Linker->General->Additional Library Directories

Installing Opera on Ubuntu (Hardy)

August 27th, 2008

found the following information here

1. Add “deb http://archive.canonical.com/ubuntu feisty-commercial main” to /etc/apt/source.list

2. sudo apt-get update

3. sudo apt-get install opera

Some notes to myself and whoever might find this

August 8th, 2008

I’m mainly writing this as a reminder to myself:

This came in handy:

Determining plugin directory on Linux (From MozillaZine Knowledge Base)

Firefox installs a default plugin named “libnullplugin.so”. Finding it will reveal the location of the correct directory.

find / -name libnullplugin.so -print

[edit]

Fedora Core 3/4

Where Firefox has been installed with the FC3/FC4 distribution, /usr/lib/firefox-<version>/plugins where <version> is a numeric reference to the version e.g. /usr/lib/firefox-0.10.1/plugins

Also, on a different issue - installing X development library on ubuntu requires:

sudo apt-get libx11-dev

Great cross-platform lightweight thread library

November 27th, 2007

“All other things being equal, the simplest solution is the best.” - this is the essence of occams razor and the reason why I enjoy so much finding minimalist coding solutions that acheive the same functionality as unneccessarily large and complex frameworks.

This time, I would like to introduce a great, lightweight, intuitive, cross platform thread wrapper - libpsync. It is written by Benbuck Nason and can be downloaded from:

http://sourceforge.net/projects/libpsync/ 

 Enjoy !

Fixing intellisense on Visual Studio

November 27th, 2007

The information below is taken from an MSDN forum:

it is just the first search result I tried and it worked (actually the first part didn’t work but the second did), which is why I’m posting the information here:

Go to Tools->Import and Export Settings…Select Reset all settings.

I figured I didn’t have anything to lose, so selected to just reset settings, overwriting my current settings, but I imagine that saving the settings wouldn’t hurt anything.

I selected Visual C# Development settings, but i imagine (again) that the others would work equally well.

Hit Finish, and everything was fine.

If that doesn’t work, try going to:
\Program Files\Microsoft Visual Studio 8\Common7\IDE
and execute devenv /setup from the command line and try again.”

Loosely coupled software libraries

November 15th, 2007

As every good software developer knows, part of a good design is writing loosely coupled code. Having a set of discrete black boxes gives you a lots of advantages in debugging, unit testing, refactoring, stability, maintaining the code etc. etc.

However, for some reason this knowledge doesn’t seem to stop experienced software developers from writing tightly coupled software libraries.

What do I mean by tightly coupled software libraries ? Well, I’ll explain by an example: the other day I was looking for a simple cross platform C++ socket wrapper for the JNEXT project. It also had to have a license which is not too restrictive commercially (something like MPL,Boost,public domain etc).

With the richness of source code available on the Web you’d think this would be quite easy to find but all the socket wrappers I found were too heavy for what I needed. So I decided to take a look at one of the many good open source cross platform libraries available - ACE, Boost, Poco, PWLib and a few others. Don’t get me wrong - these libraries are great, but it is impossible to take a relevant cpp and header file from them and just add them to your project because they depend on too many other definitions in the library framework.

Sometimes you just need a specific functionality - It would be much easier if you could just select the source component you need without building a gigantic library and then linking it to your application which can on occasion lead to injecting your application with unnecessary bloat.

By the way - I did eventually find a great cross platform C++ socket wrapper with a very liberal license, so if you are looking for a wrapper like this, let me save you the time I’ve wasted:

http://www.msobczak.com/prog/bin/sockets.zip

The above link is from the home page of Maciej Sobczak and also has many other very useful and high quality C++ code and libraries available for downloading. The irony is that one of these quality libraries is SOCI (which is a superb database abstraction library) which I’ve already used in JNEXT for the SQLite plugin, which goes to teach you that if you find one gem at a site you should take the time to look for others…

From JS to OS…

September 4th, 2007

I’ve completed a first complete working and tested version of the JavaScript native extensions. It will soon be hosted and available for download at http://www.jnext.org (soon like in next week).

The jnext framework will enable to securely access local native OS resources such as sockets, files, databases or any thing else you can imagine via JavaScript from within a Web page in a browser.

The framework uses ActiveX on Windows IE and NPAPI for other browsers and platforms. It has been tested thoroughly on both Linux and Windows.

If there is any native function or class you wish to add support for from JavaScript, just write your own extension to jnext. As in the tradition of this site - the learning curve for adding your own extension is close to nothing - just copy the sample template code for a plugin and start implementing whatever you like, knowing you will then be able to use these extensions on any browser and any platform (any exceptions will quickly be dealt with).

Now is the time where I want to invite developers to write additional plugins (currently only async TCP sockets are implemented but I intend to add a new extension every couple of days, the next on my list being file and SQLite extensions.

The sky’s the limit here - the last gap in making JavaScript truly awesome has been bridged - knock yourself out… :-)

-Amnon

Loading functions from Windows DLLs and Linux Shared Libraries

August 27th, 2007

I wasted a lot of time today trying to understand why a certain code did not find a function (via the function name) in a shared object ( Linux equivalent of Windows DLLs ). The same code had no problem finding the function in the Windows DLL version. The function was a simple C function (although it was defined in a cpp file which contained som C++ class definitions and implementations)

If you encounter this problem, I’ll give you the short version of the story so you can carry on with your work without having to listen to boring war stories: When you compile a shared library with g++, and the C functions you export are defined within a cpp file that might also contain other C++ code, you have to wrap the exported C function definitions with an

extern “C” {

// … exported function definitions go here

}

otherwise the exported functions will get mangled by the compiler in the same way C++ methods do and the code that tries to find the function by its name will not find it.

Ok - boring war story comes here, continue only if you have nothing better to do:

After trying just about every relevant combination of g++ compiler flags, I eventually arrived at the conclusion that the name is either not exported at all or it is exported incorrectly. I had a suspicion that it might be due to g++ mangling the C function names. Searching the net I learned that the readelf utility can, among other things dump all the symbolic names exported by a shared library (yes, you already know this but I’m refreshing my Linux knowledge after a long break…). The function I was looking for was named “SetEventFunc” so I ran a :

readelf -s Sockets.o | grep SetEvent

sure enough - what was found was a function named: _Z12SetEventFuncPFvPKcE

no wonder the function was not found

I then wrapped the exported C functions in extern “C”, rebuilt the library and the next grep showed a clean SetEventFunc (as shown below)

Shared library mangled exports

I guess what threw me off was the fact that in Windows, the compiler (VS2005) doesn’t seem to mangle C style functions, even if they are declared in a C++ file, so the problem never came up in windows.

By the way - the screen shot above is my first screen shot on Linux, performed with the standard tools described here - I have to say that Linux in general and Ubuntu in particular are starting to grow on me. I’m writing this from a virtual VMWare Ubuntu desktop, but the more I use Ubuntu, the more I feel like making my Windows XP the VMWare guest OS instead of the VMWare hosting OS…