#> wget http://download.silicondust.com/hdhomerun/libhdhomerun_20130117.tgz
#> tar zxvf libhdhomerun_20130117.tgz
import 'dart:mirrors'; | |
class System { | |
static final Map<String, TController> _controllers = new Map(); | |
static final Map<String, TService> _services = new Map(); | |
static TController loadController(Symbol name) { | |
TController controller = _controllers[name]; | |
if (controller == null) { |
import javax.management.* | |
import javax.management.remote.* | |
def creds = [ 'username', 'password' ] as String[] | |
def env = [ (JMXConnector.CREDENTIALS) : creds ] | |
def serverUrl = 'service:jmx:rmi:///jndi/rmi://hostname:port/jmxrmi' | |
def server = JMXConnectorFactory.connect(new JMXServiceURL(serverUrl), env).MBeanServerConnection | |
new GroovyMBean(server, 'java.lang:type=Threading').dumpAllThreads(true, true).each { thread -> | |
println "THREAD: ${thread.threadName}" | |
} |
package com.znet.examples.sse; | |
import java.io.IOException; | |
import java.io.PrintWriter; | |
import java.util.concurrent.Callable; | |
import java.util.concurrent.ExecutorService; | |
import java.util.concurrent.Executors; | |
import java.util.concurrent.Future; | |
import javax.servlet.ServletConfig; |
/** | |
* Simple definition of a dynamic MBean, named "SimpleDynamic". | |
* | |
* The "SimpleDynamic" dynamic MBean shows how to expose for management | |
* attributes and operations, at runtime, by implementing the | |
* "javax.management.DynamicMBean" interface. | |
* | |
* This MBean exposes for management two attributes and one operation: | |
* - the read/write "State" attribute, | |
* - the read only "NbChanges" attribute, |
The following is an example workflow for developing on a temporary branch and merging back to the main branch squashing all commits into a single commit. This assumes you already have a branch named branch-xyz
and have finished the work on that branch.
git checkout branch-xyz
The following code is day-to-day operations when working with 3 forks: an open source project, a local fork of that project, and a company fork of that project. The power of Git is remote aliases that allow you to work with all 3 forks in parallel in the same code base and instantly compare, push, merge, etc.
Setup:
#> git clone [url of local fork: ie: username/project]
#> cd project
#> git remote add project [url of project: ie: project/project]
#> git remote add company [url of company fork: ie: company/project]
File tmpDir = (File) servletContext.getAttribute(SERVLET_TMP_DIR); | |
if (tmpDir == null) { | |
throw new ServletException("Servlet container does not provide temporary directory"); | |
} | |
File workDir = new File(tmpDir, "classes"); | |
if (!workDir.mkdirs()) { | |
throw new ServletException("Unable to create classes temporary directory"); | |
} |
# control color output via ASCII codes for better visual aspsect in terminal | |
git config --global color.ui auto | |
# update line-ending support for win/unix cross-platform (cr/cflf) | |
# force to be LF in the repo (regardless of OS) | |
git config --global core.autocrlf input | |
# force windows t oconvert to platform on checkout and back on commit | |
git config --global core.autocflf true | |
# individually control portions of a file (patch mode) |
// anonymously invoke a closure into callable and submit to executor | |
// this fails w/o the explicit (Callable) since it converts it to Runnable | |
def executor = java.util.concurrent.Executors.newFixedThreadPool(5) | |
def future = executor.submit((java.util.concurrent.Callable) { | |
'TEST' | |
}) | |
assert('TEST' == future.get()) |