Scott's got a good method for submitting patches to SourceForge projects. If you work on code for a project you aren't a developer on, check this to to get your patch submitted: ComputerZen.com - Scott Hanselman's Weblog - Using a Windows version of GNU Patch.exe with CVS and Diff Files
Thanks, Scott!
Monday, June 20, 2005
Quickstart Guide To Open Source Development With CVS and SourceForge
Here's some good "rules" to follow on SourceForge. I guess I'll start using these and getting my guys on WinSnipLib.NET to use them: Quickstart Guide To Open Source Development With CVS and SourceForge
Thanks, Phil!
Thanks, Phil!
ComputerZen.com - Scott Hanselman's Weblog - Scott Hanselman's 2005 Ultimate Developer and Power Users Tool List
Ok, Scott's got quite an extensive list here: ComputerZen.com - Scott Hanselman's Weblog - Scott Hanselman's 2005 Ultimate Developer and Power Users Tool List
If you need anything, it's probably here.
If you need anything, it's probably here.
Friday, June 10, 2005
Update: Update: Project idea
An update on my update:
I now have all the developers in my project. Let's see how far we can go with this. I have established some ground rules and setup some standards for coding, documenting and specs of the program. Hopefully, we can all agree on things and make the overall project work well and get tings done quickly. I think we can.
I'll be away from my computer for most of the weekend since my mom is in town. That's ok since I haven't seen her since her hip surgery.
Have a great weekend all, and next week, let's go!
I now have all the developers in my project. Let's see how far we can go with this. I have established some ground rules and setup some standards for coding, documenting and specs of the program. Hopefully, we can all agree on things and make the overall project work well and get tings done quickly. I think we can.
I'll be away from my computer for most of the weekend since my mom is in town. That's ok since I haven't seen her since her hip surgery.
Have a great weekend all, and next week, let's go!
Thursday, June 9, 2005
Update: Project idea
Following up on my project idea, I've started a project at SourceForge.net.
It's a C# project instead of a VB.NET project as I feel I need to bump up and get my C# skills going. I have decided on calling it WnSnipLib.NET for now (anybody got any better name ideas?). I have some quick specs drawn up and four developers to start working on it. (As of now, I've only heard from two of them and have them in as developers. One has yet to respond back with his SourceForge user ID and the other I'm getting my mails returned.)
I've decied on an interface similar to Total VB SourceBook from FMS, Inc. The version I am referencing is an older version for VB 6. I would like to transform this tool into a source code repository not only for VB but also for VB.NET, C#, C++, and any other language. The data store would be any database via a plugin. The interface would not only be a standalone application, but it would be a plugin for #develop and VS.NET 2003 and 2005. The interface will also include NDoc support and a code to HTML converter.
Watch here for more! I'll even add the other authors so they can have a place to put .NET code and tips for everyone else.
It's a C# project instead of a VB.NET project as I feel I need to bump up and get my C# skills going. I have decided on calling it WnSnipLib.NET for now (anybody got any better name ideas?). I have some quick specs drawn up and four developers to start working on it. (As of now, I've only heard from two of them and have them in as developers. One has yet to respond back with his SourceForge user ID and the other I'm getting my mails returned.)
I've decied on an interface similar to Total VB SourceBook from FMS, Inc. The version I am referencing is an older version for VB 6. I would like to transform this tool into a source code repository not only for VB but also for VB.NET, C#, C++, and any other language. The data store would be any database via a plugin. The interface would not only be a standalone application, but it would be a plugin for #develop and VS.NET 2003 and 2005. The interface will also include NDoc support and a code to HTML converter.
Watch here for more! I'll even add the other authors so they can have a place to put .NET code and tips for everyone else.
Friday, May 27, 2005
Call VB.NET from a COM script
In my continuing pursuit for the ultimate new idea in programming, I learnt something new today.
At work we, rather I, am testing a new network/system monitoring tool. This one from ActiveXperts called Network Monitor 6.0 (how original, eh?) allows the use of VBScripts. Well, lo and behold, I couldn't get ADO 2.8 to work in a VBScript. So what did I do? I looked up how to get VB.NET to work through a COM call. The example I had to go by used C#, but not to worry, translating to VB.NET was a piece of cake.
So how do you do it? Make that call to a .NET object via a COM call? Simple, you use RegAsm.exe as explained in the example or you can use CLR ComReg . This tool is provided as part of Visual Studio .NET SDK as source code which adds some features left out by RegAsm. These are noted in the Read Me.
First you'll want to create your VB.NET solution as a class library. Simple enough.
Here's the entire class I created for my project here at HP (it checks the Oracle database TEMP tablespace for percent used):
COM requires a no argument constructor so that's the reason for the Public Sub New statement. You don't have to make it empty, it just can't be passed any values.
Now compile the project and register using RegAsm or ComReg. If you use ComReg and the /gac parameter to add the assembly to the GAC, you need to sign it with a strong name. This is fairly simple enough using some tools provided with the Framework SDK.
First you create a key pair using the sn.exe tool. Simply use this syntax:
For my assembly I used:
To create the public key file, use this syntax:
For my assembly I used:
In Visual Studio, all you need to do now is add the following to the AssemblyInfo.vb file, replacing the path and the key file name appropriately:
If you are not using Visual Studio, you will need to sign your assembly using the Assembly Linker (al.exe). This one is a little more complex so I am not going to go into that here.
Now, all that is left is calling your assembly from your COM application.
Since my COM app was a VBScript, here's how I used it:
And that's all there is. Enjoy!
At work we, rather I, am testing a new network/system monitoring tool. This one from ActiveXperts called Network Monitor 6.0 (how original, eh?) allows the use of VBScripts. Well, lo and behold, I couldn't get ADO 2.8 to work in a VBScript. So what did I do? I looked up how to get VB.NET to work through a COM call. The example I had to go by used C#, but not to worry, translating to VB.NET was a piece of cake.
So how do you do it? Make that call to a .NET object via a COM call? Simple, you use RegAsm.exe as explained in the example or you can use CLR ComReg . This tool is provided as part of Visual Studio .NET SDK as source code which adds some features left out by RegAsm. These are noted in the Read Me.
First you'll want to create your VB.NET solution as a class library. Simple enough.
Here's the entire class I created for my project here at HP (it checks the Oracle database TEMP tablespace for percent used):
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | Imports Oracle.DataAccess.Client Namespace OracleChecks Public Class OraDBChecks Private m_connectString As String Private m_dbuser As String Private m_dbpass As String Private m_dbname As String Public Sub New() ' Required for access from COM ' Don't do anything here... End Sub Public Sub Init(ByVal dbname As String, ByVal dbuser As String, ByVal dbpass As String) m_dbname = dbname m_dbuser = dbuser m_dbpass = dbpass m_connectString = "User ID=" & m_dbuser & ";Password=" & m_dbpass & ";Data Source=" & m_dbname End Sub Public Function CheckTempTablespace(ByVal threshold As Decimal) As Boolean Dim sSqlCommand As String = "SELECT decode(sum(s.blocks),NULL, 0, (sum(s.blocks)/sum(t.blocks))*100) temp_percent_used " sSqlCommand = sSqlCommand & "FROM SYS.v_$sort_usage s RIGHT OUTER JOIN SYS.dba_temp_files t " sSqlCommand = sSqlCommand & "ON s.TABLESPACE = t.tablespace_name" Dim drTestValue As OracleDataReader Dim conTestTable As OracleConnection = New OracleConnection(m_connectString) Dim cmdTestTable As New OracleCommand(sSqlCommand, conTestTable) conTestTable.Open() drTestValue = cmdTestTable.ExecuteReader(CommandBehavior.SingleRow) Do While drTestValue.Read() If drTestValue.GetDecimal(0) >= threshold Then conTestTable.Close() Return True Else conTestTable.Close() Return False End If Loop End Function End Class End Namespace |
COM requires a no argument constructor so that's the reason for the Public Sub New statement. You don't have to make it empty, it just can't be passed any values.
Now compile the project and register using RegAsm or ComReg. If you use ComReg and the /gac parameter to add the assembly to the GAC, you need to sign it with a strong name. This is fairly simple enough using some tools provided with the Framework SDK.
First you create a key pair using the sn.exe tool. Simply use this syntax:
sn -k <keyfilename>
For my assembly I used:
sn -k dbchecks.snk
To create the public key file, use this syntax:
sn -p <private_keyfilename> <public_keyfilename>
For my assembly I used:
sn -p dbchecks.snk dbchecks_public.snk
In Visual Studio, all you need to do now is add the following to the AssemblyInfo.vb file, replacing the path and the key file name appropriately:
<Assembly: AssemblyKeyFileAttribute("C:\Documents and Settings\JOBA\My Documents\VISUAL STUDIO PROJECTS\DBChecks\dbchecks.snk")>
If you are not using Visual Studio, you will need to sign your assembly using the Assembly Linker (al.exe). This one is a little more complex so I am not going to go into that here.
Now, all that is left is calling your assembly from your COM application.
Since my COM app was a VBScript, here's how I used it:
1 2 3 4 5 6 7 | Function CheckTempTablespace(servername, dbuser, dbpass, warnThreshold) Dim c Set c = CreateObject("HP_PSGIT.OracleChecks.OraDBChecks") c.Init servername, dbuser, dbpass CheckTempTablespace = c.CheckTempTablespace(warnThreshold) End Function |
And that's all there is. Enjoy!
Tuesday, May 24, 2005
Bit Shifting in VB.NET
Here's a good tidbit of info from Scott Hanselman: "Machine.Shift.Left and Bit Shifting in VB.NET"
Haven't used bit shifting in a long while, but this info is pretty cool and goes back to BASICs...
(Thanks, Scott for the refresher on how to use VB! And yes, VB can be a bit too high level for some intense operations. Isn't that why MS created VS Studio?)
Here's a bit of code from NNTP:
Haven't used bit shifting in a long while, but this info is pretty cool and goes back to BASICs...
(Thanks, Scott for the refresher on how to use VB! And yes, VB can be a bit too high level for some intense operations. Isn't that why MS created VS Studio?)
Here's a bit of code from NNTP:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | Function SafeLeftShift(ShiftThis As Integer, ShiftPlaces As Integer) As Integer Dim ShiftThisPrivate As Integer ' Private copy with extraneous bits unset Dim SignBitMask As Integer ' Mask for fixing msb ' Unset leftmost bits that will be discarded ShiftThisPrivate = ShiftThis And ((2 ^ (15 - ShiftPlaces)) - 1) ' Determine whether the sign bit should ' be set in the bit-shifted result If ShiftThis And (2 ^ (15 - ShiftPlaces)) Then SignBitMask = &H8000 End If ' Do the bit shift. SafeLeftShift = (ShiftThisPrivate * (2 ^ ShiftPlaces)) Or SignBitMask End Function |
Subscribe to:
Posts (Atom)