Oral  Brekke

Oral Brekke

1669030800

How to Manage Static Files with Flask, WhiteNoise, & Amazon CloudFront

WhiteNoise drastically simplifies static file management since it enables your Flask app to serve up its own static files. Couple it with a CDN like CloudFront or Cloudflare, and it's a convenient solution -- e.g., a good balance between simplicity and performance -- for handling static files on a Platform as a Service (PaaS) like Heroku or PythonAnywhere.

This tutorial details how to manage static files with Flask and WhiteNoise. We'll also configure Amazon CloudFront to get the best possible performance.

Why?

  1. The official WhiteNoise documentation -- Using WhiteNoise with Flask -- is, as of writing, outdated and inaccurate.
  2. There are very few tutorials out there on Flask and WhiteNoise.
  3. There are no tutorials on using Flask with WhiteNoise and CloudFront.

It's worth noting that this tutorial does not cover how to handle user-uploaded media files. Feel free to set this up as well as you work your way through the tutorial. Refer to the Storing Django Static and Media Files on Amazon S3 blog post for more info.

WhiteNoise

Assuming you have a Flask project set up that uses the Application Factory function pattern, import and configure WhiteNoise:

import os

from flask import Flask, jsonify
from whitenoise import WhiteNoise


def create_app(script_info=None):

    app = Flask(__name__, static_folder="staticfiles")

    WHITENOISE_MAX_AGE = 31536000 if not app.config["DEBUG"] else 0

    # configure WhiteNoise
    app.wsgi_app = WhiteNoise(
        app.wsgi_app,
        root=os.path.join(os.path.dirname(__file__), "staticfiles"),
        prefix="assets/",
        max_age=WHITENOISE_MAX_AGE,
    )

    @app.route("/")
    def hello_world():
        return jsonify(hello="world")

    return app

Configuration:

  • root is the absolute path to the directory of static files.
  • prefix is the prefix string for all static URLs. In other words, based on the above configuration, a main.css static file will be available at http://localhost:5000/assets/main.css.
  • max_age is the length of time in seconds that browsers and proxies should cache the static files.

Review the Configuration attributes section, from the official WhiteNoise documentation, for more info on optional arguments.

Add a "static" directory in the project root and, for testing purpose, download a copy of boostrap.css and add it to that newly created directory. Add a "staticfiles" directory to the project root as well.

Your project structure should now look something like this:

├── app.py
├── static
│   └── bootstrap.css
└── staticfiles

Next, add the following script -- called compress.py -- to your project root that compresses the files from the "static" directory and then copies them over to the "staticfiles" directory:

import os
import gzip


INPUT_PATH = os.path.join(os.path.dirname(__file__), "static")
OUTPUT_PATH = os.path.join(os.path.dirname(__file__), "staticfiles")
SKIP_COMPRESS_EXTENSIONS = [
    # Images
    ".jpg",
    ".jpeg",
    ".png",
    ".gif",
    ".webp",
    # Compressed files
    ".zip",
    ".gz",
    ".tgz",
    ".bz2",
    ".tbz",
    ".xz",
    ".br",
    # Flash
    ".swf",
    ".flv",
    # Fonts
    ".woff",
    ".woff2",
]


def remove_files(path):
    print(f"Removing files from {path}")
    for filename in os.listdir(path):
        file_path = os.path.join(path, filename)
        try:
            if os.path.isfile(file_path):
                os.unlink(file_path)
        except Exception as e:
            print(e)


def main():
    # remove all files from "staticfiles"
    remove_files(OUTPUT_PATH)

    for dirpath, dirs, files in os.walk(INPUT_PATH):
        for filename in files:
            input_file = os.path.join(dirpath, filename)
            with open(input_file, "rb") as f:
                data = f.read()
            # compress if file extension is not part of SKIP_COMPRESS_EXTENSIONS
            name, ext = os.path.splitext(filename)
            if ext not in SKIP_COMPRESS_EXTENSIONS:
                # save compressed file to the "staticfiles" directory
                compressed_output_file = os.path.join(OUTPUT_PATH, f"{filename}.gz")
                print(f"\nCompressing {filename}")
                print(f"Saving {filename}.gz")
                output = gzip.open(compressed_output_file, "wb")
                try:
                    output.write(data)
                finally:
                    output.close()
            else:
                print(f"\nSkipping compression of {filename}")
            # save original file to the "staticfiles" directory
            output_file = os.path.join(OUTPUT_PATH, filename)
            print(f"Saving {filename}")
            with open(output_file, "wb") as f:
                f.write(data)


