ArrayList ClassCastException

When trying to typecast Object array to the Actual array type, a runtime ClassCastException is thrown.

ArrayList lst = new ArrayList();
lst.add("String 1");
lst.add("String 2");
lst.add("String 3");

String[] strArr = (String[])lst.toArray();


Solution for this is to use the toArray method with argument.

String[] strArr = new String[0];
strArr = (String[]) lst.toArray(strArr);

Customizing Blogger Menu

I wanted my Blog Archives Menu to display the Post Title instead of Months or Years. And after some R&D I came up with the following code that prints the Post titles without any Year or Month information.


<div id="r_sidebar">
  <b:section class="rsidebar" id="rsidebar" preferred="yes" showaddelement="yes">
      <b:widget id="BlogArchive1"locked="false" title="Archive" type="BlogArchive">
        <b:includable id="interval" var="intervalData">
            <b:loop values="data:intervalData" var="i">
              <b:if cond="data:i.data"><b:include data="i.data" name="interval"/></b:if>
              <b:if cond="data:i.posts"><b:include data="i.posts" name="posts"/></b:if>
            </b:loop>
        </b:includable>
        <b:includable id="menu" var="data">
            <select expr:id="data:widget.instanceId + &quot;_ArchiveMenu&quot;">
              <option value="">
                  <data:title></data:title>
              </option>
              <b:loop values="data:data" var="i">
                  <option expr:value="data:i.url"><data:i.name></data:i.name> (<data:i.post-count></data:i.post-count>)</option>
              </b:loop>
            </select>
        </b:includable>
        <b:includable id="flat" var="data">
            <ul>
              <b:loop values="data:data" var="i">
                  <li class="archivedate"><a expr:href="data:i.url"><data:i.name></data:i.name></a> (<data:i.post-count></data:i.post-count>)
                  </li>
              </b:loop>
            </ul>
        </b:includable>
        <b:includable id="posts" var="posts">
            <ul class="posts">
              <b:loop values="data:posts" var="i">
                  <li>
                    <a expr:href="data:i.url">
                        <data:i.title></data:i.title>
                    </a>
                  </li>
              </b:loop>
            </ul>
        </b:includable>
        <b:includable id="main">
            <b:if cond="data:title">
              <h2>
                  <data:title></data:title>
              </h2>
            </b:if>
            <div class="archivos">
              <div id="ArchiveList">
                  <div expr:id="data:widget.instanceId + &quot;_ArchiveList&quot;">
                    <b:if cond="data:style == &quot;HIERARCHY&quot;">
                        <b:include data="data" name="interval"></b:include>
                    </b:if>
                    <b:if cond="data:style == &quot;FLAT&quot;">
                        <b:include data="data" name="flat"></b:include>
                    </b:if>
                    <b:if cond="data:style == &quot;MENU&quot;">
                        <b:include data="data" name="menu"></b:include>
                    </b:if>
                  </div>
              </div>
              <b:include name="quickedit"></b:include>
            </div>
        </b:includable>
      </b:widget>
  </b:section>

IE Security Warning for Mixed content

Internet Explorer gives a Security warning when a page with mixed content is loaded. This happens when a Secure page (HTTPS) contains resources(images/ javascript/ css/ iframes) that are not secure... meaning if the URL for a resource in a page is HTTP then IE gives the below warning.


"This page contains both secure and nonsecure items. Do you want to display the non-secure items?"


This warning message is very annoying if it appears for every page. The solution for this is to check the pages for non-secure urls and convert them to secure. The best is to always use relative URLs where possible.

What we also observed is that 'about:blank' url loaded in an IFrame of a secured page also gives the same warning. Solution for this is to create a blank.html in the server with a blank page and load this as the default url in the iframe.

SOA Tools or Integration Tools

I agree with David Linthicum opinion on the recent SOA Tools. Click on the link to read the complete article...

SOA Vendors Focus Too Much on Integration . . .
— We've all experienced the hype: "We're a SOA tool, and we're here to help!" However, most SOA vendors out there don’t understand the value of SOA, or even how to approach SOA. They focus on the tactical and not the strategic. Why? A tactical approach is easier for them to sell, and easier for them to understand. However, this approach means they are selling their customers short.