Wednesday, February 8, 2017

Catching Frontend UI Design Tricks with SnappySnippet

[caption id="attachment_148754" align="alignright" width="400"]E.T. Elliot in science class E.T. The Extra-Terrestrial: Elliot contemplates a frog's life.[/caption]

Last Monday night, I re-watched the movie 'E.T. The Extra-Terrestrial' for the first time since I was a lad. It was great. Steven Spielberg gets a boatload of story out of a few skinny kids and a fairly clunky puppet.

One scene that did stand out for me was the frog biology scene. Elliot – the 11-year-old central character – and his fellow classmates are each given a live frog which they are expected to chloroform and dissect.

Elliot decides he can't dissect his frog and inspires a mass frog jailbreak from the science class. I suspect 11-year-old Alex may have felt the same. It seems like a waste of perfectly good frogs.

Dissecting UI Design with SnappySnippet

However, when it comes to the web, I love pulling the legs off things to see how they work. There's no better way of understanding how front-end design, animation, and SVG work than digging under the skin and getting your hands dirty.

Recently I've been using a new tool to help me.

SnappySnippet is a Chrome Dev Tools extension designed to help you extract UI elements out of a site and set them up in your favorite code playground.

After installing SnappySnippet, you'll find a new tab in Chrome Dev Tools panel. (see below).

[caption id="attachment_148756" align="alignright" width="1694"]Chrome Devtools - Snappy Snippet Chrome Devtools - SnappySnippet[/caption]

Using SnappySnippet

1. When you find a section of UI that interests you, right-click on it, and launch the Chrome Inspector.

2. Click around in the source view to make sure you have selected all the UI elements you want to extract.

[caption id="attachment_148759" align="alignright" width="1692"]snappysnippet SnappySnippet[/caption]

3. Switch to the 'SnappySnippet' panel and press the Create snippet from Inspected element' button. Seconds later, you should see light gray HTML and CSS load into the panels under the button.

4. Finally, choose between Codepen, jsFiddle and JS Bin as the destination for your code snippet.

Codepen loaded

That's all there is to it.

Is this perfect, production-ready code?

No, that's unlikely. SnappySnippet seems to spider through the DOM looking for links and does its best to recompile fresh, new CSS classes for your selected HTML. It's not perfect and it can't compile styles residing in JavaScript.

Nevertheless, I've found it usually gets most of the important stuff – certainly enough to get your investigations started.

[author_more]

[/author_more]

Now obviously the idea isn't to simply rip-off someone else's work. That's just lazy and copy and pasting code you don't understand gets you into more trouble than it's worth.

But it's also a safe bet that almost all the great frontend/UI coder-designers have learned much of their craft from 'dissecting web frogs'.

Continue reading %Catching Frontend UI Design Tricks with SnappySnippet%


by Alex Walker via SitePoint

GIF, PNG, JPG or SVG. Which One To Use?

Choosing which image file format to use on the web can be a little confusing when you're getting started in web design. Jennifer and Gabrielle give an overview of the four main image file formats used on the web.

Continue reading %GIF, PNG, JPG or SVG. Which One To Use?%


by Jennifer Farley via SitePoint

Why We’re Fearful of Health and Fitness App Security

Health and fitness apps have changed the way we exercise, eat, and even sleep. Hundreds of thousands of these diverse apps exist — more than 165,000 at last count.

While these apps are serious about counting our calories, and tracking our sleep cycles, very few of them take security as seriously as they should. An incredible 90% of mobile health apps have seriously risky security vulnerabilities. Given the wealth of valuable health and personal information these apps can contain, this is troubling — the app that’s smart enough to count users’ steps, or remind them to take their blood pressure meds, may be leaving these users (and their personal information) vulnerable to hackers.

If that wasn’t enough, a study from the Future of Privacy Forum found that only 60% of health and fitness apps had privacy policies; compared to 76% of general apps.

What implications does this have for those of us developing health and fitness apps for a loyal and trusting user base? Are we putting consumers in danger if they use our apps to keep a food log or monitor their REM sleep cycles? How can we keep our customers’ information safe and private, while still offering top-notch digital tools for their fitness and wellbeing?

Continue reading %Why We’re Fearful of Health and Fitness App Security%


by Xuyen Bowles via SitePoint

