Tuesday, June 9, 2015

Building a Native App with Javascript Using Nativescript

There are many options available for utilizing HTML, CSS and JavaScript to create cross platform applications and I have covered many of them before. In this article I will look at NativeScript from Telerik that claims to be easier to create for cross platform apps than many existing options.

From their official documentation.

NativeScript enables developers to build native apps for iOS, Android and Windows Universal while sharing the application code across the platforms. When building the application UI, developers use our libraries, which abstract the differences between the native platforms.

Creating an image search flicker app

In this tutorial we will create a simple app that searches for images on flickr and displays the results. We will make use of the flicker developer API to search images.

Continue reading %Building a Native App with Javascript Using Nativescript%


by Jay Raj via SitePoint

Real-time Apps with Laravel 5.1 and Event Broadcasting

In Laravel 5.1, the framework includes functionality called broadcasting events that makes it easy to create real-time apps in PHP. With this new functionality, an app can publish events to various cloud-based real-time PubSub solutions, like Pusher, or to Redis.

Laravel 5.1

In this article, we examine a simple todo app and turn it into a real-time app using Laravel’s broadcasting events.

Download and Install App

The easiest way to get started is to spin up an instance of Homestead Improved. If you don’t want to use Homestead Improved, you must have git and composer installed on your system.

We will put the starter code in a directory called todo-app by cloning a git repo.

Continue reading %Real-time Apps with Laravel 5.1 and Event Broadcasting%


by Christopher Thomas via SitePoint

Write Better User Interfaces by Asking “Who Else is in the Room?”

There exists a debate within the User Experience community about whether a user interface should say 'Your account' or 'My account' to refer to the user's account. Should the call to action be 'Create your account' or Create my account?

Pinterest and Trello are both social web apps that use "boards", yet see how they differ!

  • [caption id="attachment_107367" align="alignleft" width="134"]Pinterest: Your Board button Pinterest: Your Board button[/caption]
  • [caption id="attachment_107369" align="alignleft" width="272"]Trello: My Boards button Trello: My Boards button[/caption]

When it comes time to delete your account, however, they both switch terms:

[caption id="attachment_107365" align="aligncenter" width="556"]Pinterest: Deactivate my account Pinterest: Deactivate my account[/caption] [caption id="attachment_107368" align="aligncenter" width="324"]Trello: Permanently delete your entire account forever? Trello: Permanently delete your entire account forever?[/caption]

Interestingly, they agree on prompts:

  • [caption id="attachment_107366" align="aligncenter" width="437"]Pinterest: What's your board about? Pinterest: What's your board about?[/caption]
  • [caption id="attachment_107370" align="aligncenter" width="301"]Trello: What are you planning? Trello: What are you planning?[/caption]

So how are you to decide? One trick is to consider who is in the room and who is talking.

There's No One in the Room Except the User

If there's no one else in the room, skip the qualifier entirely. There's no ambiguity. That is, if your user has no reason to acknowledge your brand or anyone else, imagine they're in an empty room. If there's a wrapped present on the table in this empty room, they know it's for them without needing a gift tag and their name on it.

When you avoid the qualifier, you gain the benefit of front-loading interface copy with distinguishing words instead of "your" or "my". For example, "Privacy settings" stands out from "Account" better than "My privacy settings" from "My account". This makes your user interface easier to scan. It also reduces the time it takes a user to understand what they're seeing and take their next action (perhaps, buying your product).

Two's Company — the website and the user

Only use "your" or "my" when you need to differentiate between the user and the website speaking:

  • When the website is talking, use "Your".
  • When the user is talking, use "My".

In the first instance, the website may "speak" to:

  • Orient the user through page headings and labels
  • Provide content
  • Tell the user about their content
  • Tell the user there's been an error and how that affects them
  • Provide help and instructions
  • Offer documentation