if __name__ == "__main__":
    main()

This script:

  1. Removes any existing files in the "staticfiles" directory
  2. Iterates through the files in the "static" directory and compresses then saves the compressed version to the "staticfiles" directory along with the original, uncompressed version

By having both the compressed and uncompressed versions available, WhiteNoise will serve up the compressed version when a client specifically asks for it. You'll see an example of this shortly.

To test, first install WhiteNoise, if you haven't already done so:

$ pip install whitenoise

Next, add a dummy PNG file to the "static" directory, to ensure that it gets skipped in the compress script, and then run the script:

$ touch static/test.png
$ python compress.py

You should see:

Removing files from staticfiles

Compressing bootstrap.css
Saving bootstrap.css.gz
Saving bootstrap.css

Skipping compression of test.png
Saving test.png

The "staticfiles" directory should now be populated:

├── app.py
├── compress.py
├── static
│   ├── bootstrap.css
│   └── test.png
└── staticfiles
    ├── bootstrap.css
    ├── bootstrap.css.gz
    └── test.png

To verify that this worked, install then run Gunicorn:

$ pip install gunicorn
$ gunicorn "app:create_app()" -b 127.0.0.1:5000

Now, to test out WhiteNoise's gzip functionality with cURL, run:

$ curl -I -H "Accept-Encoding: gzip" http://localhost:5000/assets/bootstrap.css

You should see the following response:

HTTP/1.1 200 OK
Server: gunicorn/20.0.4
Date: Tue, 23 Feb 2021 15:30:51 GMT
Connection: close
Content-Type: text/css; charset="utf-8"
Cache-Control: max-age=31536000, public
Access-Control-Allow-Origin: *
Vary: Accept-Encoding
Last-Modified: Tue, 23 Feb 2021 15:29:01 GMT
ETag: "6035739d-305f6"
Content-Length: 25881
Content-Encoding: gzip

Take note of Content-Encoding: gzip. This indicates that the gzipped version of the file was served.

CloudFront

Although it's not required, using a Content Delivery Network (CDN) is highly recommended since it will store cached versions of your static files on multiple geographic edge locations. Your visitors will then be served your static content from the location closest to them, which will improve the web server's overall response time. CloudFront, in particular, provides a number of additional features as well like protection against DDoS attacks and access control permissions, to name a few.

To set up, log in to the AWS Console and navigate to the CloudFront dashboard. Click "Create Distribution" and choose "Get Started" under the "Web" section. Add your domain (without http or https) in the "Origin Domain Name" field and leave the remaining defaults. Then, click "Create Distribution".

If you don't have a domain name configured, feel free to test this setup locally with ngrok. With your Gunicorn server up and running on port 5000, download (if necessary) then start ngrok:

$ ngrok http 5000

Once started, you should see a public URL that you can use with CloudFront.

Want to see a demo of this in action? Check out the video below.

It generally takes about 15 minutes for CloudFront to fully configure your distribution. You can test it out before it's been fully distributed out to all edge locations while the creation status is still "In Progress", though. It still may take a few minutes before you can begin testing.

To test, grab the URL associated with the CloudFront distribution and run:

$ curl -I -H "Accept-Encoding: gzip" https://dxquy3iqeuay6.cloudfront.net/assets/bootstrap.css

You should see something similar to:

HTTP/2 200
content-type: text/css; charset="utf-8"
content-length: 25881
access-control-allow-origin: *
cache-control: max-age=31536000, public
content-encoding: gzip
date: Tue, 23 Feb 2021 15:39:01 GMT
etag: "6035739d-305f6"
last-modified: Tue, 23 Feb 2021 15:29:01 GMT
server: gunicorn/20.0.4
vary: Accept-Encoding
x-cache: Miss from cloudfront
via: 1.1 5f09c808a81a33267d5cc58d93ce6353.cloudfront.net (CloudFront)
x-amz-cf-pop: DFW53-C1
x-amz-cf-id: _aLbrgkskBos4G1tjMFR34__rgmmBSkxaCNGiSdMBmxauX4f4CFO1Q==

