Note to self:

If UI doesn't work, there's always command prompt.

http://support.microsoft.com/kb/222444

I was surprised and worried.

Surprised, because my younger sister had just asked me about checking on her database normalisation homework. Apparently her school has taught them database normalisation (which means, her school taught them about relational database concept too, which means her school also taught them about computing, and perhaps a little bit of software development). And she's still 1.5 years away from graduating from her high school!

Worried, because usually her school have about hundreds (and perhaps close to a thousand) students from her batch alone! (It is quite a big school, actually.) Who knows what else they could learn there. SOA? Corporate governance? Web 2.0? And these could be the batch that probably could do my current job by the time they graduate from university (or earlier)!!!! :o (At this time, you should imagine a scene from the Star Wars: Attack of the Clones, where the clones are ready for deployment! Or the robots from i, Robot!)

(Image referenced from: http://news.bbc.co.uk/media/images/39912000/jpg/_39912096_i_robot_pa.jpg)

Okay, I'm not going to debate on which 1 is better between VMWare and Virtual PC. But, if you used Virtual PC, one of the limitation is that the virtual machine can't recognise the USB port that we have on the host machine. Well, if you insist to be religiously devoted to Virtual PC, you can use USB Redirector, a small application that allows one machine to "connect" to a remote USB port. Yeah, remote. Through a TCP/IP port. And not only limited to virtualization environment. Think of it as if you're connecting to a network printer.

The catch? Well, it's not a freeware... Now where's my VMWare installer again.

Have been trying out the BizTalk 2006 R2 RFID for the past 2 days, I find that it "could" be a very powerful engine. Well, there's still a lot of room for me to explore, and i'm still trying to make the sense of its existence yet (perhaps because it is something quite new, just like when BizTalk server was introduced back in year 2000). But that shouldn't stop your interest, if you would like to know more about it. So here it goes: What's in the package?

To get started, perhaps we'll need a little bit of clarification. Similar to BizTalk Services that i mentioned before, BizTalk 2006 R2 RFID is a stand-alone application, although it's packaged within BTS 2006 R2. That means, you do not need a BizTalk Server to start with! (And all the while I was trying to get a copy of BTS 2006 R2 just to test on its RFID Embarrassed) But, BizTalk 2006 R2 RFID can leverage on some features of BizTalk Server 2006, namely the powerful yet cryptic Business Rule Engine and Business Activity Monitoring.

So, without holding you back, view the end to end demo scenario, go download the trials (that means the BTS 2006 R2), look for the samples, case studies, try it out! If possible, get the RFID readers and some tags. There are a few low cost providers (will try to find Singapore based). But, should you not be able to get a reader, that shouldn't stop you, as using the RFID Manager, you can simulate a RFID reader. Cool huh!

I'll post a few more of it later on. I'll need to re-composing my thoughts first. :)

Have you ever be given a task to use SQL Server T-SQL to find out the date value of next day, at 00 hour? Say, now is '2007-10-26 13:30:50', and you need to get a '2007-10-27 00:00:00'?

Naturally, I think most of us will do something like this:

declare @today datetime

declare @tomorrow datetime

set @today = convert(datetime, convert(nvarchar(4), datepart(yyyy, getdate())) + convert(nvarchar(2), datepart(mm, getdate())) + convert(nvarchar(2), datepart(dd, getdate())))

set @tomorrow = dateadd(dd, 1, @today)

A lot of datepart and convert involved just to get the day/month/year value. There is a much simpler way actually, considering that datetime internal value is in fact numeric.

declare @today datetime

declare @tomorrow datetime

set @today = convert(bigint, dateadd(hh, -12, getdate()))

set @tomorrow = dateadd(dd, 1, @today)

Note the part that convert datetime to bigint. That's where the rounding took place. Let's step back a little bit and see how that works.

select getdate() as datetimeType, convert(bigint, getdate()) as bigintType, convert(decimal(18,12), getdate()) as decimalType

 

datetimeType            bigintType decimalType

------------            ---------- -----------

2007-10-26 13:50:27.560 39380      39379.576707870372

 

(1 row(s) affected)

From the SQL query above, we can see that a datetime can be converted to decimal type. The numbers on the left hand side of the "." denotes the number of days since "1900-01-01 00:00:00". The ones on the right hand side denotes the fraction of milliseconds in a day. That means, "1.0" means 1 day, means 24 hour, means 1440 minutes, means 86400 seconds, means 86400000 milliseconds. That means, this query below:

select convert(datetime, (convert(decimal(18,12), @tomorrow) + (2.0000000000000/24))) as tom_2am

