Python 101: All About Dictionaries

See the original posting on DZone Python

The Python programming language has several built-in types that it supports. One of my favorites is the dictionary. A dictionary is a mapping object that maps hashable values to arbitrary objects (source). Other languages call dictionaries “hash tables.” They are mutable objects that you can change whenever you want to, unlike tuples. A dictionary’s keys must be hashable or immutable, which means that you cannot use a list or another dictionary as a key. Note that dictionaries are not ordered. What this means is that when you iterate over a dictionary, you may not extract the values in the same order that you inserted them.

In this article, we will take some time to learn about some of the many things you can do with a dictionary.

Google Maps in MVC 4 with Custom InfoWindow

See the original posting on DZone Python

Introduction

I was recently investigating using Google Maps in a web-application and couldn’t find a clear example that showed how to do it with MVC 4. Hopefully, this article fills that gap! Technologies used include MS C#, MVC 4, jQuery, and of course the Google Maps API.

Background

There were some "gotchas" I encountered while putting this together. The first is that (at least for me), using a jQuery selector to link my div that would contain the Google map didn’t work. I had to specifically use the JavaScript document.getelementById call. The second was sizing. Using the default size (which was teeny weenie) wasn’t cutting it for me, so I increased width/height. Turns out Google Maps didn’t like that too much. After a bit of digging I found a post that said to create a quick in-page style that set the max-width to "none"; then it worked.

Fighting Custom Actions in Rails Controllers

See the original posting on DZone Python

I have never seen a Rails project which doesn’t have custom actions in the Rails controllers. And that makes me upset. Here I’m going to describe my thoughts about custom actions, why people use them, why I hate them, and how to deal with them.

Let’s say we want to build a simple posting system. We have already created a model Post and need to add a controller. Everybody knows about REST and we obviously want to build a RESTful application. So we create a controller:

Managing State in Angular with ngrx/store

See the original posting on DZone Python

Managing State in Angular Apps

State management in large, complex applications has been a headache plaguing AngularJS / Angular developers over the last few years. In AngularJS (version 1.x), state management is often addressed using a confusing mixture of services, events, and $rootScope. In Angular (versions 2+), component interaction is cleaner but can still be quite involved, encompassing many different approaches depending on the desired direction of the flow of data.

Note: In this article, AngularJS refers specifically to version 1.x of the framework while Angular refers to versions 2.x and up, as per the Branding Guidelines for Angular.

Pitfalls in the Validation for Uniqueness Using Rails ActiveRecord

See the original posting on DZone Python

ActiveRecord Validation in Rails provides an easy way to validate records for uniqueness. With the help of a real world example, we show why relying solely on Rails validation could become a problem and demonstrate a way to cleanup your database without downtime.

The Problem

The tagging of translation keys was added as a product feature in the very early stages of the PhraseApp development. Although the feature was constantly improved over time and the performance was very reliable, one day a customer contacted us due to a validation error. The tagging feature had been used rather extensively by this customer to automatically tag all uploaded keys with a GitHub Pull Request, leading to a validation error with an existing tag. So we investigated the issue and discovered that the error was caused by a tag name which was not unique to the project. So how could that happen? We had used ActiveRecord uniqueness validation and only used Rails without skipping the validation.

ASP.NET Core: Environment-based Configuring Methods

See the original posting on DZone Python

A fancy thing that ASP.NET Core supports is environment-based application configuring at code level. We can write special methods in an application start-up class and use default ones as fallbacks. This blog post shows how to write environment based configuring methods on ASP.NET Core.

Default Configuring Methods of Start-Up Class

When we create a new ASP.NET Core application, our Startup class looks like this.

8 Useful Ruby on Rails Gems We Couldn’t Live Without

See the original posting on DZone Python

The open source community is what makes Ruby on Rails such a powerful platform. By implementing helpful open sourced Gems, Rails developers can adapt and build the exact features needed for a project – without wasting time building everything from scratch. And while Gems are created on a daily basis, not every single one is a home run.

Sifting through dozens of Gems to find the perfect fit can feel like a Goldilocks mission. Luckily, we’ve tried and tested our share of Gems while building Rails applications across a wide range of industries. Here are eight Gems our development team has used in 2017. They’ve all been put through the ringer, tested, and come with an official Argonista stamp of approval. Check them out:

Running a React App in a Docker Container

See the original posting on DZone Python

I started converting my AngularJS AddressBook app into React. Since this is part of a larger project to run all the parts of my app in Docker containers with Docker Compose, I needed to look at how I can run my React app in a container.

For development, using the webpack dev server works well locally. Running this from within a container though requires doing an ‘npm install’ and an ‘npm run build’ inside the container, which probably doesn’t make sense to run every time, as with all the npm dependencies from create-react-app this take some time to run.

Angular 4 and What is Coming Up Next

See the original posting on DZone Python

I believe, the readers of this article are well versed or educated of Angular basics and also have hands-on experience.

There have several versions of Angular that have already been released including (BETA, Release Candidate, and Final version). If you are more interested in reading about the previous versions of Angular, I would recommend the following official links:

Latest AngularJS 2.0 Now with newly Added Features Despite Minor Controversies

See the original posting on DZone Python

