11. May 2013

Edge – invoke PowerShell from NodeJS

Project Edge allows seamless integration of NodeJS and PowrShell.

Just install packages:

npm install edge
npm install edge-ps

Create NodeJS application which contains PowerShell code:

var edge = require('edge');

var hello = edge.func('ps', function () {/*
"PowerShell welcomes $inputFromJS on $(Get-Date)"
*/});

hello('Node.js', function (error, result) {
 if (error) throw error;
 console.log(result[0]);
});

Start application and you’ll get output

PowerShell welcomes Node.js on 05/11/2013 07:14:38

Project Edge also allows integration of NodeJS with other technologies (e.g. Python)

8. May 2013

Vim mode in Cloud9 IDE

Cloud9 IDE is cloud base IDE for NodeJS, Python, Ruby or PHP projects.

The cool thing about this IDE is that code editor has support for Vim mode (it also supports Emacs) :)

vim-cloud9

Go to View, Keyboard Mode and select Vim.

Voila you can use many Vim features, like indentation by >> or many others.

Here is offical video from Cloud9 Youtube channel:

26. November 2012

There is more to C and C++. Slides from talk at FI MUNI 2012

This year I had opportunity to speak at two courses at FI MUNI. Check out slides :)

There is more to C (PDF)

Libraries ant tools for C++ (PDF)

Source code of examples is at GitHub: github.com/georgik/fimuni-c-cpp-examples

3. November 2012

Cannot find module ‘couchapp’ – solution for Linux and Windows

It is possible to create HTML5/CouchDB application using Node.js with tool Couchapp.

You can find nice totorial at RelaxTV.

The first step: install Couchapp:

npm -g install couchapp

Now you have command couchapp and you can create boilerplate:

coachapp boiler blog

This works fine, but when you want to publish this application to CouchDB server you can see weird error:

PS C:\idea\couch\blog> couchapp push app.js http://localhost:5984/blog
module.js:340
 throw err;
 ^
Error: Cannot find module 'couchapp'
 at Function.Module._resolveFilename (module.js:338:15)
 at Function.Module._load (module.js:280:25)
 at Module.require (module.js:362:17)
 at require (module.js:378:17)
 at Object.<anonymous> (C:\idea\couch\blog\app.js:1:79)
 at Module._compile (module.js:449:26)
 at Object.Module._extensions..js (module.js:467:10)
 at Module.load (module.js:356:32)
 at Function.Module._load (module.js:312:12)
 at Module.require (module.js:362:17)

People at node.couchapp discussion suggest that you should set NODE_PATH. This path should point to the place where node stores modules. npm shows this path during installation of module.

Fix for Linux:

export NODE_PATH=/usr/local/lib/node_modules

Node is using little bit different storage on Windows, it stores data into ~\AppData\Roaming\npm.

Fix for Windows Powershell (ConEmu):

$env:node_path="$home\AppData\Roaming\npm\node_modules"

If you want to persist change for PowerShell, then you can put this line into: Documents\WindowsPowerShell\Microsoft.PowerShell_profile.ps1

5. August 2012

Console2 for Windows – semi-transparent NodeJS shell, PowerShell or cmd

Console2 is great little front-end for Windows. It makes PowerShell even more usable. It’s very flexible and you can configure console window to behave like terminal window on MacOS or Linux. It has also support for transparency. It’s simply great. No need to add any more words. Just try it.

I’d like to add few more hints.

Enable transparancy

  • Go to Settings – Appearance – More…
  • Select Window transparency – Alpha
  • Change alpha level of Active and Inacative window.

Result:

Copy on left mouse button click, paste on middle button click

Default configuration of mouse is not very useful. You have to press Shift and Left Mouse to select and copy text. Make small adjustment:

  • Settings – Hotkeys – Mouse
  • Change: Copy/clear selection to Left + Shift
  • Change: Select text to Left

Use Console2 as front-end for NodeJS

You can use Console2 to invoke also NodeJS shell. Just create Tab definition for NodeJS.

  • Go to Settings – Tabs
  • Add NodeJS and set Shell to: “C:\Program Files (x86)\nodejs\node.exe”

Create new Tab with NodeJS profile:

Awesome :)

  • Babel fish

      Translate from:

      Translate to:

  • Where’s the fish?

  • Further info

  • Badges

  • Video channel

  • Learning

    Grow your brain.
  • Tags

  • Topics

  • May 2013
    M T W T F S S
    « Feb    
     12345
    6789101112
    13141516171819
    20212223242526
    2728293031  
  • Comments