Friday, December 16, 2011

Debugging a node.js app in windows (no eclipse)

If you don’t want to install eclipse and google dev tools to debug your node.js app you may use node inspector which is a node.js app that resembles google chrome’s dev tools. You start your node app passing the –debug-brk (or –debug if you don’t care about the first lines of code) and then fire up node inspector and debug the app. I actually have node inspector running all the time and I simply refresh the webpage when I reload the application.

Happy debugging…

Thursday, December 15, 2011

strcasecmp: identifier not found when porting from linux to windows

Ever tried to port from linux to windows and got the :

error C3861: 'strcasecmp': identifier not found

The easiest workaround is to add a  conditional define (visual studio add the –D _WIN32 or _WIN64 depending your OS) and define the following mappings:

#if defined(_WIN32) || defined(_WIN64)
  #define snprintf _snprintf
  #define vsnprintf _vsnprintf
  #define strcasecmp _stricmp
  #define strncasecmp _strnicmp
#endif

Another common missing identifier is the Uint which can be solved adding:

#define uint=unsigned int

Debugging native node modules loading failure on windows

If you ever need to build a module that requires another library (e.g. openssl, ict, expat etc) you may receive an “Out of memory” error when you require the file. This is unfortunately a generic error on windows but you can fire up visual studio and debug node (attaching to a process) and you can can see there the exact system error number (sys_errno) by adding a breakpoint in deps\uv\src\win\error.c when uv translates the error code (uv_translate_sys_error).

Wednesday, December 14, 2011

Node.js modules cross platform compilation using gyp

Update: I have made a pull request where you can find the updated tools discussed in this article, located here
Node.js has been using waf (node-waf) to configure and build modules up to version 0.4. From v0.6 and on, the team has moved on to gyp (Generate Your Projects) which seems to be a bit more promising when it comes to cross platform compilation. This post shows how to create a simply gyp file to build your own custom native node.js modules and provides some scripts to automate the project generation process.

Friday, December 9, 2011

Building a simple native nodejs module on windows from command line

Setting up a visual studio project to just build a simple native hello world node module is an overkill and there is a simpler way to do that by using the visual studio command prompt directly. Here you may find the required commands you have to issue, plus a vcbuild.bat file that does the whole thing at once.

Building native modules for nodeJs 0.6+ with visual studio

Since version 0.6 node js supports windows native builds which allows the windows dev to use visual studio to build both nodejs and the modules. In order to make a simple node module in visual studio you will have to link the obj file with the node.lib file that is generated when you compile the nodejs on visual studio. Here is a detailed walkthrough on how to successfully build a native node module in visual studio 2010.

Tuesday, November 29, 2011

Big blue button RSL Error 1 of 4 / Error #2032

If you have this kind of problem you can read this article or simply:
cd /var/www/bigbluebutton/client/
sudo wget http://fpdownload.adobe.com/pub/swz/flex/4.5.0.20967/mx_4.5.0.20967.swz
sudo wget http://fpdownload.adobe.com/pub/swz/flex/4.5.0.20967/rpc_4.5.0.20967.swz
sudo wget http://fpdownload.adobe.com/pub/swz/tlf/2.0.0.232/textLayout_2.0.0.232.swz
sudo wget http://fpdownload.adobe.com/pub/swz/flex/4.5.0.20967/framework_4.5.0.20967.swz

This is a problem that may occur when the flash client tries to locate the RSL files (local intranet situations) and by downloading them in the bbb’s folder, the flash can safely failover to that location.

Saturday, October 15, 2011

Create user and db in MySQL for various apps

Working on a portal which requires the integration of various opensource applications, I had to install quite a few systems that require mysql databases. In order to keep a safe separation between these systems, one should create different users that will have access only to the specific database. This is a simple way to prevent losing all your databases in case of  the mishap when an attack is successful on a system and sql commands pass directly to the database (sql injection etc). This is a how-to create the new user, the new database and set the requested permissions.

Wednesday, September 28, 2011

Reset mysql 5.1 root pass

I had to install a couple of dbs on a mysql server which refused to recognize me as its root… I kept receiving the following not-so-friendly message:
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: YES)
As it turns out, something was messed up during the installation and mysql did not recognize the given root password (mistype perhaps?). Anyway, I had to reset the pass, and this is how I did it.

Install bigbluebutton 0.8 (BBB) on Ubuntu 11.04

I recently installed big blue button version 0.8 on Ubuntu 11.04 and I came up with some errors while installing. This post is the log of my actions that solved my problem.

Saturday, September 24, 2011

Word to CHM source code

I have just finished updating an old buggy sourceforge project and decided to share code and binaries. More over, I have written a nice post on why I had to update the project and how to use it to convert word to mobi files for kindle but thanks to Windows Live Writer (which crashed :-( ) I lost it all!

Friday, June 10, 2011

Securing Asp.net applications by hidding response header

Although it’s fairly obvious that a website is running asp.net (through session cookie and the viewstate) you may protect your server by removing a few response headers that advertise the iis and the asp.net version. The most common response headers you should remove are the following:
  • X-Powered-By:ASP.NET
  • X-AspNet-Version:*.*.*
  • Server:Microsoft-IIS/*.*

Sunday, February 27, 2011

Silverlight 1.1 Alpha Refresh patch to run after expiration date

Once upon a time I won a Silverlight coding competition by writing a simple game in Silverlight 1.1 Alpha Refresh. A few weeks ago a beta tester of my game requested to play with it, once more. Installing the redistributable (thanks god I keep an archive of these because I couldn’t find it on Microsoft’s site) I came up with a message box that said that this version has expired (the alpha version should expire on 1st nov 2007).

Tuesday, January 18, 2011

Integrating WSS 3.0 Document Library into an existing asp.net application. Setting up the authentication.

If you search around the net, you’ll most probably find a lot of articles discussing how to create windows sharepoint services (WSS) modules or even how to install WSS on top of existing web site. In my case, I have to create a document management system in an existing asp.net application. In order to do so, I will be using the office integration that is provided by the document library of WSS and will be writing custom forms to handle the rest of the gui.

Monday, January 17, 2011

Redirecting any unauthenticated requests to a login form located on another asp.net application

If you have configured forms authentication across multiple asp.net applications, you may want to force users to authenticate in a single signing form. To do so you may implement a simple HttpModule that will be handling the AuthenticateRequest and redirecting to the corresponding login form.

Configuring forms authentication across asp.net applications

In order to enable forms authentication across multiple asp.net application you will have to setup the forms authentication to specify the same name, protection and path among all the asp.net applications that will be collaborating.

Thursday, January 13, 2011

Asp.net HTTP module to force authenticate user via Basic WWW-Authenticate dialogue

Playing around with the available authentication methods I came up with a simple Http module that forces the browser to display the build in credentials form and authenticates the user by simply adding a line in the web.config file.