Pages

Wednesday, September 05, 2012

npm tips

Node Package Manager (npm) has some pretty cool functionality. Some of it is here for my own reference.

Install a package:
npm install

Install a package globally:
npm install -g

List all installed packages and their version
npm ls

Display current package version:
npm info version

Install all dependencies (from package.json):
npm install


Installing Forever on Fedora 17 Linux

Installing 'forever' package for Node.js turns out to be a bit more hassle than expected. The command is simple
npm install forever
npm install forever-monitor

However, more is required on Fedora 17:
yum install nodejs-waf
yum install waf
yum install nodejs-devel

Only now 'forever' package installation will go through.
I'm still getting errors installing forever-monitor.
Running 'forever' also results in an error:

module.js:337    throw new Error("Cannot find module '" + request + "'");          ^Error: Cannot find module './daemon.v0.6.18'    at Function._resolveFilename (module.js:337:11)    at Function._load (module.js:279:25)    at Module.require (module.js:359:17)    at require (module.js:375:17)    at Object. (/usr/lib/nodejs/forever/node_modules/daemon/lib/daemon.js:12:11)    at Module._compile (module.js:446:26)    at Object..js (module.js:464:10)    at Module.load (module.js:353:31)    at Function._load (module.js:311:12)    at Module.require (module.js:359:17) 

Tuesday, September 04, 2012

XMLRPC for JavaScript

As I'm looking for an XML RPC implementation in JavaScript, I'll post the findings on the topic here.

Starting from a question on Stack Overflow (link).

List of libraries:


  • Json XML RPC, http://code.google.com/p/json-xml-rpc/
    Not maintained any longer.
  • http://kuriositaet.de/javascript/jsxmlrpc.html
  • http://kuriositaet.de/javascript/xmlrpc.html
  • http://sourceforge.net/projects/jsxmlrpc/
  • http://www.zentus.com/js/xmlrpc.js.html
  • http://www.scottandrew.com/xml-rpc/
  • http://phpxmlrpc.sourceforge.net/jsxmlrpc/
    Last news posted on 5th of September, 2009.
  • http://www.vcdn.org/Public/XMLRPC/
  • http://mimic-xmlrpc.sourceforge.net/

A few Git tips

Synchronize with remote branch (master) - fetch remote code and merge with local (git fetch + git merge)
git pull
Update local version to master branch
git checkout master
The process when updating your fork of someone else's repository is described here. Basically, fetch changes from the original repository (upstream):
git fetch upstream
Merge the changes into local master branch:
git merge upstream/master
Push the changes to your remote repository (on GitHub). Easiest way on Windows is to use GitHub application.

Remove Git Explorer Extensions (Cheetah)

Installing different Git versions over time resulted in multiple "Git Init here" and related entries in Windows Explorer context menu. Removing Git Explorer Extensions - git cheetah - is relatively simple. Go to git-cheetah installation directory and unregister the dll:

C:\Program Files (x86)\Git\git-cheetah>regsvr32 -s -u git_shell_ext64.dll

You don't have to delete the dll. As soon as it is unregistered the entries will be gone from Windows Explorer.

Friday, August 31, 2012

Dropbox Public Folder

Dropbox, as almost everyone knows, offers sharing publicly available files from a Dropbox account. This means putting a file into the Public folder and it will be publicly available to anyone with the full URL of the file. It is a neat and convenient way to store certain files to be shared with friends or just anyone, including yourself when on a public computer. Even more important, there are situations when we lose our mobile device or access credentials to our email or similarly important accounts.
Since now Dropbox also offers 2-step authentication with Google Authenticator, I strongly suggest you use it to protect your online files. But, since this also complicates access when you don't have your access devices, Public folder can be used for quick access to the files you might need on the go. Use at your own risk, of course.
The link to my public folder is here.

Thursday, August 23, 2012

RDP for Linux

XRDP (link) is an Open Source RDP server for Linux. The installation on Fedora 17 is pretty straightforward:
  • yum install xrdp
To run it manually, use
  • xrdp
  • xrdp-sesman
However, it is probably a better idea to add it as a service so that it runs on boot:
systemctl enable xrdp.service
You can confirm that the service has been created by running 'Services' from the Applications menu.

Set the RDP client to use 24-bit color and it will happily connect from Windows to your Linux server!

To set a custom resolution after you connect, go to System Settings -> Display and set any desktop resolution you like.

I also tend to use Dvorak keyboard layout. Simply changing the keyboard layout to English(Dvorak) won't work unless it is also set with "setxkbmap dvorak".

Automatic Login with Putty

To automatically log in to a remote SSH server with Putty client (from Windows), do the following:

On the Client:

  • generate a new key with PuttyGen
    • save the private key into a .ppk file
    • copy the public key string from the text box at the top and paste into authorized_keys file on the server
  • In Putty Session, go to Connection->SSH->Auth and add the private key for authentication.
  • Run pageant and add the key file with the pass phrase to it.

On the Server:

  • in your ~/.ssh/ directory create authorized_keys file
  • chmod 600 authorized_keys
  • make sure that, in sshd_config, only authorized_keys file is used to check for allowed keys


Sources:
Putty public keys (link)
ssh authorized_keys (link)
How to fix "Server refused our key"; comments (link)
Store passwords in Putty (link)

Enabling SSH Server on Fedora 17

In order to connect to your Fedora 17 Linux box via SSH protocol the following steps are required.

SSHD package is installed by default. You need to start the daemon/service. With elevated privileges do the following:
To enable the service

$ systemctl enable sshd.service

Start service

$ systemctl start sshd.service

Now you can test sshd service by logging in from the local terminal (not remote one, yet) -> ssh localhost, or ssh .

After this is done, allow access to sshd through firewall.

$ system-config-firewall

Make sure port 22 is allowed for access. This was done by default in my case. Then, I had to add a new interface in the Trusted Interfaces. The mask I added was "em+" for all em devices. Then enable this interface.

After this, I could connect to port 22 from a remote Windows box.

Sources:
SSHD service (link)
Firewall Tip (link)

Friday, August 03, 2012

Merge/diff tool settings for TFS integration

Merge/diff tool settings for TFS integration

Beyond Compare

  • Instructions (link)

CodeCompare

  • Instructions (link)
Add "/environment=standalone" parameter to CodeCompare configuration in Visual Studio (Tools -> Options -> Source Control -> TFS Settings -> Configure User Tools) in order to open diff/merge in a standalone CodeCompare window rather than in Visual Studio. This is my preferred setting.