Great Java - Caffeinated Babblings!

  • Home
  • Coffee Brewing HOW-TO
  • General
  • Web
  • Coffee
  • Java
  • Social Media
  • Coding
Caffeinated Babblings!

Java

Coding to Kaltura API using “testme” Console

January 19, 2016 by The Great Java

I’m probably too easily impressed anytime a vendor shows me a web “playground” to experiment with their API, especially if it will generate code snippets for specific languages. IBM has a pretty neat tool for IBM Connections, but it requires too much setup/footprint in my opinion. Kaltura has something similar, but has the advantage of needing just a client library. I needed to get a list of owners and managers for channels in the KMS and it seemed like for a few calls, the test console could give me the basic code.

I started with JavaScript and ran into a lot of trouble, which I chalked up to my proxy for the request. I figured server-side Java would be a better choice since I wouldn’t have to deal with the cross-site scripting and it’s a language I know well. With the Kaltura API, you start by creating a “session” (also called a “ks” for Kaltura session). You can do this with your secret admin code, but it’s far better to do it with a user that has the privileges you need. I generated some of the basic code and pasted it into a runnable class.

Kaltura Generated Code

KalturaConfiguration config = new KalturaConfiguration();
config.setPartnerId(partnerId);
config.setEndpoint("https://www.kaltura.com/");
KalturaClient client = new KalturaClient(config);
String loginId = "userid";
String password = "password";
int partnerId = 999999;
int expiry = null;
String privileges = null;
Object result = client.getUserService().loginbyloginid(loginId, password, partnerId, expiry, privileges);

Immediately, I noticed some interesting things like assigning primitives to null and declaring variables after they are used, which are easily fixed, but the issues don’t end there. The return types are not usable (all objects) and the API calls don’t match the API you downloaded from the test application. Other code examples were worse-variables were declared when all that was needed was a simple assignment to something already created.

In hindsight, I expect it wasn’t my proxy or JavaScript skills, but similar code generation issues and API mismatches that were my downfall with JavaScript. My advice is to try the console to know what classes you’ll need and get a “hint” of what data is passed around-assume the code you get is just plain wrong. I posted my experience in the forums and the response was that Java isn’t as well supported as PHP and it’s just a guide to the type of code you might write. They have a developer site with code examples, but nothing in Java yet.

In case you were hoping to find some working sample code, I’ve attached code to create a session, get a list of categories, and print out all the users with manager access in case you’d find a complete code example useful.

Download ListChannelOwners Java Class

Posted in: Coding, Java, Web Tagged: coding, Java, kaltura

leJOS with Eclipse on Mac with 32 bit

January 17, 2015 by The Great Java

While trying to compile applications for the Mindstorm NXT with a modern version of Eclipse on a Mac you’ll likely run into the deadly error, “Error: This Java instance does not support a 32-bit JVM.”. The need is clear – you need 32 bit Java support – but how? I tried various JVM flags (-d32) and trying to change where Eclipse found Java but no luck! Below I’ve detailed what worked for me.

The first step is to figure out if you have the older 1.6 version of Java on your Mac. For this just look in the directory /System/Library/Java/JavaVirtualMachines/. If you’ve had your Mac for a while you likely have the directory “1.6.0.jdk” and you’re ready to move on to the next step. If you don’t you can find it here.

Changing Eclipse to use the JDK was tricky until I found the RIGHT way, then it was easy of course. Go to /Applications/Eclipse/Eclipse.app in Finder. Right click and choose “Show Package Contents”. Next open Contents/Info.plist with a text editor (not plist editor). You’ll notice at the bottom there are actually instructions on how to launch Eclipse with a different VM. I simply stole the commented out line below and pasted it under Eclipse/array.

<string>-vm</string><string>/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Commands/java</string>

All is working now! If you’re trying to get Eclipse on your Mac working with leJOS hope that helps!

Posted in: Coding, Java Tagged: Java, robotics

No Thanks McDonalds, Not Even if it is FREE

December 19, 2008 by The Great Java