is equivalent to "2007-10-27 02:00:00.000". Cool huh? But of course, the query below:

select dateadd(hh, 2, @tomorrow) as tom_2am

is a lot easier to understand. :D

Oh? Why "dateadd(hh, -12, getdate())", you ask? That's because of the rounding during conversion to bigint. So, let's see a few time during the day:

select convert(decimal(18,12),@dt)

decimal(18,12) bigint
2007-10-26 00:00:00 39379.000000000000 39379
2007-10-26 03:00:00 39379.125000000000 39379
2007-10-26 12:00:00 39379.500000000000 39380
2007-10-26 15:00:00 39379.625000000000 39380
2007-10-27 00:00:00 39380.000000000000 39380

Any time before 12 noon on the day (< 0.5 in numeric) will be rounded down. Any other time will be rounded up. So, if we want to get today at mid night time value, we will need a source range from yesterday noon to today before noon, that can be rounded to today midnight. Hence, the "-12 hours" above.

 

PS: I have always wanted to write about this, but since I don't think it'll make any much difference to programming, I've always canceled writing this. Until I asked myself, "how worse can writing this be?", and I don't have the answer. :D If you have a better ways of doing this, please let us know.

This might interest Windows Mobile apps developers out there. Tan Loke Uei (Microsoft's technical product manager of the Mobile Communications Business division) mentioned in his blog that one of his buddy, Richard Jones (of Best Developer Award fame), wrote a Web SERVER in .NET Compact Framework that runs on a Windows Mobile device!

Just imagine the possibilities then.

My friends and colleagues keep on asking me about the blue screen of death that i keep on gettin on my laptop. So, to feed their (and perhaps your) curiosity, here's how I get it. From sysinternals website:

 http://www.microsoft.com/technet/sysinternals/Utilities/BlueScreen.mspx

Enjoy!

Cool, finally I have some hard disk space for Visual Studio 2008 Beta 2. So, the first project that I want to try is, of course, Silverlight 1.1. And so I downloaded the VS 2008 B2 image file, installed it, then Silverlight 1.1 Alpha refresh, and finally the VS Silverlight Tools Alpha for VS 2008 B2. Get all the downloads at silverlight.net.

Okay, now is the time i've been waiting on. I launched VS 2008 B2, create new project of type Silverlight Project, and then "Boom!". I was shown an error message that VS 2008 B2 is not allowed access to "Testpage.html.js". And then my AVG anti virus (free edition) gives a pop-up of "suspected" virus with hidden extension ".js". Uh-oh! A quick check with Silverlight.net forum, it seems like the error happens only when we have AVG antivirus installed. Can't find a quick solution, I decided to get my hands dirty. I decided to change the Testpage.html.js to Testpage.js, so that the AVG "thinks" that it is legitimate .js file. After all, this is just a testpage. Here's what i did:

1. Open up the VS 2008 B2 program files folder:
 C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\
(path may vary with your machine if you customized it)

 

2. Launch windows command prompt, A quick "findstr /S /L /I /M Testpage.html.js *.*" (the arguments were just easy to remember :D) shows that basically there are 4 CSharp files having testpage.html.js content, with the last file "testpage.html.js" were denied access as well. The 4 files are found in 2 different locations (I'm using C#. there could be more locations if you have installed more languages, such as VB.net, C++.net, i guess).

A. C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\ProjectTemplates\CSharp\Silverlight\1033\SilverlightProject.zip (It's a zip file)

B. C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\ProjectTemplatesCache\CSharp\Silverlight\1033\SilverlightProject.zip

 

3. Then I did the following changes (remember to back up first):

A. SilverlightProject.csproj
     <None Include="TestPage.html.js">
-->     
 <None Include="TestPage.js">

B. SilverlightProject.vstemplate
      <ProjectItem OpenInEditor="false" ReplaceParameters="false">TestPage.html.js</ProjectItem>
-->
      <ProjectItem OpenInEditor="false" ReplaceParameters="false">TestPage.js</ProjectItem>

C. Testpage.html
    <script ... src="TestPage.html.js"></script>
-->
    <script ... src="TestPage.js"></script>

D. Rename Testpage.html.js --> Testpage.js


4. Re-create a new Silverlight project from VS 2008 B2, and voila! It works!


Hope this tips helps, and enjoy Silverlight! It's really a cool application.

 

... in Silverlight.

 http://www.windowsvista.si/

 

Yeap, sushi. Read on how BizTalk Server helps a kaiten sushi restaurant in tracking their sushi from chef's cutting board to conveyor belt to customer's plate to chef's monitor and finally, to cashier billing.

 http://www.forbes.com/logistics/2007/05/23/logistics-restaurants-biz-logistics-cx_rm_0523sushi.html

http://www.microsoft.com/biztalk/evaluation/news/default.mspx

Whoa! For someone that has never attended any live video conference, this really impressed me. Microsoft Office RoundTable, from Microsoft Research. It has 360° panoramic view video, with head-size equalization. That means, it doesn't matter if you sit at the end of the room, or just next to the device, the video will display everyone in similar sizes. And, there is another video view that shows the active speaker. The device will auto-detect the direction of voice, and shows the speaker on the video.

Read the full review here.

Any similar product out there?

I'm not much into BTS 2006 yet (hopefully i'll have chance to have more hands on on it). So, pardon me if you still see a lot of BTS 2004 features here.

I was often asked about the huge tracking database that BizTalk 2004 have over time. One my my colleague's project was having 80Gb of harddisk space after only 1 year of operation. My other colleague's development machine took about couple Gb of HD space. This is normal, if there are a lot of messages involved, as for each of the message that comes into and goes from BizTalk Server, it may spawn into multiple messages internally. And each of them will be recorded into default BizTalkDTADB database. Now the problem is, how to remove those records if we're not using it anymore?

Luckily, BTS 2004 SDK (found in product CD) has a stored procedure named "dtasp_PruneTrackingDatabase", that comes handy to delete those tracking records, along with their related information (which may spawned into several tables). Best thing is, we can specify how much of data we want to retain. For example, deleting all tracking records older than 2 months.

Cool! But, this may just add another headache! We have a 80Gb table to be deleted here, and if we take a look into the stored proc, it won't commit until all of them is "delete"-ed. And that means, it may take long hours to complete the delete, not to mention the database resource it will consume. (For a 20 Gb of data, it took abt 3 hours. Not bad though...) So, one of the trick we did was, we ran the sp incrementally, deleting few older months data one at a time, rather than 1 year data at 1 go, by simply specifying the date time. It took almost the same time to complete, but at least it didn't hog the server resources (especially if it's production server).

But what if time is not in our favor? What if we need to delete the records this right minute? Then it's time to just truncate the tracking tables. Get the script here.

Remember to shrink your BizTalkDTADB database after you're done, to reclaim back your property.

EDIT:

Warning [as highlighted by softwaremaker below]: The 2 scripts above doesn't archive your tracking record, and delete/truncate is irreversible.

Last month, a customer who was exploring BizTalk Server 2006 for their new system asked me whether BTS 2006 has out-of-the-box feature for a user to subscribe to a certain event in BTS2006. Imagine this scenario:

Officer A submits a report to his immediate supervisor for approval. Upon approval, the flow stops there. Now let's say the supervisor's immediate manager wants to be alerted on a certain report type, such as a report of monthly expense with total value > $10,000.

Naturally, my response was, sure, you can do it with BizTalk Server. Just add a new business rule policy, create a new send port exclusive for the manager, and forward a copy of the report to the manager's email when the policy was hit. But then, his next question is, can the manager subscribe to the event themselves (rather than subscribe to a message type only)? Perhaps from a web page, with something like UDDI where managers can look into the list and just add the event to their account?

Okay, i was stumbled... for a while. It makes sense for such request. Well, although this is still technically possible, but this is not out-of-the-box, and the complexity increased with allowing users to subscribe to BTS through the web. BTS provides BizTalk Explorer Object Model and WMI that we can use to create the send ports on the fly. RuleEngine namespaces to work with the business rules and policies. Wrap everything under a nice web page. That should work.

But, BTS is supposed to work behind the firewall (not to mention that it doesn't even have any web interface, other than the web services that we can publish), and there will be a lot of works and concerns to be tackled if we want to expose it entirely to the web. So, that's what i told him. Well, i can understand his disappointment.

Well, if he asked me that question now, i'll still be stumbled... for a while Stick out tongue. Should I tell him to explore the "under development" BizTalk Services? Will BizTalk Services answer his requirements? As what I read, BizTalk Services is the BizTalk Server for the Internet (I don't read anywhere that says if BizTalk Service is an extension of the BizTalk Server. The documentations just mentioned the feature similarity). It works on the cloud, powered by .Net 3.0 entirely (Identity, Connectivity, and Workflow). I guess i'll just have to find out more, before I can answer him again...

Finally, my own technical blog, thanks to Kitkai. Nothing much yet, but i'll promise, this will be where i'll pour my technical findings, so, stay tuned. Wink

Posted Wednesday, June 06, 2007 9:24 PM by usoup | with no comments
Filed under:
More Posts « Previous page