pax -r < archive.paxThe Wikipedia page for the pax command is a useful source of example usage:
http://en.wikipedia.org/wiki/Pax_%28Unix%29
pax -r < archive.paxThe Wikipedia page for the pax command is a useful source of example usage:
$ git clone git@github.com:cdpjenkins/hello-clojure.git Cloning into 'hello-clojure'... remote: Counting objects: 22, done. Receiving objects: 100% (22/22), done. Resolving deltas: 100% (5/5), done. remote: Total 22 (delta 0), reused 0 (delta 0) Checking connectivity... done.This is the same Hello World app that featured in the previous blog post with one addition made to the project.clj:
(defproject hello-clojure "0.1.0-SNAPSHOT" :description "FIXME: write description" :url "http://example.com/FIXME" :dependencies [[org.clojure/clojure "1.5.1"] [compojure "1.1.6"] [javax.servlet/servlet-api "2.5"]] :plugins [[lein-ring "0.8.11"]] :ring {:handler hello-clojure.handler/app :uberwar-name "hello-clojure.war"} :profiles {:dev {:dependencies [[ring/ring-jetty-adapter "1.1.0"] [ring-mock "0.1.5"]]}} :min-lein-version "2.0.0")I've added an
uberwar-name
key to the :ring
section. This is the name of the generated WAR file that we'll generate. Also note that the version of lein-ring must be at least 0.8.11 in order to generate a conformant WAR in order to work with the Liberty buildpack.ring uberwar
task to generate our WAR file.$ lein ring uberwar Created /Users/cdpj/GitProjects/hello-clojure/target/hello-clojure.war ENDRecall that an uberwar is a WAR file that bundles our webapp together with all of the dependencies.
$ cf login API endpoint: https://api.ng.bluemix.net Email> <snip>@uk.ibm.com Password> Authenticating... OK Targeted org <snip>@uk.ibm.com Targeted space dev API endpoint: https://api.ng.bluemix.net (API version: 2.4.0) User: <snip>@uk.ibm.com Org: <snip>@uk.ibm.com Space: devFinally, it's a relatively simple matter to push our WAR to Bluemix. Note that this time, we don't use -b to specify a buildpack (since the WebSphere Liberty buildpack is built in to Bluemix). In addition, we use -p to specify the path of the artefact that we want to push, in this case the WAR file.
$ cf push hello-again-clojure -p target/hello-clojure.war Creating app hello-again-clojure in org <snip>@uk.ibm.com / space dev as <snip>@uk.ibm.com... OK Creating route hello-again-clojure.mybluemix.net... OK Binding hello-again-clojure.mybluemix.net to hello-again-clojure... OK Uploading hello-again-clojure... Uploading app files from: target/hello-clojure.war Uploading 5.2M, 812 files OK Starting app hello-again-clojure in org <snip>@uk.ibm.com / space dev as <snip>@uk.ibm.com... OK -----> Downloaded app package (5.0M) -----> Liberty buildpack is starting to compile the droplet -----> Buildpack Version: v1.4-20140908-1803 -----> Retrieving IBM 1.7.1 JRE (ibm-java-jre-7.1-1.0-pxa6470_27sr1fp2-20140828_01-sfj.tgz) ... (0.0s) -----> Retrieving com.ibm.ws.liberty-2014.9.0.0-201409081803.tar.gz ... (0.0s) Installing archive ... (1.4s) -----> Liberty buildpack has completed the compile step -----> Uploading droplet (109M) 0 of 1 instances running, 1 starting 0 of 1 instances running, 1 starting 0 of 1 instances running, 1 starting 1 of 1 instances running App started Showing health and status for app hello-again-clojure in org <snip>@uk.ibm.com / space dev as <snip>@uk.ibm.com... OK requested state: started instances: 1/1 usage: 1G x 1 instances urls: hello-again-clojure.mybluemix.net state since cpu memory disk #0 running 2014-09-24 10:15:09 PM 0.0% 116.5M of 1G 149.4M of 1G
(defn my-function [message] (println "The message is: " message))I turn the org-mode source into HTML by hitting C-c C-e (to execute org-export) and then I hit H to put the resulting export into a new buffer. It's then easy to copy the contents into Blogger's raw HTML view.
java.lang.NoClassDefFoundError: javax/servlet/http/HttpServletRequest, compiling:(ring/middleware/multipart_params.clj:39:5)
$ brew tap pivotal/tap Cloning into '/usr/local/Library/Taps/pivotal/homebrew-tap'... remote: Reusing existing pack: 200, done. remote: Total 200 (delta 0), reused 0 (delta 0) Receiving objects: 100% (200/200), 30.78 KiB | 0 bytes/s, done. Resolving deltas: 100% (101/101), done. Checking connectivity... done. Tapped 7 formulae
$ brew install cloudfoundry-cli ==> Downloading https://cli.run.pivotal.io/stable?release=macosx64-binary&versio ######################################################################## 100.0% /usr/local/Cellar/cloudfoundry-cli/6.2.0: 2 files, 18M, built in 26 secondsOnce the Cloud Foundry CLI tools is installed, you can run the cf command to interact with Bluemix. First, let's point it at the Bluemix API (note to any IBMers who are using the IBM internal Bluemix: your API endpoint will be different to this):
$ cf api https://api.ng.bluemix.net Setting api endpoint to https://api.ng.bluemix.net... OK API endpoint: https://api.ng.bluemix.net (API version: 2.2.0) Not logged in. Use 'cf login' to log in.... and log in using your IBM ID:
$ cf login API endpoint: https://api.ng.bluemix.net Email> xxxx@xxxx.com Password> Authenticating... OK ...<snip>Having done that, we need an app. Let's create Clojure web application using the leiningen compojure template:
$ lein new compojure hello-clojureLet's check out the contents of our project.clj:
(defproject hello-clojure "0.1.0-SNAPSHOT" :description "FIXME: write description" :url "http://example.com/FIXME" :dependencies [[org.clojure/clojure "1.5.1"] [compojure "1.1.6"]] :plugins [[lein-ring "0.8.11"]] :ring {:handler hello-clojure.handler/app} :profiles {:dev {:dependencies [[javax.servlet/servlet-api "2.5"] [ring-mock "0.1.5"]]})Check that the version of lein-ring is at least 0.8.11 because this will make our life easier if we want to run an uberwar of our webapp on Bluemix at a later date.
web: lein trampoline ring server-headless ${PORT}We also need to specify :min-lein-version "2.0.0" in order to require the use of Leiningen 2. Edit project.clj to look like this:
(defproject hello-clojure "0.1.0-SNAPSHOT" :description "FIXME: write description" :url "http://example.com/FIXME" :dependencies [[org.clojure/clojure "1.5.1"] [compojure "1.1.6"]] :plugins [[lein-ring "0.8.11"]] :ring {:handler hello-clojure.handler/app} :profiles {:dev {:dependencies [[javax.servlet/servlet-api "2.5"] [ring-mock "0.1.5"]]}} :min-lein-version "2.0.0")We can now push our app to Bluemix. In this example, I'm giving it the name hello-clojure. If you try this out while my app is still live, you'll need to give your app a different name.
$ cf push hello-clojure -b https://github.com/heroku/heroku-buildpack-clojure.git Creating app hello-clojure in org cdpjenkins@gmail.com / space dev as cdpjenkins@gmail.com... OK Creating route hello-clojure.mybluemix.net... OK Binding hello-clojure.mybluemix.net to hello-clojure... OK Uploading hello-clojure... Uploading app files from: /Users/cdpj/hello-clojure Uploading 1.6M, 773 files OK Starting app hello-clojure in org cdpjenkins@gmail.com / space dev as cdpjenkins@gmail.com... OK -----> Downloaded app package (904K) Cloning into '/tmp/buildpacks/heroku-buildpack-clojure'... -----> Installing OpenJDK 1.6...done -----> Installing Leiningen Downloading: leiningen-2.4.2-standalone.jar Writing: lein script -----> Building with Leiningen Running: lein with-profile production compile :all (Retrieving lein-ring/lein-ring/0.8.11/lein-ring-0.8.11.pom from clojars) (Retrieving org/clojure/clojure/1.2.1/clojure-1.2.1.pom from ) (Retrieving org/clojure/data.xml/0.0.6/data.xml-0.0.6.pom from ) (Retrieving org/clojure/pom.contrib/0.0.25/pom.contrib-0.0.25.pom from ) (Retrieving org/sonatype/oss/oss-parent/5/oss-parent-5.pom from ) (Retrieving org/clojure/clojure/1.3.0/clojure-1.3.0.pom from ) (Retrieving leinjacker/leinjacker/0.4.1/leinjacker-0.4.1.pom from clojars) (Retrieving org/clojure/core.contracts/0.0.1/core.contracts-0.0.1.pom from ) (Retrieving org/clojure/pom.contrib/0.0.26/pom.contrib-0.0.26.pom from ) (Retrieving org/clojure/core.unify/0.5.3/core.unify-0.5.3.pom from ) (Retrieving org/clojure/clojure/1.4.0/clojure-1.4.0.pom from ) (Retrieving org/clojure/data.xml/0.0.6/data.xml-0.0.6.jar from ) (Retrieving org/clojure/clojure/1.2.1/clojure-1.2.1.jar from ) (Retrieving org/clojure/core.unify/0.5.3/core.unify-0.5.3.jar from ) (Retrieving org/clojure/core.contracts/0.0.1/core.contracts-0.0.1.jar from ) (Retrieving lein-ring/lein-ring/0.8.11/lein-ring-0.8.11.jar from clojars) (Retrieving leinjacker/leinjacker/0.4.1/leinjacker-0.4.1.jar from clojars) (Retrieving org/clojure/clojure/1.5.1/clojure-1.5.1.pom from ) (Retrieving compojure/compojure/1.1.6/compojure-1.1.6.pom from clojars) (Retrieving org/clojure/core.incubator/0.1.0/core.incubator-0.1.0.pom from ) (Retrieving org/clojure/pom.contrib/0.0.20/pom.contrib-0.0.20.pom from ) (Retrieving org/clojure/clojure/1.3.0-alpha5/clojure-1.3.0-alpha5.pom from ) (Retrieving org/clojure/tools.macro/0.1.0/tools.macro-0.1.0.pom from ) (Retrieving clout/clout/1.1.0/clout-1.1.0.pom from clojars) (Retrieving ring/ring-core/1.2.1/ring-core-1.2.1.pom from clojars) (Retrieving org/clojure/tools.reader/0.7.3/tools.reader-0.7.3.pom from ) (Retrieving ring/ring-codec/1.0.0/ring-codec-1.0.0.pom from clojars) (Retrieving commons-codec/commons-codec/1.6/commons-codec-1.6.pom from ) (Retrieving org/apache/commons/commons-parent/22/commons-parent-22.pom from ) (Retrieving org/apache/apache/9/apache-9.pom from ) (Retrieving commons-io/commons-io/2.4/commons-io-2.4.pom from ) (Retrieving org/apache/commons/commons-parent/25/commons-parent-25.pom from ) (Retrieving commons-fileupload/commons-fileupload/1.3/commons-fileupload-1.3.pom from ) (Retrieving org/apache/commons/commons-parent/28/commons-parent-28.pom from ) (Retrieving org/apache/apache/13/apache-13.pom from ) (Retrieving commons-io/commons-io/2.2/commons-io-2.2.pom from ) (Retrieving org/apache/commons/commons-parent/24/commons-parent-24.pom from ) (Retrieving clj-time/clj-time/0.4.4/clj-time-0.4.4.pom from clojars) (Retrieving joda-time/joda-time/2.1/joda-time-2.1.pom from ) (Retrieving org/clojure/core.incubator/0.1.0/core.incubator-0.1.0.jar from ) (Retrieving org/clojure/tools.macro/0.1.0/tools.macro-0.1.0.jar from ) (Retrieving org/clojure/tools.reader/0.7.3/tools.reader-0.7.3.jar from ) (Retrieving commons-codec/commons-codec/1.6/commons-codec-1.6.jar from ) (Retrieving org/clojure/clojure/1.5.1/clojure-1.5.1.jar from ) (Retrieving commons-io/commons-io/2.4/commons-io-2.4.jar from ) (Retrieving commons-fileupload/commons-fileupload/1.3/commons-fileupload-1.3.jar from ) (Retrieving joda-time/joda-time/2.1/joda-time-2.1.jar from ) (Retrieving compojure/compojure/1.1.6/compojure-1.1.6.jar from clojars) (Retrieving clout/clout/1.1.0/clout-1.1.0.jar from clojars) (Retrieving ring/ring-codec/1.0.0/ring-codec-1.0.0.jar from clojars) (Retrieving clj-time/clj-time/0.4.4/clj-time-0.4.4.jar from clojars) (Retrieving ring/ring-core/1.2.1/ring-core-1.2.1.jar from clojars) Compiling hello-clojure.handler -----> Uploading droplet (68M) 0 of 1 instances running, 1 starting 0 of 1 instances running, 1 starting 1 of 1 instances running App started Showing health and status for app hello-clojure in org cdpjenkins@gmail.com / space dev as cdpjenkins@gmail.com... OK requested state: started instances: 1/1 usage: 1G x 1 instances urls: hello-clojure.mybluemix.net state since cpu memory disk #0 running 2014-07-01 10:28:01 PM 0.0% 377.9M of 1G 173.6M of 1G
(defn cheese-ston [a b] (println a b))The first step is to install htmlize. I've already got MELPA added so I just install the htmlize package from that.
(setq htmlize-output-type 'inline-css)Next, I highlight the code that I want to export and then do:
M-x htmlize-regionThis gives me a new buffer with a complete HTML file containing my text, wonderfully highlighted. I can then copy everything within the body of that HTML page into the raw HTML editor in Blogger:
<pre> <span style="color: #707183;">(</span><span style="color: #a020f0;">defn</span> <span style="color: #0000ff;">cheese-ston</span> <span style="color: #7388d6;">[</span>a b<span style="color: #7388d6;">]</span> <span style="color: #7388d6;">(</span><span style="color: #483d8b;">println</span> a b<span style="color: #7388d6;">)</span><span style="color: #707183;">)</span></pre>Before switching back to the Compose view, I have to ensure that Blogger is not going to quote my HTML so I hit Options on the right and make sure that Show HTML literally is selected.