Robs Programming Junk
Welcome to my programming blog!With some luck you will find some tasty nuggets of information here. If you do find something please post a comment on where or how you used it. I like to see what sort of impact my work has on others.
Monday, March 20, 2006
FOXPRO: Connection Pooling Sucks
Connection pooling can really suck when you're not using SQL server or another client/server based SQL. Take foxpro for example. Connection polling in OLEDB can keep a table "open" long after you've cleared references to it. This means that if you want the table exclusive later on you wont be able to because of the reference. I discovered this when I needed to physically delete a table that I had opened and read the information from
The sample above shows that OLE DB Services=-4 will turn off that connection pooling on foxpro and close the table when you actually request it. There is some small performance hit here, but nothing to hollar about considering youre using foxpro anyhow. :)
Dim strConnString = "Driver={Microsoft Visual Foxpro Driver};SourceType=DBF;SourceDB=C:\DBFDIRECTORY;Uid=;Pwd=;OLE DB Services=-4;"
The sample above shows that OLE DB Services=-4 will turn off that connection pooling on foxpro and close the table when you actually request it. There is some small performance hit here, but nothing to hollar about considering youre using foxpro anyhow. :)
Wednesday, March 15, 2006
VB.NET: SMTP Mail
Easy SMTP function in VB.NET
Imports System.Web.Mail.SmtpMail
Imports System.Data
Imports System.Data.SqlClient
Function SendEmail(ByVal strTo As String, ByVal strFrom As String, ByVal strBody As String, ByVal strSubject As String, Optional ByVal strCC As String = "") As Boolean
Dim email As New System.Web.Mail.MailMessage()
email.To = strTo
email.Cc = strCC
email.From = strFrom
email.Body = strBody
email.Subject = strSubject
email.BodyFormat = Web.Mail.MailFormat.Text
Try
System.Web.Mail.SmtpMail.SmtpServer = "primaryserver.com"
System.Web.Mail.SmtpMail.Send(email)
Catch e As Exception
Debug.WriteLine(e)
email.Body = strBody & vbCrLf & vbCrLf & "MAIN SMTP SERVER ERROR: " & vbCrLf & e.ToString
System.Web.Mail.SmtpMail.SmtpServer = "secondary server.com"
System.Web.Mail.SmtpMail.Send(email)
End Try
Return True
End Function
Tuesday, March 14, 2006
Quick and ditry strong naming. Very helpful for no longer having to trust assemblys on a network.
Execute:
sn.exe -k PublicPrivateKeyFile.snk
One more note here, 1.0 looks in the current directory. 1.1 requires a full path to th key.
Execute:
sn.exe -k PublicPrivateKeyFile.snk
'Strong Naming
<Assembly: System.Reflection.AssemblyDelaySign(False)>
<Assembly: System.Reflection.AssemblyKeyFile("mailpost.sn")>
One more note here, 1.0 looks in the current directory. 1.1 requires a full path to th key.
Monday, March 13, 2006
VB.NET: Formatting for bytes with commas
Formatting for bytes with commas. For example 1,000 or 1,000,000. While this is really basic, I almost always forget this.
include_once('/home/rwmech/public_html/robsprogrammingjunk/geshi/geshi.php');
$source = << 'To format a number with commas
Format(intBytesProc, "#,##0")
END;
$geshi = new GeSHi($source, 'vbnet');
$geshi->set_header_type(GESHI_HEADER_DIV);
$geshi->set_overall_style('font-family: Courier New , Courier, Monospace; font-size: 8pt; word-wrap:break-word;');
$geshi->set_comments_style(1, 'color: #006600;');
$geshi->set_comments_style('MULTI', 'color: #006600;');
$geshi->set_header_content('Code Example © Robert Mech. May be used freely as long as credit is given to the source.');
$geshi->set_header_content_style('font-family: Verdana, Arial, sans-serif; color: #808080; font-weight: bold; background-color: #f0f0ff; border-bottom: 1px solid #d0d0d0; padding: 2px;');
$geshi->set_footer_content('If you use this code, please make a comment on the blog!');
$geshi->set_footer_content_style('font-family: Verdana, Arial, sans-serif; color: #808080; font-weight: bold; background-color: #f0f0ff; border-top: 1px solid #d0d0d0; padding: 2px;');
echo $geshi->parse_code();
?>
include_once('/home/rwmech/public_html/robsprogrammingjunk/geshi/geshi.php');
$source = <<
Format(intBytesProc, "#,##0")
END;
$geshi = new GeSHi($source, 'vbnet');
$geshi->set_header_type(GESHI_HEADER_DIV);
$geshi->set_overall_style('font-family: Courier New , Courier, Monospace; font-size: 8pt; word-wrap:break-word;');
$geshi->set_comments_style(1, 'color: #006600;');
$geshi->set_comments_style('MULTI', 'color: #006600;');
$geshi->set_header_content('Code Example © Robert Mech. May be used freely as long as credit is given to the source.');
$geshi->set_header_content_style('font-family: Verdana, Arial, sans-serif; color: #808080; font-weight: bold; background-color: #f0f0ff; border-bottom: 1px solid #d0d0d0; padding: 2px;');
$geshi->set_footer_content('If you use this code, please make a comment on the blog!');
$geshi->set_footer_content_style('font-family: Verdana, Arial, sans-serif; color: #808080; font-weight: bold; background-color: #f0f0ff; border-top: 1px solid #d0d0d0; padding: 2px;');
echo $geshi->parse_code();
?>
View my portfolio at iFreelance.com
Hire MechSoftware for Quality Assurance (QA), Database Programming, and Security Design/Programming
Find QA Freelance Jobs at iFreelance.com
Hire MechSoftware for Quality Assurance (QA), Database Programming, and Security Design/Programming
Find QA Freelance Jobs at iFreelance.com
Recent Posts
Aptana, FTP, WebDav, PDT and Eclipse - Why cant FT...
Dynamic Query Parameters for Jasper Reports
IE8 Developer Tools
Portable Ubuntu - Take Linux With You
Quote Curling Function
Same Blog, New Look
On the fly JavaScript Packing - Speed up your site...
Super Simple AJAX Forms with jQuery and JSON : dat...
Super Simple AJAX Forms with jQuery and JSON : web...
Super Simple AJAX Forms with jQuery and JSON : Int...
Archives
01/01/2005 - 02/01/200502/01/2006 - 03/01/2006
03/01/2006 - 04/01/2006
04/01/2006 - 05/01/2006
05/01/2006 - 06/01/2006
09/01/2006 - 10/01/2006
10/01/2006 - 11/01/2006
11/01/2006 - 12/01/2006
12/01/2006 - 01/01/2007
04/01/2007 - 05/01/2007
05/01/2007 - 06/01/2007
01/01/2008 - 02/01/2008
02/01/2008 - 03/01/2008
05/01/2008 - 06/01/2008
06/01/2008 - 07/01/2008
08/01/2008 - 09/01/2008
09/01/2008 - 10/01/2008
11/01/2008 - 12/01/2008
12/01/2008 - 01/01/2009
01/01/2009 - 02/01/2009
02/01/2009 - 03/01/2009
04/01/2009 - 05/01/2009
05/01/2009 - 06/01/2009
07/01/2009 - 08/01/2009
01/01/2010 - 02/01/2010
My Software
Blinky - GBPVR PluginPhotoCopy - GBPVR Plugin
QTC - Quick Test Case
rBoop - Rob's Timers
Programming Links
C# FormatterNSIS
Other Links
Damn Small LinuxSites I Manage
Do it yourself SEO. Cheap.Pet Supplies
Dog toy of the month club
SqueakerZ pet Deals
Geocaching Community
Hitch hiker Tracking