Archive

Archive for the ‘Uncategorized’ Category

SubSonic Multiple Databases ConnectionString or DataProviders

March 6th, 2009

So you have a SubSonic Project that you now need to connect to multiple Databases. In my case, I didn’t let SubSonic build the database infrastructure, but for my 2nd database, I just used and inline query. Why? Because I needed it done YESTERDAY…So it was just easier at the time.

To configure SubSonic to connect to the other database. I did the following.

Below in the XML…notice I have 2 connectionStrings and 2 providers

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <configSections>
    <section name="SubSonicService" type="SubSonic.SubSonicSection, SubSonic" allowDefinition="MachineToApplication" restartOnExternalChanges="true" requirePermission="false"/>
  </configSections>
  <connectionStrings>
    <add name="SQLDashboard" connectionString="Data Source=MYQSTMGTDB01; Database=SQLPerfmonStats; Integrated Security=true;"/>
    <add name="MYDevicesDB" connectionString="Data Source=MYDevicesDB; Database=MYDevices; Integrated Security=true;"/>
  
  </connectionStrings>
  <SubSonicService defaultProvider="SQLDashboard" enableTrace="false" templateDirectory="">
    <providers>
      <clear/>
      <add name="MYDevicesDB" type="SubSonic.SqlDataProvider, SubSonic" connectionStringName="MYDevicesDB"/>
      <add name="SQLDashboard" type="SubSonic.SqlDataProvider, SubSonic" connectionStringName="SQLDashboard"/>
    </providers>
  </SubSonicService>
</configuration>

 

In my C# code I did the following using Subsonic.InlineQuery

String sql = @"select * from myTable";
 
IDataReader rdr = new SubSonic.InlineQuery("SACDevicesDB").ExecuteReader(sql);
             DataTable dt = new DataTable();
                 using (rdr)
                 {
                  dt.Load(rdr);
                 }
             return dt;

Greg Uncategorized

Taxed to excess

March 6th, 2009

Excellent letter to the editor Times Record News Witchita Falls Kansas

image

http://www.timesrecordnews.com/news/2009/feb/05/no-headline—2-6_oped_letters/

Dear IRS,

I am sorry to inform you that I will not be able to pay taxes owed April 15, but all is not lost.

I have paid these taxes: accounts receivable tax, building permit tax, CDL tax, cigarette tax, corporate income tax, dog licence tax, federal income tax, unemployment tax, gasoline tax, hunting licence tax, fishing licence tax, waterfowl stamp tax, inheritance tax, inventory tax, liquor tax, luxury tax, medicare tax, city, school and county property tax (up 33 percent last 4 years), real estate tax, social security tax, road usage tax, toll road tax, state and city sales tax, recreational vehicle tax, state franchise tax, state unemployment tax, telephone federal excise tax, telephone federal state and local surcharge tax, telephone minimum usage surcharge tax, telephone state and local tax, utility tax, vehicle licence registration tax, capitol gains tax, lease severance tax, oil and gas assessment tax, Colorado property tax, Texas, Colorado, Wyoming, Oklahoma and New Mexico sales tax, and many more that I can’t recall but I have run out of space and money.

When you do not receive my check April 15, just know that it is an honest mistake. Please treat me the same way you treated Congressmen Charles Rangle, Chris Dodd, Barney Frank and ex-Congressman Tom Dashelle and, of course, your boss Timothy Geithner. No penalties and no interest.

P.S. I will make at least a partial payment as soon as I get my stimulus check.

Ed Barnett

Wichita Falls

Greg Uncategorized

Create a Key Value Pair Object in Actionscript

March 5th, 2009

 

If this is essentially an ActionScript Dictionary, but if you don’t need some of the overhead a dictionary brings along, you can make a nice key value pair like this.

private var keyValuePair:Object = {"processor_TotalPercentTime_value" : "processor_color",
                                         "network_value" : "network_color",
                                         "network_value" : "network_color",
                                         "disk_DiskSecPerTransfer_value" : "disk_color",    
                                         "disk_KBytesPerTransfer_value" : "disk_color",
                                         "memory_PLE_value" : "memory_color",
                                         "memory_LazyWrites_value" : "memory_color",
                                         "memory_AvailableMBytes_value" : "memory_color",
                                         "MachineName":"sql_color"};

 

You would reference the keyValuePair as follows:

var myVal = keyValuePair["processor_TotalPercentTime"].toString();

Greg Uncategorized

Error #1034: Type Coercion failed: cannot convert mx.graphics::Stroke to mx.graphics.IStroke.

March 5th, 2009

This turned out to be a pretty haunting bug, and I still don’t quite understand what I did to fix it, but I did.

You’ve probably already seen the Adobe Bug SDK-9480 

And of couse you’ve seen an error that looks like so…..

TypeError: Error #1034: Type Coercion failed: cannot convert mx.graphics::Stroke@dfd3e21 to mx.graphics.IStroke.
    at mx.charts::AxisRenderer/measure()
    at mx.core::UIComponent/measureSizes()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\core\UIComponent.as:5956]
    at mx.core::UIComponent/validateSize()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\core\UIComponent.as:5902]
    at
mx.managers::LayoutManager/validateSize()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\managers\LayoutManager.as:579]
    at mx.managers::LayoutManager/doPhasedInstantiation()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\managers\LayoutManager.as:668]
    at Function/http://adobe.com/AS3/2006/builtin::apply()
    at mx.core::UIComponent/callLaterDispatcher2()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\core\UIComponent.as:8628]
    at mx.core::UIComponent/callLaterDispatcher()[C:\autobuild\3.2.0\frameworks\projects\framework\src\mx\core\UIComponent.as:8568]

 

