Monday, November 30, 2009

Query to get the table names in a SqlServer db

The following Query will generate a list of the tables in a sqlserver db

select [name] from sysobjects where [xtype] = 'U' order by [name]

Use [xtype] ='PK' for list of primary keys,

[xtype] = 'P' for list of stored procedures,

etc.

Wednesday, October 21, 2009

Copy Some Rows From Table1 to Table2 SqlServer

I am doing a one-time combining 2 separate legacy database tables that contain some of the same info but also additional different info into one new SqlServer table. I am also copying some but not all of that additional data.

So I am inserting some of the columns from each table into some of the columns in the new table.

If all the columns in table2 are going to be inserted into table1 and the column names are the same I can:

insert into table1 (Detail, Unitname, Sortorder) select * from table2

if there is a change in column name change:

insert into table1 (Detail, Unitname , Sortorder) select facilabbr as Detail, Unitname , Sortnum as Sortorder from table2

Tuesday, October 13, 2009

Javascript Function using RegEx Regular Expression

I need to check client side if a DropDownList.SelectedItem.Value is any of the following: 1,3,9,17,or 15.


Rather than use a clumsy if statement, I do this by seeing if the value will match a Regular Expression:

      function taskChange() {
var task = $get("ddlTest");
var RegExp = "(^1$^3$^9$^17$^15$)" ;
if (RegExp.match(task.value))
{
// A value of 1,3,9,17,or 15 was selected
               // do whatever 
           }
else
{
//Some other value was selected
                // do whatever
}
}

Thursday, September 24, 2009

Playing with an Infragistics WebDialogWindow Bug

Found a bug in the Infragistics WebDialogWindow.

I discovered it when using the zooming function via holding down the Ctrl key and scrolling the mouse wheel to make the display more visible to the group I was demo-ing to. Moving the WebDialogWindow around leaves text behind. Oops.

Not exactly the demo I was shooting for.

But can be used to generate some cool effects:

This is what the WebDialogWindow looks like before moving it:



These are screenshots of the WebDialogWindow on zoom:

Floating away:



Where did my window go?

An out of body experience
:



And my personal favorite -

WebDialogWindow Abstraction :

Thursday, September 17, 2009

Increasing number of connections in IIS 5.1

XP Pro IIS 5.1 is limited by default to 10 concurrent connections.

This can be increased to a maximum of 40 by:

C:\Inetpub\AdminScripts\adsutil set w3svc/MaxConnections 40

Using Manoli

I use http://manoli.net/csharpformat/ , or other manoli flavors, to format code for presentation in this blog.

Delayed action on Mouseover

Haven't tried this yet, just parked it here till I need to use it.



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Page title</title>

<script type="text/javascript">
var c=0;
var t;
var myTimer;
function timedCount()
{
document.getElementById('txt').value=c
c=c+1
t=setTimeout("timedCount()",50)
}

function stopCount()
{
clearTimeout(t)
}

</script>
</head>

<body>
<form>
<input type="button" value="Start count!" onmouseover="var myTimer=setTimeout('timedCount()', 1000);" onmouseout="clearTimeout(myTimer);">
<input type="text" id="txt">
<input type="button" value="Stop count!" onClick="stopCount()">
</form>
</body>
</html>