There may be instances where the Jetty web server and the applications it hosts run out of memory, but the underlying cause of the failure is not immediately obvious. In such instances there are tools available and services on Jetty that enable more in-depth and detail analysis. Read more on Debugging Memory-Related Errors on a Jetty Web Server…
When developing a web app that needs to process payments, inevitably the requirement for some sort of credit card validation will come up. Recently I worked on an app that used AngularJS on the front-end and had to accept payments. Read more on Validating & Formatting Credit Cards in AngularJS…
One of the most important concepts is how scope binds to “this”.
Over the last few months, I’ve had the opportunity to do a lot of work with DropWizard, an awesome Java web framework for developing RESTful web services.
I was recently prototyping a small application, and I wanted to serve static files directly from DropWizard. While this isn’t what DropWizard is primarily designed to do, I didn’t want to go through the process of setting up another web server just to serve static assets for a prototype. While DropWizard has some out-of-the-box support for serving static assets, I found the documentation surrounding it to be incomplete and confusing. It actually took me a couple hours of debugging to figure out how to do exactly what I wanted, So I thought I would document what I learned here.
/api. The limited documentation around serving assets in DropWizard suggest that setting up an AssetsBundle for
/ and changing the application context path in your config file should be enough to achieve this, but that did not work for me. I had to do the following steps: Read more on Serving Static Assets with DropWizard…
$routeProvider doesn’t come with the functionality to include a resolve in every single route on an application. But universal resolves can be added in using
angular.extend(), an angular method that copies one object into another.
A quick refresher on resolves in Angular routes: a resolve is a dependency that should be injected into the controller for a route. The main difference between using a resolve and just requiring the dependency in the controller is that promises in resolves are completed before Angular renders the controller. If there are any errors in completing the promise, the
$routeChangeError event triggers. Resolves take the complexity of completing a promise and checking for errors out of the controller itself. (You can read more on $routeProvider and resolves in the Angular docs.)
Part 2: Testing Behaviors is available here
Extracting Duplicate Code with Behaviors
Behaviors are designed to be loosely coupled and injectable. A behavior knows about the view it is injected into, but the view does not know the details of the behavior. This helps to keep behaviors abstract and reusable between views. Lets take a look at a couple simple Backbone views and how they could be refactored using Marionette behaviors. Read more on Marionette.js Behaviors, Part 1: The Basics…
You’ve got an Angular app and an accompanying test suite. You’ve followed the recommendations about using Page Objects, but it’s cumbersome to require each of them you’d like to use in each spec. Wouldn’t it be nice to automate that?
Page What Now?
If you happen to be writing “E2E” tests for your Angular app with Protractor but you aren’t using Page Objects yet, here’s a quick intro:
- Angular recommends Protractor.
- Protractor recommends using Page Objects.
- Thiago Felix over at Thoughtworks just wrote a great post about why it’s a good idea, with examples.
Once you’re convinced of their benefit and you’ve seen some nice examples of using them, you go and build a few. And then your app grows… and grows. Now you have a mess of page objects that have to be manually required in each spec that uses them. Read more on Requiring All Page Objects for Angular Protractor Specs…
SCSS has numerous beneficial features, include one that I really came to love during my last project. The @extend feature really took the cake, and I think will help me along my path as a maker! It has a couple downfalls in practice, but it is such a great feature that I want to convince you to give it a try on your next project.
What is @extend?
Extend is a lot like inheritance in programming. It lets you import css styles from a previously defined css rule into another rule.
Let’s say you have three elements on the DOM that you want to style. Each element will look the same except each element’s border color will be different. Using the @extend feature, one approach to solving the styling of the elements is to define one class for the structure of the element. We will call the class
.element, and define the height, width, background color, border thickness, etc. Read more on Eliminating Multiple-Style Classes with @extend and SCSS…
Angular.js is an awesome framework for medium-complexity, single-page web applications. Its feature set and use cases fit perfectly in the complexity gap between Backbone.js and Ember.js.
Composed of many interesting and useful features such as animation and touch interaction, Angular provides an architecture that makes your single-page web app a joy to work with.
1. Promises, Promises, Promises