Flask 101: Filtering Searches and Deleting Data

See the original posting on DZone Python

Last time we got our Flask based music database application partially functional. It could now add data to the database, edit said data, and also display everything in the database. But we didn’t cover how to filter the data by using the user’s filter choice (Artist, Album name, or publisher name) and search string. We also didn’t cover how to delete items from the database. That is the two-fold goal of this article.

Filtering Search Results

Filtering search results using SQLAlchemy (via Flask-SQLAlchemy) is actually quite easy. All you need to do is create some very simple query objects. Open up the main.py file that we were editing last time and replace the search_results() function with the following version of the code:

Common Front-End Mistakes That Cause Layout Problems

See the original posting on DZone Python

Successful online services like marketing and e-commerce websites rely on exceptional customer experiences. As a front-end developer, it’s your job to create flawless layouts, so your customer can complete necessary actions (like submit a sign-up form or purchase a Christmas gift). As you probably know, layout issues can cause users to distrust your website, so you’ll want to fix them up ASAP.

These are some of the most common front-end mistakes that cause layout problems on websites, using examples from our website, Raygun.com (in a test environment, of course!).

When Ruby on Rails Is Not a Good Fit

See the original posting on DZone Python

It’s no secret that we love Ruby on Rails at Planet Argon. We’ve been part of the community for 13 years, and have built over a hundred applications using this framework since then. But just because it’s our framework of choice doesn’t mean it’s the right choice for your business.

Over the years, we’ve had several companies approach us about their existing Ruby on Rails application, or with the idea of creating a new app in Rails, that we’ve directed away from this framework.

Patterns in Large Scale JavaScript Applications, Part 2

See the original posting on DZone Python

It is clear from Part 1 of this series what a pattern is in the software development process, why we use software design patterns, and the factors for using design patterns in JavaScript. If you haven’t read the previous post, i would recommend you to please read it once to get the overview.

I am a very big fan of JavaScript’s module design pattern. That’s the object literal pattern in the category of modular design patterns.

Flask 101: How to Add a Search Form

See the original posting on DZone Python

In our last article, we added a database to our Flask web application but didn’t have a way to add anything to our database. We also didn’t have a way to view anything, so, basically, we ended up having a pretty useless web application. This article will take the time to teach you how to do the following:

  • Create a form to add data to our database.
  • Use a form to edit data in our database.
  • Create some kind of view of what’s in the database.

Adding forms to Flask is pretty easy too, once you figure out what extension to install. I had heard good things about WTForms so I will be using that in this tutorial. To install WTForms you will need to install Flask-WTF. Installing Flask-WTF is pretty easy; just open up your terminal and activate the virtual environment we set up in our first tutorial. Then run the following command using pip:

Five Reasons Why You Should Use a Git-based CMS (Part 5 of 5)

See the original posting on DZone Python

In our previous posts we looked at Git-based CMS and its versioning (part 1), distributed repository (part 2), dug in to Git’s underlying mechanics to see how it benefits deployment (part 3), and we looked at how the support for branching (part 4) can help your organization dramatically speed up development and deployment activities. In this post, we’re going to wrap the series up with one final reason you should use a Git-based CMS.

There are so many advantages to the way that we’ve leveraged Git, it’s hard to pick just 5 things to talk about. Because I’ve arrived at our last reason, #5, I want to use this item to speak to something non-technical: familiarity.

Converting 600k Lines to TypeScript in 72 Hours

See the original posting on DZone Python

Background

Users have been using Lucidchart for a long time to make their diagrams, since 2010 and IE6. And for nearly that long, Lucid has used Google’s Closure Compiler to manage its increasingly sophisticated code base. Closure Compiler is a typechecker and minifier that uses JSDoc annotations in comments to understand type information. As Lucid grew from 5 to 15 to 50 engineers, the tool proved enormously helpful for quality and productivity.Then in 2016, Lucid began experimenting with TypeScript. TypeScript offers more flexible and comprehensive type checking, cleaner syntax, and better IDE support than we could get with Closure-annotated JavaScript.

// Closure JavaScript

/** @const {!goog.events.EventId<lucid.model.DocumentEvents.PagesContentChanged>} */
lucid.model.DocumentEvents.PAGES_CONTENT_CHANGED =
    new goog.events.EventId(goog.events.getUniqueId('PAGES_CONTENT_CHANGED'));