You can now use the provided CloudFront domain in the Flask app to handle static file requests:

import os
from urllib.parse import urljoin

from flask import Flask, jsonify, render_template
from whitenoise import WhiteNoise


def create_app(script_info=None):

    app = Flask(__name__, static_folder="staticfiles")

    WHITENOISE_MAX_AGE = 31536000 if not app.config["DEBUG"] else 0
    CDN = "https://dxquy3iqeuay6.cloudfront.net"

    app.config["STATIC_URL"] = CDN if not app.config["DEBUG"] else ""

    # configure WhiteNoise
    app.wsgi_app = WhiteNoise(
        app.wsgi_app,
        root=os.path.join(os.path.dirname(__file__), "staticfiles"),
        prefix="assets/",
        max_age=WHITENOISE_MAX_AGE,
    )

    @app.template_global()
    def static_url(prefix, filename):
        return urljoin(app.config["STATIC_URL"], f"{prefix}/{filename}")

    @app.route("/")
    def hello_world():
        return jsonify(hello="world")

    return app

The static_url should be used instead of url_for in your templates.

Sanity Check

Let's configure a template to test this out.

Add a new handler:

import os
from urllib.parse import urljoin

from flask import Flask, jsonify, render_template
from whitenoise import WhiteNoise


def create_app(script_info=None):

    app = Flask(__name__, static_folder="staticfiles")

    WHITENOISE_MAX_AGE = 31536000 if not app.config["DEBUG"] else 0
    CDN = "https://dxquy3iqeuay6.cloudfront.net"

    app.config["STATIC_URL"] = CDN if not app.config["DEBUG"] else ""

    # configure WhiteNoise
    app.wsgi_app = WhiteNoise(
        app.wsgi_app,
        root=os.path.join(os.path.dirname(__file__), "staticfiles"),
        prefix="assets/",
        max_age=WHITENOISE_MAX_AGE,
    )

    @app.template_global()
    def static_url(prefix, filename):
        return urljoin(app.config["STATIC_URL"], f"{prefix}/{filename}")

    @app.route("/")
    def hello_world():
        return jsonify(hello="world")

    @app.route("/hi")
    def index():
        return render_template("index.html")

    return app

Create a new directory called "templates" in the project root and add an index.html file to that directory:

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <link rel="stylesheet" href="{{ static_url('assets', filename='bootstrap.css') }}">
  <title>Hello, world!</title>
</head>
<body>
  <div class="container" style="padding-top:100px">
    <h1>Hello, world!</h1>
  </div>
</body>
</html>

Restart the Gunicorn server and then test it out at http://localhost:5000/hi.

Within your browser's dev tools, the

  1. bootstrap.css file should have been loaded from CloudFront: https://dxquy3iqeuay6.cloudfront.net/assets/bootstrap.css
  2. gzipped version of the file should have been served: content-encoding: gzip
  3. file should also have been served from the cache of the edge location: x-cache: Hit from cloudfront

cloudfront http response

Try running a WebPageTest to ensure static files are being compressed and cached correctly:

webpagetest results

Demo video:

Original article source at: https://testdriven.io/

#flask #amazon #cloud #front 

How to Manage Static Files with Flask, WhiteNoise, & Amazon CloudFront
Lawrence  Lesch

Lawrence Lesch

1662433080

Hotel: A Simple Process Manager for Developers

hotel

Start apps from your browser and use local domains/https automatically

Tip: if you don't enable local domains, hotel can still be used as a catalog of local servers.

Hotel works great on any OS (macOS, Linux, Windows) and with all servers ❤️

  • Node (Express, Webpack)
  • PHP (Laravel, Symfony)
  • Ruby (Rails, Sinatra, Jekyll)
  • Python (Django)
  • Docker
  • Go
  • Apache, Nginx
  • ...

