Monday, January 4, 2016

Introducing Bugsnag – the Last Error Monitor You’ll Need

The pursuit of building an error-free application continues. But in the meanwhile, we need to monitor our application’s errors and take action quickly. Many companies have tried to solve this problem, and one of the best on the market right now is Bugsnag. They focus on the problem of providing a bug notification system that makes sense of errors and helps you take action in various ways. In this article, we’re going to discover Bugsnag and integrate it into an existing Laravel application. You can clone the demo app from Github to follow along.

Bugsnag Logo

Creating an Account on BugSnag

Before starting to use Bugsnag, we need to create a new account and create our new project. You can start with a 30 day free trial and switch to a paid plan depending on your application size. After signing up, you’ll have to create a new project and specify your project type. In our case, that’ll be PHP.

Adding BugSnag to Our Project

Bugsnag provides a list of notifiers for different application types. You can install it using Composer and configure it manually by following this guide. However, we can use the Laravel package to easily add it to our project. Our demo application is built using Laravel 4, so we need to follow the Laravel integration guide.

Continue reading %Introducing Bugsnag – the Last Error Monitor You’ll Need%


by Younes Rafie via SitePoint

Notes for Designing Better Mobile Application Interfaces

In May this year Google announced that mobile search had finally officially surpassed desktop search for the first time. Mobile is now the default format for the majority of users.

So, as the mobile UI has become the new default UI for most people, there are factors that developers should take care of while creating either mobile apps or web-based applications for mobile.

Let's examine some common mobile app UI elements, see how a novice might typically implement them, and then look at a better way of tackling the problem.

Limit Use of Text Input Whenever Possible

Most mobile applications have an input field to capture the user's feedback. In my opinion, text fields should only be employed in mobile apps when absolutely necessary - password fields are the perfect example.

Even users with large screen phones will still be less comfortable typing than they are on desktops computers. Typing input can be minimised in a number of ways.

Uber

  • Alternate input methods such as slider and spinner elements
  • OAuth for logins can provide a better way of verifying identities

Case Study: Uber's mobile application has addressed this UI concern in a brilliant way. Uber uses GPS to track a user's location and asks then to pin their location instead of asking the users to enter the address. This allows the users to book a ride easily and more quickly.

Text Interface Elements

Photos

The use of text UI elements should be minimised in an application. in favor of the use of icons. For instance, you can use a trash bin icon in the app instead of a button with the text "Delete" on it.

However, one important thing that should be taken care of is the fact that the icons and their representations should be uniform throughout the application.

Case Study: Kudos to iOS's Photos application which has made use of icons and text in a very good proportion. The symbols of Delete, Like and Share are uniform throughout the UI and their meaning is evident even to a first time user.

Transition Between Screens

Twitter

The transition between the various screens should be smooth and the transition controls should ideally be located towards the lower half of the screen. This is because the thumbs are commonly used for navigating between screens, and most thumbs can't easily access the upper section of a large phone screen.

This helps the user to switch between various parts of the application more quickly.

Chrome on iOS lets you 'edge-swipe' with your thumb to move forward and back in your browser history.

Case Study: Twitter application's transition buttons are located at the bottom of the screen. This helps the thumb to quickly access various parts of the app such as Home, Notifications, Messages and Me. Had the buttons been on the top, it would have been difficult in the case of large screens .

Mobile: More is Never More

The overall design which is one of the most important aspects of the UI/UX of a mobile application should be minimal and the screen should not be cluttered. Heavy animations should not make their way into the application.

Inbox

In modern design philosophies such as Google's Material Design, emphasis has been placed on the minimalistic approach to design. An application's landing page is where it makes its first impression and a cluttered UI can disorient the user and will almost certainly reduce their chances of the continuing.

Case Study: Google Inbox does a great job of implementing the Material Design Framework, keeping a clean, easy-to-use and intuitive UI. The screen remains uncluttered, the transitions are smooth and it displays a pleasing image when my inbox is empty. Despite the simplified UI display, I don't have any difficulty finding any functionality in the application.

Continue reading %Notes for Designing Better Mobile Application Interfaces%


by Tanay Pant via SitePoint

An Introduction to Cordova: Basics

In this article, I’ll introduce you to Cordova, a framework used for developing mobile applications. If you’re new to Cordova or you want to know whether it’s the right tool for your next project, then you’re in the right place. In this article, I’ll be aiming to answer the following questions:

  • What is Cordova?
  • How does it work under the hood?
  • What can I build with Cordova?
  • How do I get started with Cordova and what do I need?

Let’s go ahead and dive in.

1. What Is Cordova?

