Wednesday, March 16, 2016

Quick Tip – Gradle and How It Works with Android Studio

Released in 2007, Gradle is a popular open-source automated build system that makes working on large projects easier. It’s based on concepts from its predecessors Apache Maven and Apache Ant, but uses a Groovy-based domain specific language (DSL) and Java, instead of XML.

Gradle speeds up the build process by skipping unnecessary re-execution of up-to-date projects part of larger project trees. It also makes adding different libraries to a project easier by using just one line of code.

Gradle is the official build system for Android Studio, and as Android Studio users, most Gradle configuration happens automatically for us. But I feel a basic understanding of how it works is useful to every Android Developer.

In this article I will give a quick overview of Gradle, how to use it and common problems.

Continue reading %Quick Tip – Gradle and How It Works with Android Studio%


by Deivi Taka via SitePoint

Firefox OS Pivots into Connected Devices

You might have heard that Mozilla pulled the plug off its Firefox OS for smartphones. After more than 3 years of continued guerrilla battles with the giant Apple-Google mobile duopoly, Mozilla is trying to pick new battles which it hopes it can win. In particular — the vast and blurry world of the Internet of Things (IoT). Firefox OS will now be pivoted into Connected Devices, and its technology will be used for IoT innovation processes. Mozilla foresees that the IoT boom will be a bigger one than the smartphone boom was a decade ago. Unlike with Firefox OS, there is no need to bridge such a wide gap with competitors — the Internet of Things is still a new enough concept that new players are able to shape its vision.

Meanwhile, Firefox OS is being transitioned to a community maintained project. This means no Mozilla staff will be allocated to it after 2016. Furthermore, the project will be renamed back to the Boot to Gecko (B2G). This has been announced in the Mozilla Community Forums.
With the Connected Devices strategy, Mozilla aims to reserve its spot in the IoT space too.

In the following article, we will take an early look on Mozilla’s related IoT projects, which will set the stage for Mozilla’s role in the IoT scene.

Note: All projects are in very early stages, so throughout 2016 you will notice many of them merging, splitting and changing.

FlyWeb

FlyWeb is one of Mozilla’s more concrete projects with which the Firefox creator wants to break new grounds. It is the internal codename for a project to bring the web application architecture to local-area interactions.

The FlyWeb design proposes using local-area discovery mechanisms to enable two computational endpoints (where one of those endpoints is usually a smartphone controlled by the user) to establish a web application session using local-area transport protocols.

In all of these interactions, one endpoint plays the role of web server, and another plays the role of web client. A smartphone can play the role of a local-area web client, consuming services exposed by endpoints around it. Additionally, a smartphone app can act as a local-area web server, exposing services to other smartphones around it. Or alternatively, using the web application architecture to “push” computation to endpoints around it.

FlyWeb is a very simple idea at its core. Instead of phones interacting only with the cloud, they can discover and interact with electronics around them that are running empty web clients, such as TV’s, projectors, game consoles, etc. The electronics come to life when connected to phones. The key here is that either the phones serve web apps to these electronics, or the electronics serve web apps to the phones.

Mozilla seems to be reallocating a lot of its energy and resources to the Connected Devices / IoT space, with the vision in mind that the latter could be part of a bigger revolution than the smartphone revolution was.

A very early demo of FlyWeb has been shown at the Mozilla Festival London 2015, showing the potential uses of it:

The FlyWeb project seems to be a crucial part of the new Connected Devices strategy. To find out more (apart from being patient), you can head over to the Mozilla Wiki.

CHIRIMEN

CHIRIMEN is a developing environment where you can control physical things/devices such as sensors and actuators through web technologies. Furthermore, it allows you to control virtual things (content) on computer screens and physical things (devices) simultaneously as well. The project includes both the board computer as well its software. Specifically:

  • Board computer hardware
  • The Boot to Gecko operating system (unbranded Firefox OS)
  • Low level API’s (WebGPIO, WebI2C)

Continue reading %Firefox OS Pivots into Connected Devices%


by Elio Qoshi via SitePoint

Save 93% on This Privacy and Productivity Bundle

Save 93% on this privacy and productivity bundle

Get more done while keeping more under wraps. We’ve got a privacy and productivity bundle that’ll take care of both. Save 93% on a lifetime subscription to VPN Unlimited and To Do Checklist—the bundle is just $39 at SitePoint Shop.

Start by protecting your privacy with VPN Unlimited. The VPN service protects your public Wi-Fi connection, keeps your online activity away from prying eyes, and encrypts your data—all without losing speed. Use it to bypass content restrictions abroad, too, so you can get your Netflix fix wherever you are. To Do List, on the other hand, tackles your tasks in a way that makes your more productive. Tasks synchronize across devices, are easily shareable via email and Facebook, and have the option for handy alarms.

Don’t miss your chance to grab this privacy and productivity bundle for $39 at SitePoint Shop!

Continue reading %Save 93% on This Privacy and Productivity Bundle%


by SitePoint Offers via SitePoint

Managing Redirections in WordPress With Filters

If you're new to the WordPress ecosystem, you might find it a little bit hard to grasp how flexible WordPress can be. Sure, there are literally tens of thousands of themes and plugins that you can make use of, and you may think WordPress is awfully extensible, but if you don't know about the "actions" and "filters" that WordPress provides within, you'll be surprised how much more you can do with this amazing content management system.

In this tutorial, I'm going to guide you through using WordPress filters to change the pages to redirect to upon different actions.

Let's get started!

Harnessing the Flexibility of WordPress With Actions and Filters

