Feed aggregator

Not Even Apple Knows Swift Yet

Javalobby Syndicated Feed - Mon, 21-Jul-14 22:30
Rob Napier knows quite a bit about Objective-C, but as evidenced by this recent post, he doesn't know Swift. And more importantly, according to Napier, neither does anybody else - not even Apple. Preview Text:  Rob Napier knows quite a bit about Objective-C, but he doesn't know Swift. And more importantly, according to Napier, neither does...
Categories: Java

Taming Unexpected Production Issues

Javalobby Syndicated Feed - Mon, 21-Jul-14 22:30
You have unexplained production issues from time to time. The business is impacted and the management briefs down your neck while the pieces of the puzzle are collected. There is no way to recreate this on QA set-up. The issue is lurking there for quite a while and becoming more and more frequent. Sounds scarily familiar? Preview Text:  You have...
Categories: Java

Turnkey IaaS and PaaS: Business Benefits of Build vs. Buy

Javalobby Syndicated Feed - Mon, 21-Jul-14 22:20
 Jelastic CEO, John Derrick is a featured panelist in a webinar on July 22nd at 5:00:00 PM UTC.Open source platforms such as OpenStack, OpenShift, and Cloud Foundry have emerged as the best and brightest platforms for networking, data storage, compute horsepower, and secure distributed infrastructure needs of enterprises big and small. These tools provide tremendous flexibility through...
Categories: Java

Building GlassFish from Source

Javalobby Syndicated Feed - Mon, 21-Jul-14 22:15
IntroductionThis article will look at building Glassfish 4.0.1 from source and configuring NetBeans 8.0 to then use, modify, and debug it. While GlassFish can be downloaded ready for use, even coming bundled with NetBeans, there will be some among us who need (or just want) to build it from scratch. This build was conducted using a 64bit Linux Distro, JDK 1.7.0_55, Maven 3.2.1, and SVN...
Categories: Java

TokuDB Tips: MySQL Backups

Javalobby Syndicated Feed - Mon, 21-Jul-14 22:00
Originally by Vadim Tkachenko In my recent post, “TokuDB gotchas: slow INFORMATION_SCHEMA TABLES,” I saw a couple questions and tweets asking if we use TokuDB in production. Actually I mentioned it in that post and we also blogged about it in a couple of other recent posts: Preview Text:  In my recent post, “TokuDB gotchas: slow...
Categories: Java

Indexes and Selectivity

Javalobby Syndicated Feed - Mon, 21-Jul-14 22:00
Originally by Todd Greenstein Preview Text:  Indexes in Couchbase are a flexible means of performing back end processing. When utilizing indexes it's possible to create decision tree type aggregations and selectivity functionality, such as those found in an inventory control system. Legacy Sponsored:  ...
Categories: Java

Yet Another Cordova/PhoneGap Debugging Tip

Javalobby Syndicated Feed - Mon, 21-Jul-14 22:00
Want another way to debug Cordova/PhoneGap apps? This isn't new, but I tend to forget about this option and it came in handy yesterday so I thought I would share. When you send builds to the simulator/device via the command line, you may notice that at the end of all the output about building this and generating that, you get these two lines: Preview Text:  ...
Categories: Java

5 Reasons to Use a Java Data Grid in Your Application

Javalobby Syndicated Feed - Mon, 21-Jul-14 22:00
In this post we explore 5 reasons to use a Java Data Grid for caching Java objects in-memory in your applications. In a later post we will explore some of the other data grid capabilities, beyond data storage, that can revolutionize your Java architectures, like on-grid computation and events. Preview Text:  In this post we explore 5 reasons...
Categories: Java

Pre-filling Forms via Custom Bookmarklet- A CSS solution worth embracing

Javalobby Syndicated Feed - Mon, 21-Jul-14 22:00
Testing has always been and will continue to remain the number one priority of web developers engaged in the execution of different types of web development projects. Whether it's about performing manual testing or automated testing, web developers don't delay in spending a good duration of time on ensuring that the site renders a brilliant user experience. Unit and integration testing are great,...
Categories: Java

How to enter a Docker container

codecentric Blog - Mon, 21-Jul-14 05:51

In previous articles [1,2,3] Lukas Pustina has given an introduction to system-level virtualization with Docker. In this article I discuss 4 options how to connect to a running Docker container and interact with it. All code examples are available on GitHub so you can try yourself.

