Create an account


Welcome, Guest
You have to register before you can post on our site.

Username
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 20,169
» Latest member: crabber45
» Forum threads: 21,792
» Forum posts: 22,676

Full Statistics

Online Users
There are currently 481 online users.
» 0 Member(s) | 475 Guest(s)
Applebot, Baidu, Bing, DuckDuckGo, Google, Yandex

 
  [Tut] Python Regex Split
Posted by: xSicKxBot - 01-23-2020, 05:01 AM - Forum: Python - No Replies

Python Regex Split

Why have regular expressions survived seven decades of technological disruption? Because coders who understand regular expressions have a massive advantage when working with textual data. They can write in a single line of code what takes others dozens!

This article is all about the re.split(pattern, string) method of Python’s re library.

Let’s answer the following question:

How Does re.split() Work in Python?


The re.split(pattern, string, maxsplit=0, flags=0) method returns a list of strings by matching all occurrences of the pattern in the string and dividing the string along those.

Here’s a minimal example:

>>> import re
>>> string = 'Learn Python with\t Finxter!'
>>> re.split('\s+', string)
['Learn', 'Python', 'with', 'Finxter!']

The string contains four words that are separated by whitespace characters (in particular: the empty space ‘ ‘ and the tabular character ‘\t’). You use the regular expression ‘\s+’ to match all occurrences of a positive number of subsequent whitespaces. The matched substrings serve as delimiters. The result is the string divided along those delimiters.

But that’s not all! Let’s have a look at the formal definition of the split method.

Specification

re.split(pattern, string, maxsplit=0, flags=0)

The method has four arguments—two of which are optional.

  • pattern: the regular expression pattern you want to use as a delimiter.
  • string: the text you want to break up into a list of strings.
  • maxsplit (optional argument): the maximum number of split operations (= the size of the returned list). Per default, the maxsplit argument is 0, which means that it’s ignored.
  • flags (optional argument): a more advanced modifier that allows you to customize the behavior of the function. Per default the regex module does not consider any flags. Want to know how to use those flags? Check out this detailed article on the Finxter blog.

The first and second arguments are required. The third and fourth arguments are optional.

You’ll learn about those arguments in more detail later.

Return Value:

The regex split method returns a list of substrings obtained by using the regex as a delimiter.

Regex Split Minimal Example


Let’s study some more examples—from simple to more complex.

The easiest use is with only two arguments: the delimiter regex and the string to be split.

>>> import re
>>> string = 'fgffffgfgPythonfgisfffawesomefgffg'
>>> re.split('[fg]+', string)
['', 'Python', 'is', 'awesome', '']

You use an arbitrary number of ‘f’ or ‘g’ characters as regular expression delimiters. How do you accomplish this? By combining the character class regex [A] and the one-or-more regex A+ into the following regex: [fg]+. The strings in between are added to the return list.

How to Use the maxsplit Argument?


What if you don’t want to split the whole string but only a limited number of times. Here’s an example:

>>> string = 'a-bird-in-the-hand-is-worth-two-in-the-bush'
>>> re.split('-', string, maxsplit=5)
['a', 'bird', 'in', 'the', 'hand', 'is-worth-two-in-the-bush']
>>> re.split('-', string, maxsplit=2)
['a', 'bird', 'in-the-hand-is-worth-two-in-the-bush']

We use the simple delimiter regex ‘-‘ to divide the string into substrings. In the first method call, we set maxsplit=5 to obtain six list elements. In the second method call, we set maxsplit=3 to obtain three list elements. Can you see the pattern?

You can also use positional arguments to save some characters:

 >>> re.split('-', string, 2)
['a', 'bird', 'in-the-hand-is-worth-two-in-the-bush']

But as many coders don’t know about the maxsplit argument, you probably should use the keyword argument for readability.

How to Use the Optional Flag Argument?


As you’ve seen in the specification, the re.split() method comes with an optional fourth ‘flag’ argument:

re.split(pattern, string, maxsplit=0, flags=0)

What’s the purpose of the flags argument?

Flags allow you to control the regular expression engine. Because regular expressions are so powerful, they are a useful way of switching on and off certain features (for example, whether to ignore capitalization when matching your regex).


Syntax Meaning
re.ASCII If you don’t use this flag, the special Python regex symbols w, W, b, B, d, D, s and S will match Unicode characters. If you use this flag, those special symbols will match only ASCII characters — as the name suggests.
re.A Same as re.ASCII
re.DEBUG If you use this flag, Python will print some useful information to the shell that helps you debugging your regex.
re.IGNORECASE If you use this flag, the regex engine will perform case-insensitive matching. So if you’re searching for [A-Z], it will also match [a-z].
re.I Same as re.IGNORECASE
re.LOCALE Don’t use this flag — ever. It’s depreciated—the idea was to perform case-insensitive matching depending on your current locale. But it isn’t reliable.
re.L Same as re.LOCALE
re.MULTILINE This flag switches on the following feature: the start-of-the-string regex ‘^’ matches at the beginning of each line (rather than only at the beginning of the string). The same holds for the end-of-the-string regex ‘$’ that now matches also at the end of each line in a multi-line string.
re.M Same as re.MULTILINE
re.DOTALL Without using this flag, the dot regex ‘.’ matches all characters except the newline character ‘n’. Switch on this flag to really match all characters including the newline character.
re.S Same as re.DOTALL
re.VERBOSE To improve the readability of complicated regular expressions, you may want to allow comments and (multi-line) formatting of the regex itself. This is possible with this flag: all whitespace characters and lines that start with the character ‘#’ are ignored in the regex.
re.X Same as re.VERBOSE

Here’s how you’d use it in a practical example:

>>> import re
>>> re.split('[xy]+', text, flags=re.I)
['the', 'russians', 'are', 'coming']

