Thursday, September 12, 2013

Introduction to AlmanacSoft Payer 1.0

Category: Windows Store app, PayPal, REST API, eCommerce

What is AlmanacSoft Payer 1.0?

AlmanacSoft Payer 1.0 is Windows Store app running on Windows 8.1 Preview or later. It is payment app that uses new PayPal's REST APIs with standards-based technologies such as OAuth and JSON for paying money on the Internet. It supports both Direct Credit Card Payment and PayPal Account Payment. The app is native code written in C++/CX and developed by Poom Malakul Na Ayudhya.



How to Install
  1. Download AlmanacSoft Payer 1.0 and you will get the file named "Payer_1.0.0.0_Win32_Test.zip".
  2. Extract it and right click on "Add-AppDevPackage.ps1" to Run with PowerShell. 
  3.  You may be asked to acquire the developer license if you don't have it yet. Use your Microsoft  account to log in and get the license for free. It will be expired in one month and you can renew it.
  4. You may be asked for Execution Policy Change, you have to answer "[Y] Yes"
  5. You may be asked for installing the signing certificate, you have to answer "[Y] Yes". 
  6. AlmanacSoft Payer will be installed successfully.

How to use

For Merchants
  1. You have to register at PayPal for PayPal merchant account.
  2. Log in at https://developer.paypal.com/ with your merchant account. Then create an application to get merchant's Client Id and Secret.
  3. Run AlmanacSoft Payer and select credentials page. Use your Client ID and Secret to apply and export your encrypted merchant data file (MDF).
  4. Send encrypted MDF to your customers by e-mail or let them download from your website.
  5. Tell your customers to use AlmanacSoft Payer to import or download your MDF and use it to make payment for you.
For Customers
  1. Run AlmanacSoft Payer. If you are behind proxy server, set your proxy credentials first.
  2. Using AlmanacSoft Payer to import or download encrypted MDF provided by the merchant you want to pay.
  3. Select appropriate payment method for merchant in the countries supported by PayPal.

Wednesday, March 27, 2013

C++ AMP: How fast is it?

Category: Windows Store app, C++ AMP, GPU Programming
Prerequisites: C++, C++ AMP

Full Text in Thai (PDF 1.13 MB)

This study measures time used in millisecond for calculating square matrix multiplication at different dimension sizes starting from 256x256 to 2048x2048. The C++ AMP tested engines are two GPUs (Intel HD Graphics 4000 and NVIDIA Geforce GT-650M) and one software engine (Microsoft Basic Render Driver).  Two C++ AMP methods (simple and tiling) are used.  The study also measures time used by normal sequential code for using as a baseline comparison. The testing software is C++ Windows Store app running on Intel i7 RAM 8 MB.


The figure above shows Windows Store app used in this study. It also has 3D rotating cube in background for testing with DirectX.



This is the result table of time used measured in milliseconds. The table also shows computed ratio (in red) comparing between MS Basic Render Driver and Sequential code and also between both GPUs and MS Basic Render Driver. The size means the matrix dimension starting from 256x256 to 2048x2048.


From the above figure, MS Render Driver speed is around five to ten times comparing with sequential code when using simple method and five to twenty times when using tile method.


When using simple method, NVIDIA's speed is ten to thirty times comparing with MS Render Driver while Intel's speed is around five times comparing with MS Render Driver.


When using tile method, NVIDIA's speed is from fifteen to twenty five times comparing with MS Render Driver while Intel's speed is around five times comparing with MS Render Driver.


Friday, February 15, 2013

Run-time Data Binding

Category: Windows Store App Developing
Prerequisites: XAML, C++, C++/CX, Simple Data Binding

Data binding lets you synchronise UI control elements in XAML with data source that can be dataset, data object or any primitive data types. Usually you just set binding property for any UI control elements and then set BindableAttribute attribute for the ref class in the code behind. And when you compile your code, the compiler will do the rest and all properties in your class will be bindable.

The Problem
Sometimes you may need data class that uses dynamic properties. That means you don’t know at compile time what and how many data properties and types the class should have. This is a common situation such as when you retrieve data set from the SQL server that you usually specify data fields at run time. In these cases, BindableAttribute attribute doesn't help.

The Solution
My solution is to implement ICustomPropertyProvider for the ref class. In this article I call this technique as Run-time Data Binding. The steps are as follows:

1. First, create new ref class with inheriting and implementing ICustomProperty. This class will be used for representing run-time property you will create later.

2. Create another new ref class with inheriting and implementing ICustomPropertyProvider. If you want to be notified when your property changed you can also inherit and implement INotifyPropertyChanged here. Don't forget to inherit from DependencyObject, this is mandatory.


In this class I used Map Collection to store my CustomProperty objects and created two public methods for getting and setting value for CustomProperty target.


Now you will have two ref class that can be used for run-time data binding.

3. Create new ref class to be used for run-time binding which inherit from CustomPropertyProvider ref class. In this case I'll create Person Class that will have name property created at run-time.


4. Insert name property at rum-time.