Thursday, May 2, 2013

Orchard CMS, Magelia WebStore & Credit Card Processing

I recently became the project manager for a fully integrated CMS and eCommerce solution.  After reviewing  possible options, I selected Orchard CMS(www.orchardproject.net) with a Magelia WebStore (http://www.magelia.org/) integration.

I was able to get both solutions installed without to much trouble using Microsoft Web Platform Installer.  Magelia provides some decent documentation on their website on how to integrate both solutions but their credit card processing documentation is non-existent.

After emailing back and forth with the Magelia CEO and development team, I now have a good understand of how it works and have documented their undocumented API which i am posting here including an overview of the solution.

Overview:

  • Once you have installed both Magelia and Orchard and have integrated both products via the Magelia website tutorial (Found Here) you should be able to see products, add them to your cart and begin the checkout process.  
  • Once you get to the end of the process you will get the following error:  "Override this view (DisplayTemplates\Checkout\ProceedToPayment.cshtml) in your theme in order to submit payment data to the payment provider of your choice/". see example below:


ProceedToPayment.cshtml
  • Magelia provides an Orchard theme based off the default theme to make Paypal the payment gateway for the stores (Found Here).  If we want to use any other payment gateway we will need to override this theme.  It can be downloaded or install manually using the link above OR you can goto the theme gallery in Orchard and install it using the interface (recommend).  
  • At this point you can edit the theme directly in notepad.  I have Visual Studio and so i wanted to create a VS project.  Orchard has a great system for generating theme templates which visual studio project solutions. To do so you need to use the Orchard Command Line interface (More Info).  
  • Once the Orchard CLI is running execute the following command
    • codegen theme MyTheme /BasedOn:TheThemeMachineWithPaypalForMageliaWebStore /CreateProject:true /IncludeInSolution:true
  • This will create a new theme with a visual studio project file in it.
  • modify {IIS SERVER}\Orchard\Themes\MyTheme\Views\DisplayTemplates\Checkout\ProceedToPayment.cshtml and implement your credit card processing logic using Razor syntax.

Once complete you will need to log into orchard and apply the theme to your site.

Post questions below

Friday, April 12, 2013

Combining mp3 files.

recently i was trying to combine a bunch of mp3 files from an audio book i purchased so i could play them on my phone.  The files were all 4mb and separated into folders by which of the 10 discs they came from. Originally i looked for opensource software to do this but then discovered that this can be doing using the windows command prompt.

Command:  copy /b *.mp3 Disc1.mp3

This worked great but i had to keep traversing a monster directory structure in the command line to get to were the next group of mp3's were.  In ubuntu there is a feature were you can right click in a folder from the GUI and it would open the command prompt in that directory.  I remember windows not initially having it but it appears that they have finally implemented this great feature though they hid it pretty well.

To open a command prompt in a specific folder from the OS GUI open the folder then hold down the shift key while right clicking.  This will give you an extra option which says "Open command window here".


UPDATE:
This process can have issues with variable bit rate mp3 files.  To fix them use vbrfix and it worked great.

http://windowsfreeware.net/files/vbrfix.zip

Monday, March 18, 2013

Github

Github recently pushed a windows client worth looking at.  Coming from an SVN world, i have had a hard time adjusting to the git methodology but using the Windows client has taken away most of the mystery without losing functionality.

Check out the Windows client for Github here:  http://windows.github.com/

Thursday, February 28, 2013

Bootable AntiVirus Apps

Found this article (http://www.thewindowsclub.com/bootable-antivirus-rescue-cd-windows-free-download) which outlines some of the major players.  In the past i have found Kaspersky to be the most thorough (http://support.kaspersky.com/4162).

Instead of "wasting" a CD\DVD i would suggest using the rufus bootable thumbdrive application.  It is the simplest one i have found and works great!  It can be found here:  http://rufus.akeo.ie/




Wednesday, February 27, 2013

Vmware Copy/Paste (Clipboard)

While working with ESXi 5 vSphere Client i noticed that i couldnt copy and paste into a VM.  After some searching i found the below article on the vmware website which resolved the issue.  

Summary:
Note: VMware Tools must be installed for Copy and Paste to work.
  1. Log into a vCenter Server system using the vSphere Client and power off the virtual machine.
  2. Select the virtual machine and click the Summary tab.
  3. Click Edit Settings.
  4. Navigate to Options > Advanced > General and click Configuration Parameters.
  5. Click Add Row.
  6. Type these values in the Name and Value columns:

                                Name                                                Value

    • isolation.tools.copy.disable    false
    • isolation.tools.paste.disable   false
    Note: These options override any settings made in the VMware Tools control panel of the guest operating system.
  7. Click OK to close the Configuration Parameters dialog, and click OK again to close the Virtual Machine Properties dialog.
  8. Power on the virtual machine.

Thursday, January 31, 2013

Simple Firewall Overview

I found this blog entry which explains what a firewall does in every simple, easy to understand terms.  I highly recommend it as a starting point.

http://coding.smashingmagazine.com/2013/01/30/introduction-to-firewalls/

enjoy!

Thursday, December 13, 2012

SQL 2000 Restore with Multiple .trn files

My previous blog post showed how to script a restore for SQL Server 2005 and above.  Below is a modified script which works on SQL Server 2000.  Basically i had to use temp tables instead of dynamic variables and I had to deal with SQL Server 2000's wacky backup file naming convention.

SQL:


USE Master;
GO
SET NOCOUNT ON
-- 1 - Variable declaration
DECLARE @dbName sysname
DECLARE @backupPath NVARCHAR(500)
DECLARE @MDFLDFPath NVARCHAR(500)
DECLARE @cmd NVARCHAR(500)
--DECLARE @fileList TABLE (backupFile NVARCHAR(255))
DECLARE @lastFullBackup NVARCHAR(500)
DECLARE @lastDiffBackup NVARCHAR(500)
DECLARE @backupFile NVARCHAR(500)

CREATE TABLE #fileList (backupFile NVARCHAR(255))

-- 2 - Initialize variables
-- Database Container Name
SET @dbName = 'ProgramPlan'

-- .BAK & .TRN Directory
SET @backupPath = N'C:\backup\sql\ProgramPlan\'

-- Final MDF/LDF Directory.
-- ** Directory must exists prior to running script**
SET @MDFLDFPath = N'C:\Program Files\Microsoft SQL Server\MSSQL\Data\'


-- 3 - get list of files
SET @cmd = 'DIR /b ' + @backupPath
INSERT INTO #fileList(backupFile)
EXEC xp_cmdshell @cmd

-- 4a - Find latest full backup
SELECT @lastFullBackup = MAX(backupFile)
FROM #fileList
WHERE backupFile LIKE '%.BAK'
   AND backupFile LIKE @dbName + '%'

-- 4b - Get the names of the MDF/LDF files from the backup
DECLARE @LogicalFileNameMDF NVARCHAR(128)
DECLARE @LogicalFileNameLDF NVARCHAR(128)

Create TABLE #fileListTable
(
    LogicalName          nvarchar(128),
    PhysicalName         nvarchar(260),
    [Type]               char(1),
    FileGroupName        nvarchar(128),
    Size                 numeric(20,0),
    MaxSize              numeric(20,0),
   
)
INSERT INTO #fileListTable EXEC('restore filelistonly from disk = ''' + @backupPath + @lastFullBackup + '''')

SELECT @LogicalFileNameMDF = LogicalName
FROM #fileListTable
WHERE TYPE = 'D'

SELECT @LogicalFileNameLDF = LogicalName
FROM #fileListTable
WHERE TYPE = 'L'

SET @cmd = 'RESTORE DATABASE ' + @dbName + ' FROM DISK = '''
   + @backupPath + @lastFullBackup + ''' WITH MOVE '''
   + @LogicalFileNameMDF +  ''' TO ''' + @MDFLDFPath + @dbName + '.MDF'', MOVE '''
   + @LogicalFileNameLDF + ''' TO ''' + @MDFLDFPath + @dbName + '.LDF'', NORECOVERY , REPLACE'
PRINT @cmd

-- 4 - Find latest diff backup
SELECT @lastDiffBackup = MAX(backupFile)
FROM #fileList
WHERE backupFile LIKE '%.DIF'
   AND backupFile LIKE @dbName + '%'
   AND RIGHT(backupFile,12) > RIGHT(@lastFullBackup,12)
-- check to make sure there is a diff backup
IF @lastDiffBackup IS NOT NULL
BEGIN
   SET @cmd = 'RESTORE DATABASE ' + @dbName + ' FROM DISK = '''
       + @backupPath + @lastDiffBackup + ''' WITH NORECOVERY'
   PRINT @cmd
   SET @lastFullBackup = @lastDiffBackup
END
-- 5 - check for log backups
DECLARE backupFiles CURSOR FOR
   SELECT backupFile
   FROM #fileList
   WHERE backupFile LIKE '%.TRN'
   AND backupFile LIKE @dbName + '%'
   AND RIGHT(backupFile,12) > RIGHT(@lastFullBackup,12)
OPEN backupFiles
-- Loop through all the files for the database
FETCH NEXT FROM backupFiles INTO @backupFile
WHILE @@FETCH_STATUS = 0
BEGIN
   SET @cmd = 'RESTORE LOG ' + @dbName + ' FROM DISK = '''
       + @backupPath + @backupFile + ''' WITH NORECOVERY'
   PRINT @cmd
   FETCH NEXT FROM backupFiles INTO @backupFile
END
CLOSE backupFiles
DEALLOCATE backupFiles
-- 6 - put database in a useable state
SET @cmd = 'RESTORE DATABASE ' + @dbName + ' WITH RECOVERY'
PRINT @cmd

drop table #fileList
drop table #fileListTable

Phoenix

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