brew install poppler pdfunite input-1.pdf input-2.pdf input-3.pdf output.pdf
Search This Blog
Command line tool to join multiple pdf files into one on Mac OS X
Java: parse octal number from string and format string to represent octal number
int mode = Integer.parseInt("0644", 8); System.out.println(String.format("%04o", mode));
Split large file and assemble the parts
split -b 256mb large-file.tgz large-file.tgz.
cat large-file.tgz.* > /path/to/output/large-file.tgz
Thread-safe, fixed-size map remove the eldest element automatically
public static final int MAX_SIZE = 1000; Mapmap = Collections.synchronizedMap(new LinkedHashMap () { private static final long serialVersionUID = 12345L; @Override protected boolean removeEldestEntry(Entry eldest) { return size() > MAX_SIZE; } });
See also stackoverflow
- https://stackoverflow.com/a/28654664
- https://stackoverflow.com/a/1963881
Unlock Telstra 4G My Pocket WIFI LITE (ZTE MF90)
- Download and install the driver
- Download ZTE MF90 driver to a Windows 7 PC, extract the zip package
- Turn the device on, and connect it to Windows 7 PC via USB cable. It should detect the device and install the driver. For me it does not find the driver automatically. Instead it shows "ZTE xxx installation" unsuccessfully.
- Go to Control Panel then search and open Device Manager, you should see three unknown devices with name "ZTE xxx xxx xxx". Right click each unknown device, then select Update drivers, then select the directory where the ZTE MF90 driver was extracted to. NOTE: You need to update drivers for each unknown device.
- Download and run DCCRAP
- Google DCCRAP, download and make sure it does NOT contain virus (you can check the file using VirusTotal).
- Run DCCRAP on the Windows 7 PC, select ZTE data cards then Auto detect the device. Once the device is detected, you can click the Unlock button to unlock it.
- Set to use non-telstra APN
- Put a telstra sim into the device and turn it on
- Login the web portal in 192.168.0.1, using password: password
- Set apn to vfprepaymbb for Vodafone
Command to mount smb share on Mac OS X
enter password:
mkdir -p ~/smb-share mount_smbfs //'domain;user'@smb-server.your.org/smb-share ~/smb-shareor with password in command:
mkdir -p ~/smb-share mount_smbfs //'domain;user:password'@smb-server.your.org/smb-share ~/smb-share
Wrap Java as Mac App bundle
See https://github.com/federkasten/appbundle-maven-plugin
NOTE:
- dictionaryFile and iconFile must be in src/main/resources directory, their values in configuration must be only the file names (without path).
- jrePath must be absolute path.
generate Python API DOC using Sphinx
- Install Sphinx
- Run sphinx-quickstart to generate the doc source
cd /path/to/my-python-project mkdir doc cd doc sphinx-quickstart
autodoc: automatically insert docstrings from modules: Y
- edit conf.py, uncomment and modify the following lines(assume python modules are in ../src/):
import os import sys sys.path.insert(0, os.path.abspath('../src'))
- Run sphinx-apidoc to generate reST files for specified modules (in ../src/):
sphinx-apidoc -o . ../src
- Generate html api doc:
make html
Mediaflux Plugin Development: Create dataset from HTTP URL (with Basic Auth)
The example shows how to create a dataset asset from a password protected URL (Basic HTTP Auth).
Java: HTTP GET data from URL (with basic HTTP Auth)
The example shows how to do HTTP GET to download a file from URL. It also include an example to call Mediaflux client api to create a dataset from the url by piping the streams.
encode Base64 string in command line
- Encode base64 string:
echo -n Secret | base64
- Decode base64 string:
echo -n U2VjcmV0 | base64 -D
Note:
When encoding, -n must be specified. otherwise, a newline character will always be appended, which will cause unexpected result.See http://askubuntu.com/questions/694216/base64-encode-is-giving-ambigious-results
make Java HttpURLConnection support MKCOL PROFIND and other non-standard HTTP methods
private static void setRequestMethod(HttpURLConnection conn, String method) throws Throwable { try { conn.setRequestMethod(method); } catch (ProtocolException e) { Class<?> c = conn.getClass(); Field methodField = null; Field delegateField = null; try { delegateField = c.getDeclaredField("delegate"); } catch (NoSuchFieldException nsfe) { } while (c != null && methodField == null) { try { methodField = c.getDeclaredField("method"); } catch (NoSuchFieldException nsfe) { } if (methodField == null) { c = c.getSuperclass(); } } if (methodField != null) { methodField.setAccessible(true); methodField.set(conn, method); } if (delegateField != null) { delegateField.setAccessible(true); HttpURLConnection delegate = (HttpURLConnection) delegateField.get(conn); setRequestMethod(delegate, method); } } }
Multi-threading in Mediaflux Plugin Service
package wxyz.mf.plugin.services; import java.util.ArrayList; import java.util.Collection; import java.util.List; import java.util.Map; import arc.mf.plugin.PluginLog; import arc.mf.plugin.ServiceExecutor; import arc.xml.XmlDoc.Element; import arc.xml.XmlWriter; import wxyz.mf.plugin.util.MultiThreadPluginService; public class SvcTest extends MultiThreadPluginService<Integer> { private Interface _defn; public SvcTest() { _defn = new Interface(); } @Override public Access access() { return ACCESS_ACCESS; } @Override public Interface definition() { return _defn; } @Override public String description() { return "Test multithreading."; } @Override public String name() { return "omics.test"; } @Override protected void consume(ServiceExecutor executor, Integer input, PluginLog log) throws Throwable { Thread.sleep(1000); String uuid = executor.execute("server.uuid").value("uuid"); if (input == 15) { log.add(PluginLog.WARNING, "#8: Mock Exception for value 15."); throw new Exception("Mock Exception for value 15."); } System.out.println(Thread.currentThread().getName() + " consumed: " + input); System.out.println(Thread.currentThread().getName() + " uuid: " + uuid); } @Override protected Collection<Integer> produce(Element args, Inputs in, Outputs out, XmlWriter w, Map<String, Object> intermediateResults) throws Throwable { List<Integer> inputs = new ArrayList<Integer>(100); for (int i = 0; i < 20; i++) { inputs.add(i); } return inputs; } }
HTML table fill up the whole page
<table style="width:100%; height:100%; position:absolute; top:0; bottom:0; left 0; right:0;" border="0" cellspacing="1" cellpadding="3"> <tr id="content" style="height: 100%;"> <td align="center">Content</td> </tr> <tr id="footer" style="height:28px;"> <td align="center">footer</td> </tr> </table>
DICOM Modalities
Modality | Description |
---|---|
AR | Autorefraction |
ASMT | Content Assessment Results |
AU | Audio |
BDUS | Bone Densitometry (ultrasound) |
BI | Biomagnetic imaging |
BMD | Bone Densitometry (X-Ray) |
CR | Computed Radiography |
CT | Computed Tomography |
CTPROTOCOL | CT Protocol (Performed) |
DG | Diaphanography |
DOC | Document |
DX | Digital Radiography |
ECG | Electrocardiography |
EPS | Cardiac Electrophysiology |
ES | Endoscopy |
FID | Fiducials |
GM | General Microscopy |
HC | Hard Copy |
HD | Hemodynamic Waveform |
IO | Intra-Oral Radiography |
IOL | Intraocular Lens Data |
IVOCT | Intravascular Optical Coherence Tomography |
IVUS | Intravascular Ultrasound |
KER | Keratometry |
KO | Key Object Selection |
LEN | Lensometry |
LS | Laser surface scan |
MG | Mammography |
MR | Magnetic Resonance |
NM | Nuclear Medicine |
OAM | Ophthalmic Axial Measurements |
OCT | Optical Coherence Tomography (non-Ophthalmic) |
OP | Ophthalmic Photography |
OPM | Ophthalmic Mapping |
OPT | Ophthalmic Tomography |
OPV | Ophthalmic Visual Field |
OSS | Optical Surface Scan |
OT | Other |
PLAN | Plan |
PR | Presentation State |
PT | Positron emission tomography (PET) |
PX | Panoramic X-Ray |
REG | Registration |
RESP | Respiratory Waveform |
RF | Radio Fluoroscopy |
RG | Radiographic imaging (conventional film/screen) |
RTDOSE | Radiotherapy Dose |
RTIMAGE | Radiotherapy Image |
RTPLAN | Radiotherapy Plan |
RTRECORD | RT Treatment Record |
RTSTRUCT | Radiotherapy Structure Set |
RWV | Real World Value Map |
SEG | Segmentation |
SM | Slide Microscopy |
SMR | Stereometric Relationship |
SR | SR Document |
SRF | Subjective Refraction |
STAIN | Automated Slide Stainer |
TG | Thermography |
US | Ultrasound |
VA | Visual Acuity |
XA | X-Ray Angiography |
XC | External-camera Photography |
Modify Mediaflux mflux package to install it into non-default schema
- copy the mflux.zip from /opt/mediaflux/ext/packages/ to /tmp
cp /opt/mediaflux/ext/packages/mflux.zip /tmp/
mkdir /tmp/mfpkg; cd /tmp/mfpkg; unzip /tmp/mflux.zip
- edit __install.tcl file
vi /tmp/mfpkg/__install.tcl
# HTTP processors: if { [info exists host] } { if { [xvalue exists [http.processor.exists :host $host :url /mflux]] == "false" } { http.processor.create :host $host :app mflux :url /mflux :type asset :translate /www :authentication < :domain $domain :user $user > :view mflux-www } # Set the servlet entry points for the HTTP processors. http.servlets.set :host $host :url /mflux \ :servlet -path portal.mfjp -default true arc.mflux.main \ :servlet -path icon.mfjp arc.mflux.icon \ :servlet -path iptile.mfjp arc.mflux.image.pyramid.tile \ :servlet -path meta.mfjp arc.mflux.meta \ :servlet -path content.mfjp arc.mflux.content \ :servlet -path share.mfjp arc.mflux.share \ :servlet -path output.mfjp arc.mflux.session.output \ :servlet -path execute.mfjp arc.mflux.execute \ :servlet -path transcode.mfjp arc.mflux.transcode \ :servlet -path aterm.jar arc.mflux.aterm \ :servlet -path aar.jar arc.mflux.aar } else { if { [xvalue exists [http.processor.exists :url /mflux]] == "false" } { http.processor.create :app mflux :url /mflux :type asset :translate /www :authentication < :domain $domain :user $user > :view mflux-www } # Set the servlet entry points for the HTTP processors. http.servlets.set :url /mflux \ :servlet -path portal.mfjp -default true arc.mflux.main \ :servlet -path icon.mfjp arc.mflux.icon \ :servlet -path iptile.mfjp arc.mflux.image.pyramid.tile \ :servlet -path meta.mfjp arc.mflux.meta \ :servlet -path content.mfjp arc.mflux.content \ :servlet -path share.mfjp arc.mflux.share \ :servlet -path output.mfjp arc.mflux.session.output \ :servlet -path execute.mfjp arc.mflux.execute \ :servlet -path transcode.mfjp arc.mflux.transcode \ :servlet -path aterm.jar arc.mflux.aterm \ :servlet -path aar.jar arc.mflux.aar }
- Re-package:
cd /tmp/mfpkg; zip -r ../mflux-1.zip ./*
- Install the modified package in Aterm:
package.install :in file:/tmp/mflux-1.zip :arg -name host daris.vicnode.org.au
PPSR search from Australian govenment
The PPSR is used to find out if there's any money owing on a car, or if it's previously been written off.
https://transact.ppsr.gov.au/ppsr/QuickVINSearch
https://transact.ppsr.gov.au/ppsr/QuickVINSearch
Subscribe to:
Posts (Atom)