Javascript News

Syndicate content
Pipes Output
Updated: 36 min 4 sec ago

An Introduction to ChatOps: Devops Meets IM

1 Stunde 6 min ago

This article is sponsored by VictorOps. Thank you for supporting the sponsors who make SitePoint possible!

Developers often use email as their primary mode of communication. Be it downtime alerts, 500 errors or repository commits — all of them are redirected to your email account so that everything can be found in a single place.

But email isn’t really suited to this kind of task. Email makes real-time communication difficult, and conversations can easily become unwieldy, with long delays and a lack of immediacy, particularly when you’re communicating with people in different timezones.

Chat, on the other hand, offers a more immediate way to resolve an issue. You can see who is online at a particular moment, you can share information with multiple people to receive feedback quickly, and you can even perform actions from right within the chat client, via integrations with services like GitHub’s Hubot.

We’ve come a long way from the days of Yahoo, AOL and Microsoft Messenger. Chat is no longer just a text-based interaction between two people — it’s developed into something more, something productive.

This article will cover the emerging trend of ChatOps, outlining some popular uses of chat in a devops setting, and then explain how you can take your ChatOps further with advanced integrations with VictorOps.

Let’s Chat

Popularized by GitHub, ChatOps is putting tools in the middle of the conversation. With development teams often distributed globally, there is a need for a centralized communication system which also automates certain processes like continuous deployment. GitHub started the trend with their bot, Hubot.

There are many popular chat applications in use in the tech industry. I recently wrote about using Slack for workplace collaboration, but HipChat is also popular. Most of the best chat clients offer direct messaging, multiple channels for different subjects or areas, and advanced file-sharing and integration abilities.

These apps are capable of making a world of difference to the development cycle. There are different chat-based tools and commands for different tasks, such as starting new instances of virtual machines, sending newsletters or deploying code to your main server. Traditionally, each of these tasks would involve working on different tools but with programmable chat bots these tasks can be performed by simple commands run on the chat application.

Imagine connecting with Amazon Web Services to spring up instances with just a single chat command, or deploying your latest commit to the server with the help of GitHub integrations. Or how about checking how many visitors your website has through an analytics system? Perhaps you’re just happy checking your team’s progress through Trello or Asana within your chat application of choice?

ChatOps can increase the efficiency of your team, saving time that would otherwise be wasted on redundant processes.

A standard chat app is certainly useful in improving developer communications. But when it comes to helping developer teams manage incidents, an integration with an on-call alert and management platform like VictorOps is even better.

Continue reading %An Introduction to ChatOps: Devops Meets IM%

Mocking Dependencies in AngularJS Tests

Do, 2014-10-30 18:30

AngularJS was designed with testing in mind. The source code of the framework is tested really well and any code written using the framework is testable too. The built-in dependency injection mechanism makes every component written in AngularJS testable. Code in an AngularJS application can be unit tested using any JavaScript testing framework out there. The most widely used framework to test AngularJS code is Jasmine. All example snippets in this article are written using Jasmine. If you are using any other test framework in your Angular project, you can still apply the ideas discussed in this article.

This article assumes that you already have some experience with unit testing and testing AngularJS code. You need not be an expert in testing. If you have a basic understanding of testing and can write some simple test cases for an AngularJS application, you can continue reading the article.

Role of Mocking in Unit Tests

The job of every unit test is to test the functionality of a piece of code in isolation. Isolating the system under test can be challenging at times as dependencies may come from different sets of sources and we need to fully understand the responsibilities of the object to be mocked.

Mocking is difficult in non-statically typed languages like JavaScript, as it is not easy to understand structure of the object to be mocked. At the same time, it also provides a flexibility of mocking only part of the object that is currently in use by the system under test and ignore the rest.

Mocking in AngularJS Tests

As one of the primary goals of AngularJS is testability, the core team walked that extra mile to make testing easier and provided us with a set of mocks in the angular-mocks module. This module consists of mocks around a set of AngularJS services (viz, $http, $timeout, $animate, etc) that are widely used in any AngularJS application. This module reduces a lot of time for developers writing tests.

While writing tests for real business applications, these mocks help a lot. At the same time they are not enough for testing the entire application. We need to mock any dependency that is in the framework but not mocked - a dependency that came from a third party plugin, a global object, or a dependency created in the application. This article will cover some tips on mocking AngularJS dependencies.

Mocking Services

