The Scheme Programmimg Language

by ssi 3. May 2013 08:56

Who knew this was a real language. I saw a post out there that said, “Hey this is a fun language. Does anyone get paid to program in it?

Below is the ubiquitous hello world app

 

#lang racket
(begin
  (display "Hello, World!")(newline)
  (display "Shelbysys")
  (newline)
 
  )

 

Tutorial

Racket IDE Download

Tags:

Scheme

Ask before Delete Row in a datagridview

by ssi 1. May 2013 20:56

   private void bindingNavigatorDeleteItem_Click(object sender, EventArgs e)

        {

            //not here

        }

 

        private void btnDeleteRow_Click(object sender, EventArgs e)

        {

            if (MessageBox.Show("Do you want to delete this Record?", "Confirm Record Deletion",

                MessageBoxButtons.YesNo, MessageBoxIcon.Information)

                == DialogResult.Yes)

            {

                tbl_ssi_BOASuspenseDataGridView.Rows.Remove(tbl_ssi_BOASuspenseDataGridView.Rows[nCurrentRow]);

            }

        }

Tags: , ,

CSharp

C # Regex Extract City, State zip from Address string

by ssi 1. May 2013 17:40
Useage:   string[] CityStateZip = GetCityStateZip(cus.ADD3);
 

private string[] GetCityStateZip(string sAddress)         {             //string[] split = sAddress.Split(new Char[] { ' ', });             //return split;             sAddress = sAddress.Replace(".""");             sAddress = sAddress.Replace(","", ");             sAddress = sAddress.Replace("  "" ");             string[] aRet = new string[3];             Regex addressPattern = new Regex(@"(?<city>[A-Za-z',.\s]+) (?<state>([A-Za-z]{2}|[A-Za-z]{2},))\s*(?<zip>\d{5}(-\d{4})|\d{5})");             MatchCollection matches = addressPattern.Matches(sAddress);             for (int mc = 0; mc < matches.Count; mc++)             {                 aRet[pADDR_CITY] = matches[mc].Groups["city"].Value;                 aRet[pADDR_STATE] = matches[mc].Groups["state"].Value;                  aRet[pADDR_ZIP] = matches[mc].Groups["zip"].Value;             }             return aRet;         }

Tags: , ,

Regex

GroupBy with Conditional SUMS

by ssi 1. May 2013 15:03
    private static void Main(string[] args)
        {
            DataClasses1DataContext dc = new DataClasses1DataContext(DEFAULT_CONNECTION_STRING);
            int nMonth = 2;
            int nYear = 2013;
            for (int index = 0; index < 5; index++)
             
            {
                nMonth = index;
                Console.WriteLine(string.Format("Month: {0}",nMonth));
                var qry = dc.tbl_ssi_LoanSnapshot_Documents.Where(c => c.TakenMonth == nMonth
                             & c.TakenYear == nYear)
                            .GroupBy(g => g.DocType)
                              .Select(g => new
               {
                   DocType = g.Key
                   ,
                   DocCount = g.Count(p => p.Request_Date != null)
                   ,
                   DocsReqRecd = g.Count(p => p.Request_Date != null & p.Recieved_Date != null)
                   ,
                   DocsReqNOTRecd = g.Count(p => p.Request_Date != null & p.Recieved_Date == null)
 
               })
               .OrderBy(o => o.DocType);
                foreach (var doc in qry)
                {
                    if (doc.DocCount > 100)
                        Console.WriteLine(string.Format("Month: {0} Doc: {1} Count:{2} ReqRecd: {3} ReqNOTRecd: {4}"
                                 , nMonth , doc.DocType, doc.DocCount, doc.DocsReqRecd, doc.DocsReqNOTRecd));
                }
                Console.WriteLine("");
            }
            Console.ReadLine();
        }

Tags: ,

CSharp

Convert Material To Columns for RCC

by ssi 1. May 2013 09:06

Tale [material] Table  and conver to  columns

SELECT [BATCH_NO]
      ,[BATCH_DAT]
      ,[MATERIAL]
      ,[NET_WT]
      ,[ID]
  FROM [rcc_production].[dbo].[material]

 

SELECT     BATCH_NO, SUM(CASE [MATERIAL] WHEN 1 THEN [NET_WT] ELSE 0 END) AS Bin1, SUM(CASE [MATERIAL] WHEN 2 THEN [NET_WT] ELSE 0 END) AS Bin2,
                      SUM(CASE [MATERIAL] WHEN 3 THEN [NET_WT] ELSE 0 END) AS Bin3, SUM(CASE [MATERIAL] WHEN 4 THEN [NET_WT] ELSE 0 END) AS Bin4,
                      SUM(CASE [MATERIAL] WHEN 5 THEN [NET_WT] ELSE 0 END) AS Bin5, SUM(CASE [MATERIAL] WHEN 6 THEN [NET_WT] ELSE 0 END) AS Bin6,
                      SUM(CASE [MATERIAL] WHEN 7 THEN [NET_WT] ELSE 0 END) AS Bin7, SUM(CASE [MATERIAL] WHEN 8 THEN [NET_WT] ELSE 0 END) AS Bin8,
                      SUM(CASE [MATERIAL] WHEN 9 THEN [NET_WT] ELSE 0 END) AS Bin9, SUM(CASE [MATERIAL] WHEN 10 THEN [NET_WT] ELSE 0 END) AS Bin10,
                      SUM(CASE [MATERIAL] WHEN 11 THEN [NET_WT] ELSE 0 END) AS Bin11, SUM(CASE [MATERIAL] WHEN 12 THEN [NET_WT] ELSE 0 END) AS Bin12,
                      SUM(CASE WHEN [MATERIAL] > 12 THEN [NET_WT] ELSE 0 END) AS HAND_LBS, SUM(CASE WHEN [MATERIAL] > 12 THEN 1 ELSE 0 END) AS HAND_ADDS
FROM         dbo.material
GROUP BY BATCH_NO

Tags: ,

SQL

handy function for converting date formats

by ssi 30. April 2013 20:31

SET ANSI_NULLS ON

GO

SET QUOTED_IDENTIFIER ON

GO

CREATE FUNCTION [dbo].[uf_ssi_DateFormat] (@Datetime DATETIME, @Format VARCHAR(32))

RETURNS VARCHAR(32)

AS

BEGIN

    DECLARE @DateValue VARCHAR(32)

   

    SET @DateValue = @Format

   

    IF (CHARINDEX ('YYYY',@DateValue) > 0)

       SET @DateValue = REPLACE(@DateValue, 'YYYY',

                         DATENAME(YY, @Datetime))

    IF (CHARINDEX ('YY',@DateValue) > 0)

       SET @DateValue = REPLACE(@DateValue, 'YY',

                         RIGHT(DATENAME(YY, @Datetime),2))

    IF (CHARINDEX ('Month',@DateValue) > 0)

       SET @DateValue = REPLACE(@DateValue, 'Month',

                         DATENAME(MM, @Datetime))

    IF (CHARINDEX ('MON',@DateValue)>0)

       SET @DateValue = REPLACE(@DateValue, 'MON',

                         LEFT(UPPER(DATENAME(MM, @Datetime)),3))

    IF (CHARINDEX ('Mon',@DateValue) > 0)

       SET @DateValue = REPLACE(@DateValue, 'Mon',

                          LEFT(DATENAME(MM, @Datetime),3))

    IF (CHARINDEX ('MM',@DateValue) > 0)

       SET @DateValue = REPLACE(@DateValue,'MM',

                                      RIGHT('0'+CONVERT(VARCHAR,DATEPART(MM, @Datetime)),2))

    IF (CHARINDEX ('M',@DateValue) > 0)

       SET @DateValue = REPLACE(@DateValue,'M',

                         CONVERT(VARCHAR,DATEPART(MM, @Datetime)))

    IF (CHARINDEX ('DD',@DateValue) > 0)

       SET @DateValue = REPLACE(@DateValue, 'DD',

                         RIGHT(0+DATENAME(DD, @Datetime),2))

    IF (CHARINDEX ('D',@DateValue) > 0)

       SET @DateValue = REPLACE(@DateValue,'D',

                                     DATENAME(DD, @Datetime))  

RETURN @DateValue

END

 

Ross Mason
Software Development

CADENCE BANK, N.A.
3700 Colonnade Parkway, Suite 200
Birmingham, AL  35243
T 205-949-9716
F n/a

ross.mason@cadencebank.com


Confidentiality Disclosure Notice: The information contained in this email is legally privileged and confidential information for the sole use of the intended recipient. Any use, distribution, transmittal or re-transmittal of information contained in this email by persons who are not intended recipients may be a violation of law and is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.

 

 

Tags: ,

SQL

The date time parse method

by ssi 30. April 2013 19:56

I really like the simplicity of the date time parse method

 

o1.OrderDate = DateTime.Parse("12/7/2007 1:05 PM");

Tags:

CSharp

Use String.Format

by ssi 30. April 2013 19:44

Use String.Format to convert pesky number or dates to strings

String.Format("{0:###.###}", HousingRatio)

String.Format("{0:d}", Datetime.Now)

Tags: ,

CSharp

Inset Commands for Added By and updated By

by ssi 30. April 2013 18:57

ALTER TABLE tbl_ssi_CadenceAddressBook ADD [AddedBy] [nvarchar](25) NULL
ALTER TABLE tbl_ssi_CadenceAddressBook ADD      [AddedDate] [datetime] NULL
ALTER TABLE tbl_ssi_CadenceAddressBook ADD      [UpdateBy] [nvarchar](25) NULL
ALTER TABLE tbl_ssi_CadenceAddressBook ADD [UpdateDate] [datetime] NULL

Tags:

SQL

Back up a SQL Table

by ssi 30. April 2013 18:57

I use this SQL script to make a copy of a SQL table before I do  any  drastic update, deletionsor inserts.

SELECT *
INTO JobExpenses2_0
FROM dbo.JobExpenses2

SELECT *
INTO  tbl_ssi_Loans
FROM RegSolDocs2.dbo.tbl_ssi_Loans

SELECT *
INTO  tbl_ssi_Paragraph
FROM RegSolDocs2.dbo.tbl_ssi_Paragraph

Tags:

SQL

Calendar

<<  July 2025  >>
MoTuWeThFrSaSu
30123456
78910111213
14151617181920
21222324252627
28293031123
45678910

View posts in large calendar

RecentComments

None

Development Team @ Shelbysys

We develop custom database applications for our clients. Our development tool of choice is MS Visual Studio. 

Quotations

"Fill the unforgiving minute with sixty seconds worth of distance run."
Rudyard Kipling