Thursday, October 31, 2019

Phoenix


I am resurrecting this tech blog for notes related to Azure Logic Apps with SAP.

Monday, October 31, 2016

SQL to Excel - Cleanup tabs, new lines, ect...

DECLARE @CrLf CHAR(2);
SET @CrLf = CHAR(13) + CHAR(10); -- CarriageReturn + LineFeed

SELECT [PROB_TYPE]
  ,[CONTACTNAME]
      ,[TECHNITION]
      ,[NUMBER]
  --,[DESCRIPTION]
  ,REPLACE(REPLACE(SUBSTRING([DESCRIPTION],1,DATALENGTH([DESCRIPTION])),@CrLf,'-'), CHAR(9), '') AS [DESCRIPTION]
      ,[OPENED]
      ,[CLOSED]
      ,[CLOSINGREMARKS]
      ,[STATUS]
      ,[ENTERED_BY]
      ,[CONT_PHONE]
      ,[CONT_ADDRESS]
      ,[CONT_EMAIL]
      ,[TAG_NO]
      ,[SERIAL_NO]
      ,[MODEL]
      ,[PRIORITY]
      ,[SHOW]
      ,[CODE]
      ,[CLOSEID]
      ,[EMERGENCY_CHANGE]
      ,[ENTERED_ID]
      ,[HRS_EST]
      ,[HRS_ACTUAL]
  FROM [problems]
  where status not in ('closed')
 order by prob_type

Thursday, May 26, 2016

MS SQL Tables to C# objects

I am putting this here so I don't have to search for it later.


http://stackoverflow.com/questions/5873170/generate-class-from-database-table

Tuesday, April 19, 2016

SQLITE NHibernate DateTime2

While working on a project I was using a MsSQL 2012 database for my persistence layer but wanted to use a SQLITE in memory database for my unit/integration testing.  As part of my mapping setup I used an NHibernate Version column which used DateTime2:

NHibernate Mapping Code:

Unforntuently SQLITE doesn't support DateTime2. After searching around and not finding a good solution, I ended up extending SQLiteDialect class to map it to TEXT per the following link:   http://stackoverflow.com/a/16597386/2544235

SQLiteDialect Code:

Monday, October 6, 2014

Windows 10 "element not found" - explorer.exe error

I recently installed windows 10 preview on an old laptop (Dell Precision) which has an Nvidia Quadro 3000M video card.  After running windows update i was getting an error every time i tried to load any metro app including the feedback app.

Error: The error popped up a box saying Explorer.exe with text "element not found".

Fix: Disable the Optimus feature in the bois.

It appears to be a Nvidia optimus problem similar to the one that initially affected Windows 8 and most likely will not be fixed till the vendor puts out windows 10 specific drivers.

More info:
http://answers.microsoft.com/en-us/windows/forum/windows_tp-hardware/nvidia-optimus-not-working-properly/a059390d-dfc1-44aa-9a47-d2172d70933e

https://forums.geforce.com/default/topic/779669/nvidia-optimus-doesnt-work-with-windows-10-tech-preview/?offset=2

http://en.wikipedia.org/wiki/Nvidia_Optimus

Thursday, July 24, 2014

Recurly Credit Card Processing - True Metered Billing

Overview:  I have a client that wants to simply bill a transaction fee at the end of each month.  After doing my due diligence, Recruly appeared to be the best solution for the problem as they assured me that what was i doing was not only possible but simple.

To make a long story short, technical support couldn't provide me with an example nor would they tell me anything but "look at our website" which was less then helpful as it contradicted itself.  Sometimes it would say to modify the plan subscription itself, sometimes it would say to create an addon.  None of this is correct.

The correct way to do metered billing with Recurly using is to use the following procedure:


  1. Create an account without a subscription plan
  2. At the end of each month simple add an adjustment to the account and invoice the pending charges.

Code (C#):

private void CreateAccount(RecurlyAccount recurlyAccount)
        {

            var account = new Account(recurlyAccount.AccountCode)
            {
                FirstName = recurlyAccount.FirstName,
                LastName = recurlyAccount.LastName,
                Email = recurlyAccount.Email,
                CompanyName = recurlyAccount.CompanyName,
            };

            account.BillingInfo = new BillingInfo(account)
            {
                LastName = recurlyAccount.RecurlyBillingInfo.FirstName,
                FirstName = recurlyAccount.RecurlyBillingInfo.LastName,
                Address1 = recurlyAccount.RecurlyBillingInfo.Address1,
                Address2 = recurlyAccount.RecurlyBillingInfo.Address2,
                City = recurlyAccount.RecurlyBillingInfo.City,
                State = recurlyAccount.RecurlyBillingInfo.State,
                Country = "US",
                PostalCode = recurlyAccount.RecurlyBillingInfo.PostalCode,
                CreditCardNumber = recurlyAccount.RecurlyBillingInfo.CreditCardNumber,
                CardType = recurlyAccount.RecurlyBillingInfo.CardType,
                ExpirationMonth = recurlyAccount.RecurlyBillingInfo.ExpirationMonth,
                ExpirationYear = recurlyAccount.RecurlyBillingInfo.ExpirationYear,
                Company = recurlyAccount.RecurlyBillingInfo.Company
            };

            account.Create();
        }

 
public virtual void BillCreditCard(Account account, int quantity, int amountInCents)
        {

            account.NewAdjustment("USD", amountInCents, "Orders", quantity).Create();
            account.InvoicePendingCharges();
            
        }

Phoenix

I am resurrecting this tech blog for notes related to Azure Logic Apps with SAP.