Cordova is a mobile application development framework that is primarily intended for web developers. It allows web developers to use web technologies, such as HTML, CSS, and JavaScript, to create mobile applications. Like any other technology, Cordova has its pros and cons.

Pros

  • Easy to Learn If you’re a web developer, then Cordova has a gentle learning curve. You can easily apply your skills as a web developer to build an app with Cordova. All you really need is to familiarize yourself with the command line in order to get up and running with Cordova.
  • Access to Native Functionality With Cordova, you have access to native device capabilities, such as the camera, contacts, geolocation, media, SMS, and many others.
  • Free You don’t have to pay anything to use Cordova.
  • Open Source Anyone can contribute to Cordova’s source code to make it better. Plugins are also open source and anyone can build custom plugins. This means that developers like yourself can easily install and use these plugins. Or you can build your own plugin and share it with the community.
  • Big Community Lots of developers are using Cordova. On Stack Overflow, for example, there are close to 40,000 questions tagged with cordova. This means that you’ll never be left alone solving weird bugs (if you ever encounter them). People in the community are always willing to help, all you have to do is ask.
  • Write Once, Deploy Everywhere Cordova compiles your app into a package file, which is required by most app stores. This means that apps created with Cordova can easily be deployed to the app store of your choosing. If you’re deploying to Android, Cordova creates an APK (Android Application Package) file. If you’re deploying to iOS, Cordova compiles to IPA. For Windows, it’s APPX.

Cons

  • Poor Documentation It’s hard to find information about really specific things, such as what packages you need to install with the Android SDK Manager. And when you look something up, the results point to information specific to different versions of Cordova. This is sometimes confusing for beginners as they might have a different version of Cordova installed and they’re looking at documentation for another version of Cordova.
  • Slower Than Native Since apps built with Cordova are basically web apps that are contained in a web view, they don’t perform as well as their native counterparts. This means that there is a limit to what kind of apps you can build. For example, a video editing application is better built natively since it will heavily rely on the CPU and GPU to do its work.
  • Frameworks Because Cordova is just a wrapper for a web application, it doesn’t come with the user interface components, animations, and other goodies that you find in most native applications. This means that you have to implement all of these on your own. That’s why many developer rely on frameworks like Ionic or Onsen UI for building the user interface of their applications.
  • Bugs in Plugins Not every plugin is created equal. There are those that have bugs or don’t work as expected.
  • Not Every Device Is the Same Native device functionality is accessed through the use of plugins. Cordova exposes an API so that these plugins can be used in the web view, but not every device is the same. There are quirks on every device. To put it simply, not every option that you can set on a plugin will work on every device. For example, on Android, the cameraDirection value always results in a photo taken with the rear-facing camera.

2. Cordova and PhoneGap

When working with Cordova, you often come across the term PhoneGap. PhoneGap is the name of the original project created by a startup called Nitobi around 2009. In 2011, the company was acquired by Adobe.

Note that Adobe didn’t buy the actual codebase, just the name and the people who worked at Nitobi. The open source core was donated to the Apache Software Foundation, which is now known as Cordova.

A common analogy used by developers is that Cordova is to PhoneGap what WebKit is to Safari. Put differently, PhoneGap is a distribution of Cordova that is maintained by Adobe. If you want to read more about the history, you can check out this article on the PhoneGap blog by Brian LeRoux.

In practice, PhoneGap and Cordova are basically the same. You can choose either PhoneGap or Cordova when starting a project. The only difference is the CLI (Command Line Interface). PhoneGap’s CLI integrates with Adobe PhoneGap Build. This service allows developers to compile their apps to the platform of their choice by uploading it to the PhoneGap Build website.

3. How Does Cordova Work Under the Hood?

Cordova’s user interface is a web view. You can think of the web view as a tab in a browser. When you compile a Cordova application, it doesn’t actually take your HTML, CSS, and JavaScript code and automagically converts it into native code, specific to each platform.

Cordova acts as a container for the app that you write using web technologies. When the app is compiled, your code actually stays intact. The compiler just takes your code and makes it available to the web view for rendering.

If you’ve ever opened an HTML file in a browser, that’s basically the same thing. You have to keep in mind that this web view is implemented differently on every device. This means that there are certain features that are not available on some platforms or they are implemented differently.

4. Native Device Functionality

With Cordova, you have access to native device functionality through the use of plugins. Plugins are add-ons that expose a JavaScript API for native components. They allow you to access native device capabilities by making use of the JavaScript API that it exposes.

As you might suspect, plugins are written in native code. This means that you need to have the SDK installed for the different platforms that you plan to deploy to, only then can you write the native code for each of those platforms. You then invoke the native code through the JavaScript API so that it can be accessed in the web view.

