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…
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?
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:
Pretty spectacular hey! It was a cold but fantastic day
Some Linux Shell Commands
I was going through some of my files and folders on my PC a few moments ago when I came accross a text file named “linux command.txt”. It has a very extensive list of *nix shell commands that I thought I’d share.
Here’s the contents of the file:
sudo run command as sudo more access sudo ps aux | grep -ri "script/server 8040" list proccesses for specific port cd change dir ls -la directory structure alias Create an alias apropos Search Help manual pages (man -k) awk Find and Replace text, database sort/validate/index break Exit from a loop builtin Run a shell builtin bzip2 Compress or decompress named file(s) cal Display a calendar case Conditionally perform a command cat Display the contents of a file cd Change Directory cfdisk Partition table manipulator for Linux chgrp Change group ownership chmod Change access permissions chown Change file owner and group chroot Run a command with a different root directory cksum Print CRC checksum and byte counts clear Clear terminal screen cmp Compare two files comm Compare two sorted files line by line command Run a command - ignoring shell functions continue Resume the next iteration of a loop cp Copy one or more files to another location cron Daemon to execute scheduled commands crontab Schedule a command to run at a later time csplit Split a file into context-determined pieces cut Divide a file into several parts date Display or change the date & time dc Desk Calculator dd Data Dump - Convert and copy a file ddrescue Data recovery tool declare Declare variables and give them attributes df Display free disk space diff Display the differences between two files diff3 Show differences among three files dig DNS lookup dir Briefly list directory contents dircolors Colour setup for `ls' dirname Convert a full pathname to just a path dirs Display list of remembered directories du Estimate file space usage echo Display message on screen egrep Search file(s) for lines that match an extended expression eject Eject removable media enable Enable and disable builtin shell commands env Environment variables ethtool Ethernet card settings eval Evaluate several commands/arguments exec Execute a command exit Exit the shell expand Convert tabs to spaces export Set an environment variable expr Evaluate expressions false Do nothing, unsuccessfully fdformat Low-level format a floppy disk fdisk Partition table manipulator for Linux fgrep Search file(s) for lines that match a fixed string file Determine file type find Search for files that meet a desired criteria fmt Reformat paragraph text fold Wrap text to fit a specified width. for Expand words, and execute commands format Format disks or tapes free Display memory usage fsck File system consistency check and repair ftp File Transfer Protocol function Define Function Macros gawk Find and Replace text within file(s) getopts Parse positional parameters grep Search file(s) for lines that match a given pattern groups Print group names a user is in gzip Compress or decompress named file(s) hash Remember the full pathname of a name argument head Output the first part of file(s) history Command History hostname Print or set system name id Print user and group id's if Conditionally perform a command ifconfig Configure a network interface import Capture an X server screen and save the image to file install Copy files and set attributes join Join lines on a common field kill Stop a process from running less Display output one screen at a time let Perform arithmetic on shell variables ln Make links between files local Create variables locate Find files logname Print current login name logout Exit a login shell look Display lines beginning with a given string lpc Line printer control program lpr Off line print lprint Print a file lprintd Abort a print job lprintq List the print queue lprm Remove jobs from the print queue ls List information about file(s) lsof List open files make Recompile a group of programs man Help manual mkdir Create new folder(s) mkfifo Make FIFOs (named pipes) mkisofs Create an hybrid ISO9660/JOLIET/HFS filesystem mknod Make block or character special files more Display output one screen at a time mount Mount a file system mtools Manipulate MS-DOS files mv Move or rename files or directories netstat Networking information nice Set the priority of a command or job nl Number lines and write files nohup Run a command immune to hangups nslookup Query Internet name servers interactively passwd Modify a user password paste Merge lines of files pathchk Check file name portability ping Test a network connection popd Restore the previous value of the current directory pr Prepare files for printing printcap Printer capability database printenv Print environment variables printf Format and print data ps Process status pushd Save and then change the current directory pwd Print Working Directory quota Display disk usage and limits quotacheck Scan a file system for disk usage quotactl Set disk quotas ram ram disk device rcp Copy files between two machines. read read a line from standard input readonly Mark variables/functions as readonly remsync Synchronize remote files via email return Exit a shell function rm Remove files rmdir Remove folder(s) rsync Remote file copy (Synchronize file trees) screen Terminal window manager scp Secure copy (remote file copy) sdiff Merge two files interactively sed Stream Editor select Accept keyboard input seq Print numeric sequences set Manipulate shell variables and functions sftp Secure File Transfer Program shift Shift positional parameters shopt Shell Options shutdown Shutdown or restart linux sleep Delay for a specified time sort Sort text files source Run commands from a file `.' split Split a file into fixed-size pieces ssh Secure Shell client (remote login program) strace Trace system calls and signals su Substitute user identity sum Print a checksum for a file symlink Make a new name for a file sync Synchronize data on disk with memory tail Output the last part of files tar Tape ARchiver tee Redirect output to multiple files test Evaluate a conditional expression time Measure Program running time times User and system times touch Change file timestamps top List processes running on the system traceroute Trace Route to Host trap Run a command when a signal is set(bourne) tr Translate, squeeze, and/or delete characters true Do nothing, successfully tsort Topological sort tty Print filename of terminal on stdin type Describe a command ulimit Limit user resources umask Users file creation mask umount Unmount a device unalias Remove an alias uname Print system information unexpand Convert spaces to tabs uniq Uniquify files units Convert units from one scale to another unset Remove variable or function names unshar Unpack shell archive scripts until Execute commands (until error) useradd Create new user account usermod Modify user account users List users currently logged in uuencode Encode a binary file uudecode Decode a file created by uuencode v Verbosely list directory contents (`ls -l -b') vdir Verbosely list directory contents (`ls -l -b') vi Text Editor watch Execute/display a program periodically wc Print byte, word, and line counts whereis Report all known instances of a command which Locate a program file in the user's path. while Execute commands who Print all usernames currently logged in whoami Print the current user id and name (`id -un') Wget Retrieve web pages or files via HTTP, HTTPS or FTP xargs Execute utility, passing constructed argument list(s) yes Print a string until interrupted . Run a command script in the current shell ### Comment / Remark
Comments (1)



