Posts
23
Comments
10
Trackbacks
0
August 2008 Entries
Hot To Properly Schedule a Job on Windows

I needed to automate creation of a job last night on a Windows computer. I was able to find examples of such a script, but realized that they lack a very important part - the ability to schedule a job taking into consideration the Time Zone the computer is in. This is important as the VBScript needs the time zone offset to schedule the script accurately. For people residing in different time zones the offset value will be different and this is also a factor for scheduling a job on computers in different time zones. I thought why not to overcome this limitation and make scheduling jobs easier? I was able to craft such a script. I think the time zone alignment is a necessary part of any job scheduling script. The code is below:


'Purpose: Schedule a Windows Scheduler Task
'Notes..: The script is capable of adjusting itself to the time zone of the computer

Dim offset
Dim strComputer
Dim errJobCreated

'Use local machine
strComputer = "."
For Each os In GetObject("winmgmts:").InstancesOf ("Win32_OperatingSystem")
  offset = CStr(os.CurrentTimeZone)
Next

'Schedule notepad to run at 12:30 pm every other work day
Set objWMIService = GetObject("winmgmts:" _
    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
   
Set objNewJob = objWMIService.Get("Win32_ScheduledJob")

errJobCreated = objNewJob.Create _
    ("Notepad.exe", "********123000.000000" & offset , _
        True , 1 OR 4 OR 16, , , JobID)
  
If errJobCreated = 0 Then
 Wscript.Echo "Scheduled task has been successfully created."
Else
 Wscript.Echo "New scheduled task creation has FAILED!."
End IF

posted @ Thursday, August 28, 2008 11:33 AM | Feedback (0)
SQL Server 2008 RTM First Impressions

I have decided to continue my article on the SQL Server 2008 RTM exploration update 3 in form of a new post.

I am up and running with the SQL Server 2008 with no issues.

The SQL Server Configuration Manager is a nice replacement for Surface Area Configuration and SQL Browser and it needs little attention. I spent literally 2 minutes just glancing at the settings. Nothing much to change.

Among the new things are SSMS enhancements like the built in ability to debug T-SQL be it a stored procedure or just a SQL Statement, very nice.

Another feature I liked is the ability to edit data directly:

SSSM Features 1

 

 

 

 

 

 

 

SSMS allows you to only get first 200 rows. The feature became tricky when I needed to edit 10 specific rows. I have resolve this riddle by right-clicking on the status bar after I obtain the first 200 rows. It brings you a menu where you can choose to have the SQL editor pane for example where you can fine tune your query, see picture below:

SSMS Feature 2

 

 

 

 

 

 

 

 

This works unlike the command Select First 1000 Rows where you get the SQL editor right away ready to accept your modifications.

So far so good, my next posting will be encrypting databases.

posted @ Wednesday, August 20, 2008 11:32 PM | Feedback (0)
Top 10 source code search engines

I have came across something very useful via StumbleUpon for software developers:
Top 10 source code search engines
http://www.cavdar.net/2008/08/01/my-top-10-source-code-search-engines/

I have decided to give an update to my article after I read a new related posting by Scott Hanselman.

Enjoy!

kick it on DotNetKicks.com

posted @ Saturday, August 09, 2008 11:24 PM | Feedback (0)
SQL Server 2008 Released Today - Update 2

An RTM of MS SQL Server 2008 has finally been released today!

Being an MCITP in SQL Server I will definitely give it a try especially when Microsoft is so nice with providing a free 180 Enterprise evaluation version that you can find here: http://www.microsoft.com/sqlserver/2008/en/us/trial-software.aspx

I will be trying out first the data encryption capabilities.

Update 1:

The download come as an image, and It took quite a while to set the things up as I decided to try it on a non production machine first because the installer prompted me to get the .Net Framework 3.5 SP1 that is known for several bugs that may need attention; a good, though a small summary on the bugs is here.

I have just finished installing the SQL Server up. Overall I can see huge improvements in the way the installer is designed, it is very user friendly.

Update 2:

I had zero issues installing and configuring the SQL Server 2008 default instance on my test Intel Quad Core Vista machine.

This is unlike some other people who reported hardware issues and other hurdles. Reading some blogs I found people had difficulties mostly getting the SQL Server 2008 sample databases, so to this regard I recommend William Vaughan's blog.

My personal experience was not as painful getting the sample databases because while installing them (running a sample database installer) I copied the path where the installer wanted to place the databases to. Sure I was surprised to not to see the .mdb file for the AdventureWorks (naturally I was expecting to just attach the database), so fiddling around within the directories the installer created I found AdventureWorks2008.bak file in .\Program Files\Microsoft SQL Server\100\Tools\Samples - voila! Next my DBA's hand reached out to SSMS and restored it in under 1 min. I guess, this is good to know if one messes up the database and needs to restore the pristine instance.

I am ready to rock-n-roll!

Update 3 to follow.

posted @ Thursday, August 07, 2008 1:42 PM | Feedback (0)
How to make text box autoscroll

Today I needed to make a text box auto scrolling in C#.

After reading all the articles I found relevant (only two articles) I was not satisfied and decided to experiment.

As a result in 5 minutes I produced this code:

//Make the text box autoscroll

private void tbMessages_TextChanged(object sender, EventArgs e)

{

//Get the last text position

tbMessages.SelectionStart = tbMessages.Text.Length;

tbMessages.ScrollToCaret();

tbMessages.Refresh();

}

posted @ Wednesday, August 06, 2008 11:53 AM | Feedback (7)
Check out Cuil!
Curl - a new kid on the block of search engines
posted @ Tuesday, August 05, 2008 11:00 PM | Feedback (0)
I am on the web!

After carefully examining many domain hosting providers and listening to advice (thanks Scott Hanselman!) I have finally made a choice and joined 1&1.

I wanted a cheap service just first to try out and satisfy my basic needs. It turned out 1&1 is a good provider. The interface is relatively simple, but functional, the website builder is good, so I am happy!

As a result my personal web page is now online at www.zubarev.net, you are welcome to visit!

Interestingly, this provider supports web page access with or without the WWW. An interesting article on this topic you can find here: http://www.codinghorror.com/blog/archives/001109.html

posted @ Monday, August 04, 2008 10:02 PM | Feedback (0)
Joined identi.ca

  is a new microblogging provider. Looks to me as an alternative to Twitter.

I decided to give it a try. I can see a few wrinkles in how it works, but all is quite acceptable to me.

If you are up to microblogging it might be for you.

Cheers!

posted @ Sunday, August 03, 2008 12:01 AM | Feedback (0)
Handling very large files
Yesterday I needed to deal with very large files and kept switching from one editor to another, today in the morning while browsing through my RSS feeds I came across this post at DonationCoder, Large Text File Viewer was the tool that made my day!
posted @ Friday, August 01, 2008 12:06 AM | Feedback (1)
News
Did you know you can create your own search engine with Google?