Saturday, November 19, 2005

The Los Altos Town CryBaby

I've finally started a new blog for all of my rantings about local and national politics and related issues. That way I can keep this blog focussed on the mobile and embedded software development topics it was original created for.

On the off chance that you miss my other writing, you can read my latest opinions at The Los Altos Town CryBaby

Tuesday, November 08, 2005

Microsoft Gets Religion And Gets Scared

The company thought that the Internet was a passing fad. The company thought that open source operating system and other software offerings would not be attractive because they would not be reliable, or that they came from sources who may not maintain and support those offerings. Now that the software world is turning sharply in the direction of service based architecture and subscription based or free, advertising supported models, Microsoft Corporation desperately wants to make sure it isn't left behind again.

In an October 30 memo to senior executives, which relied heavily on insights and analysis from CTO Ray Ozzie, Microsoft Chairman Bill Gates left no doubt that the company was way behind in the race to the top of this new wave of software innovation. The following story from AP details Bill's "Burning Bush" moment:

------------------------------------------------------------------------------
AP
Gates Warns of 'Sea Change' in Memo
Wednesday November 9, 12:07 am ET
By Allison Linn, AP Business Writer
Microsoft's Bill Gates Says in Memo Internet-Based Services Represents Major 'Sea Change'


SEATTLE (AP) -- The technology industry shift's to Internet-based software and services represents a massive and disruptive "sea change," Microsoft Chairman Bill Gates wrote to top-level executives in a memo aimed at rallying his troops against the new competitive threats the company faces.

In an e-mail to top executives, dated Oct. 30 and obtained late Tuesday by The Associated Press, Gates urged company leaders to "act quickly and decisively" to move further into the field of offering such services, in order to best formidable competitors. But he also warned that the company must be thoughtful in building the right technology to serve the right audience.

"This coming 'services wave' will be very disruptive," Gates wrote. "We have competitors who will seize on these approaches and challenge us -- still, the opportunity to lead is very clear."

Gates compares the push toward such services -- which range from online business software offerings to free Web-based e-mail -- to the changes he saw nearly a decade ago. Then, he wrote a now-famous memo, called "The Internet Tidal Wave," the prompted a massive shift at Microsoft toward Internet-based technology.

"The next sea change is upon us," Gates wrote to executives.

Gates included a memo from Ray Ozzie, one of Microsoft's three chief technical officers, which outlined ideas for broad companywide changes that can address the growing competitive threat.

In the memo, dated Oct. 28, Ozzie concedes that Microsoft has not led the pack on Internet-based software and services, and now faces intense competition from companies like Google Inc. Ozzie said Microsoft needs to focus on key tenets of the new model, including a shift toward offering free, advertising-supported offerings and more sophisticated, Internet-based methods of delivering products.

"I believe at this juncture it's generally very clear to each of us why we need to transform -- the competitors, the challenges, and the opportunities," Ozzie wrote.

Last week, Microsoft announced plans for Windows Live and Office Live, two Web-based offerings that aim to help the company compete with Google, Yahoo Inc., Salesforce.com and other companies that are already seeing success with such Web-based offerings.

Microsoft has recently faced criticism that its model, which still relies mostly on delivering software in traditional packaging, could grow antiquated. The concern is that, as more companies offer online services for everything from word processing to storing photos, there will be less of a need for Microsoft's lucrative Windows operating system and Office business software.

Microsoft's nascent Windows Live and Office Live efforts aim to complement its valuable software franchises with online products that build on what people find on their desktop computers.

Wednesday, November 02, 2005

SQL Server CE Sample Code

In response to some recent Microsoft newsgroup questions about using SQL Server CE for PocketPC applications, I am posting this sample code. It is a database utilities class that demonstrates how to create a database, create a table, and read / query and insert records from the table. Please forgive the fact that I didn't take the time to pretty up the format. It is readable enough for a reasonablty experience PocketPC developer to follow.

The sample is written in C# using the .NET Compact Framework.


