The following are links to the "Coolest Rock Music ever" (according to my friend njau)..Please download let mi know what you think...is there any talent...?
Media fire Link (mp3)
Tuesday, June 15, 2010
Tuesday, March 9, 2010
Ohh My..the web has ducks - You dont believe me, check out IronPhyton
Google's full of ducks, youtube is also full of ducks, i mean good web apps are ducks. To be more clear, they all use phyton, a dynamic language (am new at this, i guess php guys know better).But Python’s not the only game in town to use dynamic typing. However it did catch my eye and challenged my perspective as a programmer. “What is this? How does one accurately program anything in this fashion? Five hundred lines of code and not one duck! Python’s a liar.
Well the essence of duck typing is simple :
if it looks like a duck and quacks like a duck, it must be a duck.
In a language that supports DuckTyping an object of a particular type is compatible with a method or function, if it supplies all the methods/method signatures asked of it by the method/function at run time.simple eh? Am not going to go in the details of this, check out this link for additional information on this subject
I know there are those of you who will be tend to raise issue with dynamic languages,
such as "What if it looks like a duck, quacks like a duck, but is really a dragon impersonating a duck? You don’t want a dragon in your pond.” -(Harris,2009). My answer blame pond keeper i.e the developer
Anyway am beginning to love this idea of dynamic languages. So i decided to start learning IronPhyton (i guess i love new tech stuff). Over the past 2 weeks i dug deep into the world of IronPhyton and read the following two books
1.Pro IronPython by Alan Harris -Short and to the point kind of book, good for someone with vb.net/c# background and people who want to code than do theory
2.ironPython in action by Michael J. Foord and Christian Muirhead -Too many stories but good for the reading, the authors try to explain the concepts from scracth (mo words, less coding i figured).
In all the above i would recommend you read Alan's book, although reading both will give u a more clear picture of all aspect you might want to learn about in ironPython
Am now convinced that if am going to adopt a dynamic language then phyton is the way forward and IronPhyton is the flavor that suites me best. I mean i can even program web apps and add scripting features (plug-in) to my c# applications
Below is an Example of a class defined in IronPhyton
Well the essence of duck typing is simple :
if it looks like a duck and quacks like a duck, it must be a duck.
In a language that supports DuckTyping an object of a particular type is compatible with a method or function, if it supplies all the methods/method signatures asked of it by the method/function at run time.simple eh? Am not going to go in the details of this, check out this link for additional information on this subject
I know there are those of you who will be tend to raise issue with dynamic languages,
such as "What if it looks like a duck, quacks like a duck, but is really a dragon impersonating a duck? You don’t want a dragon in your pond.” -(Harris,2009). My answer blame pond keeper i.e the developer
Anyway am beginning to love this idea of dynamic languages. So i decided to start learning IronPhyton (i guess i love new tech stuff). Over the past 2 weeks i dug deep into the world of IronPhyton and read the following two books
1.Pro IronPython by Alan Harris -Short and to the point kind of book, good for someone with vb.net/c# background and people who want to code than do theory
2.ironPython in action by Michael J. Foord and Christian Muirhead -Too many stories but good for the reading, the authors try to explain the concepts from scracth (mo words, less coding i figured).
In all the above i would recommend you read Alan's book, although reading both will give u a more clear picture of all aspect you might want to learn about in ironPython
Am now convinced that if am going to adopt a dynamic language then phyton is the way forward and IronPhyton is the flavor that suites me best. I mean i can even program web apps and add scripting features (plug-in) to my c# applications
Below is an Example of a class defined in IronPhyton
class course:
"Contains the details of a given course"
name='course name'
number='0'
description='description'
#methods to set Course data
def setCourseName(self,name):
self.name=name
def setNumber(self,number):
self.number=number
def setDescription(self,description):
self.description=description
#methods to get Course data
def getCourseName(self):
return self.name
def getCourseNumber(self):
return self.number
def getDescription(self):
return self.description
def getCourseDetails(self):
return 'Name: ',self.name,' Number: ',self.number,' Description: ',self.description
Monday, March 1, 2010
100% CPU Usage Overhead running EM DBConsole 11g on Windows 7 64bit
I think am starting to like Oracle DB, Not that i hated the damn thing. I just never thought i would be using anything other than MSSQL, and object databases. But lets face it, Oracle 10g Express was a big milestone for oracle especially with the introduction of APEX.
I just fell in love with this simple to use technology that allowed me to build exceptional, high end online application using only plsql and some java script (my kind of thing)
Nway i finally got the nerve to do the whole installation on my hp dv5 pavilion laptop with intel core 2 duo processor and 4 gb of ram. (a killer machine......i guess). So after a normal restart all hell breaks loose...Oracle RDBMS kernel service consumes upto 1.5 gb of ram and the cup clocks 100
At that moment, i hated Oracle...I finally decided to do some digging on the net and realized that the problem is universal, affecting even linux machines.
100% CPU Usage Overhead running EM DBConsole 11g
Nway according to this blog this is how you solve the problem
You can still check this link and this one for additional details..But what makes me made is that oracle is aware of this and they have released a patch but it is only available to meta-link users
Nway my focus is set the oracle platform......i think its going to be really interesting
.....
I just fell in love with this simple to use technology that allowed me to build exceptional, high end online application using only plsql and some java script (my kind of thing)
Nway i finally got the nerve to do the whole installation on my hp dv5 pavilion laptop with intel core 2 duo processor and 4 gb of ram. (a killer machine......i guess). So after a normal restart all hell breaks loose...Oracle RDBMS kernel service consumes upto 1.5 gb of ram and the cup clocks 100
At that moment, i hated Oracle...I finally decided to do some digging on the net and realized that the problem is universal, affecting even linux machines.
100% CPU Usage Overhead running EM DBConsole 11g
Nway according to this blog this is how you solve the problem
emctl stop dbconsole (or stop the OracleDBConsoleSID Windows service)
create table mgmt_job_bad as select * from sysman.mgmt_job where job_name = 'PROVISIONING DAEMON';
delete from sysman.mgmt_job where job_name = 'PROVISIONING DAEMON';
commit;
emctl start dbconsole (or start the service)
create table mgmt_job_bad as select * from sysman.mgmt_job where job_name = 'PROVISIONING DAEMON';
delete from sysman.mgmt_job where job_name = 'PROVISIONING DAEMON';
commit;
emctl start dbconsole (or start the service)
You can still check this link and this one for additional details..But what makes me made is that oracle is aware of this and they have released a patch but it is only available to meta-link users
Nway my focus is set the oracle platform......i think its going to be really interesting
.....
Wednesday, February 17, 2010
Tsql Query to Sort Numbers in a comma separated string
/*
* Query to order numbers in asc order.
* Numbers are given as a string separated by a comma
* */
DECLARE @numbers VARCHAR(50)='23,2000,45,7,3,0,24,67,676,45,4,2,230';
DECLARE @finalString VARCHAR(max);--used to hold the final string
DECLARE @ProductTotals TABLE--Dynamic table to hold all the values numeric values
(
ProductID DECIMAL(18,2)
)
DECLARE @currentNumber DECIMAL(18,2)--variable to hold the current number that
--is reaped from the number array
WHILE( PATINDEX('%,%',@numbers)<>0)
BEGIN
SET @currentNumber=CAST(SUBSTRING(@numbers,0,PATINDEX('%,%',@numbers)) AS DECIMAL(18,2));
INSERT INTO @ProductTotals VALUES (@currentNumber);
SET @numbers=SUBSTRING(@numbers,PATINDEX('%,%',@numbers)+1,(LEN(@numbers)+1)-PATINDEX('%,%',@numbers));
END
SET @finalString='';
SELECT @finalString=@finalString +cast(pt.ProductID AS VARCHAR(10))+',' FROM @ProductTotals pt
ORDER BY pt.ProductID ASC
PRINT @finalString
/*
*The result will appear as follows
*0.00,2.00,3.00,4.00,7.00,23.00,24.00,45.00,45.00,67.00,676.00,2000.00,
*
*/
* Query to order numbers in asc order.
* Numbers are given as a string separated by a comma
* */
DECLARE @numbers VARCHAR(50)='23,2000,45,7,3,0,24,67,676,45,4,2,230';
DECLARE @finalString VARCHAR(max);--used to hold the final string
DECLARE @ProductTotals TABLE--Dynamic table to hold all the values numeric values
(
ProductID DECIMAL(18,2)
)
DECLARE @currentNumber DECIMAL(18,2)--variable to hold the current number that
--is reaped from the number array
WHILE( PATINDEX('%,%',@numbers)<>0)
BEGIN
SET @currentNumber=CAST(SUBSTRING(@numbers,0,PATINDEX('%,%',@numbers)) AS DECIMAL(18,2));
INSERT INTO @ProductTotals VALUES (@currentNumber);
SET @numbers=SUBSTRING(@numbers,PATINDEX('%,%',@numbers)+1,(LEN(@numbers)+1)-PATINDEX('%,%',@numbers));
END
SET @finalString='';
SELECT @finalString=@finalString +cast(pt.ProductID AS VARCHAR(10))+',' FROM @ProductTotals pt
ORDER BY pt.ProductID ASC
PRINT @finalString
/*
*The result will appear as follows
*0.00,2.00,3.00,4.00,7.00,23.00,24.00,45.00,45.00,67.00,676.00,2000.00,
*
*/
Wednesday, February 10, 2010
Ho to use NTBackup In Server 2008 64bit with Exchange 2007 sp2
For months I have been trying to backup my exchange 2007 database,
Challenge being u just can convince management to buy all those nice but expensive tools that are available online en secondly we all know microsoft NTBackup (promising tool really) is no
longer available in windows server 2008.
Even after I had to install exchange service pack 2 I just could not figure out how I could do the VSS backup on an exchange installation that has the mail database within the same drive as operating system.
So I decided to search the net for a few answers (thanks to Google). I came across this article
NTBackup for Server 2008 with Exchange
Nway this is what you need to do is
to a new location such as
(C:\Program Files\NTBackup\):
• ntbackup.exe
• ntmsapi.dll
• vssapi.dll
2. Install the removable storage manager from server manager:
• Start Server Manager•
Click Features
• Click Add Features
• Select Removable Storage Manager
• Click Install
3.Go into an older server (Windows server 2003) and copy esebcli2.dll from your server
(C:\Program Files\Exchsrvr\Bin)
and put it into your new location which in our case would be
(C:\Program Files\NTBackup\):
change the esebcli2 reg key (HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\BackupRestore\DLLPaths)
from
C:\Program Files\Micrsoft\Exchange Server\Bin\esebcli2.dll
To
C:\Program Files\NTBackup\ esebcli2.dll
Now go ahead and run your NTBackup utility (I know you want to)
Please Note
An incremental or differential backup cannot be performed on a storage group with circular logging enabled. Either perform Full backups, or disable circular logging in Exchange.
Please visit these URLs? for more details:
http://support.microsoft.com/default.aspx?scid=kb;en-us;294741
and
http://support.microsoft.com/default.aspx?scid=kb;en-us;218004
This article explains in details what circular logging is all about
However by default circular logging is disabled in Exchange
NOTE:
1.You will have to do one full backup before Exchange will allow you to perform any incremental
backups
2.You can view the back up status of your exchange mail db by going to
Exchange Management console->server configurations->mail box->right click on the storage
Group->Properties->General tab