mccafe1.jpgMcDonalds is really wanting to get in on the coffee game. How do I know? All the local stores are doing “Free Lattes” all day on Friday. Free? Can you imagine if your local Starbucks had free Lattes? The police would have to direct traffic in front of the stores. We stopped to see if we could get a Redbox movie (with a free code) and getting a FREE Latte seemed right up our alley as Mr. & Mrs. GreatJava. My wife didn’t get much sleep last night, so she ordered a decaf. The clerk responded with “We don’t do decaf lattes”. What? Really? I wondered if what she meant was, “Lady, there is no real coffee in this, and therefore no caffeine”. My wife ordered the beverage which was prepared quickly.

We got in the car and my wife took one sip, which was followed by a “blaaah!”. Keep in mind, my wife is a well-trained coffee snob, so I figured I should try it. I opened the lid to find a few bubbles. Yes, bubbles not foam. It was near white in appearance, and had a faint coffee smell to it. Committed at this point, I take a sip. “Yuk.” Was it the lack of espresso, missing foam, or temperature? Nope, it was just gross. It tasted like someone warmed up some milk, blew a few bubbles in it with a straw, and mixed in a meagerly teaspoon of instant joe. Wow. McDonalds, you spent a lot of money on this product rollout, testing, and free samples. You’ve missed the boat by a mile – I suggest you stick with the burgers and keep your day job.

Posted in: Coffee Tagged: bad, Coffee, free, Java, mcdonalds

JavaOne 2008 – Day 3

May 8, 2008 by The Great Java

Session One was a loser. Automation of MDA to J2EE (TS-7466). While a potentially interesting topic it wasn’t apparent from the description that this was basically a vendor demonstration. Those things should somehow be noted better. Every five years I sit through (as a skeptic) and listen to the model driven generated application idea. I’m always disappointed, and was again. Most of the time was spent on how the tool worked under the covers without really giving us a picture of what it did. We basically never got a real idea of what the tool did so the presenter told the crowd to just visit the booth to see that part. Worst session of JavaOne for me.

Next I went to an awesome session on Mylyn (TS-6421). I think Mylyn used to be Mylar which we trialed a couple years ago. It’s come a long way and is a great platform to track what you are doing in the IDE and just show you what you need to see to complete your task. It has awesome integration with tracking systems (JIRA, etc) and even includes the ability to organize emails and more into a work “episode”. Since so many of us context switch a lot this is a huge help. We’ll be incorporating this tool into our development efforts very soon.

I was signed up for an OSGi session, but was lured to a presentation on how to create your own DSL (Domain Specific Language). It was very well done, by two guys from Verisign. I think Sun should be scheduling more talks from accomplished IT guys at different companies like this (good presentation skills). Did I mention I’m available for next year? 🙂 They covered not only how you can invoke scripting languages from Java but also how to create your own. They made a clear case for where this was useful and walked through the basics to do it with a few examples. I didn’t follow it all but I got the basics. Very useful – made me think about a card game I’ve been wanting to create.

Next I visited a session on how to choose a web framework (TS-6457). Since I am involved in a lot of technology evaluations this was actually a good session. He started out with the typical criteria (some I had not thought of) and added in some of his unique ideas. I really found this useful. Then he reviewed several of the frameworks and gave his thoughts. I think he messed up Struts 2 – he treated it like a new project. AFAIK it is just a new version of WebWorks with a new name, I could be wrong. Overall a good session but it would have been better if he went deeper on three different frameworks instead of several similar ones.

Met with JBoss on a variety of topics and then headed out to dinner with my team. Good day, I’m ready to go home, Java has worn me out and I can’t drink anymore of it! Missed Bob’s Guice BOF 🙁

Posted in: Java, Web Tagged: Java, javaone, mda, osgi

Open Source Java

June 4, 2004 by The Great Java

Wow. Is Sun giving gifts away before they fold? Open Sourcing Java? They also announced Solaris. Last week their leaders said hardware was going to be free (uh, isn’t that Sun’s bread and butter?).

Posted in: Java Tagged: Java, open-source

Eclipse RCP and Swing

May 17, 2004 by The Great Java

To say the documentation for Eclipse release 3 is sparse would be generous! I was able to get existing swing code working as a plug-in by creating a view, and then using the SWT_AWT class to create an AWT frame I could add my existing swing code UI to. Worked like a charm save a few null pointer exceptions in the console that had no effect on use. Cool stuff but….

Posted in: Java Tagged: eclipse, Java, rcp

Copyright © 2025 Great Java - Caffeinated Babblings!.

Taste WordPress Theme by ThemeTaste