To all the amazing people who have answered the Hotel survey, thanks so much <3 !

v0.8.0 upgrade

.localhost replaces .dev local domain and is the new default. See https://ma.ttias.be/chrome-force-dev-domains-https-via-preloaded-hsts/ for context.

If you're upgrading, please be sure to:

  1. Remove "tld": "dev" from your ~/.hotel/conf.json file
  2. Run hotel stop && hotel start
  3. Refresh your network settings

Support

If you are benefiting from hotel, you can support its development on Patreon.

You can view the list of Supporters here https://thanks.typicode.com.

Video

Features

  • Local domains - http://project.localhost
  • HTTPS via local self-signed SSL certificate - https://project.localhost
  • Wildcard subdomains - http://*.project.localhost
  • Works everywhere - macOS, Linux and Windows
  • Works with any server - Node, Ruby, PHP, ...
  • Proxy - Map local domains to remote servers
  • System-friendly - No messing with port 80, /etc/hosts, sudo or additional software
  • Fallback URL - http://localhost:2000/project
  • Servers are only started when you access them
  • Plays nice with other servers (Apache, Nginx, ...)
  • Random or fixed ports

Install

npm install -g hotel && hotel start

Hotel requires Node to be installed, if you don't have it, you can simply install it using one of the following method:

You can also visit https://nodejs.org.

Quick start

Local domains (optional)

To use local .localhost domains, you need to configure your network or browser to use hotel's proxy auto-config file or you can skip this step for the moment and go directly to http://localhost:2000

See instructions here.

Add your servers

# Add your server to hotel
~/projects/one$ hotel add 'npm start'
# Or start your server in the terminal as usual and get a temporary local domain
~/projects/two$ hotel run 'npm start' 

Visit localhost:2000 or http(s)://hotel.localhost.

Alternatively you can directly go to

http://localhost:2000/one
http://localhost:2000/two
http(s)://one.localhost
http(s)://two.localhost 

Popular servers examples

Using other servers? Here are some examples to get you started :)

hotel add 'ember server'                               # Ember
hotel add 'jekyll serve --port $PORT'                  # Jekyll
hotel add 'rails server -p $PORT -b 127.0.0.1'         # Rails
hotel add 'python -m SimpleHTTPServer $PORT'           # static file server (Python)
hotel add 'php -S 127.0.0.1:$PORT'                     # PHP
hotel add 'docker-compose up'                          # docker-compose
hotel add 'python manage.py runserver 127.0.0.1:$PORT' # Django
# ...

On Windows use "%PORT%" instead of '$PORT'

See a Docker example here..

Proxy requests to remote servers

Add your remote servers

~$ hotel add http://192.168.1.12:1337 --name aliased-address
~$ hotel add http://google.com --name aliased-domain 

You can now access them using

http://aliased-address.localhost # will proxy requests to http://192.168.1.12:1337
http://aliased-domain.localhost # will proxy requests to http://google.com

CLI usage and options

hotel add <cmd|url> [opts]
hotel run <cmd> [opts]

# Examples

hotel add 'nodemon app.js' --out dev.log  # Set output file (default: none)
hotel add 'nodemon app.js' --name name    # Set custom name (default: current dir name)
hotel add 'nodemon app.js' --port 3000    # Set a fixed port (default: random port)
hotel add 'nodemon app.js' --env PATH     # Store PATH environment variable in server config
hotel add http://192.168.1.10 --name app  # map local domain to URL

hotel run 'nodemon app.js'                # Run server and get a temporary local domain

# Other commands

hotel ls     # List servers
hotel rm     # Remove server
hotel start  # Start hotel daemon
hotel stop   # Stop hotel daemon

To get help

hotel --help
hotel --help <cmd>

Port

For hotel to work, your servers need to listen on the PORT environment variable. Here are some examples showing how you can do it from your code or the command-line:

var port = process.env.PORT || 3000
server.listen(port)
hotel add 'cmd -p $PORT'  # OS X, Linux
hotel add "cmd -p %PORT%" # Windows

Fallback URL

If you're offline or can't configure your browser to use .localhost domains, you can always access your local servers by going to localhost:2000.

