Saturday, November 7, 2015

Tuesday, October 27, 2015

Netcat testing port connectivity

-bash-4.1$ telnet  10.75.20.102 8471
Trying 10.75.20.102...
Connected to 10.75.20.102.
Escape character is '^]'.
^CConnection closed by foreign host.
-bash-4.1$ nc 10.75.20.102 8471

^C
-bash-4.1$ nc -vz 10.75.20.102 8471
Connection to 10.75.20.102 8471 port [tcp/pim-port] succeeded!
-bash-4.1$ 
Or in a loop
MBP:~ username$ for i in `seq 60 75`; do ssh username@mrh009$i.company.com 'nc -vz 10.75.20.102 8471'; done;
Connection to 10.75.20.102 8471 port [tcp/pim-port] succeeded!
Connection to 10.75.20.102 8471 port [tcp/pim-port] succeeded!
Connection to 10.75.20.102 8471 port [tcp/pim-port] succeeded!
Connection to 10.75.20.102 8471 port [tcp/pim-port] succeeded!
Connection to 10.75.20.102 8471 port [tcp/pim-port] succeeded!
Connection to 10.75.20.102 8471 port [tcp/pim-port] succeeded!
Connection to 10.75.20.102 8471 port [tcp/pim-port] succeeded!
Connection to 10.75.20.102 8471 port [tcp/pim-port] succeeded!
Connection to 10.75.20.102 8471 port [tcp/pim-port] succeeded!
Connection to 10.75.20.102 8471 port [tcp/pim-port] succeeded!
Connection to 10.75.20.102 8471 port [tcp/pim-port] succeeded!
Connection to 10.75.20.102 8471 port [tcp/pim-port] succeeded!
Connection to 10.75.20.102 8471 port [tcp/pim-port] succeeded!

Thursday, October 22, 2015

Installing authorized_keys over a range of hosts automatically

$ for i in `seq 60 75`; do ssh -o "StrictHostKeyChecking no" username@mrh009$i.host.com '[ ! -e .ssh ] &&  mkdir .ssh; echo "ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAIEArnIJhZCiJz8arKHd1C5gi2B7G22VuMeqDGcj8jv+sdfsdfsdfsdfsdfsdfsfdsfNBekqviSUFXiG1cBNpNxaAstOWyWmKaS1oefeNJ5waihlzR5V9QTTdBCrYavHj4viPMLWfm70eOhZhOzXQjl4x/xSrh/sadfasdfasdf= " > .ssh/authorized_keys && chmod 700 .ssh '; done;

Tuesday, August 4, 2015

External resources like XSD and taglib schema resolving behind the firewall can cause issues at runtime. In order to avoid these it would be wise to set the network proxy settings for each JVM.
-Dhttp.proxyHost=proxy.domain.net
-Dhttp.proxyPort=3128
-Dhttp.nonProxyHosts=domain.net|*.domain.biz

Monday, July 6, 2015

ssh-keygen without prompts and publishing known_hosts

Self provisioning PKI infrastructure and auto registration destination known_hosts

# Generating PKI for publishing the build
ssh-keygen -q -t dsa -N '' -f /opt/jenkins/.ssh/id_dsa

# Registering the mvndev.mycompany.com target
ssh-keyscan -H destination.com,10.76.20.41 >> /opt/jenkins/.ssh/known_hosts

Sunday, May 24, 2015

Openshift, Plackware and Dancer2 with Free account

 
 rhc app delete tmgt --confirm
 rhc app create tmgt -t https://raw.github.com/debug-ito/openshift-cartridge-plack/release_0.1.0/metadata/manifest.yml
Login on rhc and install the require perl modules like this:
export PERL_CPANM_OPT="-L $HOME/plack/local"
cpanm install Dancer2
cpanm install DBD::SQLite
cpanm install Starman --force
cpanm install Moose --force
cpanm install PDF::Reuse --force
cpanm install Date::Formatter --force
cpanm install Image::Info --force
cpanm String::CRC32 Math::Round Math::Polygon
cpanm Log::Log4perl Cache::FileCache

Repeat this command and the above statement to get your dependencies sorted out ...
 perl app.psgi
Next I had to add variables to find the config file... *plack_config.pl*
## This script is executed to set environment variables for control
## actions such as starting and stopping your app.

## See https://metacpan.org/pod/plackup for detail.

$ENV{PLACK_ENV} = "development";

## If you prefer Starman, for example, uncomment the following line
## and put "requires 'Starman';" into cpanfile.

$ENV{PLACK_SERVER} = "Starman";

$ENV{DANCER_CONFDIR} = $ENV{OPENSHIFT_REPO_DIR};

$ENV{PERL5LIB} = $ENV{OPENSHIFT_REPO_DIR} . "/lib:"  . $ENV{PERL5LIB} ;