There are two type of plugins that you can find in the Cordova plugin ecosystem. First are the official plugins. These are maintained by the Cordova community. You’ll know that a plugin is official if it has the cordova-plugin prefix.

The other type of plugin are custom plugins. These are built by developers like you and me. Often times, they are built to solve a very specific problem, such as connecting an app to Facebook or the Ionic Keyboard Plugin to make interacting with the keyboard easier.

If you want to learn more about what kind of plugins you can use with Cordova, you can visit the Cordova Plugins website.

5. What Can You Build With Cordova?

While you can build pretty much any kind of app with Cordova, there are some limits which we’ll talk about later. For now, let’s go through some sample apps that you can build with Cordova.

  • TripCase TripCase is a travel app that guides you through every stage of your trip.
  • FruitSalad FruitSalad is a puzzle game similar to Bejeweled.
  • Panasonic World Heritage Calendar This is a calendar app that shows you beautiful photographs of World Heritage sites. It also includes trivia about culture and nature related to the sites.
  • HealthTap HealthTap is the Stack Overflow for health questions.
  • Wikipedia The official Wikipedia app is built with Cordova.

Based on the apps listed above, you should now have an idea of the kind of apps you can build with Cordova. If you’re a developer, then you may have noticed that all these apps use the internet. They all communicate to a remote server to fetch data. That’s what Cordova is good at, fetching data from a server, presenting it to the user, and listening for and responding to input from the user.

But this doesn’t mean that you can’t build self-contained apps with Cordova. There are lots of client-side database solutions that you can readily use. One popular example is LokiJS, a fast, in-memory document-oriented datastore for Node.js, the browser, and Cordova. In a photo gallery app, for example, you could use this library to store the paths of photos and then grab them from the storage when needed.

With Cordova, you can use pretty much any CSS or JavaScript library that you can find on cdnjs, because the code that you write runs in the browser. You have to be careful though, not all browsers are the same. And that brings us to the next section.

6. Limitations

As with anything else in life, there are always limitations. Cordova is no exception. In this section, I’ll be talking about some of the limitations of Cordova.

Whatever you can accomplish with native code, you can also accomplish with Cordova. There are two common limitations though, performance and plugin availability.

Performance

Cordova accesses native device capabilities through plugins and this has a cost, a cost that native apps don’t have. As I mentioned earlier in this tutorial, it’s not a good idea to build apps with Cordova that rely heavily on the CPU or GPU. Such apps will not be as performant as you would want them to be, especially when compared to native counterparts.

Plugin Availability

Another limitation is plugin availability. If a specific functionality isn’t available through an existing plugin in the repository, then your only choice is to build the plugin yourself.

Web View

By default, Cordova uses the platform’s web view for rendering the user interface, which means that you’re interacting with a different web view on every platform you’re targeting.

Moreover, different versions of the platform’s operating system may have a different web view or one with a different set of features. For example, modern Android devices may be running a flavor of Android that have WebRTC enabled while older versions of Android lack this feature.

For Cordova developers, it’s a good thing that projects like Crosswalk come to the rescue. Crosswalk lets you use a custom web view in Cordova apps, normalizing the differences between platforms. Later in this tutorial, I’ll be showing you how you can use Crosswalk in a Cordova project.

Learn More in Our Cordova Course

If you like to learn more about Cordova, then check out Reggie Dawson’s course on Cordova. Reggie introduces you to the platform and helps you create a Cordova app from scratch. Take a look at the below video to get a taste of the course.

Conclusion

You should now have a good idea what Cordova is and how it does its magic. I hope this article has answered the question whether Cordova is the right tool for your next mobile project.

In the next article, we’ll get our hands dirty by creating a mobile application with Cordova. Feel free to leave any questions or comments you have in the comments below.


by Wernher-Bel Ancheta via Envato Tuts+ Code

Ideas for Improving the Ruby Language in 2016

Progress Bar Loading with the text: 2016 Goals

Happy 2016, y'all! Just like many of you (I'm guessing), I always feel a sense of tabula rasa after the New Year. Anything is possible! It's a time to make resolutions and goals for the coming year, a time to think about how I am going to improve. After writing my 2015 retrospective piece, I had the genius idea of writing a 2016 planning piece for Ruby. As I was piecing together the things I think Ruby should aim for, I realized that my opinion on the subject is far too narrow. Plus, I am not an expert in the vein of some more well-known Rubyist. I am Joe Schmoe Rubyist. I work with it daily, I've been doing so for a long time, but there are others that are far more qualified and still others who have other points-of-view.

Continue reading %Ideas for Improving the Ruby Language in 2016%


by Glenn Goodrich via SitePoint

Ace the Project Management Professional Exam With This $79 Bundle