using System;
using System.Windows.Forms;
using System.Data.SqlServerCe;
namespace database
{
///
/// Summary description for Database.
///

///
public class DatabaseUtils
{
private String strFile = @"My Documents\myDB.sdf";
private String strConn =
"DataSource="+@"My Documents\myDB.sdf";
private SqlCeConnection connection;
private SqlCeDataAdapter adapter;

#region LoadTable Event Type Declarations
public class LoadTableEventArgs
{
private System.Data.DataSet data_set;

#region LoadTableEventArgs Class Properties
public System.Data.DataSet DataSet
{
get { return (this.data_set); }
}
#endregion
public LoadTableEventArgs()
{
this.data_set = new System.Data.DataSet();
}
}

public delegate void LoadTableEventHandler(
Object sender,
LoadTableEventArgs args);
public event LoadTableEventHandler LoadTableEvent;
#endregion

public DatabaseUtils()
{
//
// TODO: Add constructor logic here
//
adapter = new SqlCeDataAdapter();

}

public void CreateDatabase()
{
if (System.IO.File.Exists(this.strFile))
{
DialogResult res;
res = MessageBox.Show(
"The database " + this.strFile +
" already exists.\r\n" +
"This operation will delete and
recreate and empty database.\r\n" +
"Do you want to proceed?",
"Database Delete",
MessageBoxButtons.YesNo,
MessageBoxIcon.Question,
MessageBoxDefaultButton.Button2
);
if (res == DialogResult.Yes)
{
System.IO.File.Delete(this.strFile);
}
else
{
return;
}
}

SqlCeEngine dbEngine = new SqlCeEngine();
dbEngine.LocalConnectionString = this.strConn;
try
{
dbEngine.CreateDatabase();
if (OpenConnection())
{
SqlCeCommand cmd = new SqlCeCommand();
cmd.Connection = connection;
cmd.CommandText =
"create table Users " +
"(user_id integer not null IDENTITY(0,1)
constraint PKuser_id PRIMARY KEY " +
", first_name nvarchar(100) " +
", last_name nvarchar(100))";
cmd.ExecuteNonQuery();
CloseConnection();
}
}
catch (System.Data.SqlServerCe.SqlCeException e)
{
System.Windows.Forms.MessageBox.Show(
"Unable to create database"
);
}
}

public void InsertUser(String first_name,
String last_name)
{
try
{
if (OpenConnection())
{
SqlCeCommand cmd = new SqlCeCommand();
cmd.Connection = connection;
cmd.CommandText =
"insert into Users (first_name, last_name)+
"values" +
"('" + first_name + "', '" + last_name +"')";
cmd.ExecuteNonQuery();
CloseConnection();
}
}
catch (SqlCeException e)
{
MessageBox.Show(
"Unable to insert record into Users table." +
Reason: " + e.Errors[0].Message
);
}
}

public bool LoadTable(String table)
{
bool bResult = true;
try
{
if (OpenConnection())
{
if (this.LoadTableEvent != null)
{
LoadTableEventArgs args
= new LoadTableEventArgs();
SqlCeCommand cmd = new SqlCeCommand();
cmd.Connection = connection;
cmd.CommandText = "select * from " + table;
adapter.SelectCommand = cmd;
adapter.Fill(args.DataSet);
this.LoadTableEvent(this, args);
}
CloseConnection();
}
}
catch (SqlCeException e)
{
MessageBox.Show(
"An error occurred in ViewTable."
+ e.Errors[0].Message
);
bResult = false;
}
return (bResult);
}

///Private helper methods
private bool OpenConnection()
{
bool bResult = true;
try
{
connection = new SqlCeConnection();
connection.ConnectionString = this.strConn;
connection.Open();
}
catch (System.Data.SqlServerCe.SqlCeException e)
{
System.Windows.Forms.MessageBox.Show(
"Error occurred in OpenConnection"
+ e.Errors[0].Message
);
bResult = false;
}
return (bResult);
}

private bool CloseConnection()
{
bool bResult = true;
try
{
connection.Close();
}
catch (SqlCeException e)
{
System.Windows.Forms.MessageBox.Show(
"Error occurred in CloseConnection"
+ e.Errors[0].Message
);
bResult = false;
}
return (bResult);
}
}
}

Tuesday, November 01, 2005

Harry Reid Redeemed

My esteem for Democratic party leader Harry Reid has been redeemed! After losing me with his endorsement of Harriet Meirs for the Supreme Court, "Give 'Em Hell Harry" has made me proud by forcing his rivals in the Republican controlled Senate to participate in a behind closed doors session to discuss the Bush administration's fast and loose approach to pre Iraq War intelligence analysis. Harry exceeded all expectations and corraled the Senate majority for some 2 hours and forced them to address tough questions about the Valerie Plame case, and other matters related to Bush and his cronies cooking the books to lead us all to war.

I even have begun to believe that the Meirs support I previously derided might have been a clever move on Reid's part to push Meirs into the spotlight in order to egg on a fight between Bush and the conservative religios ideologues he so wishes to please. My faith in the Dumbocrats is slowly being restored. Not enough yet, mind you, to turn in my fresh status as a registered independent. But in time, if Harry keeps up the fight and inspires the rest of the Democrats in Congress to wake up, I just might need to reconsider my party afiliation once again.