Archive

Archive for February, 2009

Visual Studio 2008 Dynamic Data Web Appliction Database Scaffolds

February 26th, 2009
Recently I’ve been addicted to using Subsonic which is AWESOME, especially when you are converting a legacy Application a web based
RIA Application! It save me hours of tedious coding. Point being they have a very nice scaffolding feature which creates web pages that
become a nice little management console for your database. The only catch is you need to have created all of your table references.
 
Well I couldn’t figure out for the life of me how to grab it and publish it to a web site so I could use it from anywhere. Instead I always had to have SubStage running. I hated this, so we found another way, which is just as nice. Here is step by step how its done.
 
Enjoy!
 

 
Create A new Visual Studio 2008 SP1 Project using Dynamic Data Web Application
 
 
Using Server Explorer (View > Server Explorer) Add a new Database Connection
 
 
 
Add A New Item to WebAppliction1 (in Solution Explorer Right Click WebAppliction1)
 
 
 
Back to Server Explorer
 
Select All the tables and drag them into the myDBLINQ.dbml
 
 
back to Solution Explorer
Open the myDBLINQ.designer.cs and copy the className highlighted (myDBLINQDataContext)
 
Open Global.asax
Uncomment the line that looks like
Replace YourDataContextType with the line you previously copied myDBLINQDataContext
   and set ScaffoldAllTable = true
 
 
Now Run the Debugger.  Clicking OK through the Prompt Below.
 
 
 
You should now have Scaffolding for your database…without writing a line of code
 

Greg C#

Replace Carriage Returns and New Lines \r \n in Flex for HTML Template

February 24th, 2009

This came up as I was generating and HTML template in Flex. I wanted a new Table Row foreach New Line of a textArea.text

You’ll see that I am replaceing the \r (carriage returns) with HTML table rows and cells. If you are here you are probably  primarily interested in something simple like

private function otherTasks ( text : TextArea ) : String {
//replace "</td></tr><tr><td>” with whatever you want
	var newString:String = text.text.replace(/[\r\n]/g, "</td></tr><tr><td>");
}
private function otherTasks ( text : TextArea ) : String {
	var temp:String = "<tr><td>";
	temp+= text.text.replace(/[\r\n]/g, "</td></tr><tr><td>");
	var str:String = "";
	str+= "<P><table class=\"sample\" width=\"800\"><thead><tr height=13.75>";
	str+="<th>OTHER TASKS NOT IN MAGIC</th>";
	str += "</tr></thead><tbody>";
	str+= temp;
	str+="</tbody></table>";
	return str;
}

Greg Uncategorized

Firefox Kerberos Authentication

February 17th, 2009
Getting  Firefox to work with Kerberos Authentication is quite simple.
You only need to edit 2 entries in your Firefox “about:config”
Here are the steps…
1) In the address bar enter “about:config” (you will get a warning, just click through…of course you’ll be careful);
2) In the filter field enter “network.negotiate*uris
3) Enter the servername that needs to be trusted for kerberos in the value field. (Comma seperate for multiple servers) for the following 2 Preference Names:
network.negotiate-auth.delegation-uris
network.negotiate-auth.trusted-uris

Greg Firefox ,

Merge Flex Data Visualization Components with Open Source SDK

February 17th, 2009

If your application uses Flex Builder Professional features such as data visualization components or automated testing, you will need to copy those elements from the latest milestone SDK that came with Flex Builder into your newly downloaded SDK. The relevant files that you need to copy are:

{FlexSDKDir}/frameworks/libs/automation*.swc

{FlexSDKDir}/frameworks/libs/datavisualization.swc

{FlexSDKDir}/frameworks/locale/en_US/automation*.swc

{FlexSDKDir}/frameworks/locale/en_US/datavisualization_rb.swc

{FlexSDKDir}/frameworks/locale/ja_JP/automation*.swc

{FlexSDKDir}/frameworks/locale/ja_JP/datavisualization_rb.swc

{FlexSDKDir}/frameworks/rsls/datavisualization_3.0.0.* (or updated build numbers for later builds)

 {FlexSDKDir}/fbpro (source)

In order to get the source code you will need to run the following command java -jar DMV-source.jar {license-file-location} {output-location}

Greg FLEX

1119: Access of possibly undefined property grid through a reference with static type mx.core:Container

February 17th, 2009

The Actual error for me was 1119: Access of possibly undefined property grid through a reference with static type mx.core:Container. And was actually a pretty simple one to solve. Like always, I hacked at it for an hour and then when I finally got it, I smacked my self in the forehead….duh! I’m not really sure why this happens, but it appears to be something with a custom component. In my case I had a VBox that I was extending and it was called Subject. In the VBox and Advanced Datagrid existed which I was trying to get the columns for so that I could use actionscript to add a column. so to get the columns I was doing.

var cols:Array = this.TabNavigator.selectedChild.grid.columns as Array; //where grid is my ADG&lt;br /&gt;

This gave me the error, so to work around it, I chopped the object (i.e the datagrid off) Made the changes, and then put it back together. Here is my code line for line. As always comments or other work arounds are welcome.

var obj:Object = this.stn.selectedChild;
var cols:Array = obj.grid.columns;
var col:AdvancedDataGridColumn = newAdvancedDataGridColumn();
col.headerText = "My Column";
col.dataField = "mycol";
cols.push(col);
obj.grid.columns = cols;
this.stn.selectedChild = obj as Subject;

Greg FLEX

Subsonic MSSQL Stored Proc with no parameters

February 9th, 2009

Typically you would call a stored proc using Subsonic using the following.


public DataSet OverallStatus()
{
return SPs.PGetColorCoding().GetDataSet();

}

However, Subsonic has a problem getting the Object class for your stored proc when there are no parameters to pass in.  So we just we just convert it to a string doing the following


public DataSet OverallStatus()
{
StoredProcedure sp = SPs.PGetColorCoding();
string dummy = sp.Command.CommandSql;
return sp.GetDataSet();
}

Greg C#, Subsonic ,