Configurations, logs and self-signed SSL certificate

You can find hotel related files in ~/.hotel :

~/.hotel/conf.json
~/.hotel/daemon.log
~/.hotel/daemon.pid
~/.hotel/key.pem
~/.hotel/cert.pem
~/.hotel/servers/<app-name>.json

By default, hotel uses the following configuration values:

{
  "port": 2000,
  "host": '127.0.0.1',
  
  // Timeout when proxying requests to local domains
  "timeout": 5000,
  
  // Change this if you want to use another tld than .localhost
  "tld": 'localhost', 
  
  // If you're behind a corporate proxy, replace this with your network proxy IP (example: "1.2.3.4:5000")
  "proxy": false
}

To override a value, simply add it to ~/.hotel/conf.json and run hotel stop && hotel start

Third-party tools

FAQ

Setting a fixed port

hotel add --port 3000 'server-cmd $PORT' 

Adding X-Forwarded-* headers to requests

hotel add --xfwd 'server-cmd'

Setting HTTP_PROXY env

Use --http-proxy-env flag when adding your server or edit your server configuration in ~/.hotel/servers

hotel add --http-proxy-env 'server-cmd'

Proxying requests to a remote https server

hotel add --change-origin 'https://jsonplaceholder.typicode.com'

When proxying to a https server, you may get an error because your .localhost domain doesn't match the host defined in the server certificate. With this flag, host header is changed to match the target URL.

ENOSPC and EACCES errors

If you're seeing one of these errors in ~/.hotel/daemon.log, this usually means that there's some permissions issues. hotel daemon should be started without sudo and ~/.hotel should belong to $USER.

# to fix permissions
sudo chown -R $USER: $HOME/.hotel

See also, https://docs.npmjs.com/getting-started/fixing-npm-permissions

Configuring a network proxy IP

If you're behind a corporate proxy, replace "proxy" with your network proxy IP in ~/.hotel/conf.json. For example:

{
  "proxy": "1.2.3.4:5000"
}

Download Details:

Author: Typicode
Source Code: https://github.com/typicode/hotel 
License: MIT license

#javascript #front #local #https #proxy 

Hotel: A Simple Process Manager for Developers

Top 10 Front End Development Tools In 2021 - Solace Infotech Pvt Ltd

Over the last few years, web development has significantly evolved. We all are moving towards digitization and making online presence of organizations by building a business website. Website development needs technical knowledge along with the latest tools and trends that continuously appear in the market. Lots of libraries and frameworks appear in the market and replace the less efficient ones. But with the increasing number of web development tools, selecting the best one for your project can be difficult. So here, we’ve listed the best front-end development tools, libraries and frameworks that you can use in 2021. Let us see, which are those. Before digging into the front end development tools, let us see what is front end development.

What Is Front End Web Development?

Front end developers are client-side developers that produce HTML, CSS and Javascript for a website that helps clients interact with a web page without any problem. These developers ensure that the website is user-friendly and looks good. When you visit a page, you can see landing pages, buttons, aesthetics etc, are taken care of by a front end developer. Front-end development is highly in-demand, exciting and highly paying career. Front-end development tools build things together with the help of ever-improving version control systems. Let’ see the 10 best front-end development tools in 2021.

Top 10 Front End Development Tools In 2021-

1. Chrome DevTools-
Google chrome offers various web development tools that can view and transform the DOM and the style of a page. With these tools, one can run and debug JavaScript in the console, view messages, identify issue rapidly, edit pages immediately, apply styles to html elements and optimize the website speed. One can use these tools with a single browser.

Features-

  • By using Chrome DevTools, you can check network activity.
  • These tools have various functionalities for security panels such as identifying securing problems and for memory panel, network panel, application panel, elements panel, console panel, source panel and device mode.
  • By using functionalities of the performance panel, you can identify forced synchronous layouts, optimize speed, runtime performance.

2. WebStorm-
It offers smart coding support for Javascript and gives coding support for Meteor, VueJS, ReactJS and Angular. Also, webstorm helps developers code more proficiently while working on a big project. Let us see some of the great features of WebStorm-