Thursday, April 2, 2015

Importing XML file in an XML file...

up vote46down voteaccepted

You could use an external (parsed) general entity.

You declare the entity like this:
<!ENTITY otherFile SYSTEM "otherFile.xml">
Then you reference it like this:
&otherFile;
A complete example:
<?xml version="1.0" standalone="no" ?>
<!DOCTYPE doc [
<!ENTITY otherFile SYSTEM "otherFile.xml">
]>
<doc>
  <foo>
    <bar>&otherFile;</bar>
  </foo>
</doc>
When the XML parser reads the file, it will expand the entity reference and include the referenced XML file as part of the content.
If the "otherFile.xml" contained: <baz>this is my content</baz>
Then the XML would be evaluated and "seen" by an XML parser as:
<?xml version="1.0" standalone="no" ?>
<doc>
  <foo>
    <bar><baz>this is my content</baz></bar>
  </foo>
</doc>
A few references that might be helpful:

Friday, March 27, 2015

Using svn 1.8 in eclipse on Mac OS X

sudo -s
Create a symbolic link to your Xcode toolchain:
ln -s /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/ /Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.10.xctoolchain

Download SVN 1.8 sources

cd ~/Downloads/
curl -o subversion-1.8.9.tar.gz http://archive.apache.org/dist/subversion/subversion-1.8.9.tar.gz
tar -xvf subversion-1.8.9.tar.gz

Compile SVN 1.8 from sources

cd ~/Downloads/subversion-1.8.9
sh get-deps.sh serf
cd serf/
./configure
make
make install

export CC=/Applications/Xcode.app/Contents/Developer/Toolchains/OSX10.10.xctoolchain/usr/bin/cc
cd ..
./configure --prefix=/usr/local --enable-javahl --with-serf=/usr/local/serf

make 
sudo make install
make javahl
sudo make install-javahl

$ cd /Library/Java/Extensions
/Library/Java/Extensions $ sudo ln -sf /usr/local/lib/libsvnjavahl-1.dylib
/Library/Java/Extensions $ sudo ln -sf /usr/local/lib/libsvnjavahl-1.jnilib
/Library/Java/Extensions $ ls -l
total 16
lrwxr-xr-x  1 root  admin    35B 29 Jun 13:59 libsvnjavahl-1.dylib@ -> /usr/local/lib/libsvnjavahl-1.dylib
lrwxr-xr-x  1 root  admin    36B 29 Jun 13:59 libsvnjavahl-1.jnilib@ -> /usr/local/lib/libsvnjavahl-1.jnilib

Sunday, February 1, 2015

SQL Right Join

SQL RIGHT JOIN Keyword

The RIGHT JOIN keyword returns all rows from the right table (table2), with the matching rows in the left table (table1). The result is NULL in the left side when there is no match.

SQL RIGHT JOIN Syntax

SELECT column_name(s)
FROM table1
RIGHT JOIN table2
ON table1.column_name=table2.column_name;
or:
SELECT column_name(s)
FROM table1
RIGHT OUTER JOIN table2
ON table1.column_name=table2.column_name;
PS! In some databases RIGHT JOIN is called RIGHT OUTER JOIN.
SQL RIGHT JOIN

SQL Left Join

SQL LEFT JOIN Keyword

The LEFT JOIN keyword returns all rows from the left table (table1), with the matching rows in the right table (table2). The result is NULL in the right side when there is no match.

SQL LEFT JOIN Syntax

SELECT column_name(s)
FROM table1
LEFT JOIN table2
ON table1.column_name=table2.column_name;
or:
SELECT column_name(s)
FROM table1
LEFT OUTER JOIN table2
ON table1.column_name=table2.column_name;
PS! In some databases LEFT JOIN is called LEFT OUTER JOIN.
SQL LEFT JOIN


Friday, January 2, 2015

Recover from Eclipse crash.... copy paste

I encountered a horrible sight; eclipse would start and all of a sudden just crash. I first tried the obvious solution, to clean out the workspace.
./eclipse -clean
Nope, no go, still eclipse kept crashing. Ugh, I fell into despair, all those key-binds and spring templates, all gone. So, rationally I hopped on to #eclipse on irc.freenode.net to get some feed back on my situation. Rcjsuen was kind enough to provide the answer that would solve my problem. The solution was fairly straight forward. I had to remove org.eclipse.core.resources from my workspace.
cd ~/Documents/workspace/.metalog/.plugins
rm -rf  org.eclipse.core.resources
By removing org.eclipse.core.resources, you clear out all the project metadata from your workspace. However, don’t worry, once you start eclipse you can just go to “File -> Import -> import eclipse projects” and re-import all your workspace projects. If you do not see your projects just make sure your Deselect Working Sets