JavaScript
Create a Desktop App with Angular 2 and Electron
Last week, I took part in the Google Developer Day held in Beijing. The Angular team introduced their new Angular 2. Angular is a development platform for building mobile and desktop web applications. This tutorial shows how to configure and use Angular 2 web components with the Electron framework for creating native cross-platform applications with web technologies. As recommended by the Angular team, TypeScript will be used throughout this tutorial. TypeScript is a typed superset of JavaScript that compiles to plain JavaScript. Any browser. Any host. Any OS. Open-source.
Use WebSockets with Spring, SockJS and Stomp
This guide walks you through building a “hello world” application that sends messages back and forth between a browser and the server. WebSocket is a very thin, lightweight layer on top of TCP, which makes it a natural place to run a subprotocol that gives the raw bytes some structure. Here we use STOMP messaging with Spring to create an interactive web application. Note: This post has been updated for Spring 6/7. The WebSocket setup now uses @EnableWebSocketMessageBroker Java configuration and the modern @stomp/stompjs client. The original 2015 version targeted Spring 4.1 with XML <websocket:message-broker> config and the legacy Stomp.over() API; both are obsolete and have been replaced throughout.
WordPress $ is not defined
If you copy a normal jQuery snippet into a WordPress theme or plugin, sooner or later you hit Uncaught ReferenceError: $ is not defined. The confusing part is that jQuery itself is loaded; your other jQuery code may even be working. So why does $ blow up? Why It Happens WordPress ships its own copy of jQuery and loads it in no-conflict mode. On startup it effectively runs: jQuery.noConflict(); noConflict() tells jQuery to give back control of the global $. After it runs, jQuery still points to the library, but $ no longer does; it is left free for some other library to claim.
How does Ajax Work
Ajax, a term coined by Jesse James Garrett that became popular after the publication of the article Ajax: A New Approach to Web Applications in February 2005, is short for Asynchronous JavaScript and XML. The normal behavior of the Internet that involves sending pages to the browser is completely changed by the use of Ajax. Ajax has become commonplace with its integration in HTML 5 and JavaScript frameworks, and in fact, the interest of developers has moved to HTML 5 for its new tags and APIs that accompany it. Among these, WebSocket appears as the successor to Ajax, because it is a superior means of communication between an application and the server or the backend.