New Blog

Hi All,

I know that I have basically stopped posting here for a few years now. However, I have recently rediscovered my love for writing and sharing my views online once again.

My new online home can be found at http://shauntirubeni.co.za.

Hope to see you guys there!

Hello 2010: 3 months late

Well, happy new year to all! I hope everyone had a great 2009.

It’s already March now! I cannot believe how fast time seems to be going. It just goes to show how busy the year has been so far.

What’s new? Well I’ve finally started training and exercising well: pushing myself a lot more and strict on not missing sessions. Work has been very busy but there are some excellent opportunities arising. Hint: I finally get to go full circle in BI: ETL, reports, dashboards, and automation.

I also really want to further my studies but haven’t registered yet. Maybe second semester or 2011. Just have to get some time to talk to some of the lecturers.

2010 is still young. We still have to witness the soccer world cup here in SA. Traffic is already pretty bad so it’s gonna be interesting when millions more arrive.

So let’s hope that the new decade is as good (and better) than the previous…

Seasons Greetings 2009

I wish all my readers, family, and friends a Merry Christmas and a Happy New Year. I’m sure the new decade will have many opportunities that will make life fun and full of  joy!

seasons greetings 2009

The next blog post will be in 2010 and I hope to bring you much more interesting and informative content in the new year and decade.

Cheers!

Protected: How To Get User Credentials In C#

This content is password protected. To view it please enter your password below:

A Few BI Resources & Links

Since I am striving to be a BI professional, it is about time that I actually blogged something about BI. Over the past few months I have managed to collect a few links to some very valuable resources related to Business Intelligence. Here are some that I hope will provide some value to you:

  • Business Intelligence for Business People is a good blog that has content related to what’s currently happening in the BI industry. This is an excellent place to keep up-to-date. The slogan from the site: “On marketplace success, innovation, and business intelligence.”.
  • Dashboards, Reporting & Business Intelligence is a much more technical site with lots of practical examples and code. There also is an awesome set of resources linked on the right-hand site of the website related to Oracle, BI, and ERP.
  • Let’s Learn Business Intelligence is also a technical site that has some very unique and useful tutorials. I have found the Business Objects part of the site very helpful.

So that’s it for now. Be on the lookout for many more future posts relating to BI😉

My first C# ASP.Net project

Well I’m no C# fundi, or .Net expert, but sometimes you may need to use these technologies which can be quite fun. I recently had to help one of my work colleague out with creating a simple website that should have dynamic link navigation, and a simple way of changing the flash file based on the clicked url.

I have played with C# before in my spare time and created a simple desktop app to store documents. Unfortunately, I did not get to fully complete the app.

Now back to the current project. Here is the asp part of the code:

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="SomeWebsite._Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title></title>
</head>
<body>
    <form id="form1" runat="server">
    <div id="id_menu">
        <asp:Menu ID="Navigation" runat="server" OnMenuItemClick="Navigation_MenuItemClick" 
            Font-Italic="True" Orientation="Horizontal" BorderStyle="None">
            <StaticSelectedStyle HorizontalPadding="15px" />
            <Items>
                <asp:MenuItem Text="URL1" Value="URL1"></asp:MenuItem>
                <asp:MenuItem Text="URL2" Value="URL2"></asp:MenuItem>
            </Items>
        </asp:Menu>
    </div>
    </form>
    <div id="id_flash_embed" runat="server"></div>                                   
</body>
</html>

Pretty simple layout and navigation. Since we’re using the ASP.Net menu component, it allows us the option to dynamically get the urls from an xml file or sitemap. This makes it very easy for us to create a dynamic url structure.

