Aero in Remote Desktop

29 05 2009

YES! Remote Desktop now does AREO!! now = Windows 7

Basically they put in more capabilites into the RDP client. Wanna test it? You need to access a Win 7 (or maybe even vista-not sure) comp FROM a win 7 comp… it works only then.

I need to check out how games will perform through RDP now :)





Data Binding

29 05 2009

Back in PHP, I wrote loops. Loops that would take data from a single select query (no, I didnt write multiple select statements… you’re funny :) )… and then put that data out in columns etc

ASP.NET – say hello to DataBinding. Apparently its been around for quite some time, but it used to be slow. And now its not. So, there is a DataList object. Kinda simple. But use GridView. Its newer and better.

Essentially, you write a stored procedure giving you the output you want after accepting some input variables. Click on the GridView. That cute little “>”  gets a click and you add your data source. Define your connection string in web.config (so that it can be changed later). Enjoy the GUI. I am storing the login name in the Session info. Will find out soon enough if this is the right thing to do. It even lets you do a test query by allowing you to specify the input variables… CUTE too CUTE :)

Since the stored procedure gives you certain columns, that is cool and data-bound. Now you may want to change lots of stuff.

1. You want to have your own column where you add data on the fly. So add a new column. A Template column if the others are not nice. Add whatever you want inside <ItemTemplate> tags inside this

2. For GirdView, there is a rowbound event handler. Once a row is populated with bounded sql data, this function gets called… and you get to meddle with that row (change the values fom sql.. use those values to generate data for your new columns… do whatever)

3. Rowcommand is what you use to monitor clicks. The event argument e carries data. Make sure to add proper commandnames and commandarguments if they are buttons. Do this in the rowbound function.

Another nice thing is that it auto-sorts when you click on the column header names. It basically calls Rowcommand. Now if you redefine your rowcommand, just dont do anything if you detect a sort command (Commandname is “sort” ) I guess it calls another “sorting” function that does the trick after that.





SQL Stored Procedures

29 05 2009

Apparently this is the STANDARD way to do stuff :)

So, here’s the story… Microsoft has its own modified version of SQL (called T-SQL or Transact SQL)… this is what comes with those SQL Servers that get installed when you put Visual Studio… there is this neat tool called SQL Management Studio… Use it. Its a nice Graphical Interface. Saves you loads of time writing queries to do some basic stuff.. Apparently the newer 2008 SQL Managemet studio has debugging feature but 2005 doesnt :(

Anyway, so in PHP I was used to writing queries in the php code itself.. I did that for my ASP.NET code too… only to read later on that stored procedures are the way to go and then saw a small sentence in the Software Requirement Specs that said “Standard security and error checking measures… 3)Stored procedures for SQL”

So, this is how it works. Instead of giving full access to the DB user, you give them access only to the procedures. And since you have written the procedure and they open up only a very limited window for meddling with stuff… its secure :)

I am using the SQL logins with inbuilt windows authentication… one of the many advantages of being on a domain account

A few important things to remember… you pass values to the procedures through ASP.NET. Carefully specify the format field (if its nchar… coz apparently the AddWithValue() function does a String lenght of the passed char and puts that as nvarchar… ). Queries can be returned directly. No need to specify a spearate return variable etc. But you can if you want to. Just specify the direction as output (even in sql)