Challenge being u just can convince management to buy all those nice but expensive tools that are available online en secondly we all know microsoft NTBackup (promising tool really) is no
longer available in windows server 2008.
Even after I had to install exchange service pack 2 I just could not figure out how I could do the VSS backup on an exchange installation that has the mail database within the same drive as operating system.
So I decided to search the net for a few answers (thanks to Google). I came across this article
NTBackup for Server 2008 with Exchange
Nway this is what you need to do is
- Copying the following binaries from a server 2003 installation
to a new location such as
(C:\Program Files\NTBackup\):
• ntbackup.exe
• ntmsapi.dll
• vssapi.dll
2. Install the removable storage manager from server manager:
• Start Server Manager•
Click Features
• Click Add Features
• Select Removable Storage Manager
• Click Install
3.Go into an older server (Windows server 2003) and copy esebcli2.dll from your server
(C:\Program Files\Exchsrvr\Bin)
and put it into your new location which in our case would be
(C:\Program Files\NTBackup\):
change the esebcli2 reg key (HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\BackupRestore\DLLPaths)
from
C:\Program Files\Micrsoft\Exchange Server\Bin\esebcli2.dll
To
C:\Program Files\NTBackup\ esebcli2.dll
Now go ahead and run your NTBackup utility (I know you want to)
Please Note
An incremental or differential backup cannot be performed on a storage group with circular logging enabled. Either perform Full backups, or disable circular logging in Exchange.
Please visit these URLs? for more details:
http://support.microsoft.com/default.aspx?scid=kb;en-us;294741
and
http://support.microsoft.com/default.aspx?scid=kb;en-us;218004
This article explains in details what circular logging is all about
However by default circular logging is disabled in Exchange
NOTE:
1.You will have to do one full backup before Exchange will allow you to perform any incremental
backups
2.You can view the back up status of your exchange mail db by going to
Exchange Management console->server configurations->mail box->right click on the storage
Group->Properties->General tab