And here is the C# code that is behind the asp code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace SomeWebsite
{
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void Navigation_MenuItemClick(object sender, MenuEventArgs e)
        {
            //Use a dictionary to map my url text and swf file name. Dictionaries are awesome!
            Dictionary<string, string> urlMap = new Dictionary<string, string>();

            //The swf embed string that will be returned.
            string swfResponse = "";

            //The swf embed heredoc string template.
            string embedString = @"<OBJECT classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://fpdownload.adobe.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,0,0' WIDTH='1000' HEIGHT='1500' id='myMovieName'>
                                        <PARAM NAME='movie' VALUE='Swfs\find_and_replace_me.swf'> 
                                        <PARAM NAME='quality' VALUE='high'>
                                        <PARAM NAME='bgcolor' VALUE='#FFFFFF'>
                                        <PARAM NAME='play' VALUE='true'>
                                        <PARAM NAME='loop' VALUE='true'>
                                        <PARAM NAME=bgcolor VALUE='#FFFFFF'>
                                        <EMBED src='find_and_replace_me.swf' quality=high bgcolor=#FFFFFF WIDTH='1000' HEIGHT='1500' NAME='myMovieName' ALIGN='' TYPE='application/x-shockwave-flash' play='true' loop='true' PLUGINSPAGE='http://www.adobe.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash'> </EMBED>
                                   </OBJECT>";

            //Set up all of the url text values and flash file names respectively.
            urlMap.Add("URL1", "swfFile1");
            urlMap.Add("URL2", "swfFile2");

            //Generate the embed flash string based on the link clicked and then add it to the html.
            string replaceVal;
            if (urlMap.TryGetValue(Navigation.SelectedItem.Text, out replaceVal))
            {
                swfResponse = embedString.Replace("find_and_replace_me", replaceVal);
                id_flash_embed.InnerHtml = swfResponse;
            }
            else 
            {
                id_flash_embed.InnerHtml = "<strong>Sorry, the link you clicked has no data associated with it.</strong>";
            }
            
        }
    }
}

As you may notice, I have used a dictionary here; dictionaries are awesome! It cuts down the code quite a bit since there is no need to use if..else statements to test the url and get the correct flash file.

So that was my first ASP.Net app that I did all by myself. It was not all that difficult and only took me about 2 hours in total with refactoring included. If C# was truly cross-platform (mono is not close enough to MS’s implementation), I would really dedicate a fair amount of time to learn it. If you’re developing on an MS platform only, then .Net is the way to go.

Deleting Rows In PostgreSQL Based On A Duplicate Column Values

Back at my previous company we usually had the task of deleting rows that had duplicate values in a specific column. This column would usually be the email field. As simple as this sounds, it’s not that easy to do in PostgreSQL.

My friend was talking about this after I had left and I thought I’d write a little SQL query to help solve the problem. It took me around an hour to do but it was worth the time and effort. It’s not the most efficient query and there may be other ways of doing it but this does what you need in SQL only.

DELETE FROM st_emails where id NOT IN --Any ids not in the list returned below are duplicates and therefore will be deleted
 (
 --Find all unique rows
  SELECT
   id
  FROM
   st_emails
  WHERE
   --Determine the smallest ids for rows with duplicate emails
   id IN(
     select id
     from st_emails
     where id in (select min(id) from st_emails group by email having (count(*) > 1) )
      )
   --Determine all emails that are unique
   OR email IN (select email from st_emails group by email having (count(*) = 1))
 )

The query basically deletes rows where the row id is not in a list of unique rows.

The unique rows are determined by finding the unique emails and then finding the smallest row id where the email is duplicated (this will ensure that all duplicates, except a single unique row is deleted – kinda like your limit clause).

If you want the newest email duplicate entry not to be deleted then just replace “min” with “max”.

Firefox Web Developer Add-on

My friend, Muhammed Abad, sent me an awesome link to a funky little add-on for Firefox last week. It’s called Web Developer (how appropriate) and it seems to have some amazing functions.

I haven’t had the time to play with it yet, but from the toolbar I can see there is:

  • Disabling of cookies, Java, Javascript, proxy, cache and much more;
  • Viewing, disabiling, and editing CSS;
  • Form Auto-completion, clearing, and method conversions;
  • Manipulation of images and displaying information;
  • Displaying information on various HTML elements;
  • Outlining various HTML elements;
  • Window reszing and zooming;
  • Validation tools, inspectors, and consoles;
  • Source viewer.

Now that is a lot of stuff to make web development easier and debugging for IE… a little less strainful😀

The Unofficial Django Mascot

I gotta tell you, this framewrok and it’s community just keeps on amazing me. Apart from being one of the most elegant web frameworks out there, Django also has a pretty magical community!

So what am I talking about? Well I came accross the unofficial mascot for the Django framework and it’s something not very conventional. Rather, it’s…different?

Django Mascot

I like this one but there is also a green version for all the die hard fans. Find out what more good things this pony which is actually a unicorn brings.

Our Trip To Howick Falls

Earlier this year our family took a drive through the Midlands Meander and then to Howick. Such beautiful scenery:

Photo-0004

Photo-0005

Photo-0006

Pretty spectacular hey! It was a cold but fantastic day🙂