Show me the code! – By Davanum Srinivas

April 17, 2009

IBM Support Browser Toolbars

Filed under: Uncategorized — Davanum Srinivas @ 7:23 am

April 15, 2009

IBM Websphere on Twitter

Filed under: Uncategorized — Davanum Srinivas @ 9:06 am

March 16, 2009

Post/Update Twitter status snippet (from java)

Filed under: Uncategorized — Davanum Srinivas @ 10:10 am

Snippet to post to twitter. Using sun.misc to avoid introducing another jar (say commons codec). Please feel free to use another Base64 implementation. Rest of the details will remain the same.

import sun.misc.BASE64Encoder;

import java.io.InputStreamReader;
import java.io.BufferedReader;
import java.io.OutputStreamWriter;
import java.net.URLConnection;
import java.net.URL;
import java.net.URLEncoder;

public class Twitter {
    public static void main(String[] args) throws Exception {
        if (args.length < 3) {
            System.out.println("Twitter <userid> <password> <message>");
            System.exit(-1);
        }

        URL url = new URL("https://twitter.com/statuses/update.xml");
        URLConnection connection = url.openConnection();

        connection.setDoInput(true);
        connection.setDoOutput(true);
        connection.setUseCaches(false);

        String authorization = args[0] + ":" + args[1];
        BASE64Encoder encoder = new BASE64Encoder();
        String encoded = new String
                (encoder.encodeBuffer(authorization.getBytes())).trim();
        connection.setRequestProperty("Authorization", "Basic " + encoded);

        OutputStreamWriter out = new OutputStreamWriter(
                connection.getOutputStream());
        out.write("status=" + URLEncoder.encode(args[2], "UTF-8"));
        out.close();

        BufferedReader in = new BufferedReader(
                new InputStreamReader(
                        connection.getInputStream()));
        String response;
        while ((response = in.readLine()) != null) {
            System.out.println(response);
        }
        in.close();

    }
}

March 12, 2009

Technotes about Axis2 and IBM Websphere co-existence

Filed under: websphere — Tags: , , — Davanum Srinivas @ 8:01 am

If you are deploying Axis2 in a WAR/EAR under Websphere 6.1 with Web services feature pack or Websphere 7.0, please read the following tech notes:

You can search for newer technotes here:
http://www.ibm.com/support/us/en/

Exceptions like the following:
SRVE0026E: [Servlet Error]-[javax.servlet.UnavailableException: SRVE0201E:
Servlet [org.apache.axis2.transport.http.AxisServlet]: not a servlet class

java.lang.ClassCastException: org.apache.axiom.om.impl.llom.OMTextImpl incompatible with org.apache.axiom.om.impl.OMNodeEx

SRVE0100E: Did not realize init()
exception thrown by servlet AxisServlet: java.lang.StackOverflowError

January 22, 2009

Top 10 WebSphere Trends and Directions (Bonus – skit with David Letterman)

Filed under: Uncategorized — Davanum Srinivas @ 12:33 pm

December 29, 2008

Updated XMPP Client for Android

Filed under: Uncategorized — Davanum Srinivas @ 12:09 am

Updated the sources to latest android version – Android 1.0 SDK, Release 2

Original article:
http://davanum.wordpress.com/2007/12/31/android-just-use-smack-api-for-xmpp/

Updated screen shots:
1
2

Download Source and APK from here – XMPPClient-2.zip

December 14, 2008

BlueTwit Firefox sidebar (supports Twitter too)

Filed under: Uncategorized — Davanum Srinivas @ 12:29 am

here are some screen shots of what i was working on the side:

December 13, 2008

[Websphere] Article on securing web services using ws-security and policies in WAS7

Filed under: websphere — Davanum Srinivas @ 11:21 pm

here’s the link:
http://www.ibm.com/developerworks/webservices/library/ws-offload/?ca=drs-&ca=dgf-my

here are the highlights:

  • Deploying and configuring a secure Web service using asymmetric
    encryption.
  • Using Rational Application Developer to import a sample EAR file and
    configure Web services security policies and binding attachments for a
    Web service Client
  • Using the WebSphere Application Server console to configure the Web
    service Security policies for a sample service
  • Preparing Java™ Cryptography Extension (JCE) and JCEKS
    security credentials.

October 23, 2008

[android] Building and running Android from source

Filed under: Uncategorized — Davanum Srinivas @ 9:01 am
  • Use the repo script to pull down the source as explained in
  • Make sure you install ncurses headers using “sudo apt-get install ncurses-dev”
  • run make from the root directory
  • run the emulator using “out/host/linux-x86/bin/emulator -system out/target/product/generic/ -kernel prebuilt/android-arm/kernel/kernel-qemu”

PS: Many thanks to massiveRobot on #android IRC channel for the tip for running the emulator.

October 22, 2008

Greasemonkey script for Summize search on Twitter Home page

Filed under: Uncategorized — Davanum Srinivas @ 3:31 pm
// ==UserScript==
// @name           Summize / Twitter
// @namespace      dims
// @include        http://twitter.com/
// ==/UserScript==

var summize = document.createElement("div");

summize.innerHTML = '<div style="margin: 0 auto 0 auto; ' +
    'border-bottom: 1px solid #000000; margin-bottom: 5px; ' +
    'font-size: small; background-color: #000000; ' +
    'color: #ffffff;">'+
  ' <form action="http://search.twitter.com/search" id="searchForm" method="get"> ' +
  '	<input autosave="com.twitter.search" id="searchBox" ' +
  '        name="q" placeholder="Enter your query" results="10" type="search" />' +
  '	<input type="submit" value="Search" />' +
  ' </form>' +
  '</div>';
document.body.insertBefore(summize, document.body.firstChild);

click here to subscribe to the greasemonkey script.

« Newer PostsOlder Posts »

Blog at WordPress.com.