Simple Web hosting on Amazon

Enabling your web presense is no longer a luxury, This architecture diagram shows a simple, scalable, and Elastic deployment for your web hosting on Amazon.

With the exception of your end user devices, you don’t own any infrastructure: You lease it !!

Download and enjoy.

How to create adobe illustrator symbols from objects

Sometimes you have a lot of drawings that you want to use as symbols.

One way to create your symbols in illustrator for later re-use is to manually adding each object to your symbol library.

Or

Use this script to do it automatically

var currentDoc = activeDocument;
var groupItemsList = currentDoc.groupItems;
var vCounter =0;

// Add all object that are grouped together as a new symbol
// If one needs to add single paths ( ungroup items) then add another loop for currrentDoc.pathItems.

if (groupItemsList.length > 0) {
for (i = 0; i < groupItemsList.length; i++) {
vCounter = vCounter +1 ;

currentDoc.symbols.add(groupItemsList[i]);
}
alert ( vCounter + ” Symbols created”);
}
else {
alert(“Your document does not have any valid objects”);
}

Hadoop in MS Azure cloud

In the past few years or since Hadoop graduation in apache.org, there has been many contribution almost on a daily basis addressing anything on this magic platform from data streaming to real-time analytics.

Although a little bit late to both parties (cloud and big data) Microsoft has now a solid platform for Hadoop ecosystem. But it is still advisable for architects to avoid any vendor lock-in (U-SQL for example).

This diagram shows some basic and high level view of Hadoop on Azure. Not a complete solution but it should give your architects or you (if you are the architect of your company) a good starting point and some nice graphics too in SVG format.

In PDF

In SVG

How to capitalize first letter in MySQL

Unlike other (some) DB engines, MySQL does not have a built-in function for capitalizing (capitalize first letter) but the solution can be simple.

select
option_name ‘original’
,
CONCAT(UCASE(LEFT(option_name, 1)), LCASE(SUBSTRING(option_name, 2))) Capitalized
from wp_options where LEFT(option_name, 1) <> ‘_’

Add amazon enterprise Icons to adobe illustrator library

Using adobe illustrator symbols to quickly add pre-existing symbols to your diagrams is a big time saver.

Amazon provides icons for architecture drawing, although the icons provided from these vendors in vector format, each comes as individual file . to simplify your drawings I created a symbol library for your use.

Follow these steps to permanently add amazon (AWS) symbols to your Illustrator workspace.

  1. Download a copy of the symbols library from here https://www.teamsrunner.com/tr-assets/ai/amazon-symbols.ai
  2. Copy the file to your adobe illustrator symbols directory : \Program Files\Adobe\Adobe Illustrator CC 2017\Presets\en_US\Symbols\

  3. Now from the symbols panel add a reference to your symbols library, it will be showing in the drop down menu.

Amazon icons can be found in here.

https://aws.amazon.com/architecture/icons/

Enjoy.

How to add a product to a shopping cart programmatically in woocommerce

The problem
Sometimes you need the functionality of a shopping cart without forcing your customer to interact with your web site in the traditional way of a e-commerce.

For example let’s say you have a sample product that you just want automatically added to a shopping cart, so your customers can just click on let say “try product” and then be taken directly to a checkout process. This only applies to woocommerce, however the approach may be similar to other e-commerce toolkits.

This example is a modification from the woocommerce documentation.

Requirements:

# Requirement detail

1

A Product x is automatically added to a shopping cart when a non-logged in customer visits your site. This forces a visitor to register when they do checkout

2

Remove a product if the users is logged in

3

The site “try now” button is a link to “check out”, where the web site collects customers billing/shipping information.

These requirements allow a web site to collect customer billing information taking advantage of the built-in woocommerce logic.

Implementation:

  1. Go to your wordpress admin page usually under https://[your-web-site]/wp-admin/

  1. We are going to use the SKU to do a lookup in this case is L3-670115

  1. When your customers visit your site the product is going to be in their shopping cart , ready to checkout

  2. And here is the code, this needs to be visible in your functions.php file. But that you already knew it.
  3. add_action(‘wp_loaded’, ‘add_product_to_cart’);

    function add_product_to_cart()
    {

    if (!is_admin()) {

    $product_id = wc_get_product_id_by_sku(‘L3-670115’);

    $found = false;

    if (is_user_logged_in()) {
    if (sizeof(WC()->cart->get_cart()) > 0) {
    foreach (WC()->cart->get_cart() as $cart_item_key => $values) {
    $_product = $values[‘data’];
    if ($_product->id == $product_id)
    WC()->cart->remove_cart_item($cart_item_key);
    }
    }
    } else {
    if (sizeof(WC()->cart->get_cart()) > 0) {
    foreach (WC()->cart->get_cart() as $cart_item_key => $values) {
    $_product = $values[‘data’];
    if ($_product->id == $product_id)
    $found = true;
    }
    // if product not found, add it
    if (!$found)
    WC()->cart->add_to_cart($product_id);
    } else {
    // if no products in cart, add it
    WC()->cart->add_to_cart($product_id);
    }
    }
    }
    }

    Hope you enjoy.