Play with Apache or nginx forwarding on Ubuntu 12.10

Posted on Thursday, March 21, 2013


I am still playing around with scala play so I may be mistaken in this idea… so take that into mind as I describe what I am doing…

I have a need to run multiple scala applications on the same server for different domain names.   I think I can do this if I have apache or nginx as the front end HTTP server sending the correct address to the correct scala play app.  I also need to run all of this on an ubuntu  12.10 server.

At any rate here is what I did to accomplish that.


Linux shuf command

Posted on Tuesday, March 12, 2013




At least 2-3 times a year I come across a very useful linux command line tool that I think to myself… "How did I not know about this tool, it's so useful!"

This is command 'shuf'  is  one of those tools.

The need


I was writing a simple bash script last night to simply use curl to test out a restful service I am working on.    It’s a restful service that accepts a POST of a JSON file.   I wanted some of the number values in the JSON post to be randomized,  something like 12.34   22.14  some floaty looking number within a narrow range.

Doing a quick google search I came across the command line tool shuf.

Here are a couple of main pages detailing shuf  http://linux.die.net/man/1/shuf [1]


Here are some basic examples of what it can do.


> shuf -i 10-20


Will generate a list of the integers 10 to 20 inclusive and shuffle them up.



Or for my purposes I just wanted 1 number


> shuf -i 10-20 -n 1



Does the same thing but returns you  a number in the shuffled list



> shuf -i 10-20 -n 3



Returns 3 numbers

For my base script I wanted to create a random number like 12.21  (it was not important that it be really random)



#!/bin/bash


for ((i = 0; i < 20; i++))
do
   num=`shuf -i 1-20 -n 1`.`shuf -i 1-99 -n 1`
   echo $num
done






Here are the results of the program running.


[1]        shuf(1) - Linux man page
                Accessed 03/2013
[2]        shuf — generate random permutations
                Accessed 03/2013

Quick EC2 Pricing Chart 03-09-2013

Posted on Saturday, March 9, 2013



These prices were updated 03-09-2013

The change this go around was a drop in the yearly contracts for some of the ec2 instance types.    Anywhere from 13-23% savings.


Scala Hello World

Posted on Monday, March 4, 2013



This is just a real quick Scala HelloWorld program.  I am going to install Scala on my Windows 7 box and on an ubuntu server I have handy.


Install Scala on Win 7


In this section I will go over installing Scala in a Windows 7 environment.

First we need to download  Scala for windows

Go to http://www.scala-lang.org/downloads and download scala.


Installing Java 7 on ubuntu 12.10

Posted on Friday, March 1, 2013



This post has an error its been superseded by this post
http://www.whiteboardcoder.com/2013/08/installing-java-7-on-ubuntu-1210-fixed.html

Here are the commands to install Java 7 from Ubuntu 12.04 server.


>  sudo apt-get purge openjdk*
>  sudo apt-get install python-software-properties
>  sudo add-apt-repository ppa:webupd8team/java
>  sudo apt-get update
>  sudo apt-get install oracle-java7-installer
>  java -version









References
NA