Although your regex is lowercase, we ignore the capitalization by using the flag re.I which is short for re.IGNORECASE. If we wouldn’t do it, the result would be quite different:

>>> re.split('[xy]+', text)
['theXXXYYYrussiansXX', 'are', 'Y', 'coming']

As the character class [xy] only contains lowerspace characters ‘x’ and ‘y’, their uppercase variants appear in the returned list rather than being used as delimiters.

What’s the Difference Between re.split() and string.split() Methods in Python?


The method re.split() is much more powerful. The re.split(pattern, string) method can split a string along all occurrences of a matched pattern. The pattern can be arbitrarily complicated. This is in contrast to the string.split(delimiter) method which also splits a string into substrings along the delimiter. However, the delimiter must be a normal string.

An example where the more powerful re.split() method is superior is in splitting a text along any whitespace characters:

import re text = ''' Ha! let me see her: out, alas! he's cold: Her blood is settled, and her joints are stiff; Life and these lips have long been separated: Death lies on her like an untimely Frost Upon the sweetest flower of all the field. ''' print(re.split('\s+', text)) '''
['', 'Ha!', 'let', 'me', 'see', 'her:', 'out,', 'alas!', "he's", 'cold:', 'Her', 'blood', 'is', 'settled,', 'and', 'her', 'joints', 'are', 'stiff;', 'Life', 'and', 'these', 'lips', 'have', 'long', 'been', 'separated:', 'Death', 'lies', 'on', 'her', 'like', 'an', 'untimely', 'Frost', 'Upon', 'the', 'sweetest', 'flower', 'of', 'all', 'the', 'field.', ''] '''

The re.split() method divides the string along any positive number of whitespace characters. You couldn’t achieve such a result with string.split(delimiter) because the delimiter must be a constant-sized string.

Related Re Methods


There are five important regular expression methods which you should master:

  • The re.findall(pattern, string) method returns a list of string matches. Read more in our blog tutorial.
  • The re.search(pattern, string) method returns a match object of the first match. Read more in our blog tutorial.
  • The re.match(pattern, string) method returns a match object if the regex matches at the beginning of the string. Read more in our blog tutorial.
  • The re.fullmatch(pattern, string) method returns a match object if the regex matches the whole string. Read more in our blog tutorial.
  • The re.compile(pattern) method prepares the regular expression pattern—and returns a regex object which you can use multiple times in your code. Read more in our blog tutorial.

These five methods are 80% of what you need to know to get started with Python’s regular expression functionality.

Where to Go From Here?


You’ve learned about the re.split(pattern, string) method that divides the string along the matched pattern occurrences and returns a list of substrings.

Learning Python is hard. But if you cheat, it isn’t as hard as it has to be:

Download 8 Free Python Cheat Sheets now!



https://www.sickgaming.net/blog/2020/01/...gex-split/

Print this item

  [Tut] Shipping API Integration in PHP with Australia Post Example
Posted by: xSicKxBot - 01-23-2020, 05:01 AM - Forum: PHP Development - No Replies

Shipping API Integration in PHP with Australia Post Example

Last modified on January 22nd, 2020 by Vincy.

In an eCommerce website, we use the shipping API to calculate shipping cost. We calculate based on the items added to the shopping cart.

Integrating Shipping API with an eCommerce website will optimize the logistics cost. It takes care of the shipping needs in an effective way.

Shipping API integration helps eCommerce website by charging the right amount for shipping. Imagine when we add a random fixed cost to each checkout. What will happen is that, we will either overcharge the customer or end up in direct loss.

Australia Post Shipping API Integration in PHP

In this article, we will see how to integrate Australia Post shipping API in a PHP application. You can use this code in a shopping cart checkout page to calculate shipping rates.

I have created code to request the Australia Post API to calculate the shipping rates. This rate is for the products on domestic shipping.

What is inside?


  1. What is Shipping API?
  2. Utilities of third-party shipping API
  3. Existing shipping API available
  4. About Australia Post API
  5. About this example
  6. File Structure
  7. Australia Post shipping API integration steps
  8. Web interface to get data to calculate shipping rates
  9. PHP code with Australia Post shipping API request-response handlers
  10. Australia Post shipping API integration output

What is Shipping API?


Shipping API – a digital intermediate as like as other APIs. It resolves eCommerce website shipping needs.

Integratable extern responds to the queries generated by the application.

With the available services and capabilities, it help build the eCommerce website’s shipping needs.

This ready-made solution will smoothen the customer’s buying experience with your online store.

Capabilities of Shipping APIs


For each eCommerce website, the motive to integrate Shipping API differs. This variation depends on the utilities required by the shopping cart.

In general, the capabilities of Shipping APIs are,

  1. Verifying shipping zone
  2. Multi-carrier support
  3. Tracking the order traces during shipment.

With these capability limit, the Shipping APIs provides ultimate services. And, they are huge in number. For example,

  1. Ensuring the shipping destination and thereby calculate the success probability of the delivery.
  2. Request a quote for the carrier or shipment.
  3. Receiving notification about tracking updates.

The Australia Post shipping API provides services like,

  • Postage assessment calculation
  • Postal code search
  • SecurePay online payments and more.

Existing shipping API available


Postal carrier APIs like DHL, USPS, Australia Post provides services for the eCommerce website. It offers services like calculating shipping rates, tracking shipped parcel and more.

There are numerous third-party shipping APIs available.  For example Postmen, EasyPost, Shippo and more.

The third-party shipping API has a RESTful interface that connects postal service APIs. It creates a channel to read the API to access its functionalities.

About Australia Post API