The situation only appears to occur when I am running a Module across Application Domains.  For me it worked fine, as I was developing the module stand alone with a Main.mxml that I was using as my loader for the Module. When I ported the module to my global application….I was not so lucky and it broke things.

To fix the bug you will need to make a change in the code that is loading the module. In 1 of the following 2 ways. I used the 2nd because forcing all modules into the same “currentDomain” broke other modules that were using shared classes.

Here are the 2 ways I know of to fix it.

 

1) Set the Application Domain in your ModuleLoader as follows

var Mod:ModuleLoader = new ModuleLoader();
Mod.applicationDomain = ApplicationDomain.currentDomain;

2) In your Parent Application not in the module itself. (Every module needs and application)

import mx.graphics.IStroke;
private var uStroke:IStroke;

Greg Uncategorized

Use your Keyboard to turn your monitors off [ PushMonitOff v1.0 ]

March 5th, 2009

Found a handy piece of Software (Available Here) which allows you to quickly turn your monitors off using a keyboard shortcut. The default is Shift-F1. But can be changed using the task manager (seen below).

image

 

PushMonitOff v1.0

Greg Uncategorized

FLEX ItemRenderer in Actionscript 3.0 (AdvancedDataGridRenderer)

March 2nd, 2009

In the following example, I wanted to have a custom Renderer when I expanded a row in the AdvancedDataGrid. I need to do it in Actionscript, so here is what I did.

private function ExpandClick (e:AdvancedDataGridEvent) : void {
            trace(e);
            var children:ArrayCollection = new ArrayCollection([{Name:"Greg",Status:"O",Top:e.item}]);
            e.item.children =  children;            
            var renderer:AdvancedDataGridRendererProvider = new AdvancedDataGridRendererProvider();
            
            renderer.dataField = "Name";
            renderer.renderer = new ClassFactory(View.MagicRenderer);
            renderer.columnSpan = 0;
            renderer.columnIndex = 0;
            var rp:Array = new Array();
            rp.push(renderer);
            trace(tickets.selectedItem);
            tickets.rendererProviders = rp;            
            tickets.expandItem(e.item,true,true,false,null);    
            
        }

Greg Uncategorized

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

Jury Duty Phone Scam

July 23rd, 2008

All, I just recieved an email which circulated from a senior VP at my company. Here is the exact email.

DO NOT DELETE WITHOUT READING!

Jury Duty Scam

This has been verified by the FBI (their link is also included below). Please pass this on to everyone in your email address book. It is spreading fast so be prepared should you get this call. Most of us take those summonses for jury duty seriously, but enough people skip out on their civic duty, that a new and ominous kind of fraud has surfaced.

The caller claims to be a jury coordinator. If you protest that you never received a summons for jury duty, the scammer asks you for your Social Security number and date of birth so he or she can verify the information and cancel the arrest warrant. Give out any of this information and bingo; your identity was just stolen.

The fraud has been reported so far in 11 states, including Oklahoma, Illinois, and C olorado. This (swindle) is particularly insidious because they use intimidation over the phone to try to bully people into giving information by pretending they are with the court system. The FBI and the federal court system have issued nationwide alerts on their web sites, warning consumers about the fraud.

Check it out here: <http://www.fbi.gov/page2/june06/jury_scams060206.htm>

And here:  <http://www.snopes.com/crime/fraud/juryduty.asp><http://www.snopes.com/crime/fraud/juryduty.asp>

 

Greg Uncategorized

Smoked Pepper Halibut

July 19th, 2008

 

Smoked Pepper Halibut

Smoked Pepper Halibut
Rated  by 3 people
Rate This   
100s of main-dish recipes plus suggestions for simple go-with dishes to make a meal complete.
 
4 servings
Prep: 15 minutes
Marinate: 30 minutes
Grill: 8 minutes
 

Ingredients

Directions

Thaw fish, if frozen. Rinse fish; pat dry with paper towels. If necessary, cut fish into 4 serving-size pieces. For marinade, in a blender container combine chipotle peppers, adobo sauce, sweet pepper, lime juice, oregano, and garlic. Cover and blend until pureed. Transfer half of the marinade to a shallow dish; set aside remaining marinade.

Add fish steaks to dish, spooning some of the marinade over fish. Cover and marinate at room temperature for 30 minutes.

Drain fish, discarding marinade. Sprinkle fish with salt. Grill fish on the greased rack of an uncovered grill directly over medium coals for 8 to 12 minutes or until fish flakes easily when tested with a fork, turning once halfway through grilling. Heat reserved marinade and serve as sauce with fish. Makes 4 servings.

 

Greg Uncategorized

Test of SyntaxHylighter

July 17th, 2008
#!c:\\perl\\bin
#use strict;
use WWW::Mechanize;
use HTTP::Cookies;
use HTML::TableExtract;
use Net::Whois::IP qw(whoisip_query);
use chilkat;
our $count = 0;
my %Whitelist =
(
'67.228.182.163' =&amp;amp;amp;amp;gt; 'Xoopit',
'ip.ip.ip.ip' =&amp;amp;amp;amp;gt; 'Work'
&amp;amp;lt;code&amp;amp;gt;);

Greg Uncategorized