When it’s a structure, DOH! I couldn’t figure out why my For Each loop wasn’t saving the value of my Reference objects. Turns out they were Structures (treated like value objects) so they were copies, not references. I discovered that with the help of Google Answers!
Friday, November 30, 2007
When is a class not a Class?
Troubleshooting the FCKing Editor
TestLink relies on FCK for rich-text editing. Well the File Upload and Browser weren’t working – initially b/c then needed to be enabled, then I was getting a popup that said “XML Request Error : Internal Server Error (500)”. I used the FCK Editor test page: editor/filemanager/browser/default/connectors/test.html to determine the /userfiles/ directory needed to be created. I ended up just putting it in the root to save time/trouble.
Administering SQL Express without Management Studio
Call me a glutton for punishment, but today I endeavored to create a database and user w/o the aid of SQL Management studio. Why would you do something so ridiculous you ask? First, my new shop is more of an Oracle group that tolerates MS, so I don’t have Management Studio installed yet. Second, I think you learn more about a product when you start using it command-line. No hand holding, point and click stuff here. Just raw ascii and endless error messages. Anyway, I got it working so here’s the script to create a database and a login for it:
create database TestLink
go
create login testlink with password = 'abc123', DEFAULT_DATABASE = testlink
go
use testlink
create user testlink with default_schema = dbo
go
sp_addrolemember 'db_owner', 'testlink'
go
Btw, if you’re SQL Express install is fresh then it is in Windows Authentication mode and needs to be changed to Mixed mode (restart SQLEXPRESS service required):
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Microsoft SQL Server\MSSQL.1\MSSQLServer
LoginMode = 2
Thursday, November 29, 2007
PHP + MSSQL working
I have learned much more than I wanted to about PHP trying to get TestLink working with MSSQL 2000 so here’s what I did:
- Downloaded ntwdblib.dll from webzila.com and overwrote the c:\PHP5 version and copied to SYSTEM32 (this seems to be a key to solution)
- Enabled the MSSQL extension (extension=php_mssql.dll )
- Restart IIS
- Visited PHP page with the info code in it: <? phpinfo(); ?> to verify the extension loaded.
- Ran test code that connected to a SQL server (I just Googled it).
Wednesday, November 28, 2007
Dynamically create a DataTable for Oracle Stored Procedures results
I recently had to write a report that flattened 20 joined tables to “dump” the contents for ad-hoc-i-ness; probably 100+ columns. Well, I did not want to have to build a fixed DataTable (Table.Column.Add(“Col1”)…), as was the standard in our shop, so I wrote a routine to do it instead:
Public Shared Function BuildDataTable(ByRef dr As OracleDataReader) As DataTable
Dim table As New DataTable()
Dim colName As String
' Create the table from the DataReader columns
For i As Integer = 0 To dr.FieldCount - 2
colName = dr.GetName(i)
table.Columns.Add(colName)
Next
' Populate the table
While dr.Read
Dim row As DataRow = table.NewRow()
For i As Integer = 0 To dr.FieldCount - 2
row.Item(i) = dr(i)
Next
table.Rows.Add(row)
End While
Return table
End Function
Tuesday, November 27, 2007
Fermenting Update 1
As of Tuesday at 7am (30 hours), the fermenting has slowed to a very occasional bubble (1 in 30 seconds). Once it stops I’ll wait 24 hours before bottling. Unfortunately I discovered (actually read ALL the directions) that I put the Dry Hops in before I was supposed to. Don’t know what effect that will have…only time will tell.
Monday, November 26, 2007
MySQL Backup & Restore
Just wanted to document how to backup and restore my shiny new MySQL database since I’ve got some real data in it.
Backup:
mysqldump -u sadmin -p pass21 Customers > custback.sql
Restore:
mysql -u sadmin -p pass21 Customers < custback.sql
Brewmeister C
Well, I jumped feet first into hobby-brewing. After plunking down some bucks at the local homebrew store for their economy kit, I created a sweet smelling “amber” wort – beer jargon for boiled hops & sugars. By the next day, the air-lock was bubbling, so I guess the yeast are alive and well in that plastic bucket (aka fermenter). Only time will tell if I followed enough of the directions in enough detail to have a consumable beverage.
Thursday, November 15, 2007
PHP + MySQL
Still can't get testlink working though...
Wednesday, November 14, 2007
Good find: HttpContext.Current.Items
Thanks to Mike Duncan for a good tip and lots of laughs:
Generally, HttpContext.Current.Items doesn’t get all that much hot blog press, but let me tell you, I’m here to change all that. For those out of the know, System.Web.HttpContext.Current.Items is a sweet key-value pair collection you can use to pass objects around up and through all components that participate in a single HTTP request.
Array.ForEach (also works for )
Thanks to the .Net Tip of the Day for this little gem:
Sub HandleClick()
Dim myFam As String() = {"Chris", "Sue", "Matthew", "Annie", "Samuel"}
txtResult.Text = ""
Array.ForEach(myFam, AddressOf AddSeperator)
End Sub
Sub AddSeperator(ByVal name As String)
txtResult.Text += name & "|"
End Sub
MVC .net?
One of the things that many people have asked for over the years with ASP.NET is built-in support for developing web applications using a model-view-controller (MVC) based architecture.
Last weekend at the Alt.NET conference in Austin I gave the first public demonstration of a new ASP.NET MVC framework that my team has been working on. You can watch a video of my presentation about it on Scott Hanselman's blog here.
We'll be releasing a public preview of this ASP.NET MVC Framework a little later this year. We'll then ship it as a fully supported ASP.NET feature in the first half of next year.
MaintainScrollPositionOnPostback is cool (and easy)
MaintainScrollPositionOnPostback
="true"setting for the Page control. It's a little "jerky", but it gets the job done. It pays to troll the 4Guys site from time to time. They really know their stuff!
Tuesday, November 13, 2007
GridView DataItem and Sorting NameValueCollections
If e.Row.RowType = DataControlRowType.DataRow Then
name = CType(e.Row.DataItem, DataRowView).Row.Item("TestServerName").ToString()
value = CType(e.Row.DataItem, DataRowView).Row.Item("TestServerId").ToString()
If Not name.Equals(String.Empty) AndAlso testServerList(name) = Nothing Then
testServerList.Add(name, value)
End If
sortedKeys = testServerList.AllKeys
Array.Sort(sortedKeys)
Monday, November 12, 2007
Ntelos 8K
37:55 HR: 173avg 197max
Mile 1 - 7:36 158avg
Mile 2 - 7:49 174avg
Mile 3 - 7:53 175avg
Mile 4 - 7:34 177avg
Mile 5 - 7:01 180avg
Friday, November 9, 2007
How (NOT) to winterize an irrigation system
Note: you should not follow my advice. This is how a computer programmer winterizes a system and is clearly what not to do!
Do not:
- attach a compressor without understanding how your pressure regulator works (mine is loosen = less pressure ?!?!?) if you're asking what's a pressure regulator just stop now
- open the city water valve with your compressor attached!
- assemble cast iron fittings without lots of teflon tape
- walk back and forth to the timer control
- expect things to go as planned
I assembled my "adapter" and when connecting it to the system the pressure instantly shot up to 80psi - the danger zone for PVC. You don't want to be above 60psi - city water pressure. Anyway, I figured lets see what happens to that zone I don't use that much...it turned on and worked like normal. The big zone never did lift the sprinklers, so I'm a little worried it didn't get blown out enough. Hopefully we'll be okay here - south of the mason/dixon.
My valves have little manual override tabs that I discovered after walking back and forth a bunch of times to the control in the garage. Next time I'd use them! Make sure you use lots of teflon tape, since the iron didn't seem to seal well with the PVC.
Thursday, November 8, 2007
Flip-Flop - GIMP for President
Great DIV hide JavaScript code
<
fieldset><legend onclick="toggleLayer( 'divComponentInfo', 'expandImg' )" onmouseover="this.style.cursor='hand'">
<img alt="expand" id="expandImg" src="images/expand_plus.gif" style="vertical-align:middle;padding-right:5px;" />Component information</legend>
<div id="divComponentInfo" style="display:none">
function toggleLayer( whichLayer )
{
var elem, vis;
if( document.getElementById ) // this is the way the standards work
elem = document.getElementById( whichLayer );
else if( document.all ) // this is the way old msie versions work
elem = document.all[whichLayer];
else if( document.layers ) // this is the way nn4 works
elem = document.layers[whichLayer];
vis = elem.style;
// if the style.display value is blank we try to figure it out here
if(vis.display==''&&elem.offsetWidth!=undefined&&elem.offsetHeight!=undefined)
vis.display = (elem.offsetWidth!=0&&elem.offsetHeight!=0)?'block':'none';
vis.display = (vis.display==''||vis.display=='block')?'none':'block';
}
Heater fix - blown fuse
Expression Design
Wednesday, November 7, 2007
Testing results of REF CURSOR in PL/SQL and Toad
CUR1 AMR_PACK.PROJECT_CUR;
C1 NUMBER;
C2 VARCHAR2(10);
C3 VARCHAR2(100);
C4 VARCHAR2(20);
T1 VARCHAR2(100);
T2 NUMBER;
P1 VARCHAR2(100);
P2 NUMBER;
BEGIN
DBMS_OUTPUT.ENABLE(1000000);
EXTRACT_APPS_SUPPORTED('',OUT_CURSOR => CUR1);
LOOP
FETCH CUR1 INTO C1,
C2,
C3,
C4,
T1,
T2,
P1,
P2;
EXIT WHEN CUR1%NOTFOUND;
DBMS_OUTPUT.PUT_LINE('base_id: ' || C1);
END LOOP;
CLOSE CUR1;
END;
Crazy day
Boy was yesterday a tough one! Kids throwing up, code blowing up, interpersonal issues, and to top it off…I broke my mother's heater trying to install a new thermostat (blower motor would not stop running). Today is looking much better by comparison!
WPF experiences
Rockford Lhotka said it right:
From early on, my consistent feedback to Microsoft has been that the technology is a failure if developers have to learn XAML to use WPF. By that measure, the current release of WPF is not doing well.