Run Static Files Locally Using Node.js

1. Install Node.js if you don’t have it already.

2. Install node-static.

> npm install -g node-static

3. Create a sample index.html you would like to serve.

4. Run static on the index.html directory.

> static
serving "." at http://127.0.0.1:8080

5. Open http://127.0.0.1:8080 in your favorite browser.


Connecting to Microsoft SQL Server using jTDS

Here’s how we are able to connect to Microsoft SQL Server using the jTDS JDBC driver. This is a local development environment using a newly installed SQL Server Express 2012.

1. Create the user with SQL Server authentication. Here we are using SQL Server Management Studio to create the new user “demo”.

Microsoft SQL server Login

Figure 1

Connecting to Microsoft SQL Server using jTDS - Fig 2

Figure 2

2. Make sure SQL Server supports both Windows and SQL Server authentication. Here we are using SQL Server Management Studio.

Connecting to Microsoft SQL Server using jTDS - Figure 3

Figure 3

Connecting to Microsoft SQL Server using jTDS - Figure 4

Figure 4

3. Enable TCP/IP for the database instance. Here we are going to use the SQL Server Configuration Manager.

Connecting to Microsoft SQL Server using jTDS - Figure 5

Figure 5

Connecting to Microsoft SQL Server using jTDS - Figure 6

Figure 6

4. Start the SQL Browser service. Go to Control Panel -> Administrative Tools -> Services and start the SQL Server Browser.

Connecting to Microsoft SQL Server using jTDS - Figure 7

5. Here are the JDBC parameters passed to jTDS.

url=jdbc:jtds:sqlserver://localhost:1433/MY_DATABASE;instance=MY_INSTANCE
driver=net.sourceforge.jtds.jdbc.Driver
user=MY_USERNAME
password=MY_PASSWORD

Please replace the MY_ variables with your own values.


How to Access Linux PostgreSQL Remotely

1. Login to your Linux box as user postgres.

> su postgres

2. If needed, create the user that needs remote access.

> createuser -W

3. Edit the PostgreSQL pg_hba.conf file. In our system, it’s under /var/lib/pgsql/data/.

> vi /var/lib/pgsql/data/pg_hba.conf

4. Append the following lines to pg_hba.conf. In this example, we are allowing remote access to all databases for user MYUSER with a 0.0.0.0/0 CIDR mask.

host all MYUSER 0.0.0.0/0 md5

5. Edit postgresql.conf and change the listen_addresses property.

> vi /var/lib/pgsql/data/postgresql.conf
listen_addresses='*'

6. Reload PostgreSQL for the changes to take effect. Here we are using the data directory /var/lib/pgsql/data.

> pg_ctl reload -D /var/lib/pgsql/data

7. Connect remotely to PostgreSQL using your favorite client, like pgAdmin III.