nsenter

The nsenter tool is part of the util-linux package since version 2.23. It provides access to the namespace of another process. nsenter requires root privileges to work properly. Unfortunately, util-linux is still at version 2.20 in Ubuntu 14.04. To install the latest version (2.24) proceed as follows:

cd /tmp
curl https://www.kernel.org/pub/linux/utils/util-linux/v2.24/util-linux-2.24.tar.gz | tar -zxf-
cd util-linux-2.24
./configure --without-ncurses
make nsenter
cp nsenter /usr/local/bin

In order to connect to a container, you have to find out the PID of the first process in the container.

docker inspect --format "{{ .State.Pid }}" <container-id>

With that PID you can connect to the container:

nsenter --target $PID --mount --uts --ipc --net --pid

nsinit

Since version 0.9 Docker offers its own library for managing containers called libcontainer. The tool nsinit of the libcontainer allows the user direct access to the linux namespace and cgroup kernel features. Before you can install nsinit you have to install the Go runtime environment:

apt-get install git golang-go
 
mkdir -p $HOME/go-dev/bin
mkdir -p $HOME/go-dev/src
 
echo "export GOPATH=\$HOME/go-dev" >> ~/.profile
echo "PATH=\$PATH:\$GOPATH/bin" >> ~/.profile
 
source ~/.profile

In a second step, you install nsinit:

mkdir -p $GOPATH/src/github.com/dotcloud
cd $GOPATH/src/github.com/dotcloud
 
git clone https://github.com/dotcloud/docker.git
cd $GOPATH/src/github.com/dotcloud/docker
 
/usr/bin/go get -v github.com/dotcloud/docker/vendor/src/github.com/docker/libcontainer/nsinit

nsinit reads the configuration data from the container directory located in /var/lib/docker/execdriver/native/<container-id>. In order to use nsinit you have to change into that container directory. This requires root privileges because the directory /var/lib/docker is only readable for root. The container id can be determined with the docker ps command. Once you stepped into the directory you can connect to the container:

nsinit exec /bin/bash

lxc(-attach)

Up to version 0.8.1 LXC was the base for Docker to manage containers and Docker still supports it. But since version 0.9.0 Docker uses libcontainer by default, cutting the dependency to LXC. Thus, you cannot use lxc-attach by default anymore.

If you still want to use lxc-attach you have to restart the Docker daemon with the -e lxc option. With this option Docker will use LXC under the hood again. The easiest way to do so, is to create the file /etc/default/docker (if it does not exist yet) and add the following line:

DOCKER_OPTS=”-e lxc”

Now you have to restart the Docker daemon. To connect to a container you need the full container id:

docker ps --no-trunc

Now you can connect to the container. For this to work, root privileges are needed again:

lxc-attach -n <container-id> -- /bin/bash

sshd

The three previous methods all require root privileges on the host system. To avoid that, accessing containers via SSH is a good alternative.

For that you need to build a base image supporting an SSH daemon. At this point we run into the problem that we can only execute one command with the Docker keywords CMD or ENTRYPOINT. If this were the sshd process we could not run any other process. A workaround is to create a script to start all necessary other processes or to use a process management tool like supervisord. There is excellent documentation on how to use supervisord on the Docker website. Once you have started a container with a sshd process, you can connect as usual with a ssh client.

Fazit

The sshd approach is probably the easiest one and the most users are accustomed to connect to a virtual machine via ssh. In addition, you also do not need root privileges in order to connect with a container. However, there are a lot of discussions [1,2] about whether a container should manage more than one process or not. In the end, you have one additional sshd process per container which is basically not the idea of ​​process virtualization.

For the other three options, root privileges are required. Docker has used LXC to manage its containers up to version 0.8.1. For this reason, it was pretty easy to use lxc-attach. Since version 0.9.0 the Docker daemon must be started with the option -e lxc for still using LXC under the hood. But with this option set, Docker relies on LXC again which might vary across distributions or installations.

nsenter and nsinit are basically equivalent. The main difference between both tools is that nsinit will setup a new process in the container and nsenter will just enter the namespace. Jerome Petazzoni has described it very well in the Docker Blog.

The post How to enter a Docker container appeared first on codecentric Blog.

Categories: Agile, Java, TDD & BDD