With the bold preaching I gave in the introduction, you might think that I exaggerated a bit. I assure you, I didn't. Hooks are, without a shadow of doubt, the actual reason for the flexibility of WordPress. Without the hooks system, themes would be way more rigid and, more importantly, most WordPress plugins wouldn't even exist. This would cause developers to develop fewer plugins and themes, and the world of WordPress would be much smaller, making it yet another dull content management system.

Hooks are meant to do what they are named after: to hook stuff. There are two types of hooks, action hooks and filter hooks. Action hooks fire functions before or after specific actions, and filter hooks handle the data before outputting it. (We'll be focusing on filter hooks in this tutorial.) That's why most plugins rely on hooks to control WordPress, and themes create their own hooks for other plugins to allow others to extend the themes.

I couldn't find a reliable source on when hooks were introduced in WordPress, but in the Version 1.2 announcement post on WordPress.org, a new plugin architecture is integrated and it says that "plugins can now hook into nearly every action WordPress does". If that's the very beginning of the introduction of WordPress hooks, it means that hooks were born in spring 2004, a year after the first version of WordPress was released.

If you want to learn more about actions and filters in WordPress, I have one series for each type of hook: "50 Filters of WordPress" and "50 Actions of WordPress". If you're interested, be sure to check them out!

Managing WordPress Redirection for Different Scenarios

As promised, I'm going to get to the WordPress filters now. We have seven WordPress filters to learn about in this tutorial: one for registrations, two for logins and logouts, one for password resets, one for comments, and two for the recently-revamped "Press This" feature.

Note: You can use the bits of code in this tutorial in your theme's functions.php file to get them into use quickly, but editing theme files for functionality purposes is considered a bad practice. (Check out my tutorial about "plugin territory".) Instead, you should make up a site-specific plugin for this purpose. (Check out Rachel's video tutorial about creating a plugin.)

Redirecting the User Upon Successful Registration

Normally, new users are redirected to the login form with this notice: "Registration complete. Please check your email." With the help of the registration_redirect filter, we're going to change that.

Let's say that you have a special white paper about your area of expertise, and you offer it to new users on your website. Using the code snippet below, you can send new users to a page with a download link to your white paper:

Edit the slug "white-paper" with your own page's slug and you're good to go!

Redirecting the User Upon Logging In and Out

After each login, users are sent to the dashboard. If your users don't need to (or shouldn't) see the dashboard for some reason, you can keep them in the front-end using the login_redirect filter.

In the following example, we're going to check the user role and redirect "subscribers" to the homepage:

The same can be done with the logout_redirect filter. Instead of sending them to the homepage, you can redirect them to a "goodbye" page where they can confirm that they've logged out:

Redirecting the User Upon Password Reset

By default, users who enter their usernames or email addresses in the "Reset Password" form are sent back to the login form with a notice to check their emails to reset their passwords. The lostpassword_redirect filter allows us to change that page.

The "Check your e-mail for the confirmation link" notice is sufficient for most WordPress websites, but if you need to share more information on the process of resetting passwords (like "Check your SPAM folder" or "Call this number if you haven't got any email"), you can redirect your users to a specific page:

Redirecting the User Upon Commenting

The comment_post_redirect filter lets you change the page your commenters go to after sending a comment.

This might be the best tip in this tutorial because it can increase your newsletter subscribers. For example, you can send them to a "Thanks for commenting, and don't forget to subscribe to our newsletter" page using the following lines of code:

Redirecting the User Upon Using "Press This"

"Press This" is a simple tool to quickly publish or save posts, but it has some limitations. For example, after you've used your website's "Press This" bookmarklet, it makes you return to the page you're sharing inside the popup window, while that page is already open in your browser. Weird, I know.

Thankfully, we can change that, with the help of the press_this_redirect_in_parent and press_this_save_redirect filters. Using the following code will make the "Press This" tool close the popup (first filter) and return to your own website's homepage (second filter):

Micro tip: Did you notice that I used an anonymous function? That's right: You can pass an anonymous PHP function if your server is running PHP v5.3.0 or later.

Wrapping Everything Up

The system of "hooks" is one of the most powerful features of WordPress, and it has helped the community make the gigantic mass of great plugins and themes we utilize today. Without "action hooks" and "filter hooks", it would probably be impossible to achieve this level of extensibility. And I think it's safe to say that without these hooks, WordPress wouldn't be used in one in every four websites. Whoever came up with the idea of these "hooks", thank you!

What do you think about the filters we've gone through in this tutorial? Can you think of better use cases for them? Or do you think I missed a hook that could be mentioned in this post? Share your thoughts, experiences and ideas with us in the Comments section below. And if you enjoyed reading this article, don't forget to share it with your friends and colleagues!

For anything else unrelated to this article, you can get in touch with me at @BarisUnver_EN (English) and @BarisUnver (Turkish) on Twitter.

Thanks for reading!


by Barış Ünver via Envato Tuts+ Code

normalmap.js – Interactive Lighting Effects with jQuery

normalmap.js is a library for creating simple interactive lighting effects using normal maps.


by via jQuery-Plugins.net RSS Feed

6 Productivity Tools for Twitter

iag-6-twitter-tools-560

Are you struggling to keep up with your Twitter activities? Looking for a way to streamline your Twitter marketing? The right productivity tools will help you manage your Twitter marketing more effectively and free up your time for other tasks. In this article you’ll discover six tools and techniques that will boost your productivity on Twitter. [...]

This post 6 Productivity Tools for Twitter first appeared on .
- Your Guide to the Social Media Jungle


by Ian Anderson Gray via

Steven Mengin - Portfolio

Portfolio of Steven Mengin, Digital Designer. Minimal, Black & WebGL
by via Awwwards - Sites of the day