A service is the most common type of dependency in AngularJS applications. As you are already aware, service is an overloaded term in AngularJS. It may refer to a service, factory, value, constant, or provider. We will discuss providers in the next section. A service can be mocked in one of the following ways:

  • Getting an instance of the actual service using an inject block and spying methods of the service.
  • Implementing a mock service using $provide.

I am not a fan of the first approach as it may lead to calling actual implementation of the service methods. We will use the second approach to mock the following service:

[js] angular.module('sampleServices', []) .service('util', function() { this.isNumber = function(num) { return !isNaN(num); }; this.isDate = function(date) { return (date instanceof Date); }; }); [/js]

The following snippet creates a mock of the above service:

[js] module(function($provide) { $provide.service('util', function() { this.isNumber = jasmine.createSpy('isNumber').andCallFake(function(num) { //a fake implementation }); this.isDate = jasmine.createSpy('isDate').andCallFake(function(num) { //a fake implementation }); }); }); //Getting reference of the mocked service var mockUtilSvc; inject(function(util) { mockUtilSvc = util; }); [/js]

Continue reading %Mocking Dependencies in AngularJS Tests%

Sass-based Media Queries With Breakpoint

Do, 2014-10-30 17:45

This post is not going to be talking about any old Sass media query mixin. No. We are going to look at the @import (formerly Team Sass) Breakpoint Mixin. In May, Hugo Giraudel wrote a post comparing various ways of handling media queries with Sass. He mentions Breakpoint near the end of that article and today we're going to take an in-depth look at managing responsive breakpoints with Sass using the Breakpoint plugin.

Why Use a Plugin?

If you're like me, you might have started reading this article and thought, "I already have my own media query mixin, why use this one?" That is the exact same question I would have asked a few months ago. I've built my own mixin that I'm really comfortable with and I don't see a need to switch. Even so, there are a few good reasons to look at and try another mixin.

First, we all have blindspots. While I may be completely happy with the code I wrote, I may be missing some great ways to improve it or overlooking a bug. Getting your hands dirty with someone else's code is a great way to stretch your skills and improve your own code.

Second, it's totally fine to depend on someone else's code. There are no bonus points for being a 'Lone Ranger' programmer. Of course you need to evaluate the code and the reliability of its authors and maintainers, but having a useful plug-in that is maintained by a set of skilled volunteers is an incredible luxury.

Third, being familiar with multiple tools makes for a more versatile developer. This is especially true if you're in a situation where you frequently "inherit" existing code. It ultimately doesn't matter whether you love or hate new code that you try, trying it makes you more versatile and confident.

Basic Breakpoint Installing Breakpoint

Breakpoint is a Compass extension so you'll need to have Compass running before you can use it. Once that's ready, you can find installation instructions on the Breakpoint website.

Setting Breakpoint Variables

To get started with Breakpoint you will need to set up a series of variables for your breakpoints. Breakpoint variables can be as simple as a measurement ($bp-large: 1200px), or as complex as a list of values ($bp-complex: (min-height 720px) (orientation landscape) (min-resolution: 300dpi);). Let's look at the options for these variables.

Continue reading %Sass-based Media Queries With Breakpoint%

The Client’s Guide to What it Actually Takes to Create a Website

Do, 2014-10-30 17:15

When you’re looking to create a website for your business, it’s important to choose the right design and development team to do it for you. A website is your primary interface with your customers in the online world. Just like any other business asset, your website needs to generate a good return on the investment […]

Continue reading %The Client’s Guide to What it Actually Takes to Create a Website%

The Forum PHP Report

Do, 2014-10-30 16:00

Forum PHP is an annual PHP conference in Paris, France. This year, I was invited as a speaker and talked about work automation with some interesting tools and libraries.

Organization

The conference is organized by AFUP, the French Association of PHP Users - a.k.a. the French PHP user group. Under the overwhelmingly capable leadership of Fabrice Bernhard, Maxime Teneur and Thierry Marianne and the ever watching eye of Amelie, a wonderwoman who corresponded with everyone and made sure all arrangements were in order, the conference took place in its entirety at Le Beffroi, home of the biggest elePHPant you’ve ever seen.

Continue reading %The Forum PHP Report%

12 Essential Responsive Design Tools

Do, 2014-10-30 15:00

Translating client requirements to a full fledged, live website is no easy task. At the best of times, it requires multiple rounds of discussions between clients, designers, and developers, resulting in multiple iterations of the design, and the website itself. Throw in the whole responsive concept – having your design adapt to all kinds of mobile devices – and it can get a bit much to handle.

Fortunately, designers and developers are an innovative, caring, and sharing lot. We like to ease each other’s pain. Along with the growing need for responsive websites, there’s been a parallel growth of tools to help make responsive web design and development just a little bit easier. I’ve sorted through some of the tools available and put together this list to help through the phases of the responsive design and development process. Note that this is by no means an exhaustive list, so if you have another tool to share, be sure to post a comment.

Mock-ups, Prototyping and Wireframing Tools

Let’s start with the basics. The design usually starts with a sketch, a wireframe, or a mock-up. The key element here is to get the layouts properly aligned for a variety of mobile devices. Here are some tools to help with that.

1. InterfaceSketch

I’m old fashioned and still prefer paper and ink for basic sketches. And I love that InterfaceSketch gives designers a bunch of simple (and free) PDF templates designed to match the screen of various mobile devices. You can print out these PDFs and use them to sketch out initial designs with the best design tool ever – a good old pencil. Though it’s basic, it’s a great way to visualize how you’d want things to be.

2. StyleTiles

No one likes getting caught up in creating multiple mock-ups and wireframes for clients. StyleTiles eases part of that pain by enabling web designers to borrow design concepts from interior design. StyleTiles are akin to the swatches of fabric and paint tiles interior designers use. Instead of creating full mock-ups, you can instead use StyleTile swatches to help define the visual language for clients and take them through iterations easily. This is perfect for responsive designs, since there’s no fixed dimensions or layouts defined, but instead it’s all about the visual appeal. Once that’s frozen with the clients, it becomes that much easier for the designer to proceed to the wireframe or real mock-up.

3. Responsive Wireframes

Now that we’ve got the first sketches and the visual language, time to move on to the wireframes. Traditionally wireframes have been a static representation how the website will eventually look. But what about responsive sites? You don’t want to create separate wireframes for multiple screen sizes. James Miller has a work-workaround. He’s adapted the most typical layouts and created responsive wireframes for them. This saves you the headache of creating them from scratch and lets you easily see which areas of your layout will draw the user’s focus on different devices.

4. Wirefy

For those looking to create their own wireframe, Wirefy is a great option. It has a very simple workflow with an extensive collection of atomic components that can be moved around easily. It enables designers to build functional wireframes with fluid designs that help keep the focus on the actual content.

Continue reading %12 Essential Responsive Design Tools%

Build Great APIS with Grape

Do, 2014-10-30 14:00

APIs are needed for various reasons, such as by mobile apps to interact with backend CRUD operations. Creating maintainable APIs is not a simple task. As the application grows, so does the need to version and maintain the API.

In this tutorial, we'll have a look at Grape, a micro-framework for creating maintainable REST-like APIs in Ruby.

From grape's Github page:

Grape is a REST-like API micro-framework for Ruby. It's designed to run on Rack or complement existing web application frameworks such as Rails and Sinatra by providing a simple DSL to easily develop RESTful APIs. It has built-in support for common conventions, including multiple formats, subdomain/prefix restriction, content negotiation, versioning and much more.

Continue reading %Build Great APIS with Grape%

The 100 Year Old Trick to Writing at 240 Words Per Minute

Do, 2014-10-30 02:20

Ever seen one of these badboys? This was some serious state-of-the-art tech in 1912 -- the stenotype machine.

If you haven't come across one in real-life, you've most likely seen them in TV or movies. In courtroom dramas there's often a primly-dressed woman to one side quietly tapping away at what looks like a baby typewriter.

Stenography is still a specialist skill that requires significant training and practice to master, but that is still in high demand.

The stenotype machine has just 22 keys and no spacebar. Rather than typing each letter to build a word, stenographers use key combinations -- much like chords on a piano -- that can trigger much longer words.

Originally stenographers produced rolls of coded shorthand that were later manually converted to plain text. Today's more advanced machines handle the conversion in realtime.

Beside court reporting, stenographers are often used in live captioning of television, as well as other general business situations.

While there are friction points to learning stenography, there's a good reason why stenographers take on the expensive tuition fees, the steep learning curve and the overpriced hardware (top-end machines are over $4,000).  

Stenography is fast. Really fast.

A good stenographers can cruise along at 240 words per minute with 99.9% accuracy. That's a single mistake every four pages.

Ok. And I care..., why?

About four years ago, stenographer Mirabai Knight came to the conclusion that stenography had been a walled garden for too long -- controlled and marginalized by big companies. She set about creating her own affordable hardware and open source sofware designed to set stenography free to the masses.

This system -- called Plover -- can be used by book authors, journalists, bloggers and -- importantly for us -- coders and developers in our daily work!

Continue reading %The 100 Year Old Trick to Writing at 240 Words Per Minute%

The WordPress JSON REST API

Mi, 2014-10-29 19:30

WordPress has a big market share on web. Rest APIs are a growing technique and a big opportunity for developers. Knowing how to create APIs and how to consume them gives you a great advantage. A REST API can be consumed everywhere. On mobile applications, on front-end (web apps) or any other devices that have access on the net.

Maybe your customer already has a site that is running on WordPress and also wants a mobile application. You can create the API using custom code and relying on the database but that can cause a lot of frustration. Maybe they're in a hurry and want the API as soon as possible. In WordPress, it is as simple as installing a plugin.

In this article, we will give a general overview of the JSON REST API plugin. We will cover how this plugin works and the basic philosophy of the REST architecture.

Continue reading %The WordPress JSON REST API%

jQuery 3.0: The Next Generations

Mi, 2014-10-29 18:23

It’s hard to believe it’s been nearly eight years since jQuery was released. Web development has changed a lot over the years, and jQuery has changed along with it. Through all of this time, the team has tried to walk the line between maintaining compatibility with code from the past versus supporting the best web development practices of the present.

One of those best practices is semantic versioning, or semver for short. In a practical sense, semver gives developers (and build tools) an idea of the risk involved in moving to a new version of software. Version numbers are in the form of MAJOR.MINOR.PATCH with each of the three components being an integer. In semver, if the MAJOR number changes it indicates there are breaking changes in the API and thus developers need to beware.

The concept of versioning gets a little more nuanced with jQuery, where browser compatibility can be just as important as API compatibility. In order to create a slimmer jQuery, the team started shipping two versions in 2013. The first version remained numbered in the 1.x line and, currently at 1.11.1, maintains compatibility with a maximal number of browsers. The second version, starting with 2.0.0 and now at 2.1.1, dropped support for browsers like IE8 or lower in order to streamline the code. Both the 1.x and 2.x versions of jQuery have the same public APIs, even though they differ somewhat in their internal implementations.

Our next releases will use a different nomenclature. As before, there will be two different released files. The successor to what is now version 1.11.1 will become jQuery Compat 3.0. The successor to jQuery 2.1.1 will be jQuery 3.0. There are two different packages on npm and Bower, but they share the same version to indicate they have the same API behavior.

We’ll also be re-aligning our policy for browser support starting with these releases. The main jQuery package remains small and tight by supporting the evergreen browsers (the current and previous versions of a specific browser) that are common at the time of its release. We may support additional browsers in this package based on market share. The jQuery Compat package offers much wider browser support, but at the expense of a larger file size and potentially lower performance.

Despite the big version number jump, we don’t anticipate a lot of migration issues for most current jQuery code. We’re just being good semver citizens with this version bump. Changes such as removing deprecated methods will be detected by a new version of the jQuery Migrate plugin to make them easy to find and fix. We’ll have more details on the changes in future blog posts.

So, here’s the TL;DR for version 3.0 of the jQuery API:

  • If you need support for the widest variety of browsers including IE8, Opera 12, Safari 5, and the like, use the jQuery-Compat 3.0.0 package. We recommend this version for most web sites, since it provides the best compatibility for all website visitors.
  • If your web site is built only for evergreen leading-edge browsers, or is an HTML-based app contained in a webview (for example PhoneGap or Cordova) where you know which browser engines are in use, go for the jQuery 3.0.0 package.
  • Until we announce otherwise, both packages will contain the same public APIs in correspondingly-numbered major and minor versions. This should make it easy for developers to switch between the two and be maximally compatible with third-party jQuery plugins.

With each future release, we’ll be making both packages available on npm and bower. Both packages will also be available as single-file builds on the jQuery CDN. Using them from there is as simple as including either jquery-compat-3.0.0.js or jquery-3.0.0.js depending on your needs. We’ve talked with the folks who run Google’s CDN and they will also be supporting both packages.

As we make further progress on version 3.0, we will update everyone with the details about code changes, supported browsers, and the like. Stay tuned!

Working with Phone Numbers in JavaScript

Mi, 2014-10-29 18:00

When you're collecting data from users, there are two key challenges; collecting that information, and validating it. Some types of information are straightforward - someone's age, for example, couldn't really be simpler to collect and to validate. Names aren't as straightforward as they sound, but provided you cater for edge cases and international variations - for example patronymics, the mononymous, or even just people with hyphenated surnames - you can't go too far wrong (although plenty of applications and services do!). Email addresses, while theoretically very easy to validate, have their own challenges - yet nevertheless, there are plenty of regular expressions in the wild that aren't quite right.

And then there are telephone numbers. These are hard. Really hard. In this article I'll discuss some of the challenges around collecting, validating, and displaying telephone numbers.

Why Telephone Numbers are Different

Perhaps you're thinking that since telephone numbers tend to follow a pretty rigid format, such as this:

[code] 202-456-1111 [/code]

...that it ought to be simple to construct a simple regular expression to validate them. In fact, here's one:

[code] ^(\([0-9]{3}\)|[0-9]{3}-)[0-9]{3}-[0-9]{4}$ [/code]

Well, stop right there. For starters, here are just some variations of the number above, all of which are perfectly valid:

[code] 202 456 1111 (202) 456 1111 2024561111 1-202-456-1111 1-202-456-1111 x1234 1-202-456-1111 ext1234 1 (202) 456-1111 1.202.456.1111 1/202/456/1111 12024561111 +1 202 456 1111 [/code]

So based on that, we know that the regular expression apparoach isn't as simple as we first thought - but that's only the half of it. These examples are just for a US-based number. Sure, if you know that the number you're collecting is going to be for a specific country, you may be able to use a regular expression. Otherwise, this approach won't cut it.

Let's look at some of the other issues around telephone numbers, and why they make our job even harder.

Numbers Change

All sorts of external factors can have implications for telephone numbering. Whole countries come and go, introducing new country prefixes. New classifications of numbers introduce new numbering systems - premium-rate, local-rate, toll-free, and so on. When a carrier runs out of one set of numbers - like, sadly, premium-rate - they simply introduce a new prefix.

Some changes have enormous implications; in the United Kingdom some years ago, for example, the entire regional numbering system underwent a drastic change, with virtually every area code getting an additional "1" inserted. Even then, the capital had a subtly different system. It was probably a decade before signage was changed across the country to reflect the changes.

Then, of course, there was the enormous and unprecedented growth in mobile. No longer was the number of telephone numbers required largely limited to the number of households, but many times over. The continued strain on the pool of available numbers can only increase the likelihood of further changes.

Continue reading %Working with Phone Numbers in JavaScript%

20 HTML Elements for Better Text Semantics

Mi, 2014-10-29 17:00

Semantic HTML can help web designers and developers convey meaning not simply in the presented page, but also with the tags and elements used to code that page, potentially improving accessibility, search engine indexing, and even human understanding.

As a term, semantic or semantics relates to meaning in language. If something is more semantic, it is by definition more meaningful. Semantic HTML is simply markup that is more effective at communicating some intended meaning.

Semantic HTML Conveys More Meaning

Consider as an example the difference between a <div> element and a <header> element. The former describes a generic group of block content in an HTML document, while the latter more specifically denotes a block of introductory content, possibly including navigational elements.

[code language="html"] Welcome Welcome [/code]

In a browser, a style sheet makes it possible to present the <div> and the <header> elements identically. But the moment that a search engine bot or a screen reader parses the code, the semantics become significant, since these tools may treat the two tags differently, including assigning a different weight or value to the content of one over the other.

Semantics become more important where the difference in meaning is subtle or where the use of a tag specifically implies a meaning.

The <s> Element

The <s> element represents content that is no longer relevant, accurate, or applicable. It might show a price change on an ecommerce site, a sold out item on a menu, or a no longer relevant ad.

[code language="html"] Widget for Sale

Reg. Price $19.99 Now $9.99

Grilled Cheese Sandwich Sold Out Three Bedroom Apartment $1,000 Monthly [/code]

The <s> element should not be used to indicate edits to a document, like deleted text. The <s> puts a horizontal line (a strikethrough) over its content by default.

<ins> and <del> Elements

The <ins> and <del> elements work together to describe insertions and deletions to an HTML document. Each element supports two attributes. The cite attribute stores a URL pointing to an explanation of the change. The datetime attribute indicates when the change was made.

By default, the contents of <del> will appear with a strikethrough, while the contents of <ins> are rendered with an underline.

[code language="html"] Meeting Agenda
  • Discuss Sales Plan
  • Review Q3 Marketing
  • Review Q3 Marketing

The meeting will be on Thursday Friday afternoon.

[/code] The <cite> Element

Not to be confused with various elements’ cite attributes as with <ins> and <del> above, the <cite> element is a tag in its own right, representing a reference to some creative work like an article, book, comic, picture, poem, song, video, or similar.

Continue reading %20 HTML Elements for Better Text Semantics%

5 Easy Ways to Get Started with PHP on Vagrant

Mi, 2014-10-29 16:00

Vagrant is a tool for creating and managing virtual environments that help many developers not have to care about the “works on my machine…” problem. Vagrant creates reusable development systems that can be used again and again, helping you keep your system clean of too many installations.

When you are focused on development and lack the skills of a sys admin, the best thing to do (if you are going to use Vagrant during development) is to try another way of setting up your Vagrant configuration.

When it comes to PHP development, there are some online services that simplify the setup and configuration of these Vagrant virtual machines. Here is a list of some of these services.

Continue reading %5 Easy Ways to Get Started with PHP on Vagrant%

How Do You Represent a Language on the Web?

Mi, 2014-10-29 15:30

The internet has been like a big roll of global duct tape, binding us together in a million different ways. But while vast distances have melted away online, some global differentiators are more fundamental. Clearly language is one of them, and is one of the most important ways that we localize our sites and apps.

This leads us to the very important UI question “how do you graphically represent a language on the web?

The Problem

At first glance this seems like a ridiculous question. Using flags to represent languages for a website seems like a no-brainer. But on closer inspection we start to notice obvious issues.

A flag is a pictorial symbol representing a nation and most often a distinct geographical area.

Of course, the problem with flags is that many countries have more than one national language. Many countries and nations around the world have two, three and even four national languages.

This means that displaying, for instance, a Swiss flag is not especially useful to denote language as Switzerland recognizes German, French, Italian and English as national languages. Even choosing to select the most commonly spoken language is only likely to disenfranchise natives who do not speak the majority tongue.

In short, a flag is a representation of a country so therefore cannot be effectively used synonymously for a language. Languages are a method of communication so in order for it to be graphically translated there needs to be a new solution.

What are the alternatives?

Looking at the current state of play, there doesn’t seem to be any widely settled upon solution to graphically represent a language. Many sites still use flags to note translating options while others have gone a different route. While not conclusive in which is a better method it is a great way to get more people talking on what is the best way to solve this apparent issue.

Solution 1: Flags with Abbreviated Text

One common variation is to keep the flags but add a text label. This is seemingly an improvement as it clears up any possible confusion that visitors may have. It also allows you to keep a graphic while allowing visitors to identify their country without much effort.

Continue reading %How Do You Represent a Language on the Web?%

Increase Productivity with Komodo: an Extensible, Multi-language IDE

Mi, 2014-10-29 15:00

This article is sponsored by Komodo IDE. Thank you for supporting the sponsors who make SitePoint possible!

As unglamorous as it sometimes is, it’s undeniable that most of a developer’s time is spent inside an editor, writing code. Think about it: You'll use your coding tool for hours every day at work, and then at home for coding side projects. That can be 30 hours a week, if not more.

With this in mind, it’s really important to make that editor space as comfortable, helpful, and useful as possible. To get to that point, you really need a reliable, well-established Integrated Development Environment, rather than just a code editor with syntax highlighting and a few simple plugins.

IDEs are much more than just code editors. They provide a whole development toolset. From code debuggers, integrated version control — supporting the most popular software such as Git, SVN, Mercurial — to unit testing environments, where you can have a framework automatically set up. Bonus points go to any IDE that can really let you make yourself at home, by allowing you to customize the environment to conform to the way you work best.

While most powerful IDEs boast some or all of these features, they’re often restricted to a specific platform. You’ll typically need to buy a license for each operating system you choose to develop in. A costly proposition, but fortunately not one that applies to all IDEs.

Komodo IDE stands out by offering a single license that can be used across all platforms — Windows, OS X and Linux — to develop a wide variety of languages. You don’t need to waste money buying a separate license key for each one, and you don’t need to worry about compatibility or being forced to put up with the particular quirks of one platform. Komodo also offers plenty of customization and extensibility, as well as top-notch version control and debugging services.

In this article I’ll review Komodo IDE version 8, outline its features and advantages, and you’ll learn how this software can help you in writing better code and to be a more productive developer.

For the screenshots displayed below, I used Komodo’s “Abyss” skin after having customized Komodo to my liking.

How Komodo IDE can help you

Komodo IDE is a cross-platform IDE that supports most of the major programming languages in use today, such as PHP, Ruby, Node.js, and Python. The IDE also crosses the boundary into front-end, with support for HTML, CSS and JavaScript.

Its “cross-platform” nature means you can run the software on all major operating systems, OS X, Windows and Linux. This is nice if you work in a team and team members use different operating systems.

These cross-platform capabilities stem from Komodo’s implementation of the Mozilla engine, the same framework that powers equally-cross-platform browser Firefox.

More and more companies are making their software free for the open-source world and for educational institutions and ActiveState, the team behind Komodo IDE, is no different, with a range of licensing options available for individuals/freelancers, companies, and open source projects. Head over to the website and download a free trial.

ActiveState, the company behind Komodo IDE, also offers a free and open-source version of the software, cutting out all the advanced features, leaving you with a powerful, stripped-back code editor.

Key features of Komodo IDE

Komodo IDE has a balanced selection of features, with everything you’d expect from an IDE while avoiding becoming a software behemoth.

Besides the editor, the IDE has a debugger, a "toolbox" version control system integration, team collaboration, and powerful code intelligence with autocomplete and intelligent code refactoring.

Debugger

Komodo has a powerful debugging engine with all the features you’d expect, such as viewing the call stack, breakpoints, remote debugging, and an interactive shell.

To start the debugger go to Debug -> Go/Continue or Debug -> Step In. By default the Debug Options window will appear, where you can configure the debugger environment, like select the programming language, set up environment variables or insert additional arguments.

Currently Komodo supports Perl, Python, PHP, Ruby, XSLT and Tcl programming languages. It will automatically detect the programming language by the currently opened file’s extension.

Toolbox

The Toolbox is a very useful feature of Komodo, allowing you to store code snippets, JavaScript macros, templates or even URLs in a sidebar for quick access. This opens up all sorts of automation possibilities, allowing you to create code snippets that auto-abbreviate, for example.

To open the toolbox go to View -> Tabs & Sidebars -> Toolbox. You can categorize your “tools” into three sections: the top level is the global toolbox and two additional toolboxes, the shared and project toolbox.

The top level toolbox can be applied to any file you’re working on, the shared toolbox are tools that can be shared with your team members or available in other Komodo installations, and finally the project toolbox contains tools specific and visible to the currently active project.

Code intelligence

Code intelligence (or “code completion”) is a must-have feature for every major IDE. Komodo is no exception, and it has a very powerful engine for this feature.

Code intelligence in Komodo IDE isn’t limited to completing your method and property names, it also has code refactoring capabilities and smart code transformations like variable renaming and method extraction.

The code browser and go-to definitions are also part of the IDE’s code intelligence. The code browser lets you navigate the source in a tree view, and clicking on one of the methods or properties will jump to that line in the file. It’s very convenient.

Continue reading %Increase Productivity with Komodo: an Extensible, Multi-language IDE%

WordPress Landing Page Creation Made Easy

Di, 2014-10-28 19:30

Landing pages are a vital component of virtually any marketing strategy because they allow you to break away from your standard techniques and explore new possibilities for your campaigns. As discussed in a previous article on SitePoint about landing pages, there is a science to creating a solid page, that doesn't mean you need specialized tools to create these pages for your website.

With the rise of webinars, eCommerce sales, crowdfunding (which requires a unique marketing funnel) and much more, incorporating landing pages into your websites is a vital way to stand out in today's saturated digital ecosystem.

While it's possible to create your own pages and style them to your needs with virtually any WordPress theme, the tips below can help you create WordPress landing pages without worrying about hacking up a theme to do something it isn't primarily intended to do.

WordPress Landing Pages

Continue reading %WordPress Landing Page Creation Made Easy%

Creating a ‘Hello World’ App with Swift

Di, 2014-10-28 18:30

Back in June, Apple announced the Swift programming language and if you’re like me, it probably made you think

“Maybe now is the time I learnt how to develop applications for iOS devices and the Mac”

Of course, the real “best time” to learn Swift was a while ago, but there’s a lot to love about Swift compared to Objective-C:

  1. It’s modern.
  2. It’s clean.
  3. It’s safe.

It’s not without its flaws, it’s a young language after all, but those flaws are not so significant that a beginner developer shouldn’t start with Swift. Objective-C has years of real-world use, but Swift is the future.

To step into this future, we’re going to make a simple “Hello World” example in Swift, while covering the absolute basics of iOS development.

Continue reading %Creating a ‘Hello World’ App with Swift%

Dealing With Constants In Sass

Di, 2014-10-28 18:00

Sass, like JavaScript, does not have a native way to implement constants. But before going any further, let's have a quick reminder for those of you who are not very aware of this programming jargon.

In computer programming, a constant is an identifier whose associated value cannot typically be altered by the program during its execution (though in some cases this can be circumvented, e.g. using self-modifying code). Many programming languages make an explicit syntactic distinction between constant and variable symbols. – Wikipedia

So a constant is basically an immutable variable. However since a variable is editable by its very own nature, we needed a new name to describe a variable that is not... you know, variable. Hence, constant.

So as I was saying, Sass has no way to define constants. And if you ask me, it's probably for the best. In a declarative, styling related language such as CSS, needs for immutable values is very unlikely. But as you may know, I'm the guy who does crazy things with Sass so...

Let's go.

How did it all started?

There is a convention in computer programming that wants authors to define constants name as snakerized uppercased strings, like this: LOOK_AT_ME_I_AM_A_CONSTANT.

So my first thought was to rely on naming convention in order to define constants in Sass. Basically, all snakerized uppercased variables should be considered as constants, thus should never ever be muted.

For instance:

[code language="sass"] $MAX_Z_INDEX: 2147483647; $PI: 3.1415926535897932384626433832795028841971693993751; $E: 2.71828182845904523536028747135266249775724709369995; [/code]

If you ask me, you should probably stop there in most cases. But if you like adding some extra fun/useful stuff to your code, you might want to keep reading.

Continue reading %Dealing With Constants In Sass%

A First Look at Google Inbox

Di, 2014-10-28 17:15

Last week, Google released a new invite-only product, Inbox. Inbox is an interface to Gmail - designed not as an alternative service, but as an alternative and augmented interface. As a super-heavy email user, I’ve been taking a look at it since day one and will be reporting my initial findings and impressions in this post. It is through this kind of public feedback - rather than in-app feedback functionality that is available across all Google products - that I believe most change can be brought forth.

If you’d like to know more about Inbox, look through the various online resources already published on the topic. In this post, I’ll express my initial opinion about the service, and how it has impacted my daily workflow, if at all.

Overview

Google’s team says the best way to use Inbox is to go all in - and go all in I did. From the night of release, Inbox has completely replaced both my mobile and my desktop Gmail application, just to see how much of an effect it would have. During that time, I was also at ForumPHP in Paris, so the emails kept piling up, making for a perfect opportunity to properly test things.

Continue reading %A First Look at Google Inbox%

Creating an Opt-in Monster Clone with jQuery

Di, 2014-10-28 16:30

Without a doubt, the most effective way to build an email list is to create a modal that appears when a visitor stumbles across your website. This modal will then contain an opt-in form that they simply can't ignore (usually with a compelling bribe to hand over their email, like a free download of some sort). This approach is not without its share of controversy, but:

  1. They remain incredibly effective.
  2. The complaints are from a vocal minority.

To create these modals, most people use third-party software like Opt-in Monster, LeadPages, or the List Builder plugin from SumoMe. But while these applications are convenient, they aren't always the best choice, and as we'll talk about in this tutorial, they're easy to replace with jQuery.

Here's how.

Step 1: Install jQuery

To begin, download and embed a copy of jQuery inside a web page. To save the slightest bit of time, feel free to embed an external copy of jQuery:

[html] [/html]

Next, we'll need to add two different jQuery plugins to our page:

The first plugin is the jQuery Modal plugin. This is what we can use to create the modal box that appears after the user visits our page. When adding the plugin to your project, make sure to download all of the files:

  • jquery.modal.min.js
  • jquery.modal.css
  • close.png
  • spinner.gif

You can follow this tutorial using other modal plugins (or a custom modal), but I've found the jQuery Modal plugin to be the simplest option.

The second plugin is the jQuery Cookie plugin. This is what we'll use to make it so that when a user clicks the "Close" button on the modal, they won't see the modal again for the next thirty days. This means:

  1. Everyone should see the modal at least once.
  2. Return visitors won't see the modal on every visit.

Relying on cookies is not a fool-proof approach but it's good enough.

After setting up jQuery itself, along with these plugins, you should have a HTML file that looks something like this:

[html] [/html]

Continue reading %Creating an Opt-in Monster Clone with jQuery%