Select sample WS Callouts straight from your Oracle DB

It’s often nice to have the most recent data when you want to test a web service, so in the best scenario you would want to query existing data with some criteria such as active contracts and/or within a certain range.
This example will show you how to get ready-to-use web service callout requests from SQL Developer (or any other SQL tool) which can be used in a Service Bus Console or SoapUI. We will use the HR example database -which can be found in every Oracle DB- as the source.
This is the request which we’ll use:

select '<v1:IncreaseSalaryRequest xmlns:v1="http://example.joris.visscher/hr/types/v1/">
 <v1:EmployeeId>
 <v1:Type>DEFAULT</v1:Type>
 <v1:Identifier>'||emp.employee_id||'</v1:Identifier>
 </v1:EmployeeId>
 <v1:FirstName>'||emp.first_name||'</v1:FirstName>
 <v1:LastName>'||emp.last_name||'</v1:LastName>
 <v1:Department>
 <v1:Type>DEFAULT</v1:Type>
 <v1:Identifier>'||dep.department_id||'</v1:Identifier>
 </v1:Department>
 </v1:IncreaseSalaryRequest>' WSRequest
from employees emp
, departments dep
where emp.department_id = dep.department_id
-- Let's add some conditions which are needed to finish the process succesfully.
and emp.last_name is not null
and dep.department_name = 'IT' -- return the most valuable employees
-- We only need 5 results.
and rownum <= 5;

This will result in five instantly usable requests from live data so we’ll know for sure that all the criteria that should be met for a functional correct case are indeed met:

<v1:IncreaseSalaryRequest xmlns:v1="http://example.joris.visscher/hr/types/v1/">
  <v1:EmployeeId>
    <v1:Type>DEFAULT</v1:Type>
    <v1:Identifier>103</v1:Identifier>
  </v1:EmployeeId>
  <v1:FirstName>Alexander</v1:FirstName>
  <v1:LastName>Hunold</v1:LastName>
  <v1:Department>
    <v1:Type>DEFAULT</v1:Type>
    <v1:Identifier>60</v1:Identifier>
  </v1:Department>
</v1:IncreaseSalaryRequest>

This query should work on most databases, but it works on an Oracle DB for sure 🙂
Happy testing!

Oracle SQL developer queries an OracleXE11g db on Ubuntu 11.10

Use XSLT to display your RSS feeds on Google Chrome (Live Bookmark alternative)

I’ve recently made the transition from Firefox to Chrome as my main browser. Unfortunatly there still isn’t an alternative on Google Chrome for the Live Bookmark functionality which I used on Firefox, and this might not come soon according to these sources:
RSS Live Bookmarks @ Google Support forums
I did found this link, the extension was a bit too buggy for me (but maybe you’ll be fine)
Chrome Web Store – Live Bookmarks
While trying several extentions I did not find one which offers the same functionality as the Live Bookmarks on Firefox, only RSS readers which wouldn’t work as intended.
My use for these rss feeds is to point to servers and/or environments. So it’s more used as a dynamic bookmark than as a RSS reader. The bookmarks are placed on a local server at my company so our operations department only has to update 1 resource when there are updates.
The end result isn’t exactly the same as the live bookmark in Firefox but to me it’s a pretty good alternative:

Instructions:

First we’ll show you the XML which is used for this RSS feed:

<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
 xmlns:atom="http://www.w3.org/2005/Atom"
 xmlns:dc="http://purl.org/dc/elements/1.1/">
 <channel>
 <title>jorisvisscher.wordpress.com Example RSS Feed</title>
 <link>http://localhost/links/example.xml</link>
 <description>Example RSS Feed for showing XSLT transformation</description>
 <atom:link href="http://localhost/links/example.xml" rel="self" type="application/rss+xml" />
 <item>
 <title>====== First Category ======</title>
 <link>http://google.com</link>
 </item>
 <item>
 <title>Local ALSB Server</title>
 <link>http://localhost:7001/console</link>
 </item>
 <item>
 <title>Local WLS Server</title>
 <link>http://localhost:7002/console</link>
 </item>
 <item>
 <title>Local BPM Workspace</title>
 <link>http://localhost:8585/workspace</link>
 </item>
 <item>
 <title>====== Second Category ======</title>
 <link>http://google.com</link>
 </item>
 <item>
 <title>Link to another server</title>
 <link>http://notlocalhost:7001:sbconsole</link>
 </item>
 <item>
 <title>Link to yet another server</title>
 <link>http://notlocahost:7001/console</link>
 </item>
 </channel>
