Posts

Showing posts with the label Wood & Associates Transition

WebPart - InPlace Custom Property editing

Bear with the formatting, this Blog engine is old and getting on my nerves.  Time for an upgrade after 8 yrs :P Spent some time working on a WebPart implementation, where i wanted to edit the webpart in place instead of constantly clicking the glorious Edit WebPart for the WebPart object. So after some research, found a great article from  MATHIEU DESMARAIS  about the design patterns and logic flow. The main difference i had from his design, was i was prescribing the way the View/Edit Modes would be represented with the HTML syntax. I will not bore you with the details of getting up to this point, as there are numerous amounts of posts out there. I will although focus on the details of how i took Mathieu's implementation and modified for a Static set. Some of the pitfalls i had, probably because his was on demand control creation and mine is predefined. Notes to take mind of: This Implementation is for a SQL Connection Webpart. As such, you will notice...

Iterating through Workbook Tables

Nothing special just want to put a culmination of information available out there into one useful code-snippet 1: Dim wb As Workbook 2: Set wb = ActiveWorkbook 3: Dim ws As Worksheet 4: Dim lo As ListObject 5: Dim lc As ListColumn 6: Dim lr As ListRow 7: Dim frm As New frmListRanges 8: Dim txt As String 9: 10: For Each ws In wb.Worksheets 11: For Each lo In ws.ListObjects 12: txt = "" 13: For Each lr In lo.ListRows 14: txt = "{ " 15: For Each lc In lo.ListColumns 16: txt = txt & " " & CStr(lo.DataBodyRange.Cells(lr.Index, lc.Index).Value) & "," 17: Next lc 18: Trim (txt) 19: If StrComp(Right(txt, 0), ",", vbTextCompare) Then 20: txt = Left(txt, Len(txt) - 1) 21: End If 22: txt = txt & " }" 23: frm.AddNamedRange (...

Iterating through Excel Named Ranges

Simple code to iterate through named ranges 1: Dim fm as Form 2: Dim nm As Name 3: Dim val As Double 4: 5: For Each nm In ActiveWorkbook.Names 6: 'Check MacroType and Sheet References (in Name and Value) 7: 'If (nm.MacroType < 0 And InStr(1, nm.Name, "!", vbTextCompare) = 0 And InStr(1, nm.Value, "!", vbTextCompare) = 0) Then 8: 'If (nm.MacroType < 0 And InStr(1, nm.Name, "!", vbTextCompare) = 0) Then 9: If (nm.MacroType > 0) Then 10: 'Is not a standard XIXLMMacroType (1, 2, 3) 11: frm.AddNamedRange (nm.Name &amp; "( " &amp; CStr(nm.Value) &amp; " )") 12: 'frm.AddNamedRange (nm.Name &amp; "( " &amp; CStr(nm.MacroType) &amp; " )") 13: End If 14: Next nm 15: 16: frm.Show

SQL Agent Jobs - Non Maint Plan

While doing some development found a need to find non-Maintenance Plan Jobs for doing some reporting.  After couple minutes searching Google and some other sites, there is a huge lack of information or queries that effectively show how to obtain or tie system tables together to derive the literal SQL Agent Jobs. That being said, here is a little script i created that will query the system databases and produce a list of SQL Agent jobs. Code Snippet: 1: select * 2: from msdb.dbo.sysjobs as job 3: where job.job_id not in (select job_id from msdb.dbo.sysmaintplan_subplans)

Acquire SQL Service Account

Reference:  Jason Yousef Blog 1: DECLARE @SrvAccount varchar(100) 2: set @SrvAccount ='' 3: 4: EXECUTE master.dbo.xp_instance_regread 5: N'HKEY_LOCAL_MACHINE', 6: N'SYSTEM\CurrentControlSet\Services\SQLSERVERAGENT', 7: N'ObjectName', 8: @SrvAccount OUTPUT, 9: N'no_output' 10: 11: SELECT 12: @@SERVERNAME as [MachineName] 13: , @SrvAccount as SQLAgent_ServiceAccount

Linked Server....

Well today, I started the fun filled adventure of managing data from/to a LinkedServer. During this learning curve, I found plenty of information about how to query from and instert into a Linked server but most of them utilized the OpenQuery  TSQL Statement to operate. One failure of the concepts is to use the inline statement to access the Linked Server. In my situation, i was linking to a MySQL database offsite.  Below you will find the MSSQL statement patterns to used when utilizing query statements against the Linked Server. Select: 1: Select {cols} 2: From {LinkedServer}...{table} 3: [Conditions] Insert: 1: Insert Into {LinkedServer}...{table} [cols,...] 2: Values ([cols,...]) There are more commands you can use but the point is that the developer/dba is utilizing only the 'server' and 'table' portions of the source information.  This being, as described by Microsoft, as ' {server}.{database}.{schema}.{table} ' is simply ' ...

Maintenance Plan history

I have been researching for the last couple of weeks a way to acquire a maintenance plan job history, success or failure. After alot of searching and finding that no one has or is not sharing the ability to do this, I decided to start hacking away at the MS SQL 2005/2008 core databases to find the relationship. After much digging, there are a total of 4 tables you need to have access to, whether through a proxy account of dbo schema account. Tables in question: - msdb..sysmaintplan_log - msdb..sysmaintplan_logdetail - msdb..sysmaintplan_subplans - msdb..sysjobs (optional: gives the SQL Agent Job name) SQL Script as i built it, but you will probably modify it to your needs: 1: SELECT 2: mpld.server_name, 3: j.name, 4: mpl.start_time, 5: mpl.end_time, 6: mpl.succeeded, 7: mpld.error_number, 8: mpld.error_message, 9: mpld.line1 + char(10) + char(13) + 10: mpld.line2 + char(10) + char(13) + 11: mpld.line3 + ch...

Forensic Translation - What Is it?

A style that currently is not advertised and probably under-pronounced on resume's is the ability to translate a old code-base into a up-to-date framework (whether it is a .Net framework or simply taking ForTran 77 and converting it to GNU-C).  In either case, the process it the same. Forensic Translation is the ability of the programmer to read another language, deduce the methodology being incorporated and then successfully translating it to the new code-base.  This process could take as little as 1 week or as long as several years. The major variable in this process is source informations direct usage of declarations.  For the most part, the bracket languages (Java, C/C++/C#, AdaXX, etc) tend to have the ability to utilize an object that otherwise would be declared but is not.  This process enables the reduction of resources for the compiler to have to declare for operation.  Although, this is find great and dandy for stream-lining the execution process, ...

Concept: Extensions

Reference:  MSDN Extension Methods (Visual Basic) Intro: While translating a C# library, i ran into a segment of code that i didnt recognize. After doing some research found out that the same design can be implemented in VB.Net (VB 2k8). One catch to the whole implementation is that the Extension development is only possible in a module. As well, there are some limitations to the design of the extension.

Dynamically Loading Controls

Recently, i ran into a situation where i needed to daisy-chain several usercontrols together. The basic thought was similar to most sites "New User Data Entry" forms. You fill one out, and then you goto the next one to fill more incriminating information and then the last form you fill out, you basically sign your life away and your first born. Problem i ran into was the fact that i could not achieve this effect without a severe overload of page resources (i.e. Multi-View/View relationship) and even then it was sadly sketchy and buggy. After doing some research and some serious code management (thats what i call it :> ) I managed to achieve a relatively small method, through VB but should be easily translatable since it is small, to get the effect i needed. 1: Friend Shared Sub NextForm(ByRef par As Control, ByRef curr As Control, ByVal [new] As String) 2: 'remove current control (curr) from parent (par) 3: par.Controls.Remove(curr) 4: 'load c...