Thursday, April 27, 2006

CIO Blogs - Could "Found Code" Cripple Your Company? |

While the article
CIO Blogs - Could "Found Code" Cripple Your Company? | makes some valid points, what they don't mention is the impact of not using these types of resources. When you ask most developers what they do when they hit a wall on a problem they almost always say "Go to the web". Frankly, it's what the damn thing was invented for anyhow.



Management is often unwilling to hear (or accept) how long something will really take to develop. The other side of it is that many developers lack the skill to develop the same piece of code. This is not a fault of the hiring process or the developer, it's just a fact. Developers in many cases are like doctors, some work in the general field of coding, some are specialized surgeons. You wont find a developer that knows everything, just too much out there.



I think the mind set of management is what needs to change here. I think that reasonable and acceptable use of searched code could be used in most environments. Most developers (who develop for GPL projects) generally don't have an issue with someone using their brilliant code somewhere else. The problem is if they want to sell it. Most companies that develop software do it for internal purposes vs. producing a software product they outright sell. Blackberry comes to mind where "sold for profit" bit them in the ass. If blackberry was using the same type of code in their accounting software, nobody would have known, or cared. Developing an "acceptable use" policy would be a preferred method for handling this type of issue vs. overreacting and saying "don't use it". With that sort of policy you'd end up extending deadlines and your developers would adopt a "don't ask, don't tell" policy.

Monday, April 24, 2006

TechToolBlog 195 Free Online Programming Books

Well this was cool. Where else can you find 195 books on programming. Some of the basics are in here. Hey, what can you really expect for free.



TechToolBlog � 195 Free Online Programming Books - Web Programming focusing on Marketing the world wide web

Convert String to Byte Array

Thanks dave, this is a great piece of code however more blog entries showed there was a flaw (at least for my milage). Saved me some time though. Why microsoft doesnt have this natively in the .net framework is also beyond me. The sample below is my slightly modified version which does do the conversion correctly.

Imports System.Text  Public Shared Function ConvertStringToByteArray(ByVal stringToConvert As String) As Byte()     Return System.Text.Encoding.ASCII.GetBytes(stringToConvert.ToCharArray()) End Function


Convert String to Byte Array

Sql Server Row Size Limit - Rick Strahl's WebLog

Sql Server Row Size Limit - Rick Strahl's WebLog

Did you know that SQL server had an 8K row limit? I didn't either until Michele ran into the problem and I started researching it. What a load of crap. Thanks Microsoft.

Friday, April 21, 2006

Visual Studio Express

Microsoft has made Visual Studio Express completely free permanantly. Their FAQ now states


10. How much will these products cost?
Effective April 19th, 2006, all Visual Studio 2005 Express Editions are free permanently. This pricing covers all Visual Studio 2005 Express Editions including Visual Basic, Visual C#, Visual C++, Visual J#, and Visual Web Developer as well as all localized versions of Visual Studio Express.

SQL Server 2005 Express Edition has always been and will continue to be a free download.

I can't help but think that this was all forged by the GNU project and FSF with years of free software.

VB.NET: Base 36 Function

My office frequently uses BASE36 for naming of transactions and files. This is a base36 function in VB.NET. Simply passing in the integer will return the BASE36 value for it. I wrote this function as I was not aware of any way to natively do this in .NET. I have searched the net high and low for something like this but wasnt able to find one. Hopefully somone else will make use of it.



include_once('/home/rwmech/public_html/robsprogrammingjunk/geshi/geshi.php');

$source = <<
Private Function Base36(ByVal intNumber As Int32) As String
Dim intNum As Int32
Dim strSum As String
Dim intCarry As Int32
Dim intConvertBase As Int32 = 36
strSum = ""
intNum = intNumber
Do
intCarry = intNum Mod intConvertBase
If intCarry > 9 Then
strSum = Chr(intCarry + 87) + strSum
Else
strSum = intCarry & strSum
End If
intNum = Int(intNum / intConvertBase)
Loop Until intNum = 0
Return strSum
End Function

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();
?>

BLOGGER: You can use GeSHi in your blogger posts

You can use GeSHi in your blogger posts. Simply use your own PHP server and install GeSHi. Then you can use the following code to post code snippets to your blog.



A few notes:

1. You must tell blogger to not convert your line breaks. If you don't it'll screw up the PHP code.

2. You must have your blogger set to create an index.php or the like.

3. Change the 'php' below to the proper language based on what you're posting.




Code Example © Robert Mech. May be used freely as long as credit is given to the source.





<?php
include_once('geshi/geshi.php');



$source = <<<END



// SOURCE CODE HERE



END;



$geshi = new GeSHi($source, 'php');

$geshi->set_header_type(GESHI_HEADER_DIV);



echo $geshi->parse_code();


?>


If you use this code, please make a comment on the blog!


LINUX: wget

I'm always forgetting this command and it's very useful for getting downloads to you linux box quickly.
 
Usage: wget [OPTION]... [URL]...
 

Thursday, April 20, 2006

FOXPRO: Defeat the error handler

include_once('geshi/geshi.php');

$source = <<
ON ERROR *

END;

$geshi = new GeSHi($source, 'visualfoxpro');
$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();
?>

 
This disables the fox error handler.  It fixes just about everything. :)

Wednesday, April 19, 2006

ALL: MSXML Memory Leaks

I recently ran into a problem with MSXML and memory leaks.  If you repeatedly call it from within FoxPro with many SelectNodes() in there you'll certainly run into a problem.  Go with the MSXML6 or higher where it doesn't have nearly as many memory leaks.  It's documented on MSDN, but was not easy to find.  http://support.microsoft.com/kb/328998