</rss>

Previously on Firefox this feed would look like this:

Without a XSLT transformation, this RSS feed would look like this when opened in Google Chrome:

This ofcourse isn’t useful since we can’t click on the links. To fix this, we’ll add the following line to the XML file:

<?xml-stylesheet href="rss.xsl" type="text/xsl" media="screen"?>

The RSS Feed would look then like this:

<?xml version="1.0" encoding="utf-8"?>
<?xml-stylesheet href="rss.xsl" type="text/xsl" media="screen"?>
<rss version="2.0"
 xmlns:atom="http://www.w3.org/2005/Atom"
 xmlns:dc="http://purl.org/dc/elements/1.1/">
 <channel>
 <title>jorisvisscher.wordpress.com Example RSS Feed</title>
 <link>http://localhost/links/example.xml</link>
 <description>Example RSS Feed for showing XSLT transformation</description>
 <atom:link href="http://localhost/links/example.xml" rel="self" type="application/rss+xml" />
 <item>
 <title>====== First Category ======</title>
 <link>http://google.com</link>
 </item>
 <item>
 <title>Local ALSB Server</title>
 <link>http://localhost:7001/console</link>
 </item>
 <item>
 <title>Local WLS Server</title>
 <link>http://localhost:7002/console</link>
 </item>
 <item>
 <title>Local BPM Workspace</title>
 <link>http://localhost:8585/workspace</link>
 </item>
 <item>
 <title>====== Second Category ======</title>
 <link>http://google.com</link>
 </item>
 <item>
 <title>Link to another server</title>
 <link>http://notlocalhost:7001:sbconsole</link>
 </item>
 <item>
 <title>Link to yet another server</title>
 <link>http://notlocahost:7001/console</link>
 </item>
 </channel>
</rss>

As you can see, we are pointing to a xslt file to transform our RSS feed for use on the screen (or any other XML file for that matter). Place the XSLT file in the same directory as the RSS feed, or adjust the locator to the correct URL.
This is the XSLT file which we’ll use:

<?xml version="1.0"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:wfw="http://wellformedweb.org/CommentAPI/">
 <xsl:output method="html"/>
 <xsl:template match="/">
 <xsl:apply-templates select="/rss/channel"/>
 </xsl:template>
 <xsl:template match="/rss/channel">
 <div>
 <h3><xsl:value-of select="title"/></h3>
 <p><xsl:value-of select="description"/></p>
 </div>
 <div>
 <xsl:apply-templates select="item"/>
 </div>
 </xsl:template>
 <xsl:template match="/rss/channel/item">
 <div>
 <a href="{link}" rel="bookmark"><xsl:value-of select="title"/></a>
 <xsl:value-of select="description"/>
 </div>
 </xsl:template>
</xsl:stylesheet>

Please note; It’s pretty basic, I didn’t do much formatting since I’m not that much of a CSS guru 🙂
When opened in Google Chrome, it will look like this:

Which is completely usable for me, since I don’t need Firefox anymore for my live bookmarks.
Happy bookmarking!

Proxy authentication in Ubuntu 11.10 Oneiric Ocelot (Update)

This post simplifies the way to set your proxy which was explained in my previous post on October 21st.
(From the original post): Since Ubuntu 11.10, the proxy settings tab in the system settings have been changed, it’s no longer possible to enter your credentials in the proxy settings.
Before you start, you’ll need to find these values:

  • Proxy host
  • Proxy port
  • Proxy user name (would normally be your personal user name)
  • Proxy user password (would normally be your personal password)

