This guide will get you started using Spark on Heroku/Cedar. Spark is basically a clone of Sinatra for Java. 'Nuff said.
Create a single Java main class in src/main/java/HelloWorld.java
:
import static spark.Spark.*;
import spark.*;
SELECT DISTINCT lot_code | |
FROM current_inventory_levels as ia | |
WHERE ia.site_id = 48 AND ia.sku_id = 'null' AND ia.lot_code ILIKE '%%' AND ia.status = 1 | |
AND ia.location_id = '19080' | |
GROUP BY ia.sku_id, ia.lot_code, ia.expiry_date | |
HAVING sum(ia.each_quantity) > 0 | |
ORDER BY lot_code asc | |
LIMIT 10 |
A couple of things! I don't know why I put an exclamation point on the end of that, it wasn't as if that sentence was particularly noteworthy, or even a full sentence. It could be that I'm kind of in love with exclamation points. | |
(Here's the part where I digress and tell you a story about my childhoood. It's also the part where I tell you that sometimes I'm in a ridiculously silly and rambly entertain-myself-for-hours type of mood and fortunately/unfortunately for you this happens to be one of those times. That last sentence made me laugh but you won't get why until I tell you the story.) | |
When I was around 6 and had just started writing my own short stories for school, I thought that every sentence in the story had to be exciting and attention-grabbing. I wanted the reader hanging on my every word, itching to find out what happened to the hapless protagonist next. I decided that the best way to accomplish this was to incorporate an abundance of exclamation points (like, trillions of them) into the body of |
### ZSH | |
### Add one of these to your .zshrc | |
# Outputs a github link that you can click on to see the diff | |
devreview() { | |
if [[ -n $1 ]]; then | |
git log --pretty=oneline | egrep "Merge branch '${1}.*' into (dev|release|rails_3)" | awk '{print "https://github.com/nulogy/packmanager/commit/" $1}' | |
fi | |
} |
# Customize to your needs... | |
be() { | |
if [[ -a Gemfile ]]; then | |
bundle exec $* | |
else | |
command $* | |
fi | |
} | |
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND | |
16965 nulogy 18 0 2372m 1.5g 100 D 17 41.8 267:41.66 Rack: /data/nulogy/current | |
1466 nulogy 18 0 667m 527m 392 R 9 14.0 3:45.65 Rack: /data/nulogy/current | |
1457 nulogy 18 0 659m 523m 420 R 18 13.9 3:32.19 Rack: /data/nulogy/current | |
1460 nulogy 18 0 585m 451m 680 R 18 12.0 3:14.81 Rack: /data/nulogy/current | |
1407 nulogy 24 0 522m 344m 336 S 0 9.1 0:33.26 Passenger ApplicationSpawner: /data/nulogy/current | |
1463 nulogy 18 0 554m 316m 336 D 13 8.4 1:56.39 Rack: /data/nulogy/current | |
11549 nulogy 18 0 789m 178m 84 R 14 4.7 55:40.76 Rack: /data/nulogy/curren |
nulogy@tm22-s00081 ~ $ sudo /usr/sbin/passenger-status | |
----------- General information ----------- | |
max = 4 | |
count = 4 | |
active = 4 | |
inactive = 0 | |
Waiting on global queue: 2 | |
----------- Application groups ----------- | |
/data/nulogy/current: |
require 'benchmark' | |
require 'rubygems' | |
require 'bunny' | |
m = "<event> | |
<string1>123456790123456790123456790123456790</string1> | |
<string2>123456790123456790123456790123456790</string2> | |
<string2>123456790123456790123456790123456790</string2> | |
<string2>123456790123456790123456790123456790</string2> |
tm22-s00334 rabbitmq # ls -l | |
total 59624 | |
-rw-r--r-- 1 rabbitmq rabbitmq 0 Mar 27 03:10 [email protected] | |
-rw-r--r-- 1 rabbitmq rabbitmq 94393 Mar 27 03:10 [email protected] | |
-rw-r--r-- 1 rabbitmq rabbitmq 0 Mar 26 03:10 [email protected] | |
-rw-r--r-- 1 rabbitmq rabbitmq 51897 Mar 26 03:10 [email protected] | |
-rw-r--r-- 1 rabbitmq rabbitmq 20 Mar 27 03:10 [email protected] | |
-rw-r--r-- 1 rabbitmq rabbitmq 34326652 Mar 27 11:00 [email protected] | |
-rw-r--r-- 1 rabbitmq rabbitmq 32088122 Mar 27 03:10 [email protected] | |
-rw-r--r-- 1 rabbitmq rabbitmq 0 Mar 26 03:10 [email protected] |
class T | |
def initialize(&block) | |
self.class.send(:define_method, :runner, &block) | |
end | |
def do_stuff | |
self.runner do |thing| | |
puts thing | |
end | |
end |