This Week in Mobile Web Development (#144)

Read this on the Web

Mobile Web Weekly February 8, 2017   #144
Holly Schinsky recommends
The Web Share API Brings Native Sharing Capabilities to The Browser — The Web Share API is a modern browser API designed to extend users’ sharing experience in a cross-platform way.
Serg Hospodarets
Brian Rinaldi recommends
Google Makes AMP URLs Shareable — One of the biggest complaints about AMP was that it hid the original URL. Google has made some tweaks and the latest technical challenges and changes are explained here.
Google
Chris Brandrick recommends
Building Great Mobile Forms — Some approaches for helping users be successful with the forms you are designing.
Mobiscroll
Sponsored
Capture both native and JavaScript errors 💥 in React Native! — Automatically detect JavaScript and native OS crashes with Bugsnag for React Native. Get full stacktraces for every error with support for sourcemaps, dSYMs, and Proguard. You’ll be alerted instantly when crashes occur 🚀. Start your free trial.
Bugsnag

Brian Rinaldi recommends
Maintaining Accessibility in a Responsive World — How to handle the disconnect that can occur with assistive technology when you adapt a layout to the viewport size.
Scott Jehl
Brian Rinaldi recommends
NativeScript 2.5 is Now Available — Improvements include an improved WebPack story, Chrome DevTools debugger integration and more.
NativeScript
Chris Brandrick recommends
Twitter Mobile Traffic Now Powered by Node.js — They switched over yesterday to a Node and React-based PWA.
Twitter
Holly Schinsky recommends
Use Angular Translate to Build A Multi-Language Ionic Framework App
Jorge Vergara
Holly Schinsky recommends
Porting a Vue.js Webapp to a PhoneGap-Based App
YouTube
Brian Rinaldi recommends
A Podcast on the Latest with AMP — Dave Rupert and Chris Coyier discuss AMP with Google’s Paul Bakaus.
ShopTalk Show
Holly Schinsky recommends
framework7-redux: Redux Bindings to Keep a Redux Store in Sync with Framework7
Ben Compton
Brian Rinaldi recommends
Luxbar: A Featherweight, Responsive, CSS Only Navigation bar
Balazs Saros
Chris Brandrick recommends
Help Us Test Ionic Native 3.x — Ionic are currently seeking feedback on their latest build of Ionic Native - which moves each plugin to its own npm module.
Max Lynch
Holly Schinsky recommends
Ionic 2 Instagram Authentication and Instagram API Integration (on Android and iOS) — A sample app using Ionic 2, Instagram authentication and the Instagram API.
Sudipta Sarkar
Holly Schinsky recommends
Ionic 2 vs. Ionic 1: Performance Gains, New Tools, and a Big Step Forward — We announced the release of Ionic 2 last week.
Julien Renaux
Brian Rinaldi recommends
Integrating Progressive Web Apps Deeply into Android — Progressive web apps can now appear in the app drawer alongside full apps and offer the same notification controls.
Google
Brian Rinaldi recommends
Adaptive Design vs. Responsive Web Design — What’s the difference? Luca explains how a conversation with Ethan Marcotte and Karen McGrane that he’d listened to changed the way he looked at this.
Luca Passani
Chris Brandrick recommends
Lottie: After Effects Animations for React Native — An iOS, Android, and React Native library that renders After Effects animations in real time and makes animations as easy to use as static assets.
Airbnb Engineering
Holly Schinsky recommends
Onsen UI Releases Alpha Bindings for Vue2
Onsen UI
Curated by Brian Rinaldi and Holly Schinsky for Cooperpress.
Cooperpress is located at Office 30, Fairfield Enterprise Centre, Louth, LN11 0LS, UK
Update your email address
or stop receiving MWW here


by via Mobile Web Weekly

CSS Pseudo-classes: Styling Form Fields Based on Their Input

The following is an extract from our book, CSS Master, written by Tiffany B. Brown. Copies are sold in stores worldwide, or you can buy it in ebook form here. Let’s take a look at some pseudo-classes that are specific to form fields and form field input. These pseudo-classes can be used to style fields […]

Continue reading %CSS Pseudo-classes: Styling Form Fields Based on Their Input%


by Tiffany Brown via SitePoint

Native Swinson

Wonderful multi-scrolling One Pager showcasing the work of talented wallpaper artist Kate Swinson aka Native Swinson. The long screenshot featured here doesn't capture how the site is actually one big canvas. Each wallpaper has the option to preview as a repeat pattern, as well as multi color view options. This is the third "Most Loved" award for the Ed. team.

by Rob Hope via One Page Love

Getting Started With Cassandra: Using CQL API and CQLSH

Apache Cassandra is one of the most popular open-source distributed database systems available. It was designed with the goal of handling large amounts of data stored in many servers distributed across geographies while providing high scalability and availability with no single point of failure. Cassandra systems can span multiple data centres, allowing low latency for all connected clients.

This is a three-part tutorial series where I will start with the basics of Cassandra, using CQLSH to create tables and records. Then I'll explain the various data types supported by Cassandra, and then we'll use a Go client library to handle Cassandra operations programmatically. 

In this first part, I will cover how the Cassandra data model is laid out in brief and perform basic operations using CQLSH.

For this tutorial series, I am assuming that readers would be able to install Cassandra by themselves on their respective machines depending on the operating system.

The Cassandra Data Model

The Cassandra data model follows the column family approach, which can easily be understood as being analogous to a relational table structure but in a NoSQL way. The description below should make it clearer:

Keyspace

A keyspace can be seen as the outermost container for data in Cassandra. All data in Cassandra should live inside a keyspace. It can be seen as a database in RDBMS which is a collection of tables. In the case of Cassandra, a keyspace is a collection of column families.

Column Family

A column family can be seen as a collection of rows, and each row is a collection of columns. It is analogous to a table in RDBMS but has some differences. The column families are defined, but it is not necessary for each row to have all the columns, and columns can be added or removed from a row as and when required.

Column

The column is the basic unit of data in Cassandra. It has three values: key or column name, column value, and a timestamp.

Super Column

A super column is a special type of column which stores a map of other sub-columns. It makes storing complex data easier and also makes data fetching faster as each column family in Cassandra is stored in a single file on the file system.

Using Cassandra Console

CQLSH is the standard shell for interacting with Cassandra through CQL (Cassandra Query Language). CQL is very similar to SQL (which is mostly used for RDBMS) and hence makes it very easy for developers new to Cassandra to get working with it quickly. CQLSH is shipped with every Cassandra package and should already be installed on your machine when you installed Cassandra.

Create a Keyspace

As we saw in the data model described above, a keyspace is the outermost container and should be created before anything else. To create it, run:

In the above command, I have assumed that your Cassandra exists on localhost without any user authentication. I have created a keyspace called k1 with replication and durable_writes policy defined.

If you have user authentication defined, you can run:

In the above command, replace <username> and <password> with your authentication credentials.

Running a command like this can be a bit cumbersome. Another way is to launch the CQLSH prompt and then run queries directly inside it.

Moving ahead, I will be using the above method of running queries. Before running any other query, we need to tell CQLSH which keyspace should be used.

The replication_factor for a keyspace can be altered to suit how much replication is needed as per the replication class.

Create and Alter a Table

A table is equivalent to a column family in Cassandra. Cassandra supports many different datatypes for storing data, which I will be covering in detail in the next part of this tutorial series. To create a table, simply run the CREATE TABLE command.

To check how the structure of the table looks once created:

Now let's say we want to alter the table to store the email of the person as well.

Insert and Update Data

Inserting data into a Cassandra table using CQL is pretty straightforward.

In this table, we have all the fields for only one data type. Things become a bit complex when we're using different datatypes or composite datatypes. This will be a discussion in the next part of this series.

Let's say we want to update the value in the column email to something else.

Querying Data

Data in a table can be queried simply by using SELECT statements.

Let's insert some more records and query them.

More complex query operators like inequality operators can also be used, or several WHERE conditions can be concatenated using AND/OR, etc.

Conclusion

Cassandra is one of the most popular NoSQL database systems available and is the best build to be used in distributed environments. Dealing with Cassandra is pretty easy for beginners with some knowledge of RDBMS and SQL. 

CQL is very similar to SQL to a certain extent, and CQLSH makes testing and debugging much easier. In the next part of this series, I will cover the various datatypes provided by Cassandra and how to deal with them.


by Shalabh Aggarwal via Envato Tuts+ Code