Monday, October 19, 2009
MS SQL 2008 hierarchyid In Linq To SQL
I have of let been involved in trying to make my applications using the MS SQL 2008 hierarchyid data type. However am a LINQ fanatic and have found it really hard to incorporate such a good feature in any of ma application. I have however been doing some serious research and have come across multiple articles some of which were really helpful but seemed too complicated and none really seemed to focus on Stored procedures
So in this article I will try to show how you can use the tree view in VS 2008 to display records in the data base that are based on the hierarchyid data type while using the LINQ TO SQL tool. All you have to know is a little bit of TSL stored procedures (that is if u love them as I do)
First create the following table
CREATE TABLE [dbo].[Employee](
[NodeId] [hierarchyid] NOT NULL,
[NodeLevel] AS ([NodeId].[GetLevel]()),
[EmployeeId] [int] NOT NULL,
[EmployeeName] [varchar](20) NOT NULL,
[Title] [varchar](20) NULL,)
Remember to Include a primary key value for your above table. I recomend you use the NodeID column. Now since we have two unique columns we can query the table quite comfortably with either. (NodeId or EmployeeId). Plase remember that if we try to create query statements that take hierarchyid as the parameter values, we will not the able to access them using the LINQ TO SQL mapping tool provided in Visual studio 2008. Hence all our queries will be based on the employee Id (any unique field u can use to query the records within the table)
First fill the table with respective data
DECLARE @root hierarchyid;
DECLARE @child1 hierarchyid;
DECLARE @child2 hierarchyid;
DECLARE @childOf1 hierarchyid;
DECLARE @childOf2 hierarchyid;
SET @root=hierarchyid::GetRoot();
INSERT INTO Employee(NodeId,EmployeeId, EmployeeName, Title)
VALUES(@root,6,'Ndwiga','MD');
SET @child1=@root.GetDescendant(NULL,NULL)
INSERT INTO Employee( NodeId, EmployeeId, EmployeeName, Title)
VALUES(@child1,701,'Kamau','Accounts Manager')
SET @child2=@root.GetDescendant(@child1,NULL)
INSERT INTO Employee( NodeId, EmployeeId, EmployeeName, Title)
VALUES(@child2,801,'Mwangi','IT Manager')
SET @childOf1=@child1.GetDescendant(NULL,NULL)
INSERT INTO Employee( NodeId, EmployeeId, EmployeeName, Title)
VALUES(@childOf1,702,'Otieno','ASST Acc Manager')
SET @childOf2=@child2.GetDescendant(NULL,NULL)
INSERT INTO Employee( NodeId, EmployeeId, EmployeeName, Title)
VALUES(@childOf2,802,'Amani','ASST IT Manager')
Next create the following stored procedure is used to get the Employee id of the top most person within the organisation
CREATE PROCEDURE [dbo].[spGetRootNode]
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
SET NOCOUNT ON;
DECLARE @empid INT
-- Get The Root Node Employee id
SELECT @empid=e.EmployeeId FROM Employee e
WHERE e.nodeid=hierarchyid::GetRoot()
-- Return Result Set
SELECT e.EmployeeId, e.EmployeeName,e.Title FROM Employee e
WHERE e.EmployeeId=@empid
END
GO
Then create the following stored procedure to get the list of descendants for each member of the hierarchy. It takes the current known employee id as input parameter
CREATE PROCEDURE [dbo].[spGetDescendants]
@employeeId int
AS
BEGIN
SET NOCOUNT ON;
DECLARE @managerId hierarchyid;
--Select Manager HierarchyId value
SELECT @managerId=nodeid FROM Employee e
WHERE e.EmployeeId=@employeeId;
-- Return a list of Emoloyees under the given Manager
SELECT e.EmployeeId,e.EmployeeName,e.Title FROM Employee e
WHERE e.nodeid.GetAncestor(1)=@managerId
END
Go to visual studio 2008

