Sunday, March 29, 2015

Adding Custom SSL Certificate for Cloud Front

CloudFront

Cloud front is a CDN web service provided by Amazon AWS.
Image result for cloudfront logo

Adding SSL Certificate to CloudFront

First of all before allowing SSL to CloudFront distributions you need to change the behavior section to redirect and enable HTTPS request to specific origins. However CloudFront by default comes with a SSL certificate which needs to be changed to include custom SSL Certificates.

Steps in Adding SSL certificate
  1. Prepare the Certificate and Related files
    1. Private key file
    2. Certificate file
    3. Certificate Chain File
  2. Install and Setup AWS CLI in host machine (Your Laptop) (Note: Remember to configure key value pair of a user who has IAM Change Policies permission
  3. Use the following command to upload SSL Certificate (Follow the Guide)
          aws iam upload-server-certificate --server-certificate-name CertificateName --certificate-body file://public_key_certificate_file --private-key file://privatekey.pem --certificate-chain file://certificate_chain_file --path /cloudfront/path/

Note:
  • When uploading the certificate remember to use file:// and then file names
  • Remember to allow the configured user account (which is added to AWS CLI) has the attach IAM policy IAMFullAccess
    • Steps: IAM -> Select user/role -> Permissions section -> Attach Policy -> Select IAMFullAccess
  • When preparing Certificate Chain File Only include Intermediate and Root Certificate in Order

Common Errors

A client error (MalformedCertificate) occurred when calling the UploadServerCertific
ate operation: Unable to validate certificate chain. The certificate chain must star
t with the immediate signing certificate, followed by any intermediaries in order. T
he index within the chain of the invalid certificate is: -1
When Certificate Chain file is not in correct order

A client error (MalformedCertificate) occurred when calling the UploadServerCertific
ate operation: Unable to parse certificate. Please ensure the certificate is in PEM
format.
When 'file://' is not used in-front of file names or files are not in correct format

Worked Example

D:\CloudFrontSSL>aws iam upload-server-certificate --server-certi
ficate-name testdomain.com-20180126 --certificate-body file://web_testdomain_com.crt --priva
te-key file://private.key.rsa --certificate-chain file://Chained.crt --path /cloudfr
ont/testdomain/

Thursday, October 20, 2011

V 1.1


Geo data visualization is one of the major areas affected by the rapid technology growth of modern browsers as well as client side scripting languages. It enables to develop standalone as well as distributed applications which enables to visualize large amount of geodata in informative manner.


GViz Framework is a geo data visualization framework which basically built using JavaScript and freely available visualization API's & Libraries.


It supports data source integration through data providers (e.g: Google Doc, CSV File, XML File,JSON File, XML String, JSON String, CSV String etc.) implemented in the framework and it provides extendable & simple API to write custom data providers.

The data is described using Data Set Publishing Language (DSPL) which uses a XML Schema. The Framework uses both the regular DSPL Schema with JavaScript configuration and Extended DSPL Schema to support direct configuration of Data Providers & Visualization Components (Vizcomps).To visualize data GViz utilizes existing visualization components(e.g Maps, Charts , Graphs etc.) as well as keeping the flexibility through API to add new custom components.Few of the features of GViz is categorized as below,
  • Rich set of popular components
  • Configurable visualization
  • Facilitate data binding to sources
  • Easy integration
  • Independent from server side technology
Using GViz Framework consists of following steps,

  1. Step 1: Prepare DSPL
  2. Step 2: Prepare HTML Structure
  3. ¡Step 3: Add Gviz framework JavaScript to webpage

JavaScript Introduction


JavaScript is the most popular scripting language on the internet, and works in all major browsers, such as Chrome, Firefox, Internet Explorer, Opera, and Safari. JavaScript is an implementation of the language standard. ECMA-262 is the official JavaScript standard. "JavaScript" is also a trademark of Oracle Corporation.
If you are new to JavaScript you can go through the introduction tutorial provided by w3schools
Executing JavaScript
  • JavaScript can be executed in the web browser's address bar directly. Type javascript: followed by your JavaScript code
  •  If you are using Google Chrome Browser you can use the CTRL + SHIFT + J to open JavaScript Console where you can directly execute JavaScript.
  •  For Firefox browser you can install Firebug as an Addon to develop and execute JavaScript.
Although JavaScript is commonly used as snippets of code to add interactivity for webpages you can use it to build very sophisticated components such as Interactive Charts, Tables, Maps etc.Use of Object Oriented Concepts with JavaScript will make it more practical to deal with the complexity of the code.

Sunday, December 6, 2009

Sinhala Inline for Firefox ver 1.1

This is the latest version of the Firefox addon which I build earlier.

Many new features are added to the extension to improve the usability.

Few screen shots of the add-on is shown below.














You can download it using the following Link
Click Here to Download (WithOut EnterKey Conversion)
Click Here to Download (With EnterKey Conversion)

Thursday, November 26, 2009

How to retrieve Text from a Document (Open Office AddOn)

The following code will retrieve the Word before the cursor position

public String readPreviousWordFromDocument() {


          XMultiComponentFactory xmcf = m_xContext.getServiceManager();
        Object desktop;


        try {
            desktop = xmcf.createInstanceWithContext("com.sun.star.frame.Desktop", m_xContext);
            XDesktop xDesktop = (XDesktop) UnoRuntime.queryInterface(XDesktop.class, desktop);


            // retrieve the current component and access the controller
            XComponent xCurrentComponent = xDesktop.getCurrentComponent();


            // get the XModel interface from the component
            XModel xModel = (XModel) UnoRuntime.queryInterface(XModel.class, xCurrentComponent);


            // the model knows its controller
            XController xController = xModel.getCurrentController();


            XTextViewCursorSupplier xViewCursorSupplier =
                    (XTextViewCursorSupplier) UnoRuntime.queryInterface(
                    XTextViewCursorSupplier.class, xController);


            // get the cursor
            XTextViewCursor xViewCursor = xViewCursorSupplier.getViewCursor();


            // query its XPropertySet interface, we want to set character and paragraph properties
            XPropertySet xCursorPropertySet = (XPropertySet) UnoRuntime.queryInterface(
                    XPropertySet.class, xViewCursor);


            // set the appropriate properties for character and paragraph style
            xCursorPropertySet.setPropertyValue("CharStyleName", "Quotation");
            xCursorPropertySet.setPropertyValue("ParaStyleName", "Quotations");


            XPageCursor xPageCursor = (XPageCursor) UnoRuntime.queryInterface(
                    XPageCursor.class, xViewCursor);
            XText xDocumentText = xViewCursor.getText();
            XTextCursor xModelCursor = xDocumentText.createTextCursorByRange(xViewCursor.getStart());


              XWordCursor xWordCurser = (XWordCursor) UnoRuntime.queryInterface(
                    XWordCursor.class, xModelCursor);


            xWordCurser.gotoPreviousWord(true);


            String lastWord = xWordCurser.getString();
           return lastWord;
        } catch (Exception e) {
           return "";
        }
    }


In the above code by changing the Cursor (eg:- xWordCurser ,xParagraphCursor etc.. ) you can shift between word word or else paragraphs.


If you want to change which word ...simply change by changing the following line
" xWordCurser.gotoPreviousWord(true);"