Izzy gets the iPad, Arrival of Dell Mini

July 8th, 2011

On 02 JULY 2011, I gave my four year old daughter, Isabelle, my iPad after the arrival of my Dell Mini 10 laptop!

Automating passwd command on Linux

July 8th, 2011

Instead of using passwd interactively there is sometimes a need to automate the passwd parameters.
You can do so by:

echo [password] | passwd –stdin [userid]

Sync Blackberry Calendar with MS Outlook

July 8th, 2011

In order to synchronize your calendar within Blackberry with MS Outlook…

Click your Calendar icon on your BB, press the “menu” button, then choose “options”.
Now type rset (no e) any where on this screen (text will not show).

WARNING: This will erase your calendar on your desktop and reload it from the server that feeds it.

Sending email through MS Outlook via C#

July 8th, 2011


using System.Reflection;
using Outlook = Microsoft.Office.Interop.Outlook;

public static int SendMail (string recipient, string subject, string msg)
{
try
{
// Create the Outlook application.
Outlook.Application oApp = new Outlook.Application();
// Get the NameSpace and Logon information.
Outlook.NameSpace oNS = oApp.GetNamespace(“mapi”);
// Log on by using a dialog box to choose the profile.
oNS.Logon(Missing.Value, Missing.Value, true, true);
// Alternate logon method that uses a specific profile.
// TODO: If you use this logon method,
//  change the profile name to an appropriate value.
//oNS.Logon(“YourValidProfile”, Missing.Value, false, true);
// Create a new mail item.
Outlook.MailItem oMsg = (Outlook.MailItem)oApp.CreateItem(Outlook.OlItemType.olMailItem);
// Set the subject.
oMsg.Subject = subject;
/*
// Set HTMLBody.
String sHtml;
sHtml = “\n” +
“\n” +
“Sample GIF\n” +
“\n” +

\n” +

Inline graphics

\n” +
“\n” +
“”;
oMsg.HTMLBody = sHtml;
*/
oMsg.Body = msg;
// Add a recipient.
Outlook.Recipients oRecips = (Outlook.Recipients)oMsg.Recipients;
// TODO: Change the recipient in the next line if necessary.
Outlook.Recipient oRecip = (Outlook.Recipient)oRecips.Add(recipient);
oRecip.Resolve();
// Send.
oMsg.Send();
// Log off.
oNS.Logoff();
// Clean up.
oRecip = null;
oRecips = null;
oMsg = null;
oNS = null;
oApp = null;
}
// Simple error handling.
catch (Exception e)
{
MessageBox.Show(“Exception caught. ” + e);
}
// Default return value.
return 0;
}

Getting the iMac to Speak

July 8th, 2011

In order to have Text-to-Speech via Mac OS X…

System Preferences-> Speech-> Spoken User Interface

Check “Speak selected text when the key is pressed…” and then select a key combination.

I am currently using CMD+T.

Connecting to SQL Server 2008 database from ASP.Net/C#

July 8th, 2011

Inside of the web application go to the web.config file.  (This is an XML based configuration file for the web application.)

Look for the <configuration> section  then inside of that section find the <connectionStrings> subsection.

It is here you need to add your new connection string for your database.

For example:

<configuration>

<connectionStrings>


<add name=”[Name of Connection String]“
connectionString=”server=[HOST\SID];Database=[Name of Database]; User Id=[Userid to connect as];password=[Password for this account]“
providerName=”System.Data.SqlClient” />

</connectionStrings>
</configuration>

Then establish a SQLConnection and use it per usual throughout the rest of the code.

SqlConnection conn = new SqlConnection(WebConfigurationManager.ConnectionStrings["NameOfConnectionString].ConnectionString);

Connecting to MS SQL Server with C#

July 8th, 2011

The C# code below demonstrates connecting to a MS SQL Server database, inserting a value in a table and querying the table for data.
Source code


using System.Data.SqlClient;

// Create connection string
SqlConnection conn = new SqlConnection();
conn.ConnectionString =
“user id=<USERID>;” +
“password=<PASSWORD>;” +
“Server=<SERVER>\\<URL>;” +
“Trusted_Connection=<YES OR NO>;” +
“database=<DATABASE NAME;” +
“connection timeout=30″;

try
{
// Open connection
conn.Open();

// ===========================================
// Execute a non-query command
// ===========================================

try
{
string sql1 = “insert into users values (‘<USERID>’,'<FIRST NAME>’,'<LAST NAME>’)”;
SqlCommand cmd1 = new SqlCommand(sql1, conn);
cmd1.ExecuteNonQuery();
}
catch (Exception err)
{
MessageBox.Show(“ERROR: ” + err.Message);
conn.Close();
}

// ===========================================
// Generate query
// ===========================================

string sql2 = “SELECT userid FROM users”;
SqlCommand cmd2 = new SqlCommand(sql2, conn);

// Read multiple data results
try
{
SqlDataReader myReader = null;
myReader = cmd2.ExecuteReader();
while (myReader.Read())
{
MessageBox.Show(myReader.GetString(0));
}
}
catch (Exception err)
{
MessageBox.Show(“ERROR: ” + err.Message);
conn.Close();
}

conn.Close();
}
catch (Exception err)
{
MessageBox.Show(err.ToString());
}

}

Reverting back to LAMP for the webserver…

July 8th, 2011

Back on 07 MAY 2011 I converted from running my webserver as Linux/Apache/MySQL/PHP to Windows 2008/IIS/SQL Server/ASP.Net.    Today, I switched back to my original configuration… for several reasons :)

Here I am… again.

March 24th, 2010

So after taking a brief hiatus from working overtime… I decided to spend time doing things I used to enjoy.    One of which was programming.   I realize that my websites are extremely outdated and are in desparate need of attention.  I have that on my list.  I also have a few projects in mind and intend on joining some open source projects and additional software engineering forums.   Stand by… ;)

Back in action…

January 29th, 2009

I have not had time to modify the collection of websites that I have been working on, including this one. Between work and family… I have not had much free time. However, I plan on getting back into website development as well as a few side projects as time permits.

A few projects that I am currently working on:

1) Quad-booting one system with Windows Vista Business, Windows 2003 Enterprise Server, Windows 7 Beta and Fedora 10.

2) Researching ITIL methods for Change/Release Management.

3) Establishing a Beowulf Cluster for special research projects (ie: hurricane/tornado modeling, protein folding, SETI)

4) Establishing an IIS web server for ASP.Net / web services development.

5) Building a 5 tera-byte file server for network distribution.

6) More collaboration and features of my intrusion detection system and sharing of IP black lists.

7) Modification to family website.

So stay tuned… ;)