DZone's 200th Refcard Released: Java Performance Optimization

Javalobby Syndicated Feed - Mon, 21-Jul-14 00:00
Today, DZone released Refcard #200: Java Performance Optimization. To mark the significance of this milestone, this Refcard boasts a complete redesign - all the information you expect from a Refcard in a shiny new package! Take a look: Preview Text:  Today, DZone released Refcard #200: Java Performance Optimization. To mark the significance of this...
Categories: Java

Linking to Github

Javalobby Syndicated Feed - Sun, 20-Jul-14 23:00
It was rightly pointed out yesterday that it's dangerous to link to lines or blocks of code on Github without explicitly specifying the commit hash in the URL. On this theme, consider this git command: $ git browse -u -- commit/$(git rev-parse HEAD) https://github.com/tangentlabs/django-oscar/commit/17851d4b66922f8d7e203e2b469040690c84a0db Preview Text:  ...
Categories: Java

Spring MVC 3 View Controller Example

Javalobby Syndicated Feed - Sun, 20-Jul-14 23:00
When I was writing post on SpringMVC-Tiles3 integration, I used one controller method index() to just return to index.jsp view. It was very stupid way to write a method to just re-direct it to a view if you don’t have anything to do in controller. Preview Text:  Previously, I used one controller method index() to just return to index.jsp...
Categories: Java

Finding All the Red M&Ms: A Story of Indexes and Full‑Table Scans

Javalobby Syndicated Feed - Sun, 20-Jul-14 23:00
Originally written by Chris Saxon In this guest post, Chris Saxon explains a very important topic using an analogy with chocolates: When does a database use an index and when is it better not using it. Although Chris explanation has the Oracle database in mind, the principles apply to other databases too. Preview Text:  A common question that...
Categories: Java

DZone Research Cloud News Update (July 21)

Javalobby Syndicated Feed - Sun, 20-Jul-14 23:00
A lot has happened in the cloud industry since the release of our 2014 Cloud Platform Research Report in early March, which is why we are providing monthly industry news updates to keep our community truly updated. Here are the major happenings up through July 16th: Preview Text:  A lot has happened in the cloud industry since the release of our...
Categories: Java

What is Your Minimum Agile Reading List?

Javalobby Syndicated Feed - Sun, 20-Jul-14 22:30
In preparation for my talk, Agile Projects, Programs, and Portfolio Management: No Air Quotes Required, I have created a Minimum Reading List for an Agile Transition. Note the emphasis on minimum. I could have added many more books to this list. But the problem I see is that people don’t read anything. They think they do agile if they say they do agile. Preview Text:  ...
Categories: Java

R: ggplot: Problem automatically picking scale for difftime object

Javalobby Syndicated Feed - Sun, 20-Jul-14 22:30
While reading ‘Why The R Programming Language Is Good For Business‘ I came across Udacity’s ‘Data Analysis with R‘ courses – part of which focuses exploring data sets using visualisations, something I haven’t done much of yet. Preview Text:  I thought it’d be interesting to create some visualisations around the times that people...
Categories: Java

Introducing inefficiencies into RavenDB, on purpose

Javalobby Syndicated Feed - Sun, 20-Jul-14 22:30
Yes, I chose the title on purpose. The topic of this post is this issue. In RavenDB, we use replication to ensure high availability and load balancing. We have been using that for the past five years now, and in general, it has been great, robust and absolutely amazing when you need it. Preview Text:  The administrators on the server noted the high...
Categories: Java

Processing and Analyzing Sensor Data – A DIY Approach (Part II)

Javalobby Syndicated Feed - Sun, 20-Jul-14 22:30
In a recent Lab, we set up sensors in our office to collect our own machine-generated data (see this blog post). For the follow-up lab, our team split up into three groups. Two of us set out to implement a nice real-time visualization of our data, another colleague investigated and benchmarked different document schemas for storing time series data in MongoDB (see
Categories: Java

Are You Choosing the “Right” Components?

Javalobby Syndicated Feed - Sun, 20-Jul-14 22:30
[This article was originally written by Manfred Moser.] Preview Text:  All these and many other characteristics can influence your component choices. And while your decisions will change over time, the more information you have readily available to you when making these choices, the better off you will be. Legacy ...
Categories: Java

Thread Slivers eBook at Amazon

Syndicate content