Australia Post API suite has the following list APIs. All these APIs help to fulfil the transactional needs of your eCommerce website.

  1. Postage assessment calculator – To get the cost for shipping a document or parcel.
  2. Shipping and tracking – To get service on product dispatch and tracking.
  3. SecurePay online payments – Payment solutions for an eCommerce website via SecurePay integration.
  4. Delivery choices API – gives the delivery choices to the user to choose location, speed, day, date, time.

For accessing the API, it requires the corresponding API key. As per the Australia Post API access requirements it asks to register with the API  to get the key.

Australia Post provides an interface to explore the APIs. You may generate live API requests via this explorer to see how it works.

About this example


In this example, it uses the Postage assessment calculator API  or PAC of the Australia Post API suite.

This API provides services to calculate the shipping cost. This cost varies based on the parcel weight, dimension, and more parameters.

This API includes various endpoints returning resources data based on the access requests.

I am creating a request for calculating the shipping cost for a domestic parcel. This request needs the corresponding API key. In the next section, we will see how to get the API key for accessing the PAC API.

For this calculation, the API requires the parcel dimension, height, width. And also, it needs the shipping zone’s origin and destination postal codes. These are all common considering any eCommerce website.

I get the parameters from the user via an HTML form and send it with the API request.

This example uses PHP CURL to access the Australia Post Postage assessment calculator API.

File Structure


The below screenshot shows the Australia Post shipping rate calculation example files.

Shipping API AusPost Files Structure

Australia Post shipping API integration steps


The steps to integrate Australia Post in an eCommerce website are,

  1. Choose API from the Australia Post API suite.
  2. Create a new account to get the API key.
  3. Choose the postage service and set the endpoint.
  4. Set the API key as the HTTP header AUTH-KEY.
  5. Generate the PAC API request with the header set in step 4.

How to get the Australia Post PAC API key


There are many APIs provided by the Australia Post in API suite. The first step is to choose the API based on the need of your eCommerce website.

As discussed in the last section, I choose PAC API for calculating the shipping cost.

The PAC API access requirements state that it need the API key. This key is for authenticating the service request generated from the application.

Aus Post PAC API Registration

On submitting valid information, it will send the API key to the registered email address. You can use this API then, to access the PAC API services.

Getting API Key from Auspost

Web interface to enter details to calculate shipping rates


This is the code to show a form to collect the product and shipping details.

It has the fields to collect the width, height, weight, and length of the parcel. The form will show the units of these parameters to the user.

 Also, it collects the shipping address. This is the shipping destination address. The zip code is a mandatory field among the shipping address fields.

The shipping origin and destination postal codes are mandatory to calculate the rates.

In this example, the postal code of the shipping origin is configurable. You can also move it to the HTML form to let the user enter the data.

index.php

<HTML> <HEAD> <TITLE>Shipping API</TITLE> <link href="./assets/css/phppot-style.css" type="text/css" rel="stylesheet" /> <link href="./assets/css/shipping-api.css" type="text/css" rel="stylesheet" /> <script src="./vendor/jquery/jquery-3.3.1.js" type="text/javascript"></script> </HEAD> <BODY> <div class="phppot-container"> <div class="australian-api"> <div class="page-heading">Australian Shipping API</div> <form name="australian-api" id="australian-api" action="" method="post" on‌submit="return formValidation()"> <div class="sub-heading">Product Details</div> <div class="row"> <div class="inline-block"> <div class="form-label"> Length<span class="units-style">(cm)</span><span class="required error" id="length-info"></span> </div> <input class="input-box-110" type="text" name="length" id="length" value="<?php if(! empty($_POST["length"])){ echo $_POST["length"];}?>"> </div> <div class="inline-block input-right-margin"> <div class="form-label"> Width<span class="units-style">(cm)</span><span class="required error" id="width-info"></span> </div> <input class="input-box-110" type="text" name="width" id="width" value="<?php if(! empty($_POST["width"])){ echo $_POST["width"];}?>"> </div> <div class="inline-block"> <div class="form-label"> Height<span class="units-style">(cm)</span><span class="required error" id="height-info"></span> </div> <input class="input-box-110" type="text" name="height" id="height" value="<?php if(! empty($_POST["height"])){ echo $_POST["height"];}?>"> </div> <div class="inline-block input-right-margin"> <div class="form-label"> Weight<span class="units-style">(kg)</span><span class="required error" id="weight-info"></span> </div> <input class="input-box-110" type="text" name="weight" id="weight" value="<?php if(! empty($_POST["weight"])){ echo $_POST["weight"];}?>"> </div> </div> <div class="row"> <div class="inline-block"> <div class="form-label"> Quantity<span class="required error" id="quantity-info"></span> </div> <input class="input-box-110" type="number" name="quantity" id="quantity" value="<?php if(! empty($_POST["quantity"])){ echo $_POST["quantity"];}else{echo 1;}?>"> </div> </div> <div class="sub-heading">Shipping Address</div> <div class="row"> <div class="inline-block input-right-margin"> <div class="form-label">Address1</div> <input class="input-box-330" type="text" name="address1" id="address1" value="<?php if(! empty($_POST["address1"])){ echo $_POST["address1"];}?>"> </div> <div class="inline-block"> <div class="form-label">Address2</div> <input class="input-box-330" type="text" name="address2" id="address2" value="<?php if(! empty($_POST["address2"])){ echo $_POST["address2"];}?>"> </div> </div> <div class="row"> <div class="inline-block input-right-margin"> <div class="form-label">Country</div> <input class="input-box-330" type="text" name="country" id="country" value="<?php if(! empty($_POST["country"])){ echo $_POST["country"];}?>"> </div> <div class="inline-block"> <div class="form-label">State</div> <input class="input-box-330" type="text" name="state" id="state" value="<?php if(! empty($_POST["state"])){ echo $_POST["state"];}?>"> </div> </div> <div class="row"> <div class="inline-block input-right-margin"> <div class="form-label">City</div> <input class="input-box-330" type="text" name="city" id="city" value="<?php if(! empty($_POST["city"])){ echo $_POST["city"];}?>"> </div> <div class="inline-block"> <div class="form-label"> Zip Code<span class="required error" id="to-postcode-info"></span> </div> <input class="input-box-330" type="text" name="to-postcode" id="to-postcode" value="<?php if(! empty($_POST["to-postcode"])){ echo $_POST["to-postcode"];}?>"> </div> </div> <div class="row"> <div id="inline-block"> <input type="submit" class="submit-button" name="submit-btn" id="submit-btn" value="Get Quote"><span><img src="img/loader.gif" class="loader-ic" id="loader-icon"></span> </div> </div> </form> <?php if (! empty($shippingPrice)) { ?><div> <div class="sub-heading">Shipping Details</div> <div class="row"> <label class="shipping-result">Address1:</label> <?php echo $address1;?></div> <div class="row"> <label class="shipping-result">Address2:</label> <?php echo $address2;?></div> <div class="row"> <label class="shipping-result">Country:</label> <?php echo $country;?></div> <div class="row"> <label class="shipping-result">State:</label> <?php echo $state;?></div> <div class="row"> <label class="shipping-result">City:</label> <?php echo $city;?></div> <div class="row"> <label class="shipping-result">Quantity:</label> <?php echo $quantity;?></div> <div class="row"> <label class="shipping-result">Shipping price:</label> $<?php echo $quantity * $shippingPrice;?></div> </div> <?php }else if(!empty($errorMsg)){?> <div class="error-message"><?php echo $errorMsg;?></div> <?php }?> </div> </div> <script src="./assets/js/shipping.js"></script> </BODY> </HTML> 