Features-

  • Integrates with famous command-line tools to develop web
  • It provides in-built debugger for Node.js apps and client-side code
  • Highly customizable to suit different coding styles perfectly
  • It offers a unified interface to work with several popular version control systems
  • Assists developers to code appropriately while working on a big project
  • Spy.JS in-built tools helps to trace JS code.

3. SaaS-

It is most dependable and robust web development tools which helps to extend functionality of existing CSS like variables, inheritance and easy nesting. SaaS is an open-source project which pulls refreshed CSS preprocessors. It gives you a hand recorded as a hard copy that can be handily kept up, so diminishing the measure of CSS you need to code. Before you can use SaaS, your projects need to be configured with it. SaaS allows you to settle a CSS area using a method that follows the visual order of HTML.

Features-

  • It is Simple to compose any code, acknowledges language expansion like variables, inheritance and nesting.
  • Has numerous helpful capacities to control tones and different qualities
  • Has advanced functions like library control directives
  • It has a big community
  • SaaS is compatible with CSS.
  • Has features of Arguments, Variables, Nesting, Loops etc.
  • One can streamline large Stylesheets using SASS
  • Supports many inheritances

4. Grunt-
Know more at- https://solaceinfotech.com/blog/top-10-front-end-development-tools-in-2021/https://solaceinfotech.com/blog/top-10-front-end-development-tools-in-2021/

#front #end #development #tools #software

Top 10 Front End Development Tools In 2021 - Solace Infotech Pvt Ltd

What is Frontier (FRONT) | What is Frontier token | What is FRONT token

What is Frontier( FRONT)?

Frontier is a Chain Agnostic DeFi Aggregation layer. Using Frontier, Users can Track and Manage DeFi positions, Stake Assets, Swap or Exchange Assets and explore more DeFi Applications in one single place. Frontier is also building Frontier chain, which is a Decentralised Key Management blockchain based on Cosmos SDK. FRONT is the Utility token that is used for:

  • Staking on Frontier Chain
  • Gasless transactions in Application Suite ( iOS and Android)
  • Liquidity Provisions (DEXs and AMMs)
  • Incentive protocol (Incentivizing using of DeFi via Frontier)
  • NFT Acquisition
  • Referrals

The Frontier Ecosystem includes:

Frontier DeFi Application - DeFi Aggregator on Mobile Frontier Chain - A Cosmos Based Decentralised Key Management Blockchain UniFront - Unified API for all DeFi Protocols and Services.

Who Are the Founders of Frontier?

Frontier currently consists of a team of more than 15 members scattered across the world. It was founded by Ravindra Kumar, Palash Jain, and Vetrichelvan Jeyapalpandy.

As Founder, Ravindra was formerly the CTO of InstaDApp and Woodstock, is a smart contract developer, Android developer, and computing polyglot. He is an early adopter of Ethereum development with rich technical knowledge of its core codebase, cryptography, and form verification. Ravindra has 9+ years of dev and worked on 50+ mobile applications, including Fueled.com, Care.com, and Cleartrip.com.

Vetrichelvan has 13 years of experience in software development and has an interest in exploring and learning new technologies. He has worked on various projects in the marketplace and transportation and has a keen eye for design. He has been developing in the blockchain & DeFi space for 2+ years.

Palash Jain oversees all aspects of Frontierʼs marketing, community, PR, and brand awareness. He has 3+ years of experience in the blockchain space and has worked with several projects on the marketing front, including IOST, BitMax, Matic, and Lambda.

How Many Frontier (FRONT) Coins Are There in Circulation?

The FRONT tokens have a fixed maximum supply. This is set at precisely 100,000,000 FRONT Tokens, and will never increase beyond this point. At the time of writing, the current circulation supply is 15,650,000 FRONT. Of the total supply, 32.5% were distributed to investors, 8% to the community, 13.5% to Staking rewards, 20% to the Ecosystem, 10% to Marketing, 10% to Reserves, and 10% to the Team.

Where Can You Buy Frontier (FRONT) Tokens?

