# Wednesday, June 1, 2005

The Palestine Information Center (http://www.pitcenter.org) is a passion of mine. A very courageous friend of mine in the West Bank, Jihad Hammad, has created the PIT and put in most of the hard work so far. I am the Development Director and also sit on the Advisory Board (along with a few others you may recognize from this blog like Richard, Clemens and Goksin). I have donated a lot of my time and money to this effort in a bid to get it off the ground and off the ground it is!

The vision is simple. Create an IT Community/Training Center in a place that desperately needs one. Hold classes to get people certified in MS technologies (as well as Java and Linux). Provide a library and lifetime learning resource. A bridge to industry. Then mid to long term, have the center partner with local government, business and university to have the newly certified people work on projects under the direction of project managers at the center. The center can be a software and networking resource for the local industry and government. We would like to produce professional “white collar” workers in an economy that needs them, but also partner with the local industry to more easily place these newly trained people on projects.

The Al-Quds Open University has offered PIT the opportunity to use their lab free of charge for this beginning phase. The PIT curriculum would differ from the typical University Computer Science department courses as it would seek industry leaders to teach the courses with the goal of the courses to be industry certification and lifelong learning. We have four workshops under way. The first one is an Excel class to get started. It is in progress this week!

The Execl class in progress is for the Bethlehem Arab Society for Rehabilitation (http://www.basr.org/) Ultimately we plan to target the MSCD and MSCE curriculum. For now we are just getting interest in the center amongst the population and the university students.

posted on Wednesday, June 1, 2005 7:07:27 PM (Eastern Daylight Time, UTC-04:00)  #    Comments [2] Trackback

In the Netherlands today for the final day of the SDC and the NO vote to the EU charter was not a surprise after several long conversations with locals. after the vote they took us to play some paintball. Somehow I managed to get shot a lot. :)

posted on Wednesday, June 1, 2005 7:02:42 PM (Eastern Daylight Time, UTC-04:00)  #    Comments [1] Trackback
# Tuesday, May 31, 2005

 

So last night during the geek night session at the SDC, the Dutch, inspired by Richard Campbell called me on my SMO Backup and Restore GUI that had a progress meter. They thought I was hacking it, not that I was actually providing a true representation of the progress made by the status of the backup. Here is the progress meter in action, as the database backup makes progress we update the progress meter:

 

 

 

To do a backup programmatically you can to use SMO (see yesterday). Begin by setting the variables to get started.

 

Server svr = new Server();//assuming local server

Backup bkp = new Backup();

 

Cursor = Cursors.WaitCursor;

 

Then you have to set the device to backup to and what database to backup. Notice in the comments the code to the progress meter

 

try

{

      string strFileName = txtFileName.Text.ToString();

      string strDatabaseName = txtDatabase.Text.ToString();

                       

      bkp.Action = BackupActionType.Database;

      bkp.Database = strDatabaseName;

 

      //set the device: File, Tape, etc

      bkp.Devices.AddDevice(strFileName, DeviceType.File);

      //set this when you want to do Incremental

      bkp.Incremental = chkIncremental.Checked;

 

      //progress meter stuff

      progressBar1.Value = 0;

      progressBar1.Maximum = 100;

progressBar1.Value = 10;

 

      //this gives us the % complete by handling the event

      //provided by SMO on the percent complete, we will

      //update the progress meter in the event handler

                       

      //set the progress meter to 10% by default

bkp.PercentCompleteNotification = 10;

//call to the event handler to incriment the progress meter

bkp.PercentComplete += new PercentCompleteEventHandler(ProgressEventHandler);

     

//this does the backup

      bkp.SqlBackup(svr);

      //alert the user when it is all done

      MessageBox.Show("Database Backed Up To: " + strFileName, "SMO Demos");

 

                       

                       

      }

catch (SmoException exSMO)

      {

      MessageBox.Show(exSMO.ToString());

 

      }

catch (Exception ex)

      {

      MessageBox.Show(ex.ToString());

      }

 

finally

      {

      Cursor = Cursors.Default;

      progressBar1.Value = 0;

      }

 

 

Here is the ProgressEventHandler, notice that I made it generic enough that I can call it from both the backup and restore methods!

 

public void ProgressEventHandler(object sender, PercentCompleteEventArgs e)

      {

            //increase the progress bar up by the percent

            progressBar1.Value = e.Percent;

      }

 

posted on Tuesday, May 31, 2005 6:28:53 AM (Eastern Daylight Time, UTC-04:00)  #    Comments [1] Trackback
# Monday, May 30, 2005

The Software Developers Conference in the Netherlands has begun. Today I show how to prevent SQL Injection Attacks in ASP .NET as well as other cool tricks. Lots of RDs here and lots of happy attendees. As usual at SDC I will show something very new and cool. I will show off some of the new SQL Server Management Objects (SMO) in the keynote tonight. Ill give you a preview here.

The SMO object model is a logical continuation of the work done in SQL-DMO. SMO is feature-compatible with SQL-DMO, containing many of the same objects. . To achieve maximum data definition language (DDL) and administrative coverage for SQL Server 2005, SMO adds more than 150 new classes. The primary advantages of SMO are in its performance and scalability. SMO has a cached object model, which allows you to change several properties of an object before effecting the changes to SQL Server. As a result, SMO makes fewer round trips to the server, and makes its objects more flexible. SMO also has optimized instantiation, meaning that you can partially or fully instantiate objects. You can load many objects quickly by not instantiating all the properties of the objects. To get started you have to set a reference to it and pull in the namespace:

using Microsoft.SqlServer.Management.Smo;

Now I will show you how to programitically do a database restore. You start with getting the SMO objects: Server and Restore.

Server svr = new Server();

Restore res = new Restore();

Now take a look at how easy you can do a restore, just a few lines of code:

res.Database = “AdventureWorks“;

res.Action = RestoreActionType.Database;

res.Devices.AddDevice(“c:\mybackup.bak“, DeviceType.File);

res.ReplaceDatabase = true;

res.SqlRestore(svr);

There is a lot more that you can do with SMO, but this shows you how easy it is to manage your server from code. A very cool thing to do it put some of the server monitor stuff into an ASP .NET page for viewing your server stats from a remote location.

More on SMO to come...

 

posted on Monday, May 30, 2005 7:32:15 AM (Eastern Daylight Time, UTC-04:00)  #    Comments [0] Trackback
# Saturday, May 28, 2005

That is the title of Richard and my Monday night keynote at the Software Developers Confrence in the Netherlands. Well I think it is now: “Estaban, splain dis Jukon to me!“ where we talk all about SQL Server 2005 in bad Spanish accents. To tell you the truth we have no idea what we are going to talk about, we do know that it will  be fun, contain beer and technical content. Confrences in the Netherlands rock.

Off to the Red Lights...

posted on Saturday, May 28, 2005 7:33:16 AM (Eastern Daylight Time, UTC-04:00)  #    Comments [1] Trackback
# Wednesday, May 25, 2005

At TechED 2005 US in Orlando, you will not want to miss the GrokTalks. Trust me. They break the mold and do not follow the MS party line. Stay tuned...

posted on Wednesday, May 25, 2005 5:12:06 PM (Eastern Daylight Time, UTC-04:00)  #    Comments [0] Trackback
# Monday, May 16, 2005

24 states have laws barring interstate shipments of wine. This is done to protect state industry. It is foolish. This means if I travel to Napa and visit a vinyard that is small they can't ship me wine unless they are “doing business in New York State”. Might as well move back to the Soviet Union.

Anyway, today the Supreme Court agreed with me and overturned a NY and Michigan law.

posted on Monday, May 16, 2005 1:29:05 PM (Eastern Daylight Time, UTC-04:00)  #    Comments [2] Trackback
# Thursday, May 12, 2005

Today at 2 p.m. Nepal time, Ed Viesturs, reached the summit of Annapurna. He has failed in the past, but by getting here he has become the first American to climb all 14 of the world's 8,000-meter peaks (and all without oxygen, having been there I know how hard that is!). In a call from the summit, Ed said that it's "one of the happiest days of my life, one of the hardest days of my life."

Congratulations Ed!

posted on Thursday, May 12, 2005 3:59:08 PM (Eastern Daylight Time, UTC-04:00)  #    Comments [104] Trackback
# Friday, April 29, 2005
DBA304  Advanced Querying Techniques, Tips & Tricks Using Transact-SQL
Speaker(s): Richard Campbell, Stephen Forte
Session Type(s): Breakout
Track(s): Database Administration
Day/Time: Monday, June 6 3:15 PM - 4:30 PM Room: S 310 A
Take your querying to the next level! This session gets away from the fundamentals of SQL queries and into the hard stuff. See two experts in SQL Server compare and contrast querying techniques between SQL Server 2000 and SQL Server 2005. This session has a series of real world examples to show how creative SQL queries can generate solutions in record time. Some techniques you'll learn include how to do crosstab queries that take seconds to execute instead of hours, exploiting sub-queries and taking advantage of self-joining. Along the way, get some insight into how SQL servers work, as well as how SQL Server 2005 is going to make advanced querying even easier.
 
posted on Friday, April 29, 2005 8:13:37 AM (Eastern Daylight Time, UTC-04:00)  #    Comments [1] Trackback