CSS created to present the payment form


This CSS includes basic styles to show the shipping form to the user. It has exclusive styles related to this example.

Apart from that, this example contains a generic CSS phppot-styles.css. It contains common template styles with a list of selectors. You can find this generic CSS in the downloadable source.

assets/css/shipping-api.css

.australian-api { background: #fff; border-radius: 4px; padding: 10px; width: 85%; margin: 20px 40px; } .page-heading { font-size: 2em; font-weight: bold; } .sub-heading { font-size: 1.2em; font-weight: bold; margin: 20px 0px; } .inline-block { display: inline-block; } .row { margin: 15px 0px; } .form-label { margin-bottom: 5px; text-align: left; } input.input-box-330 { width: 250px; } input.input-box-110 { width: 120px; margin-right: 5px; } .australian-api .error { color: #ee0000; padding: 0px; background: none; border: #ee0000; } .australian-api .error-field { border: 1px solid #d96557; } .australian-api .error:before { content: '*'; padding: 0 3px; color: #D8000C; } input.submit-button { background-color: #ffb932; border-color: #ffc87a #e2a348 #da9d0a; text-align: center; cursor: pointer; color: #000; width: 100px; } .input-right-margin { margin-right: 30px; } .shipping-result { font-weight: bold; color: #737171; padding: 15px 0px; } .error-message { color: #D8000C; } .units-style { font-size: 0.8em; color: #666; margin-left: 2px; } .loader-ic { display: none; } 

jQuery script to validate the shipping details


The shipping.js file contains the form validation function. It validates the mandatory fields and makes sure that they are not empty.

It returns boolean based on which the form-post carried forward to PHP. While returning false, it highlights what’s wrong with the entered data.

After successful validation, PHP will validate the shipping attributes sent via the form.

assets/js/shipping.js

function formValidation() { var valid = true; $("#length").removeClass("error-field"); $("#width").removeClass("error-field"); $("#height").removeClass("error-field"); $("#weight").removeClass("error-field"); $("#quantity").removeClass("error-field"); $("#to-postcode").removeClass("error-field"); var Length = $("#length").val(); var Width = $("#width").val(); var Height = $("#height").val(); var Weight = $("#weight").val(); var Quantity = $("#quantity").val(); var toPostcode = $("#to-postcode").val(); if (Length.trim() == "") { $("#length-info").html("").css("color", "#ee0000").show(); $("#length").addClass("error-field"); valid = false; } if (Width.trim() == "") { $("#width-info").css("color", "#ee0000").show(); $("#width").addClass("error-field"); valid = false; } if (Height.trim() == "") { $("#height-info").css("color", "#ee0000").show(); $("#height").addClass("error-field"); valid = false; } if (Weight.trim() == "") { $("#weight-info").css("color", "#ee0000").show(); $("#weight").addClass("error-field"); valid = false; } if (Quantity.trim() == "" || Quantity < 1) { $("#quantity-info").css("color", "#ee0000").show(); $("#quantity").addClass("error-field"); valid = false; } if (toPostcode.trim() == "") { $("#to-postcode-info").css("color", "#ee0000").show(); $("#to-postcode").addClass("error-field"); valid = false; } if (valid == false) { $('.error-field').first().focus(); valid = false; } if (valid == true) { $("#submit-btn").hide(); $("#loader-icon").show(); } return valid; } 

PHP code with Australia Post shipping API request-response handlers


This is the configuration file of this example code. It has the constants defined for keeping the API key and shipping origin.

Common/Config.php

<?php namespace Phppot; class Config { const AUSTRALIAN_POST_API_KEY = 'REPLACE_WITH_THE_API_KEY'; const SHIPPING_ORIGION = '1000'; } ?> 

This is an exclusive service class for executing curl script. The execute() function is receiving URL, API KEY as its parameters.

It initiates curl object and set the URL. It sets the header with the API key to call the Australia Post live URL.

The rawBody will receive the API response in JSON format. You can use this as a sample to build an eCommerce website backed by a shopping cart with shipping API integration.

lib/CurlService.php

<?php namespace Phppot; class CurlService { public function execute($url, $apiKey, $ch = null) { if (is_null($ch)) { $ch = curl_init(); } curl_setopt($ch, CURLOPT_URL, $url); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0); curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false); curl_setopt($ch, CURLOPT_HTTPHEADER, array( 'AUTH-KEY: ' . $apiKey )); return $rawBody = curl_exec($ch); } } ?> 