FRONT tokens are highly liquid and can be purchased or traded on both Decentralised and Centralised exchange platforms, including several top 10 exchanges — such as Binance, Huobi, OKEx, Uniswap, and Balancer. Some of the most popular trading pairs include FRONT/USDT, FRONT/BTC and FRONT/ETH.

Looking for more information…

☞ Website
☞ Announcement
☞ Explorer
☞ Source Code
Message Board
☞ Coinmarketcap

Create an Account and Trade FRONT NOWBinance

Thank for visiting and reading this article! I’m highly appreciate your actions! Please share if you liked it!

#bitcoin #crypto #blockchain #frontier #front

What is Frontier (FRONT) | What is Frontier token | What is FRONT token
Dock  Koelpin

Dock Koelpin

1602920160

Adding Sounds to UI

We use a combination of vision and audition every day to gather information and interact with the world around us. However, this combination is not yet reflected in web interfaces. Most UIs are extremely vision-oriented/graphic-driven.

In the past, because of my music background, I always advocated for the use of sounds on websites. A marriage of vision and audition could be a powerful tool for interaction with human-computer interfaces.

Rafa Absar and Catherine Guastavino, authors of the paper Usability of non-speech sounds in user interface(2008), note that:

“If all the information is presented visually, it may lead to visual overload and may also lead to some information being missed, if the eyes are focused elsewhere.”

At the time, the conventional wisdom was that sounds should be used only in gaming applications. This perception came from a misunderstanding that users had their full attention on the desktop. They would hardly ever get distracted. Therefore, the use of sounds would be unnecessary and could even detract from the user’s experience.

There were also technical limitations that could make the whole experience poor — lack of browser compatibility with audio formats and slow connections (it took time to load audio files on most devices).

Fortunately, things changed. There is less guesswork in UI development, UX became a predominant field, and the number of studies around the use of sounds in UI began to grow.

#ux #sound-design #javascript #ui-sound #front

Adding Sounds to UI
Justyn  Ortiz

Justyn Ortiz

1599987600

Front End Development Roadmap 2021

In this video we are going to about front end developer roadmap 2021

#development #front

Front End Development Roadmap 2021

Here's a Free Course to Help Front End Developers Learn Math

Are you looking to become a more effective developer by improving your fundamental math skills without reaching for NASA-level calculations? Look no further!

At Scrimba, we’re are really excited to announce our new course ‘Practical Math for Front-End Developers’, which offers exactly that. In the course we build 3 projects:

  1. A Shopping Cart, where we generate a list of products, calculate the total price of the products and apply a tax rate.
  2. A Weekly Schedule, where we introduce the Date object, perform layout manipulation and learn about the reduce function.
  3. A Monthly Expense Sheet, which brings together everything we’ve learned and gives us a few handy tips and tricks.

This course is brought to you by Ryan Gonyon, who has his own Twitch and YouTube channels.

With 5 years of Web Dev experience, a B.S. in Computer Science, and experience tutoring K-12 and University-level math, Ryan is the perfect tutor for this course. Head over to Scrimba to see what he has in store!

App Layout and CSS calc() Introduction

Site header, main and footer

Click the image to access the course.

In this screencast, Ryan shows us how to build the outer shell of our applications by correctly sizing the <header><footer> and <main> tags with CSS variables and the calc() function.

We use overflow-y: auto; to ensure that the contents of the <main> tag do not extend over the footer.

* {
	--headerFontSize: 2rem;
	--headerPadding: 0.5rem;
	--footerFontSize: 1rem;
	--footerPadding: 1rem;
}

header {
	font-size: var(--headerFontSize);
	padding: var(--headerPadding);
}

main {
	font-size: 1.5rem;
	height: calc(
		100vh - var(--headerFontSize) - (2 * var(--headerPadding)) - var(
				--footerFontSize
			) - (2 * var(--footerPadding))
	);
	overflow-y: auto;
}

footer {
	font-size: var(--footerFontSize);
	padding: var(--footerPadding);
}

#learn math #developers #course #front #machine learning

Here's a Free Course to Help Front End Developers Learn Math
Lia Sue Kim

Lia Sue Kim

1591141770

Javascript Arithmetic Operators

https://youtu.be/rE7XSIRXQGA