/**
 * @constructor
 * @extends {goog.events.Event}
 * @final
 * @param {!Object<boolean>} pages
 * @struct
 */
lucid.model.DocumentEvents.PagesContentChanged = function(pages) {
    lucid.model.DocumentEvents.PagesContentChanged.base(
        this, 'constructor', lucid.model.DocumentEvents.PAGES_CONTENT_CHANGED
    );
    /** @const {!Object<boolean>} */
    this.pages = pages;
};
goog.inherits(lucid.model.DocumentEvents.PagesContentChanged, goog.events.Event);

is equivalent to

An Introduction to Node.js

See the original posting on DZone Python

Introduction

Node.js is an application framework and sometimes is referred to as a runtime, through which applications are built using the JavaScript programming language. Node.js is well known for its speed, due to the fact that it is non-blocking. Further, being non-blocking means one request does not wait for the other request to finish (i.e it is asynchronous). The asynchronicity is what makes Node.js the framework that it is today in terms of throughput, unlike Java application servers which are mostly blocking each request that is bound to a thread and as soon as there are no more threads available the server almost always stops receiving requests.

In this article, we will discover some aspects of Node.js. We will do so by discussing some topics such as: uses cases of Node.js, how Node.js achieves concurrency, and its main design pattern.  

Redux: A Practical Tutorial

See the original posting on DZone Python

TL;DR:  Shows through practical, short examples how Redux works and what are its main pieces. To find the final code that we are going to create in this article, please check this GitHub repository.

What Is Redux?

Mostly used with React, Redux is a storage facility that helps JavaScript applications to manage state. Note that I started the introductory sentence with "Mostly used." What I mean is that we do not have to use Redux with React. We don’t even need a browser to use Redux. We can use it to control the state of a Node.js backend application, for example.

Trying BitBucket Pipelines With ASP.NET Core

See the original posting on DZone Python

BitBucket provides a continuous integration tool called Pipelines. This is based on Docker containers which are running on a Linux-based Docker machine. In this post, I want to try to use BitBucket Pipelines with an ASP.NET Core application.

In the past, I preferred BitBucket over GitHub because I used Mercurial more than Git. But that changed five years ago. Since then, I’ve used GitHub for almost every new personal project that doesn’t need to be a private project. But at my company, YooApps, we use the entire Atlassian ALM Stack including Jira, Confluence, and BitBucket (we don’t use Bamboo yet because we also use Azure a lot and we didn’t get Bamboo running on Azure). BitBucket is a good choice if you use the other Atlassian tools because the integration to Jira and Confluence is awesome.

Getting to Know Custom CSS Properties

See the original posting on DZone Python

Today’s front-end developers have a plethora of tools to help them create and edit CSS. One of those tools are preprocessors, and one of the major perks of using a preprocessor is the ability to use variables within your styles. This eliminates the need for copying and pasting, which then makes refactoring easier.

When using preprocessor variables, developers tend to define them with colors, font sizes, layout details, etc. This is all fine and dandy, but preprocessor variables have some limitations:

Accelerating the Development of Node.js Using OpenShift

See the original posting on DZone Python

In this blog entry, I want to introduce a "different" way to work with OpenShift. In the typical way to deploy a Pod to OpenShift, we have available a set of very useful objects; we have build/image configurations. This takes the pain from us by hiding the details about image construction but, sometimes we just want to see some code running in the cloud. Or we want to see if our service/application is able to interact with nearby services or we have some code but we don’t want to use a git repo just yet. To solve that problem, I will show the concept of InitContainers, and how by being a little bit creative we achieve some cool stuff like deploying our code inside a running container.

Getting Started

This guide is dependent upon you having access to an OpenShift installation or you have installed OpenShift on your local machine using Minishift or using oc cluster up.

What’s New in PHP 7.2?: Literally Better Everything

See the original posting on DZone Python

As we all know, most web developers either love or hate PHP with a passion. I’m one of those developers that absolutely love it. I know PHP like the back of my hand. Now, since 7.2 has been released, my love is growing even more! Let’s talk about the awesomeness that the newest version brings to us.

Security Is the Most Important Thing Here

The 7.2 Release offers some highly needed improvements to security.

1 2 3 92