Whether you’re a business owner, an engineer, a manager, or even completely new to the workforce, project management skills can majorly boost your career (and your salary). Especially when you have the certification to back up your skills. Get the Project Management Certification bundle at SitePoint Shop for $79.

This bundle is valued at $3,188 and includes six courses that’ll prep anyone—including business owners and engineers—to ace the globally recognized Project Management Professional exam. Those new to the industry will pick up fundamentals in the beginners course. There’s also plenty of advanced material covering communication techniques, team building, progress tracking, budgeting, and more. And to ensure you’re really exam-ready, you’ll get unlimited practice testing during your two years of access to the bundle.

Set your sights on a bigger paycheck in 2016. Get the Project Management Certification bundle for $79 on the SitePoint Shop.

Continue reading %Ace the Project Management Professional Exam With This $79 Bundle%


by SitePoint Offers via SitePoint

Rails Image Upload: Using CarrierWave in a Rails App

If you are building a web application, you definitely will want to enable image uploading. Image uploading is an important feature in modern-day applications, and images have been known to be useful in search engine optimization.

In this tutorial (which is the first part of the Rails Image Uploading series), I will show you how to enable image uploading in your Rails application using CarrierWave. It will be a simple application as the focus is on the image uploading.

CarrierWave is a Ruby gem that provides a simple and extremely flexible way to upload files from Ruby applications. You need to have Rails on your machine to follow along. To be sure, open up your terminal and enter the command below:

That will show you the version of Rails you have installed. For this tutorial I will be using version 4.2.4, which you can install like so:

With that done, you are good to go.

Rails Application Setup

Now create a new Rails project:

Open up your Gemfile and add the following gems.

The first gem is for CarrierWave, and the second gem called mini_magick helps with the resizing of images in your Rails application. With that done, run bundle install.

Generate a scaffold resource to add CarrierWave’s functionality. Run the following command from your terminal:

A scaffold in Rails is a full set of model, database migration for that model, controller to manipulate it, views to view and manipulate the data, and a test suite for each of the above.

Migrate your database next:

Setting Up CarrierWave

You need to create an initializer for CarrierWave, which will be used for loading CarrierWave after loading ActiveRecord.

Navigate to config > initializers and create a file: carrier_wave.rb.

Paste the code below into it.

From your terminal, generate an uploader:

This will create a new directory called uploaders in the app folder and a file inside called image_uploader.rb. The content of the file should look like this:

You can edit it to fit what you want. Let me take you through it.

First, uncomment the MiniMagick line. That should be line 7.

You need this to generate different versions of an image. If you want to generate a thumbnail version of images uploaded, there is already a code form included in the image_uploader file for you. Uncomment the version code block as shown below:

You can also add different versions using the same format.

For the purpose of this tutorial, we will be saving to file and not fog. Fog is the Ruby cloud service library. I will show you how to put it into use in another part of this series. So leave your storage option as it is.

For security purposes, certain files might pose a threat if allowed to be uploaded to the wrong location. CarrierWave allows you to specify a white-list of allowed extensions. You should see a method that looks like what I have below, so uncomment it.

It is time to mount your uploader. Navigate to your model and paste the code below.

Go to your views and edit it to look like what I have below:

Open your terminal and start your rails server: rails s.

Point your browser to http://localhost:3000/pets. You should be able to add a new pet by entering a name and description and uploading an image. The image does not get displayed after successful upload. Let me show you how to fix that.

Navigate to your show page where you are displaying the image, and edit it to fit what I have below:

This will display the thumbnail version of the image.

CarrierWave makes it easy to remove a previously uploaded file on a mounted uploader with just a checkbox. I will show you how to do it.

Open up your form file and make a little adjustment. Edit it to look like this:

In the code above, we checked if there is already an image object. If there is, we display the image and the option to remove it, but if there is none, we display just the field to upload the image.

Navigate to your controller and add :remove_image to your params. Reload your edit page, tick the box, click on Update Pet, and the image will be removed.

Validating Image Size

There are different means of doing this. I will show you an easy and quick method. Open up your pet model and paste in the code below:

This will help ensure that no image greater than 500KB gets uploaded to your Rails application. Start your rails server and check out what you have.

Conclusion

Now you know how to enable image uploading in your Rails application. You have also learned how to validate the format and size, as well as deleting an image. In the next part of this series, we will look at how to use CarrierWave alongside Devise.


by Kingsley Silas Chijioke via Envato Tuts+ Code

Growraf : jQuery Animation Plugin for Flot Charts

Growraf (pronounced grow-rough) is a jquery plugin for flot charts, that produces smooth animations using requestAnimationFrame wherever possible.

The post Growraf : jQuery Animation Plugin for Flot Charts appeared first on jQuery Rain.


by Admin via jQuery Rain