Thursday, August 29, 2013

Deep Thoughts from Rob Roy

Next Time you are bounced, transferred or put on hold ask the individual, "Who do I send an invoice to the company for my time".

Accounts Payable.

Time, Rate, and Description Customer Service Consulting.


Thursday, August 22, 2013

Old Data Grid --- I cannot believe I am posting this old technology, but good to know and remember

The following is VB.NET I am currently on a contract programming both VB.NET and C# at the same time.  Does not make for a dull day.  However I had the code wrong with the following and wanted to be sure I blogged about the fix.

When calling the "SelectedIndexChange" Event on an old Data Grid be sure to declare a Int32
and by the way Int32 = Integer (Same thing).

Dim an index variable to hold the index as show below then get the DataKeys(index). Be sure
to convert to and Integer....

Protected Sub dg_Mygrid_SelectedIndexChanged(sender As Object, e As EventArgs)
        
        Dim index As Int32 = dg_Mygrid.SelectedIndex
        Dim intMy_ID As Int32

        intMy_ID = Convert.ToInt32(dg_Mygrid.DataKeys(index)) 
        FillForEditing(intMy_ID)

Wednesday, August 21, 2013

jQuery Hide and Show elements

$(document).ready(function () {
            if ($('#diagGroupBtnGroup').is(':visible'))
            {
                $('#divlbServices').hide();
            }
            else
            {
            $('#divlbServices').show();
            }
        });

Tuesday, August 20, 2013

LAWS OF PROJECT MANAGEMENT

1. No major project is ever installed on time, within budget, or
with the same staff that started it. Yours will not be the
first.
2. Projects progress quickly until they become 90% complete,
then they remain at 90% complete forever.
3. One advantage offuzzy project objectives is that they let
you avoid the embarrassment of estimating the
corresponding costs.
4. When things are going well, something will go wrong.
• When things just cannot get any worse, they will.
• When things appear to be going better, you have
overlooked something.
5. If project content is allowed to change freely, the rate of
change will exceed the rate of progress.
6. No system is ever completely debugged. Attempts to debug
a system inevitably introduce new bugs that are even harder
to find.
7. A carelessly planned project will take three times longer to
complete than expected; a carefully planned project will
take only twice as long.
8. Project teams detest progress reporting because it vividly
manifests their lack of progress.

Reference: Project Planning and Implementation - Jim Keogh

Monday, August 19, 2013

VB.NET Query to get data when Key ID is Null aka Nothing (vb.net)

Dim Query = From x In ctx.tbl_funding_capitation _ Order By x.start_dt Descending _ Select New With { _ .providerID = If((x.my_id IsNot Nothing), x.tbl_data.DATA_ID, Nothing),
 _ .provider = If((x.my_id IsNot Nothing), x.tbl_data.DATA_NAME, "")
, _ .active = x.active
 }

Thursday, August 15, 2013

What do Sender and EventArgs mean?

