Thursday, December 20, 2007
Tuesday, December 18, 2007
Debug symbols not loaded
I spent a frustrating hour yesterday trying to figure out why I couldn’t hit the breakpoints (“Debug symbols not loaded”) in my class library. I added and removed references and build options until I could think of nothing else to do. Then I said, even though it’s not pointing at the GAC version (this is a DLL shared by multiple apps), let’s see what happens when I remove it from the GAC…BINGO, problem solved! I still don’t understand why it was using the GAC version since all the projects in my solution were referencing each other as “project references”, but that solved the issue.
Thursday, December 13, 2007
MasterPage tips
Fortunately, a strongly-typed solution is available that doesn't involve casting the Master property to the base class of the master page in order to access its members (keep in mind that any server controls defined in the master page won't be accessible even after a cast is performed, because they're marked as protected by default).
In cases where a control defined in a master page needs to be exposed to one or more content pages in a strongly-typed manner, a public property with a get block can be added into the master page class as shown in Figure 2. The get block returns a Label control instance named lblHeader.A content page can reference members defined in the custom master page class by adding the MasterType directive immediately under the Page directive:
<%@ MasterType VirtualPath="~/Templates/WebsiteMasterPage.master" %>This causes the ASP.NET compiler to use the custom master page class for the type of the Page class's Master property as opposed to the default MasterPage class
Word to Help Converter
I found a great little open source tool for converting Word documents to compiled HTML help files written by tonibo. It also generates a reasonably good HTML frames based help system – the purpose for which I am using it. Rather than create a single large PDF file, I prefer to have a series of help files that can be consumed as a guide, or link directly to from the content. If you download the source, you also get to brush up on your Spanish! Mui Bien!
Tuesday, December 11, 2007
First beer - first impressions
For those awaiting the results of my first homebrew, the Big Sky Amber Ale (thank you Weekend Brewer) it made the debut tasting at a holiday party this weekend to rave reviews by the partakers. The tasters were being charitable considering this was my first attempt: “wow, it doesn’t make me want to throw up!” In all fairness, the beer is a bit young at only one week in the bottle. Over the next few weeks the taste should improve and the hoppy-ness should mellow.
If you are considering brewing, I strongly encourage you to jump right in. The process is fairly straightforward and the satisfaction of brewing your own beverage is quite rewarding.
Wednesday, December 5, 2007
DefaultButton, DefaultFocus and UniqueID vs ClientID
Wow, now I just stumbled upon something rather confusing. I discovered one of my screens was deleting records by default (confirmation prompt of course) when users pressed ENTER so I went to set the DefaultButton to something more appropriate. While I was at it, why not set the DefaultFocus too? So I added the following code:
Page.Form.DefaultButton = btnComponentSearch.UniqueID
Page.Form.DefaultFocus = txtComponentName.UniqueID
That fixed the button, but the focus wasn’t working so I changed focus to
Page.Form.DefaultFocus = txtComponentName.ClientID
To my surprise it worked! Then I thought…what happens if I change the DefaultButton:
Page.Form.DefaultButton = btnComponentSearch.ClientID
That resulted in the following error:
The DefaultButton of 'form1' must be the ID of a control of type IButtonControl.
So it could no longer find the control, how confusing…until I read this article about Naming:
Rendered name attributes correspond to UniqueID property and id attribute to ClientID property.
So gist is: VB.Net understands UniqueID, but for Javascript-ish stuff, you’ll need ClientID (except for the DefaultButton – which uses both J ). Pretty crazy!
Monday, December 3, 2007
Bottled my first brew
With the help of a little child labor (my 5yo son helped), the first batch of malted beverage is carbonating in 28 bottles (22oz each). A quick sample revealed a hoppy amber liquid that tasted something like beer. Two more weeks to wait for the final product…
Friday, November 30, 2007
When is a class not a Class?
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!
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.