(This is often expressed through some kind of label — a page label, form label, button label — so for simplicity we'll refer to this type of dialog as a label.)

In the second instance, the user "speaks" when they perform actions. That is, the user lets the website know what they want by:

  • Pressing buttons
  • Clicking menu items
  • Entering data
  • Selecting filters
  • Otherwise making some choice and commanding the website

(For simplicity, we'll focus on buttons.)

As such, "My" is appropriate in actions.

Using "Your" or "My" when there are multiple voices removes the ambiguity about who is talking and who they are addressing, however, you still don't need to use both at all times. Assume one person is always talking, then add the qualifying "your" or "my" for exceptions when you need to differentiate between the website and user.

If the default is that the user is talking, you need to specify when the website is interjecting:

  • Website: "Would you like free gift wrapping with your purchase?" (label)
  • User: "Add gift wrapping" (button) — not "wrap my gift"
  • Website: "Your Clients:" (label)
  • User: "Contact Clients" (button) — not "Contact My Clients"

If the default is that the website is talking, you need to specify when the user speaks up:

  • Website: "Gift wrapping:" (label) — not "Wrap your gift:"
  • User: "Wrap my gift" (button)
  • Website: "Clients:" (label) — not "Your Clients:"
  • User: "Contact My Clients" (button)

Whether you emphasize the website's voice or the user's voice may depend on your product or service. A chatty, engaging brand will use "your" extensively. Alternatively, in personal, individual environments, a brand may wish to hide their presence. For example, consider these buttons:

Continue reading %Write Better User Interfaces by Asking “Who Else is in the Room?”%


by Diana MacDonald via SitePoint

Sakura – Ya

opl-small

Elegant One Pager for Japanese restaurant 'Sakura – Ya' featuring a unique horizontal accordion. The Single Page website has gorgeous little touches including a custom preloader within Japanese symbols. The menu section features lovely illustrations and the items fill a big screen well. This is also a good reference to loading news within a One Pager using AJAX.

by Rob Hope via One Page Love

Style Tiles with Sass

As responsive web design has become the new normal, many designers, developers, and agencies have realized that static comps are no longer a valuable way to show clients their sites. As Stephen Hay says, “We’re not designing pages, we’re designing systems of components.” Those components reflow and resize in various container sizes as the viewport changes and layouts shift. Rather than spending weeks building static comps of 3-4 different screen sizes for a single site design (and risking client rejection of all that work), many designers are turning to “style tiles” to help clients understand and approve design direction without building fully detailed comps. Style tiles are designed to “present clients with interface choices without making the investment in multiple photoshop mockups.” Sometimes they’re referred to as element collages or UI maps.

The rise of style guides fits nicely with another recent development in front-end development: starting in-browser prototyping as early in the process as possible. When we help clients understand a design by putting together style guides and move that process into markup and out of design software, we end up creating live web versions of the PDF brand guideline documents many clients use.

As the title of this post hinted, Sass has some features that make it easier for us to create living style guides. Let’s take a look at those now.

Color Palette

An easy way to make style guides easier is to automate repeatable information. For example, to show your client your color palette, you might create several squares, each one showing one of the colors. Your HTML might look like this:

Continue reading %Style Tiles with Sass%


by James Steinbach via SitePoint

Accessibility, Part 6: Going Beyond Code Best Practices

In this series we've looked at some simple ways theme developers can help make their theme accessible. If you follow all the recommendations in this series, you will more than exceed the minimum requirements for the accessibility-ready tag in the WordPress theme repository.

However, the tag is accessibility-ready rather than accessible, as no theme can ensure a website is accessible—too much relies on how the theme is used, and the nature of the content added to the site. 

In this final tutorial we look at some simple techniques that we as theme developers could employ, to help the end users of our product use it in an accessible-friendly manner. There is also a lot scope for plugin developers to do likewise (an obvious example being a plugin which allows an audio file to be uploaded and attached to a custom post type could also allow a transcript to be uploaded and linked to that file).

Encouraging a Valid Header Structure

Earlier in this series we discussed ensuring the theme has a reasonable header structure, namely appropriate headings for the site title and post title(s). As mentioned, this structure should meaningfully reflect the page structure, and the <h1> tags should be nested in <h2> tags, <h2> tags in <h3> and so on. 

But, on any given page, if we have used the <h1> (and maybe <h2>) tag outside the page or post's content, it would be a good idea to discourage their use inside the content, so as to prevent breaking that page structure. TinyMCE has a 'blockformat' dropdown which allows users to quickly add paragraphs and headings and so forth. We can remove the header tags which we don't want used in the post content:

Of course, this isn't foolproof, and will be ineffective against users who don't use the TinyMCE editor. Additionally, it does not (and we cannot) ensure that the headers used in the content meaningfully reflect the structure of that content. It does, however, discourage the misuse of the reserved <h1> (and <h2>) tags.

Encouraging Good Colour Contrast

A slightly more involved idea, if allowing users to select their own colours in the theme, is to alert them when they are selecting colours with a low contrast rating (e.g. background and text colours). Exactly which colours you should be comparing will depend on the choices you've made available to the user. Below I've simplified this idea by assuming a fixed font-colour of #444444, and comparing this with the user-provided background colour.

I'll leave the details of how to set up fields in the customiser, and to enable live previews to the codex. Here I just provide an example JavaScript file which alerts the user when their chosen background colour is too low.

First create a file called customizer-a11y.js in your theme, with the following code:

Next we need to create a function which, given any two colours (in hex) format, returns the contrast ratio between them. Details of calculating this ratio can be found on the W3C website, but it is done by first calculating the "relative luminance" (roughly speaking a measure of "brightness". The contrast ratio is then the ratio of those "relative luminance" values, with an added 'penalty' for bright colours.

The following should live at the bottom of the JavaScript file just created.

Lastly we load the JavaScript and print the mark-up for the contrast warning notice.

Summary

We have covered only a couple of suggestions in detail here, but the list could go on. There is also a lot of scope for plugin developers to do likewise:

  • Form plugins could discourage the use of empty labels.
  • Slider plugins could discourage the use of the auto-play option.
  • Whenever an audio/video file is to be uploaded and attached to a custom post type, a plugin could prompt for a transcript to also be uploaded and linked to that file.

"Discourage" here doesn't mean removing the option entirely. However, alerting the user of the ramifications to the accessibility of the website can go a long way to educating the user, and ultimately improving web accessibility.

Resources

We finish this series with an overview of useful resources and tools to help you learn more about web content accessibility, and more importantly to help you ensure that your next plugin or theme is available to all users.

Websites

WordCamp Talks

(Other talks can be found at http://ift.tt/1K6MvpP)

Tools / Plugins


by Stephen Harris via Tuts+ Code

Fetch – window.fetch JavaScript Polyfill

The global fetch function is an easier way to make web requests and handle responses than using an XMLHttpRequest. This polyfill is written as closely as possible to the standard Fetch specification at http://ift.tt/1vMII7w.


by via jQuery-Plugins.net RSS Feed