Open a terminal and use the following commands to set these values, each line represents one command (! Adjust the values to your values !)

gsettings set org.gnome.system.proxy use-same-proxy 'true'
gsettings set org.gnome.system.proxy.http authentication-password 'ReplaceWithYourPassword'
gsettings set org.gnome.system.proxy.http authentication-user 'ReplaceWithYourUsername'
gsettings set org.gnome.system.proxy.http host 'ReplaceWithYourProxyHost'
gsettings set org.gnome.system.proxy.http port 'ReplaceWithYourProxyPort'
gsettings set org.gnome.system.proxy.http use-authentication 'true'
gsettings set org.gnome.system.proxy.http enabled 'true'

This should give you access through your company proxy! Happy browsing!
Ps. When you’re at home and you want disable the use of a proxy, use this command:

gsettings set org.gnome.system.proxy.http enabled 'false'

Proxy authentication in Ubuntu 11.10 Oneiric Ocelot

UPDATE December 27th: I’ve added a post which doesn’t need dconf-editor here.

Since Ubuntu 11.10, the proxy settings tab in the system settings have been changed, it’s no longer possible to enter your credentials in the proxy settings.
There’s a solution where you can edit these settings through dconf-tools:
Download and run dconf-tools  in the terminal by executing these two lines of code:

sudo apt-get install dconf-tools
dconf-editor

Within dconf-editor, goto “system > proxy” and change “mode” to manual.
Then select “use-same-proxy”
After that, go to “system > proxy > http”, enter your proxy information and select “enable”
Make sure ftp, https and socks have “0” (zero) on “port” and nothing on “Host” field
Everything should work fine now.
Update on October 23th with screenshots:


(Please note: you should change the blurred values)

Ubuntu terminal doesn't unset proxy

Last week I’ve brought my own laptop to work and setting up evolution, subversion, the alsb and bpm environments with their proper endpoints and last but not least, I’ve set my Ubuntu Network Proxy to my companies proxy settings.
When I’ve returned home, I found out that the proxy settings were still active. One might imagine that would purge the settings in the Network Proxy to “Direct Internet Connection” but unfortunately, it did not.
Apparently there are three proxy settings which are left being set when using the terminal:

  • http_proxy
  • https_proxy
  • ftp_proxy
Apt-get, wget and all the CLI programs which use internet would fail because they’re searching for this proxy setting, but it isn’t to be found since we’re not at our company 🙂
A temporary solution is to unset these proxy settings, copy and paste each of these commands in your terminal and press enter:
unset http_proxy
unset https_proxy
unset ftp_proxy

I’ll add a permanent solution when I find it. For now this will clear the proxy settings within your terminal and you’ll be able to update and upgrade your repos through the terminal again!
Ps. I’m still looking for a nice dhcp client script which would add dns search domains to my /etc/resolv.conf, if you might know one; keep me posted!

Tabs are huge in Eclipse on Ubuntu

You might have noticed the tabs are a bit bigger in Eclipse than what you’re used to when running Eclipse in Windows.
(This is a minor annoyance, but more screen real estate is always welcome..!)
This is what it would look like before:

You can solve this by creating a custom gtkrc-2.0 file, which should be in your home folder.
Start up your terminal and execute the bold text:

joris@dipshit:~$ nano ~/.gtkrc-2.0

You’re in nano right now, insert the following text in .gtkrc-2.0:

style "compact-toolbar"
{
        GtkToolbar::internal-padding = 0
        xthickness = 1
        ythickness = 1
}
style "compact-button"
{
        xthickness = 0
        ythickness = 0
}
class "GtkToolbar"                              style "compact-toolbar"
widget_class "*<GtkToolbar>*<GtkButton>"        style "compact-button"

Press “CTRL+x” to close the file and press “Y” to save the edited contents.
Next time you’ll open eclipse, the tabs will look like this: