Wednesday
May222013

Javascript - arrayfilter

Not at all a non-trivial example of javascript, but rather something I seem to do from time to time. Especially manipulating data from object graphs received over the wire of a variety of services, or even dom node collection. The gist here is to demonstrate how simple it is to implement a common filtering function in JavaScript, and continue my efforts in language cross-examination. Definately, do not re-invent this wheel. It also wont hurt to just use jquery.grep.


Saturday
May182013

Ruby function to pivot sort an array of integers

This source may not reflect properly:  A follow-up post will handle this issue.

Thursday
May162013

Groovy single linked list reversal

Its Thursday, May 16, 2013. This is a multi language code exercise I have started doing in order to sharpen my polyglot code abilities.  In these instances,  I will be providing implementation of some standard CS algorithm in a new language, every day. Today I have chosen Groovy because of a grails project which I have started that took me in this direction. I'll try to find better fit algorithms to maximise language expressions as to walk away with a better understanding after every implementation.

Now here is the code to reverse a custom single linked list:

 

 

Sunday
Feb242013

A great article on STS and Cloud Foundry

This article takes you through the steps of sign-in, configuring, writing and deploying a small web application to SpringSource's Cloud Foundry (PAAS) service. But to get started, you will need to obtain Spring Tool Suite (STS), an Eclipse distribution that comes pre-tooled with Spring-Framework specific componentry.


Link to Blog Post.

Sunday
Feb242013

Cloud Foundry Access Through Caldecott

This is a brief introduction/summary of the Caldecott tool as part of the Cloud Foundry stack.

Caldecott is the ‘proxying’ tunnel program which sits as a deployment in your Cloud hypervisor. Its job is to tunnel traffic between your CF deployment and your local workstation (both are possibly running behind firewalls, and other odd-sorts of network infra). It is invoked through the ‘vmc tunnel’ command which does the heavy lifting of negotiating the session.

Lets say you have CF provisioned with postgresql with instance id ‘postgresql-12345’ and want to access this instance from your workstation to perform backup or initialization. It’s really transparent in how vmc creates the tunnel, just issue a command ‘vmc tunnel postgresql-12345’ and viola!  Caldecott gets deployed into your remote CF then a local port is opened to direct traffic ala’ ip-tunnel to that Caldecott instance. An (interactive) password must also be given so that future connections are protected.

This tunnel invocation connects your local client with the postgres service running on the CF.  It executes a specific client (e.g. psql  -h .. -p .. -d …) command as you would from the command line, which can be duplicated from another local shell.  Additionally, you may setup other clients to access a database in any manner by employing the username/password/db parameters that vmc listed as it was creating the tunnel.


e.g

JDBC can similarly connect through a URL (given port 10001 was used)

jdbc:postgresql://localhost:10001/de1a2b6b327bd4bba95e74893ef8b62f1?user=u37be048a9ef9485a8b2abe20ab2b2b82&password=pbe1977779ddf406586429aaa28fc5f88

This gives only temporary access as the user/password combination changes between vmc logins.  You would ordinarily use this for ad-hoc use-cases where one were initializing a DB, performing one-time queries, or as in the case stated above - making a backup. That pretty much sums up with as little detail as possible how the Caldecott tool provides coverage for network access to your CF instance from afar, without additional infrastructure negotiation.  I hope to see updates in this journal as I discover new things by you, or myself.  Please provide any feedback as I am very appreciative for corrections, embellishments, and suggestion.