import org.apache.http.client.methods.*; import org.apache.http.client.*; import org.apache.http.impl.client.*; import org.apache.http.*; import org.apache.http.entity.mime.*; import org.apache.http.entity.*; import java.io.*; public class API_H01 { public static void main (String args[]) { try { HttpClient client = HttpClientBuilder.create().build(); File f = new File(“/opt/tomcat8/hierarchy.csv”); MultipartEntityBuilder builder = MultipartEntityBuilder.create();…
Category: Development
Jython to call REST service and write output to a file
from org.apache.http.client.methods import * from org.apache.http.impl.client import * from org.apache.http.client import * from org.apache.http import * from org.json import * from java.io import * from java.util import * from java.lang import * client = HttpClientBuilder.create().build(); url = “https://host/api/invoices”; rq =…
Example of a structure in C
This is just a placeholder for how these work. Largely, this is the predecessor of object oriented programming in that a structure has properties that can be assigned. #include #include struct student { int studentId; char studentName[40]; …
java dynamic SQL formatter
import java.sql.*; public class dynColumns { public static void main(String[] args) { try { Connection con = DriverManager.getConnection(“jdbc:oracle:thin:” + args[0]); Statement stm = con.createStatement(); ResultSet rst = stm.executeQuery(args[1]); ResultSetMetaData rstMeta = rst.getMetaData(); int columns = rstMeta.getColumnCount(); while (rst.next()) { for…
Why can’t I truncate my active JBOSS server.log file?
If you find yourself in a position where it is 3AM and the filesystem on which your server.log file lives is full, you may issue some kind off redirect or “cat /dev/null > server.log”, or even “truncate –size=0 server.log”. After…
Does BlockingQueue.take() use CPU?
No… [root@cmhlcarchapp01 ~]# cat t.java import java.util.concurrent.*; public class t implements Runnable { static ArrayBlockingQueue Q = new ArrayBlockingQueue(5); String type; public static void main (String args[]) { t n = new t(“producer”); t n2 = new t(“consumer”); } public…
Python modules
Create an __init__.py file in each directory that will be in the tree of your import. For example, if you have the following directory structure… /opt/software/com/yourcompany/yourdivision/yourfile.py …you would issue the following commands: export PYTHONPATH=$PYTHONPATH:/opt/software touch /opt/software/com/__init__.py touch /opt/software/com/yourcompany/__init__.py touch /opt/software/com/yourcompany/yourdivision/__init__.py…
Flexibly instrumenting java with CPU utilization recordings
Each of these has their own set of strengths, and is appropriate for differing and sometimes similar requirements. What each of them lack is the ability to flexibly, easily, and succinctly report on CPU utilization at not only an individual…
JetBrains dotPeek
Nice decompiler, this is a just a note for reference. Original source code …and the output of the decompiler…
C# – Write file on client and read same file from inside the database
We had a job that an enterprise software vendor was running that failed on permissions denied. They asked us to open the file share to anyone without a password. Our awesome SQL Server DBA pushed back, thankfully. We came up…