#math #javascript #programming #web-development #coding #front

Javascript Arithmetic Operators
Lia Sue Kim

Lia Sue Kim

1588543715

Naughty Search bar

https://youtu.be/L–FBYAiIF0

#html #css #ui #csstricks #front

Naughty Search bar
Randy Rickards

Randy Rickards

1583494260

Top 6 Helpful Tools for Front-End Development

The internet has a lot of tools developed by the community to ease our lives as front-end devs. Here is a list of my favourite go-to tools that have personally helped me with my work.

You may also like: 6 Front-End Challenges 

1. EnjoyCSS

To be honest, although I do a lot of front-end dev, I am not that good with CSS. This very simple tool is my saviour in hard times. It lets you design your elements with a simple UI and gives you the relevant CSS output.

This is image title

2. Prettier Playground

Prettier is a code formatter with support for JavaScript, including ES2017, JSX, Angular, Vue, Flow, TypeScript, and more. It removes your original styling and replaces it with standard consistent styling adhering to the best practices. This handy tool has been very popular in our IDEs, but it also has an online version — a playground where you can prettify your code.

This is image title

3. Postman

Postman is a tool that has been in my developer toolset since the beginning of my dev career. It has been very useful to check my endpoints in the back end. It has definitely earned its position on this list. Endpoints such as GET, POST, DELETE, OPTIONS, and PUT are included. You should definitely use this tool.

This is image title

4. StackBlitz

According to Chidume Nnamdi, this is every user’s favourite online IDE tool. The main reason why is that it brings on our favourite and most used IDE to the web — Visual Studio Code.

StackBlitz allows you to set up your Angular, React, Ionic, TypeScript, RxJS, Svelte, and other JavaScript frameworks with just one click. You can start coding in less than five seconds because of this handy feature.

I have found this tool quite useful, especially when trying out sample code snippets or libraries online. You would not have the time to create a new project from scratch just to try out a new feature. With StackBlitz, you can simply try out the new NPM package in less than a few minutes without creating a project locally from scratch. Nice, right?

This is image title

5. Bit.dev

One basic principle of software development is code reusability. This enables you to reduce your development, as you’re not required to build components from scratch.

This is exactly what Bit.dev does. It allows you to share reusable code components and snippets and thereby allows you to reduce your overhead and speed up your development process.

It also allows for components to be shared among teams, which lets your team collaborate with others.

As quoted by Bit.dev, this component hub is also suitable to be used as a design system builder. By allowing your team of developers and designers to work together, Bit.dev is the perfect tool for building a design system from scratch.

Bit.dev now supports React, Vue, Angular, Node, and other JavaScript frameworks.

This is image title

6. CanIUse

This online tool can be very handy, as it allows you to find out whether the feature you are implementing is compatible with the browsers you are expecting to cater to.

I have had many experiences where some of the functionalities used in my application were not supported on other browsers. I learned the hard way that you have to check for browser compatibility. One instance was that a particular feature wasn’t supported in my portfolio project on Safari devices. I figured that out a few months after deployment.

To see this in action, let’s check which browsers support the WebP image format.

This is image title

As you can see, Safari and IE are not currently supported. This means you should have a fallback option for incompatible browsers. The code snippet below is the most commonly used implementation of WebP images to support all browsers.

This is image title

Conclusion

I have tried to fit the best tools I have encountered in my dev career. If you think there are any worthy additions, please do comment below. Happy coding!

Thank you for reading!

#front-end #javascript #webdevelopment #programming

Top 6 Helpful Tools for Front-End Development

Gregory Smith

1577778272

Hire Frontend Developer in San Francisco

Hiring a frontend developer in a competitive market is a tedious task as IT company promising the services do not deliver desired outcomes but we at Data EximIT provide a dedicated front-end developer in San Francisco.

Your web application’s front-end represents your business and services you provide to your customers that’s why it is one of the most important parts which needs cutting-edge skills and experience to deliver the best results.

To Read More: Hire Frontend Developer in San Francisco

#Hirefrontenddeveloper #front #frontenddeveloper #frontend

Hire Frontend Developer in San Francisco