Mark Ashworth

Designing applications, writing, photography and reading

Visualize data and execution

The blog post has an amazing introduction on how a learning environment can show a budding developer the state and execution of a piece of code.

Website updated

The website over at has been updated with a new look and feel.

Duinsoft makes installing Oracle Java 7 easy on Linux Mint 13

I needed Oracle’s version of Java 7 so that I can develop with the JetBrains WebStorm IDE on my Mint Linux 13 box, and I found that the folks over at Duinsoft have made it real easy to do this.

The basic steps are:-

  • put the line
    deb debs all
    in the file /etc/apt/sources.list, either using Software Sources from your System Menu or by editing the file in an editor (as root)
    put this line in a file named (e.g.) duinsoft.list in the directory /etc/apt/sources.list.d
  • import the gpg key with the command (all on one line)
    sudo apt-key adv –keyserver –recv-keys 5CB26B26
  • enter the commands (two lines)
    sudo apt-get update
    sudo apt-get install update-sun-jre
    or use Synaptic to install the package
  • installation of the Runtime Environment will follow automatically

The page at Duinsoft details how to more control of the installation process.

Installing Apache Karaf features behind a firewall

Apache Karaf can either use :-

  • the proxy settings in the Maven settings.xml in the specific user’s .m2 directory running the Karaf instance
  • the proxy settings in the global settings.xml in the conf directory of the Maven installation
  • the mvn repository can be changed within Karaf to include a local Maven repository like Sonatype Nexus

To use the settings.xml file, specify the following in the file in the global conf directory or in the user’s .m2 directory.

<host>hostname or ip</host>

The approach that I prefer is to add the Sonatype Nexus public url to the list of repositories that Apache Karaf should use when resolving features. This allows all the developers in a team to utilize the same shared resource for resolving artifacts. Open the ${karaf install folder}\etc\org.ops4j.pax.url.mvn.cfg file and add the url to the org.ops4j.pax.url.mvn.repositories config item.

org.ops4j.pax.url.mvn.repositories= \
http://localhost:9091/nexus/content/groups/public, \, \, \, \
file:${karaf.home}/${karaf.default.repository}@id=systemrepo, \

YouTube Downloader commands

Download a video

Continue a previously cancelled download
youtube-dl -c

Request the file formats of the video
youtube-dl -F

Download the video in specified format
youtube-dl -f

Batch download
youtube-dl -a filename.txt

Batch download and use title in filename
youtube-dl -at filename.txt

Extract audio
youtube-dl –extract-audio
youtube-dl –audio-format mp3
youtube-dl –audio-quality 256k

Extract audio and keep the video
youtube-dl –audio-format mp3 –audio-quality 176 -k

cURL commands

1. Download a Single File
$ curl

2. Save the cURL Output to a file
-o (lowercase o) the result will be saved in the filename provided in the command line
-O (uppercase O) the filename in the URL will be taken and it will be used as the filename to store the result

$ curl -o mygettext.html
$ curl -O

3. Fetch Multiple Files at a time
$ curl -O URL1 -O URL2

4. Follow HTTP Location Headers with -L option
$ curl -L

5. Continue/Resume a Previous Download
curl -C - -O

6. Limit the Rate of Data Transfer
$ curl --limit-rate 1000B -O

7. Download a file only if it is modified before/after the given time
$ curl -z 21-Dec-11
$ curl -z -21-Dec-11

8. Pass HTTP Authentication in cURL
$ curl -u username:password URL

9. Download Files from FTP server
$ curl -u ftpuser:ftppass -O ftp://ftp_server/public_html/xss.php
$ curl -u ftpuser:ftppass -O ftp://ftp_server/public_html/

10. List/Download using Ranges
$ curl[a-z]/

11. Upload Files to FTP Server
$ curl -u ftpuser:ftppass -T myfile.txt
$ curl -u ftpuser:ftppass -T "{file1,file2}"
$ curl -u ftpuser:ftppass -T -

12. More Information using Verbose and Trace Option
curl -v

13. Get Definition of a Word using DICT Protocol
$ curl dict://

14. Use Proxy to Download a File
$ curl -x

15. Send Mail using SMTP Protocol
$ curl --mail-from --mail-rcpt smtp://

Excellent blog about resolving project dependencies into a Shrinkwrap archive for Arquillian. Now I just hope Pax Exam takes note for OSGi testing.

Exit Condition

The use case which lead to the birth of the ShrinkWrap project may be summed up: identify deployments for simplified integration testing.

So we built an API which made it easy to group resources together in a single deployable unit:

JavaArchive archive = ShrinkWrap.create(JavaArchive.class, "deployment.jar")
   .addClass(MyEjb.class, MyCdiBean.class);

Combined with the Arquillian Test Platform which deploys objects like the above into Application Servers, Servlet Containers, and IoC Containers, the result is a full integration test which writes and executes like a unit test.  This is the heart of the Arquillian component model.

ShrinkWrap excels at filing byte-based content into a tree structure; that’s all a virtual filesystem does (or should do!).  But for a long while now there’s been a divide which has made testing more complex deployments difficult: you might not always have the content you want to insert on-hand.  Consider the following use cases:

  1. A CDI bean which has…

View original post 638 more words

Adding Apache Shiro feature to Apache Karaf

Start Apache Karaf
cd bin
./karaf or karaf.bat

Adding a feature repository
feature:repo-add mvn:org.apache.shiro/shiro-features/1.2.1/xml/features

List features
shiro-core | 1.2.1 | | shiro-1.2.1
shiro-web | 1.2.1 | | shiro-1.2.1
shiro-aspectj | 1.2.1 | | shiro-1.2.1
shiro-cas | 1.2.1 | | shiro-1.2.1
shiro-ehcache | 1.2.1 | | shiro-1.2.1
shiro-quartz | 1.2.1 | | shiro-1.2.1
shiro-spring | 1.2.1 | | shiro-1.2.1

Install the feature
feature:install -v shiro-web

shiro-core | 1.2.1 | x | shiro-1.2.1
shiro-web | 1.2.1 | x | shiro-1.2.1
shiro-aspectj | 1.2.1 | | shiro-1.2.1
shiro-cas | 1.2.1 | | shiro-1.2.1
shiro-ehcache | 1.2.1 | | shiro-1.2.1
shiro-quartz | 1.2.1 | | shiro-1.2.1
shiro-spring | 1.2.1 | | shiro-1.2.1


It looks like there is a bug in Weld that causes the Conversation Scoped beans to by synchronized during creation.
Bug email url
Bug report url

Blog at

Up ↑