import com.restfb.*; import com.restfb.types.*; import com.restfb.json.*; import com.restfb.util.*; import com.restfb.FacebookClient.*; import java.net.*; import java.io.*; import java.util.*; import org.json.simple.*; import org.json.simple.parser.*; public class fbLogin { public static void main(String args[]) { AccessToken accessToken = new DefaultFacebookClient().obtainAppAccessToken(“153104261535601″,”5f7acbbe49a0fcd29afe0280d4dadc6c”); System.out.println(accessToken.getAccessToken()); //User user = facebookClient.fetchObject(“me”,…
Category: Development
HDFS – Where are my file blocks?
At times I would like to know how a file is stored in HDFS. What is below will show which blocks exist for a given file, as well as on which nodes they are stored. import java.io.*; import java.util.*; import…
Formatting garbage collection output with timestamps
If you are running a version of java where -XX:+PrintGCDateStamps is not honored, you can run what is below. For those that are unaware, by default garbage collection will print the seconds since the JVM process started. In the heat…
Does hadoop/HDFS distribute writes to all data nodes on ingest?
I like simple, command line test cases. Lather, rinse, repeat (do any shampoo bottles actually have that anymore 🙂 ?) I wanted to ensure I could prove that ingests to hadoop actually didn’t send everything through the name node, which…
One way to tell if a thread pool is hung
A hung ThreadPoolExecutor in java can be manifested in various ways. At least one, that I wanted to post for my own notes, is below. A thread dump may show something like what is below: “pool-9-thread-5” prio=6 tid=0x01b84400 nid=0x16e0 waiting…
Can you run java hprof and a custom agentlib together?
We run newrelic, which is an Advanced Performance Management (APM) software stack that will profile your java application from the browser all the way to the database. It is really good software, affordable, and highly recommended. I also wanted to…
Query AS400/iSeries from JDBC
We are migrating an in house system from the AS400 to Oracle, and I needed to look at the data in its “raw” format to assist with a migration plan. I ended up using JDBC rather than the GUI provided…
OutOfMemory error in one classloader
I thought this was interesting. If an OutOfMemory error (not exception, there is a difference) is thrown in one classloader when multiple class loaders are in use, it won’t cause the entire JVM to abort as it will when it…
Example of creating an order in ATG
I spent a lot of time understanding the plumbing of the Pipeline, OrderManager, etc. As I have indicated in the past, simple startup examples of ATG development are hard to find. The out of the box form handlers work far…
Simple byte code injection example with Javassist
This is a simple example that will time how long a method takes to execute, without changing the source code. First, we need to download the javassist software from http://www.javassist.org Please the javassist.jar file in your classpath. Also, set your…