The AusPost.php PHP class handles the operation for preparing the API request.

The getShipmentPrice() function set the API key and form data to the PHP variables. It prepares the query parameters with these variables.

The class constructor instantiates the curlService created for this example.

Using the curl instance, it hits the Australia Post live PAC API URL. The API will validate the shipping criteria passed with the query parameters.

The request and response can be of either JSON or XML.

lib/AusPost.php

<?php namespace Phppot; class AusPost { private $curlService; private $api_url = 'https://digitalapi.auspost.com.au/postage/parcel/domestic/calculate?'; public function __construct() { require_once __DIR__ . '/CurlService.php'; $this->curlService = new CurlService(); } public function getShipmentPrice() { require_once __DIR__ . '/../Common/Config.php'; $con = new Config(); $apiKey = $con::AUSTRALIAN_POST_API_KEY; $fromPostcode = $con::SHIPPING_ORIGION; $toPostcode = $_POST["to-postcode"]; $length = $_POST["length"]; $width = $_POST["width"]; $height = $_POST["height"]; $weight = $_POST["weight"]; $queryParams = array( "from_postcode" => $fromPostcode, "to_postcode" => $toPostcode, "length" => $length, "width" => $width, "height" => $height, "weight" => $weight, "service_code" => "AUS_PARCEL_REGULAR" ); // here use $curlService and execute $url = $this->api_url . http_build_query($queryParams); $result = $this->curlService->execute($url, $apiKey); $shippingResult = json_decode($result); return $shippingResult; } } ?> 

index.php (PHP Code)

<?php namespace Phppot; if (! empty($_POST["submit-btn"])) { require_once __DIR__ . '/lib/AusPost.php'; $shippingApi = new AusPost(); $result = $shippingApi->getShipmentPrice(); if (isset($result->postage_result)) { $shippingPrice = $result->postage_result->total_cost; } else { $errorMsg = $result->error->errorMessage; } $quantity = $_POST["quantity"]; $address1 = $_POST["address1"]; $address2 = $_POST["address2"]; $state = $_POST["state"]; $country = $_POST["country"]; $city = $_POST["city"]; } ?> 

Australia Post shipping API integration output


The output screenshot below shows the payment and shipping form. It is to get the shipping details from the user.

It also has the fields to collect parameters like height, width and the dimension of the products.

You can also integrate this form into your shopping cart checkout page to calculate rates. For a shopping cart, it requires only the shipping address.

Because, the height, width, height will be a part of a product entity. And the quantity can be read from the cart session or database. The below form is generic and with little customization can be used for any eCommerce website.

Shipping API Australia Post User Interface

Download

↑ Back to Top



https://www.sickgaming.net/blog/2020/01/...t-example/

Print this item

  (Indie Deal) Final 100 Crackerjack keys, Dharker Studio Sale, Table Manners Deal
Posted by: xSicKxBot - 01-23-2020, 05:01 AM - Forum: Deals or Specials - No Replies

Final 100 Crackerjack keys, Dharker Studio Sale, Table Manners Deal

Less than 100 keys are available for this one of a kind Crackerjack Deal. [www.indiegala.com]
Now's your chance to claim an incredible indie gem with an emotional story you wouldn't want to miss.

Dharker Studio Winter Sale, up to -85%
[www.indiegala.com]

For just a few hours the opportunity knocks at your door...quite hard and loudly. Win Steam Keys by beating the Gameplay Challenge.[www.indiegala.com]

Pre-Purchase Table Manners: The Physics-Based Dating Game
https://youtu.be/WJ3FGaHTBfk
Prepare yourself early. A night of romance is yours to enjoy, if you play your cards right. [www.indiegala.com]

Happy Hour
Today's Happy Hour is LIVE for Indie Resolutions Bundle[www.indiegala.com]!

Check out IndieGala on Twitter, YouTube & Facebook[www.facebook.com]


https://steamcommunity.com/groups/indieg...3820430096

Print this item

  Material Maker 0.8 Released
Posted by: xSicKxBot - 01-23-2020, 05:01 AM - Forum: Game Development - No Replies

Material Maker 0.8 Released

Material Maker 0.8 was just released.  Material Maker is a free procedural texture generation software that was built on top of the Godot game engine.  We previously covered Material Maker in this video.  The 0.8 release brings several new features including several new nodes and examples.

Details from the itch.io page:

Regressions and incompatibilities

Bad news come first, as always:

  • 2D SDF nodes do not output greyscale information and cannot be directly connected to greyscale/color/RGBA inputs anymore. you will have to use the sdShow Node
User interface

  • the 2D and 3D previews are now in separate tabs
  • the 3D preview in the background of the graph pane can now be shown and hidden using the “cube” button at the bottom left of the graph view and controlled independently,
  • the 2D preview now shows a tiled version of the selected node (so it’s easy to check the result is seamless)
  • the 2D preview now has controls that can be associated to (float) node parameters (this applies mainly to shape/transform nodes)the UI will now be dimmed when exiting the application (this change was contributed by Calinou)
Nodes and code generation

  • 2 new types of node inputs/outputs have been added for 2D and 3D signed distance functions. Both types have a custom preview (distance field for 2DSDF and shaded scene for 3DSDF)
  • shader nodes inputs now have a “function” attribute. When this option is selected, the input is generated as a function and is usable in instance Functions. This feature made all 3D SDF nodes possible.
  • a few problems in convolution nodes have been fixed
New and improved nodes

  • all 2D signed distance functions have been modified to use the 2DSDF inputs/outputs (that are shown in orange). The sdShow node is now the only way to generate an image. Added 2DSDF transform and morph nodes.
  • the new 3D signed distance functions nodes can be used to describe 3D shapes. Many shapes (sphere, box, capsule, torus, cylinder…), transforms (translate, rotate, scale), operators (boolean, repeat, extrusion, revolution…) are provided and the Render node can be used to generate a height map and a normal map from 3DSDF information. All this is based on ray marching and can be used to describe 3D objects that can then be spread on the textures, as demonstrated in the “skulls” and “pile_of_bricks” examples.
  • the new 3D box and a sphere nodes are not based on 3DSDF and just output a height map
  • the new “workflow” nodes can be used to define base materials and mix them using height/orientation/offset maps, and to ultimately create complex materials without drawing spaghetti monsters in the graph view. A few simple base materials are provided in the node library as templates. The new “marble” and the updated “medieval_wall” examples show how to use all those nodes.
  • the bricks node has been improved with round brick corners and output UV information for each brick and each brick corner. Also added an output that gives brick orientation.
  • the new CustomUV node uses one of its input as coordinates to read the other input and can thus be used to implement psychedelic image transforms
  • the new generic truchet node tiles its input, randomly flipping it horizontally, vertically or both
  • the beehive node just outputs hexagonal tiles
  • the new convolution nodes are 3 edge detectors and a sharpen filter
  • the normal map node has a new option to disable its input buffer. The buffer should still be used when the input is complex, but disabling it will generate smoother normal maps
  • the new greyscale node converts color input to greyscale with a choice of 5 algorithms
  • the new swap channels node replaces all channels (R, G, B, A) of its output with 0, 1 or a (optionnally inverted) channel of its input

Material Maker 0.8 is available for download for Windows and Linux here.  You can learn more about Material Maker 0.8 in the video below.

GameDev News


<!–

–>



https://www.sickgaming.net/blog/2020/01/...-released/

Print this item

  (Free Game Key) Hello Neighbor - Free Epic Game (Daily Encore Giveaway - Day 12)
Posted by: xSicKxBot - 01-23-2020, 05:01 AM - Forum: Deals or Specials - No Replies

Hello Neighbor - Free Epic Game (Daily Encore Giveaway - Day 12)

Visit the giveaway page:

https://store.epicgames.com/GRABFREEGAMES/hello-neighbor

Create an account or log in an already existing one and permanently add the game on your account. Alternatively you can redeem it from the Epic Launcher on the game's giveaway page.

This is the 12th daily giveaway that lasts only 24 hours. They will give away one free game per day until the end of 2019.

Epic is also giving away 10$ coupons for free on anyone who logs on their site https://www.epicgames.com/store/promotion/holiday-sale-2019

We are welcoming everyone to join our discord server (link below). We are more active there on finding giveaways, small or large.

?GrabFreeGames.com ?Twitter ?Steam Curator ?Facebook[fb.me]?Discord[discord.gg]
❤️Support us: ✔️HumbleBundle Partner[www.humblebundle.com] Epic Tag: GrabFreeGames


https://steamcommunity.com/groups/GrabFr...7573128930

Print this item

  Mobile - Maze Machina Review
Posted by: xSicKxBot - 01-23-2020, 05:01 AM - Forum: New Game Releases - No Replies

Maze Machina Review

A tinkerer once made a maze. To test it, he sent a little mouse to work their way out. You are that mouse, and Maze Machina is quite a clever, vexing little contraption: simultaneously stressful and accessible. The design is brilliant and such fun to play, but the margins of error are also pretty tight, at least in the modes with turn pressure.

Tinytouchtales has been a quality outfit for years now, with the games it produces being basically guaranteed day-one purchases from myself and quite a few others. In this respect the latest is also certifiably good, but it should additionally be praised for its juxtaposition of incredible simplicity and unflinching difficulty. It’s even more pared-down than you’d think, yet chock-full of interactions and interesting edge cases.

Maze Machina Premise

So far, Arnold Rauers’ niche has always been single-player turned-based solitaire games, with the other big ticket games (Card Crawl, Card Thief, Miracle Merchant) utilizing cards. Well, Maze Machina is solitaire all right, but it uses a randomized board of items, not cards. The goal is straightforward: grab the key, make your way to the level exit, as quick as you can. To accomplish this, you have to use items. The tile is the effect, the location is the device, just as with Michael Brough’s Imbroglio. If the mousy protagonist is on a dagger tile, then the dagger can stab enemies. That’s the game’s first key proposition: position is everything.

Movement is the other proposition. By swiping in any of the four cardinal directions, every figure on the board that can move, will move in that direction with a few minor exceptions. (The game credits Threes! for this mechanic). The figures that don’t move will use an item on their space, if possible. That means you, of course, but all of the automatons standing in your way as well. It’s fiendish how often this mechanic is difficult to manipulate to a specific end. Early levels only have a few enemies, but the later ones have five, and they stay true to their automaton nature: when destroyed they come back often (though not always?). The game wants you to find an elegant solution and not just browbeat your robot foes into submission. On that note, it has an energy system, with each move costing one stamina and a hunk of cheese replenishing said stamina every third level. ‘Elegance’ forever means the fewest moves, prioritising repositioning effects over direct battle.

Maze Machina Items

The full variety of items is a doozy. Quite a few of them are weapons, with various hit ranges, priority effects and other quirks. Some are for repositioning enemies or items. There are trap helmets, thieving masks and mirror items which actually want to provoke a fracas. Most difficult of all are the random or hidden effects, because although they are difficult to discern they must nevertheless be factored in. Each level feels like an elaborate multivariate deathtrap where one false swipe can mean your poor heroic mouse is stuck spending twenty turns or more getting out.

In this way the game is closer to the type of Solitaire you’d read about in Hoyle’s book of games and bust out a pack of Penguin cards to play. In solitaires of old, fail states abound. The state of play can get wretched very quickly. Maze Machina has quite a few combo effects and unusual timing structures, so it requires very clear-sighted forecasting and strategic planning. The difference between a good plan and a sloppy one is not numerical, it’s binary. You will fail, as I have, if you play haphazardly relying on a few favorite tricks or stacking combos to bail you out. Excellent play here means minding the boring elements every bit as much as the flashy ones.

Maze Machina Gameplay

Modern videogames have gamed human psychology by attaching numerical values to anything and everything: health, rarity, currency, even free time itself, are all conventionally made fungible by rendering them as numbers. Not so with Maze Machina, which cares about effects more than numbers. A single hit destroys almost any object or entity, there are no additional unlocks or grind and the whole game is available to play without extra investment or progression.

It’s refreshing and hardcore, and to this reviewer the most fun game to fail at repeatedly. Normally I’d bounce off a game after having so little success, but I can clearly see what it wants from me: deliberate, total consideration of every possibility. My normal pattern is just to brutally find the cleanest, best path from A to B but that approach is such a bad fit for Maze Machina.

Maze Machina Modifiers

It has quite a few play modes, so to relax and practice my technique I switch from the standard mode to Limit, which puts a hard cap of 250 turns. Draft is also a refreshing twist, giving a choice between new rules which take effect every few floors. The mechanical theme is present in the art, animations, sound effects and music throughout. It’s cohesive and slick. There is a richness, both in the number of ways to play and artistic vision that… enriches the play experience. The automaton theme also emphasis how heavily turns revolve around programmed series of actions, like a Rube Goldberg Machine.

I must again reiterate how bad I am at this game. I can recognise good plays with 100% benefit of hindsight, and occasionally even set them up in advance, but I cannot for the life of me get to that mythical fifteenth level. This is fine! Great, even! I’m shocked that none of my previous puzzle experience is proving very useful, and grateful for the chance to learn a new system from scratch. I do suspect some of the variance can genuinely ruin a run, but without a more perfect understanding I’d be rightfully accused of sour grapes (a.k.a. mad because bad). I hate this game! I can’t escape it!  5/5 would embark on this embarrassing, compelling learning spree again.



https://www.sickgaming.net/blog/2020/01/...na-review/

Print this item

  AppleInsider - Adobe Flash disabled in latest Safari Technology Preview
Posted by: xSicKxBot - 01-23-2020, 05:01 AM - Forum: Apples Mac and OS X - No Replies

Adobe Flash disabled in latest Safari Technology Preview

 

Presaging what will be the final nail in the coffin for Adobe Flash on Safari, Apple on Wednesday disabled support for the much-maligned multimedia plug-in in the latest version of Safari Technology Preview.

Adobe Flash

Apple quietly announced the imminent demise of Flash on Safari in a set of release notes accompanying Safari Technology Preview 99. Along with a number of enhancements to WebKit code and assets is mention of a single deprecation under “Legacy Plug-Ins,” which simply states, “Removed support for Adobe Flash.”

CNET was first to note the change on Wednesday.

Introduced as a developer-focused experimental browser in 2016, Safari Technology Preview provides an early look at upcoming Web technologies that will appear — or in the case of Flash, won’t appear — in both iOS and macOS. The browser is in many ways a standalone beta version of Safari.

The death of Flash is a long time coming. A once-pervasive standard for distributing rich media over the internet, the asset-hungry, proprietary software is now viewed as out-of-date and unsuitable for a mobile-first world. Late Apple cofounder Steve Jobs said as much some 10 years ago in a widely circulated letter appropriately titled “Thoughts on Flash.”

Following increased competition and pushback from the likes of Apple, Google and other browser makers, Adobe in 2017 said it would pull the plug on Flash in 2020. Now, with five words, Apple is signaling that time is nigh for Safari.

For iOS device users, the end of Flash is a non-issue as the platform never integrated the web standard. Safari on Mac has shipped with Flash disabled since macOS Sierra, leaving users to manually activate the software on a case-by-case basis.



https://www.sickgaming.net/blog/2020/01/...y-preview/

Print this item

  Fedora - Set up an offline command line dictionary in Fedora
Posted by: xSicKxBot - 01-23-2020, 05:01 AM - Forum: Linux, FreeBSD, and Unix types - No Replies

Set up an offline command line dictionary in Fedora

You don’t need an internet connection to have an easily searchable and extendable dictionary on your Fedora computer. You can use sdcv (StarDict under Console Version) and the public Stardict files on the default repositories to keep a local record for offline use. This article shows you how.

What is sdcv?


sdcv is a command line variant of Stardict. Stardict is a part of a long legacy of GUI offline dictionaries. The “dic” files it uses are formatted as a colon delimited file, with the word in first column and the definition in the second column. You can have multiple lines with the same word and different definitions. sdcv will provide you with a search function and formatted display of your results.

Installing sdcv


You can get started quickly with sdcv and the English dictionary by installing them from the default repos:

sudo dnf install sdcv stardict-dic-en

sdcv will be ready for use right away. If you want to see what other languages are available, use this command:

dnf search stardict

How to use sdcv


sdcv has an interactive and non-interactive mode. You can perform a quick search on a word or term using this command:

sdcv word

For example, you could search sdcv linux. Alternately, you can run sdcv by itself to activate interactive mode.

Customizing sdcv


sdcv has a –color option that adds coloring to the words and source of the definition. You can also use an alias to enable –color by default. Simply edit your shell resource file (default on Fedora is ~/.bashrc) to add this command:

alias sdcv="sdcv --color"

You can also use a more friendly name like this:

alias describe="sdcv --color"

sdcv references /usr/share/stardic/dic by default, or it uses the path located in the shell variable STARDICT_DATA_DIR. You can also set up a personal dictionary in the file $HOME/.stardict/dic.

Fun facts


Believe it or not, the dict network protocol is still alive to this day. You can use it with the curl command by using a command like this to search for a word:

curl dict://dict.org/d:<word>

This pull definitions straight from the internet via your command line. Enjoy using sdcv!


Photo by Pisit Heng on Unsplash.



https://www.sickgaming.net/blog/2020/01/...in-fedora/

Print this item

  News - Mini Review: Lydia – One Of The Most Emotionally Impactful Games On Switch
Posted by: xSicKxBot - 01-23-2020, 05:01 AM - Forum: Nintendo Discussion - No Replies

Mini Review: Lydia – One Of The Most Emotionally Impactful Games On Switch


Lydia is a powerful game. It’s the kind of experience that, while very short, will make you stop and think about its story long after the end credits roll. It’s tense, funny, and heartbreaking all in one go, and with the option to purchase additional DLC in support of the Finnish A-Clinic Foundation, its underlying message will undoubtedly resonate with many people.

You play as the titular Lydia, a child with a highly active imagination trapped in a neglectful home environment. After her father tells her a story of monsters in the night, Lydia becomes convinced that monsters are real, and with the help of her beloved teddy, ventures into her wardrobe to confront her fears. To say more of the story would ultimately ruin it, but needless to say that a lot of what you see within the game is not always as it seems.

For the most part, Lydia plays out like your typical adventure title; you can directly control Lydia for large portions of the game, investigating areas of interest and talking to people within the environment. Other scenes play out more like a visual novel, occasionally providing you with dialogue choices as you progress through conversations. Disappointingly, we found on a second playthrough that many of the choices presented to you actually make very little impact to the overall plot, and this is particularly noteworthy in the final scene of the game.

What’s immediately striking with the game is the one-two punch of the visuals and sound design. It looks like an abstract graphic novel, and its black and white colour palette is very much reminiscent of Limbo, but with occasional streaks of vibrant colour dotted throughout to denote areas of danger or safety. The soundtrack consists of a mixture of sinister ambient music and emotional melodies, and the characters speak in a nonsensical tongue that somehow fits quite naturally in the overall experience.

With only 4 short chapters to play through, Lydia will only take you about 1 or 2 hours to complete, so those after more of a meaty experience might want to look elsewhere. We would, however, encourage you to experience it at least once, if only for its eye-opening message. It successfully tells a haunting story about abuse and heartbreak without necessarily shoving it down your throat, and that’s really hard to do. It’s one of the most emotionally impactful games to grace the Switch since its launch nearly three years ago.



https://www.sickgaming.net/blog/2020/01/...on-switch/

Print this item

  News - Pokemon-Like MMO Temtem Can Already Be Snagged At A Discount
Posted by: xSicKxBot - 01-23-2020, 05:01 AM - Forum: Lounge - No Replies

Pokemon-Like MMO Temtem Can Already Be Snagged At A Discount

The Pokemon-like Temtem hit Steam Early Access this week, and just like the game that inspired it, people are going wild for it. Its user reviews are currently sitting at "Very Positive," and if you want to jump in at a cheaper price than what you can find on Steam, then Green Man Gaming and publisher Humble Bundle have got your back. The best part is that buying from either retailer will get you a Steam key.

Best deals on Temtem

Temtem's regular price is $35--and it'll only increase as development continues--but at Green Man Gaming, you can pick up Temtem for $28.69 USD with promo code UPCOMING18. However, if you're a Humble Choice subscriber, then you can snag the creature-catching game for slightly cheaper: $28. These deals are valid everywhere Green Man Gaming and Humble Bundle operate.

Temtem launched to Early Access with some server instability issues, but after its latest update, it seems to be operating more smoothly. Developer Crema stated that Temtem's early access period is expected to run through mid-2021. The studio confirmed that the version currently available to players includes about 50% of the game's overall content.

If you're interested in learning more about the Pokemon-inspired game, then be sure to read our preview on how Temtem twists the Pokemon formula. It goes into the game's double battles, which you can take on with a friend by your side, and more.


https://www.gamespot.com/articles/pokemo...0-6472968/

Print this item

 
Latest Threads
Black Ops (BO1, T5) DLC's...
Last Post: crabber45
3 hours ago
Thank you
Last Post: cschir10
4 hours ago
The Best Apollo Neuro [AP...
Last Post: ScorpioxYaduvanshi
7 hours ago
Save Today with Apollo Ne...
Last Post: ScorpioxYaduvanshi
7 hours ago
Claim Your Apollo Neuro [...
Last Post: ScorpioxYaduvanshi
7 hours ago
Get Apollo Neuro [APOLLOZ...
Last Post: ScorpioxYaduvanshi
7 hours ago
Apollo Neuro Promo Code $...
Last Post: ScorpioxYaduvanshi
7 hours ago
Apollo Neuro Discount Cod...
Last Post: ScorpioxYaduvanshi
7 hours ago
Apollo Neuro Coupon Code ...
Last Post: ScorpioxYaduvanshi
7 hours ago
Apollo Neuro Promo Code $...
Last Post: ScorpioxYaduvanshi
7 hours ago

Forum software by © MyBB Theme © iAndrew 2016