Posts

Showing posts from April, 2008

Batch File for Windows to start/stop Oracle Services

In a bit of a departure from my regular coding I had to write a batch file yesterday that would start/stop our Oracle 11g instance on our server. Since this was old old old school stuff it took me some tweaking but i got it done. So now I've decided to share it with the rest of the world. Link to oracle.bat It's pretty simple you just call oracle.bat start/stop from the command line to start or stop your oracle services. Now the service names in there are specific to our instance so you will need to rename them to the values you have installed. Also this is for one database instance with one listener running. If you have different services running you just to need to add their service name to the appropriate start/stop section. It's a good base for extending if you need it.

Enabling Paging on a GridView

So I have been recently playing with GridViews in asp.net. Normally I use repeaters but the auto styles and paging have been appealing to me a bit lately. But there is some trickery to enable the paging on a GridView. You have to write a wee bit of code to get it to work correctly. The documentation doesn't make it abundantly clear on how to do this. What you need to do is implement the PageIndexChaning event and rebind your datasource to the grid. So for my project the code looks like this: protected void GridViewProducts_PageIndexChanging( object sender, GridViewPageEventArgs e ) { /* Reset your datasource, I am using a custom collection here */ this.GridViewProducts.DataSource = this.ProductsList; /* Set the new page index this comes from the GridViewPageEventArgs arguement passed into the method */ this.GridViewProducts.PageIndex = e.NewPageIndex; /* Rebind the grid */ this.GridViewProducts.DataBind(); }

windows powershell

So for those of you not in the know, microsoft has realesed a pretty good set of command line tools called windows powershell. It pretty much offers unix power commands to the windows command line. It's pretty cool and allows developers to add functionality via snappins. The microsoft documentation is here . A pretty good tutorial can be found here . I've followed the tutorial and found it fairly easy to create the cmdlet and snappin. Installation isn't as easy as I woule like but it's doable.