Then using C#
public partial class Form2 : Form
{
DataClasses1DataContext dc = new DataClasses1DataContext();
public Form2()
{
InitializeComponent();
}
private void Form2_Load(object sender, EventArgs e)
{
//Get Top Node
treeView1.Nodes.Add("Root", dc.spGetRootNode().Single().EmployeeName);
//Get All Nodes Below the Root/Main Node
IList result = dc.spGetDescendants(6).ToList();
foreach (spGetDescendantsResult value in result)
{
treeView1.Nodes["Root"].Nodes.Add(value.EmployeeId.ToString(), value.EmployeeName);
IList temp = dc.spGetDescendants(value.EmployeeId).ToList();
foreach (spGetDescendantsResult ttValue in temp)
{
treeView1.Nodes["Root"].Nodes[value.EmployeeId.ToString()].Nodes.Add(ttValue.EmployeeId.ToString(), ttValue.EmployeeName);
}
}
}
}
However the only problem with this code is that it will allow you to interate From TOP NODE->>LEVEL ONE->>LEVEL TWO
You can however add another loop to get to the next level...am still working on the function to make it a little bit easier.
This is what your should get
So in this article I will try to show how you can use the tree view in VS 2008 to display records in the data base that are based on the hierarchyid data type while using the LINQ TO SQL tool. All you have to know is a little bit of TSL stored procedures (that is if u love them as I do)
First create the following table
CREATE TABLE [dbo].[Employee](
[NodeId] [hierarchyid] NOT NULL,
[NodeLevel] AS ([NodeId].[GetLevel]()),
[EmployeeId] [int] NOT NULL,
[EmployeeName] [varchar](20) NOT NULL,
[Title] [varchar](20) NULL,)
Remember to Include a primary key value for your above table. I recomend you use the NodeID column. Now since we have two unique columns we can query the table quite comfortably with either. (NodeId or EmployeeId). Plase remember that if we try to create query statements that take hierarchyid as the parameter values, we will not the able to access them using the LINQ TO SQL mapping tool provided in Visual studio 2008. Hence all our queries will be based on the employee Id (any unique field u can use to query the records within the table)
First fill the table with respective data
DECLARE @root hierarchyid;
DECLARE @child1 hierarchyid;
DECLARE @child2 hierarchyid;
DECLARE @childOf1 hierarchyid;
DECLARE @childOf2 hierarchyid;
SET @root=hierarchyid::GetRoot();
INSERT INTO Employee(NodeId,EmployeeId, EmployeeName, Title)
VALUES(@root,6,'Ndwiga','MD');
SET @child1=@root.GetDescendant(NULL,NULL)
INSERT INTO Employee( NodeId, EmployeeId, EmployeeName, Title)
VALUES(@child1,701,'Kamau','Accounts Manager')
SET @child2=@root.GetDescendant(@child1,NULL)
INSERT INTO Employee( NodeId, EmployeeId, EmployeeName, Title)
VALUES(@child2,801,'Mwangi','IT Manager')
SET @childOf1=@child1.GetDescendant(NULL,NULL)
INSERT INTO Employee( NodeId, EmployeeId, EmployeeName, Title)
VALUES(@childOf1,702,'Otieno','ASST Acc Manager')
SET @childOf2=@child2.GetDescendant(NULL,NULL)
INSERT INTO Employee( NodeId, EmployeeId, EmployeeName, Title)
VALUES(@childOf2,802,'Amani','ASST IT Manager')
Next create the following stored procedure is used to get the Employee id of the top most person within the organisation
CREATE PROCEDURE [dbo].[spGetRootNode]
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
SET NOCOUNT ON;
DECLARE @empid INT
-- Get The Root Node Employee id
SELECT @empid=e.EmployeeId FROM Employee e
WHERE e.nodeid=hierarchyid::GetRoot()
-- Return Result Set
SELECT e.EmployeeId, e.EmployeeName,e.Title FROM Employee e
WHERE e.EmployeeId=@empid
END
GO
Then create the following stored procedure to get the list of descendants for each member of the hierarchy. It takes the current known employee id as input parameter
CREATE PROCEDURE [dbo].[spGetDescendants]
@employeeId int
AS
BEGIN
SET NOCOUNT ON;
DECLARE @managerId hierarchyid;
--Select Manager HierarchyId value
SELECT @managerId=nodeid FROM Employee e
WHERE e.EmployeeId=@employeeId;
-- Return a list of Emoloyees under the given Manager
SELECT e.EmployeeId,e.EmployeeName,e.Title FROM Employee e
WHERE e.nodeid.GetAncestor(1)=@managerId
END
Go to visual studio 2008

Then using C#
public partial class Form2 : Form
{
DataClasses1DataContext dc = new DataClasses1DataContext();
public Form2()
{
InitializeComponent();
}
private void Form2_Load(object sender, EventArgs e)
{
//Get Top Node
treeView1.Nodes.Add("Root", dc.spGetRootNode().Single
//Get All Nodes Below the Root/Main Node
IList
foreach (spGetDescendantsResult value in result)
{
treeView1.Nodes["Root"].Nodes.Add(value.EmployeeId.ToString(), value.EmployeeName);
IList
foreach (spGetDescendantsResult ttValue in temp)
{
treeView1.Nodes["Root"].Nodes[value.EmployeeId.ToString()].Nodes.Add(ttValue.EmployeeId.ToString(), ttValue.EmployeeName);
}
}
}
}
However the only problem with this code is that it will allow you to interate From TOP NODE->>LEVEL ONE->>LEVEL TWO
You can however add another loop to get to the next level...am still working on the function to make it a little bit easier.
This is what your should get