The sender is the control that the action is for (say OnClick, it's the button). The EventArgs are arguments that the implementor of this event may find useful. With OnClick it contains nothing good, but in some events, like say in a GridView 'SelectedIndexChanged', it will contain the new index, or some other useful data.

Programmer Productivity By Jonathan Erickson, September 26, 2009

Multitasking is good when it comes to computer programs, letting them do more with less. But when computer programmers start multitasking, productivity flies out the door.

For one thing, when programmers have to shift tasks, it takes "a really, really, really long time," says Joel Spolsky, host of the Joel On Software Web site and co-founder of Fog Creek Software. Programmers have to keep a lot of things in their heads at once, Spolsky says, and the more they remember, the more productive they are. "A programmer coding at full throttle is keeping zillions of things in their head at once," he says, "everything from names of variables, data structures, important APIs, the names of utility functions that they call a lot, even the name of the sub-directory where they store their source code."

On top of that, as applications have become more collaborative, complex, modular, and distributed, developers are having to track an increasing number of tasks and deal with more interruptions from the people with whom they're collaborating. As a result, they're multitasking more frequently and becoming less productive.

How bad is the problem? Developers spend an average of 11 minutes on one task before being interrupted to deal with another, according to Gloria Mark of the University of California at Irvine's Department of Informatics, who has spent years examining developers' work environments. It then takes them 25 minutes to return to the original task.

Keeping programmers productive in these fragmented work environments is a challenge for large software developers as well as for IT shops developing for end users. In both cases, application life-cycle management tools and processes can help. They automate steps -- such as change management, build processes, and testing -- in the development process, off-loading work from developers and cutting back on the number of interruptions they face.

Tuesday, August 13, 2013

DB Property Create --- By Rob McCrady

If you want to quickly generate a property list for a VB class from the list of columns on a DB table, this script is a way to do that quickly without a lot of typing.

Just set the value of @tablename to the name of the table you’re scripting and run the script.  Copy and Paste the resultset directly into yoru .vb file.

Note:  In this script I’m converting only varchar, int, bit, and the datetime db types into vb types.  If your table has other db types, you’ll want to add those to the CASE statement.

declare @tableName varchar(50)
set @tableName = 'tblSlotMgmt'

select
 'Public Property ' + propName + ' as ' + type
from (
select c.name as propName
, t.name
, Case t.name
      WHEN 'int' then 'integer'
      WHEN 'varchar' then 'string'
      WHEN 'datetime' then 'datetime'
      when 'smalldatetime' then 'datetime'
      when 'bit' then 'boolean'    
      else ''
  end as type
, ColOrder
FROM sysobjects o
inner join syscolumns c on c.id = o.id
inner join systypes t on c.xtype = t.xtype
where o.name = @tableName
and t.uid = 4
) d

order by ColOrder

Bound Columns -- "DataFormatString"

Important back pocket tool to have for formatting bound fields...

Reference MSDN --- http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.boundfield.dataformatstring.aspx

NoteNote
In most cases, formatting depends on the server's culture setting. The examples are for a culture setting of en-US.
Format character
Description
Example
C or c
Displays numeric values in currency format. You can specify the number of decimal places.
Format: {0:C}
123.456 -> $123.46
Format: {0:C3}
123.456 -> $123.456
D or d
Displays integer values in decimal format. You can specify the number of digits. (Although the type is referred to as "decimal", the numbers are formatted as integers.)
Format: {0:D}
1234 -> 1234
Format: {0:D6}
1234 -> 001234
E or e
Displays numeric values in scientific (exponential) format. You can specify the number of decimal places.
Format: {0:E}
1052.0329112756 -> 1.052033E+003
Format: {0:E2}
-1052.0329112756 -> -1.05e+003
F or f
Displays numeric values in fixed format. You can specify the number of decimal places.
Format: {0:F}
1234.567 -> 1234.57
Format: {0:F3}
1234.567 -> 1234.567
G or g
Displays numeric values in general format (the most compact of either fixed-point or scientific notation). You can specify the number of significant digits.
Format: {0:G}
-123.456 -> -123.456
Format: {0:G2}
-123.456 -> -120
N or n
Displays numeric values in number format (including group separators and optional negative sign). You can specify the number of decimal places.
Format: {0:N}
1234.567 -> 1,234.57
Format: {0:N4}
1234.567 -> 1,234.5670
P or p
Displays numeric values in percent format. You can specify the number of decimal places. (NOTE TO SELF --- System will perform calculation (n * 100) just provide the number.

In other words (n1 \ n2 = n3)  n3 *100 will be handled by the Format {0:P}   Note alos {0:P0} will not produce decimals values.
Format: {0:P}
1 -> 100.00%
Format: {0:P1}
.5 -> 50.0%
R or r
Displays SingleDouble, or BigInteger values in round-trip format.
Format: {0:R}
123456789.12345678 -> 123456789.12345678
X or x
Displays integer values in hexadecimal format. You can specify the number of digits.
Format: {0:X}
255 -> FF
Format: {0:x4}
255 -> 00ff

Friday, August 02, 2013

T-SQL IF Exists Table Drop and Add - SQL Server

IF EXISTS(SELECT * FROM dbo.sysobjects WHERE ID = OBJECT_ID('[dbo].[tbl_staging_services_to_summary]'))
 BEGIN
  --PRINT 'tbl_staging_services'
  DROP TABLE [dbo].[tbl_staging_services_to_summary]
  PRINT 'Table Dropped and Recreated'
 END
ELSE
 BEGIN
 PRINT 'No Table Existed - Created Completed'
 END

Thursday, August 01, 2013

Great Quote I heard today from a co-worker

Life is too short to get uptight over stuff. Not going to help a bit to do otherwise. God’s got the stuff I can’t control. If I can control it, I work on it & do my best. If I can’t, God will take care of it in his way. If someone else has control of it – no point in working myself up over it – just try to lend a helping hand.


Janet Alexander