When we think about all the key JavaScript structures, AngularJS is one of the first names that comes to mind. It’s been extraordinarily successful since its launch and has been used to create various fabulous applications and sites. 

Why AngularJS 2.0? 

AngularJS 1.3 adaptation has some execution issues while managing advanced cell working frameworks. The new form is more centered around the formation of versatile applications. Notwithstanding the portable driven approach, AngularJS 2.0 will contain many breakthroughs as far as modules and will work well with every present day program. It will be current in every sense, including the execution. The whole code was revamped with no regressive similarity which could prompt a vulnerability. Existing ventures in AngularJS 1.3 should be completely changed to fit the new format.

What I Learned from Teaching JavaScript, Part Two

See the original posting on DZone Python

Here, we are going to a see an another article of the JavaScript series. In the first part, we saw some basics that you can start with. In this article, we will be discussing the JavaScript object continuations and constructors. You can always see my other posts related to JavaScript here. We will be using Visual Studio for our development. If you are totally new to JavaScript, I strongly recommend you to read some basics here. I hope you will like this. Now let’s begin.

Download the Source Code

Do you know JavaScript – Part Two

ASP.NET Core Response Cache

See the original posting on DZone Python

Where is the output cache in ASP.NET Core? Is it gone? No, it’s there but in new and better extensible form, and it is called now response caching. This blog post shows how to use response caching on ASP.NET Core and provides tips about some of the internals of it.

In ASP.NET Core caching is solved as a middleware service that comes with Microsoft.AspNetCore.ResponseCaching NuGet package. In MVC, caching is driven by the ResponseCache attribute. It’s possible to use the ResponseCache attribute without also response caching the middleware to just set response headers. This way, it is possible to tell the browser to cache content, and also cache or proxy servers on the way that can read these headers to find out how to cache page.

Angular Modules vs ES6 Modules

See the original posting on DZone Python

I often see people being confused when it comes to understanding Angular Modules vs. ES6 Modules. This happens especially for newcomers in the JavaScript and front-end development ecosystem and immediately get confronted with both of them. Here’s a short article that hopefully sheds some light on the matter.

Contents are based on Angular version 2+.

User-Friendly UI and UX Design Trends for 2017

See the original posting on DZone Python

In the influential web industry trends don’t last long. Born out of innovative concepts, experimentation, and fresh techniques, trends are the major forces for change, which, ultimately push an industry forward to something better and remarkable. The web offers a constantly changing and evolving environment. This leaves many of us with a multi-million dollar question which strikes almost every designer’s heart: What will define Web Design trends in 2017? Like a number of Design experts and the UX think tanks, I’m wagering on VRs, Rich typography, and conversational interfaces to leave an enduring mark on the design industry. Without much ado, let’s take a look at the top trends that will dominate the web design space in 2017.

1. Mobile-First Design Concept

The Mobile-first concept isn’t a new one. It was a big hit over the past few years and it is anticipated that it will prevail and show its dominance even in the year 2017. More and more companies are expected to realize the importance of delivering the content for small screen devices and then working up to the bigger screens. Several visual and design restrictions limit mobile-first models (in a useful way) and what companies can create as their core content and the message which they want to convey to their target audiences. Smartphones usually come with smaller screen sizes, which limits the content that user views at once. This compels the companies to get rid of, or limit, the amount of information which is not 100% required. However, allowing the value-added and visually attractive extras to users as they switch up to larger screens is obviously necessary.

Quick Start: End-to-End Testing With Protractor

See the original posting on DZone Python

As AngularJS applications become more complex, manual testing becomes unreliable and repetitive. Unit Testing is a great start for testing the code, but eventually, End-to-End testing is needed for better coverage.

A great tool to use for this is Protractor, which is an end-to-end test framework for AngularJS applications. In this blog, we’ll introduce the benefits of Protractor and give you the steps needed to get started.

Using Dependency Injection in Multiple .NET Core Projects

See the original posting on DZone Python

One of my last posts was about Dependency Injection (DI) in .NET Core Console Applications. Some days after that post was published, I got a question about how to use the IServiceCollection in multiple projects. In this post, I’m going to try to explain just that. 

Setup

To demonstrate that, I created solutions with two .NET Core Console apps and two .NET Standard libraries. One of the console apps uses two of the libraries, and the other one is just using one. Each library provides some services which need to be registered to the DI container. Also, the console apps provide some services to add.

The Basics of Package.json in Node.js and npm

See the original posting on DZone Python

The package.json file is core to the Node.js ecosystem and is a basic part of understanding and working with Node.js, npm, and even modern JavaScript. The package.json is used as what equates to a manifest about applications, modules, packages, and more – it’s a tool to that’s used to make modern development streamlined, modular, and efficient.

As a developer in the Node.js ecosystem, understanding the basics of package.json is one of the first steps to really kicking off your development experience with Node.js.

Building Angular2 Single Page Applications with Crafter CMS

See the original posting on DZone Python

Single Page Applications (SPA) are quickly becoming the industry standard for HTML5 based applications and responsive websites because they tend to be more user-friendly, feel faster, and are more responsive.

As with most applications today, SPA’s frequently contain a lot of content and related digital media, such as images and videos.  Often times, content and digital media are deployed statically along with the application. This approach creates unwanted dependencies for content updates on the developers and requires heavy deployment processes.

1 2 3 73