Wednesday, December 16, 2015

Giveaway Alert! Win a Microsoft Surface Book worth $1,499

If you love something, get it free. Is that how the saying goes? It does now—we’re giving away the Microsoft Surface Book free to one lucky winner at SitePoint Shop! If you can type your email address, you can enter the giveaway in about three seconds—just head over to SitePoint Shop, submit your email address, […]

Continue reading %Giveaway Alert! Win a Microsoft Surface Book worth $1,499%


by Reuben Acciano via SitePoint

How to Use RethinkDB with Node.js Applications

One of the most common task for a web application is to save data. Without the ability to store data, users would not be able to customize their preferences for an application, organize their data, or achieve similar tasks.

For a long time, the web has relied on relational database to save information. For example, on the web the liason between PHP and MySQL is well known. But not all the database must be relation!

In this article we'll focus on using RethinkDB, an open source JSON database, with Node.js applications. We'll make use of the RethinkDB Node.js driver called rethinkdbdash to connect to the database.

But before starting, let's have a look at what RethinkDB is and where we might want to use it.

Introducing RethinkDB

RethinkDB is an open source JSON database built for real time Web.

The official documentation states:

RethinkDB is the first open-source, scalable JSON database built from the ground up for the realtime web. It inverts the traditional database architecture by exposing an exciting new access model – instead of polling for changes, the developer can tell RethinkDB to continuously push updated query results to applications in realtime.

It provides the functionality to get real time updates from the database each time a change occurs.

RethinkDB targets applications which require to send real time updates to the connected clients. For example, let's consider an application that enables users to collaboratively design a plan. When a particular user makes a design change, it needs to be pushed to the other connected clients in real time to keep the design in sync. RethinkDB can be used in such cases to make real time updates possible.

Continue reading %How to Use RethinkDB with Node.js Applications%


by Jay Raj via SitePoint

jumboShare – Social Share Buttons with Counter

Jumbo Share is a jQuery Plugin that add social share buttons on your website with a counter.


by via jQuery-Plugins.net RSS Feed

How to Use the Long Form Storybuilder Plugin for WordPress

In my previous article "Easy Landing Pages in WordPress with Long Form Storybuilder", I highlighted some of the important facts about landing pages as one of the best outcomes of marketing research and analysis. While landing pages bring pretty impressive leads and conversions, building one is not always easy, especially if you don't know how to code. For this purpose, I introduced you to a handy solution which is the Long Form Storybuilder (LFS) plugin for WordPress. In this article, I'll show you how to create intuitive landing pages in just a few clicks.

Basic Setup

Let’s get you all setup and running. At this point I’m assuming that you have somewhat of the following setup:

  • A WordPress website on a local machine or a web server
  • The Long Form Storybuilder plugin installed & activated

Once that’s done, go to the WordPress dashboard and add a new page via Pages > Add New. Give it a suitable title and save it. Next, allow the LFS plugin to get included in your project by clicking Enable Long Form Content checkbox in the top right metabox.

Continue reading %How to Use the Long Form Storybuilder Plugin for WordPress%


by Ahmad Awais via SitePoint

A Beginner’s Guide to WebGL

This article is part of a web development series from Microsoft. Thank you for supporting the partners who make SitePoint possible.

HTML5 & WebGL

Join the discussion on Reddit.

WebGL (Web Graphics Library) is a JavaScript API for rendering interactive 3D computer graphics and 2D graphics within any compatible web browser without the use of plug-ins. You will often find developers using it for games, but it is finally gaining widespread visibility across the web, and is now being used for map visualizations, charting data, and even presentations.

First introduced in early 2011, this is similar OpenGL ES, the mobile version of OpenGL, but built inside of the browser. Desktop browsers have really started to support it as of late, as have mobile browsers. I wrote about the current state of it (as of November 2014) here.

3d canvas graphics usability

How Many People Are Using WebGL?

User pyalot on reddit has pointed me towards an excellent site for tracking WebGL usage and statistics: http://webglstats.com/. WebGL Stats uses a tracker frame embedded in other sites to collect the data. You can help too, just embed the code below into your page.


<script src="//cdn.webglstats.com" defer="defer" async="async"></script>

What is WebGL Doing and Why Should I Care?

WebGL has three distinct advantages over writing code that simply manipulates the DOM:

  • Tasks. Drawing reflective materials or complex lighting generate a ton of overhead, and seeing that JavaScript is single threaded and CPU bound, why not offload some of that to the GPU in your device and have that do the heavy lifting?
  • Performance.Utilizing hardware acceleration (the GPU built into your device), WebGL is a great fit for games or complex visualizations.
  • Shaders.Complex visual effects can be produced with small programs known as “shaders”. This may be as simple as producing a sepia coloring effect, or more complex simulations such as water or flames. Visit Shadertoy for a showcase of some examples which really highlight this.

Asm.js and Emscripten

asm.js and emscripten

Unity, and Epic’s Unreal Engine, the popular middleware tools frequently used by game developers are not limited to creating compiled applications that run as an executable.

Unity previously had a web player, which was a downloadable plugin that used ActiveX. Chrome killed support for NPAP (Netscape Plugin API), but announced it over one year ago.

In April, with the release of Chrome 42 stable, they finally put the axe to it. There are a number of reasons as to why, but most notably they stated “hangs, crashes, security incidents, and code complexity.” Google suggests using web standards instead, such as WebGL, which I will explain below.

Microsoft is following suit and deprecating ActiveX, VBScript, attachEvent, and other legacy technologies in favor of web standards. The need for ActiveX controls has been significantly reduced by HTML5-era capabilities, which also produces interoperable code across browsers.

With the advent of WebGL and now asm.js, developers can now harness much of the power of their computing device from within the browser and access markets previously unavailable.

JavaScript is the only language which works in all web browsers. Although only JavaScript will run in the browser, you can still write in other languages and still compile to JavaScript, thereby allowing it to also run in the browser. This is made possible by a technology known as emscripten.

Emscripten is an LLVM based project that compiles C and C++ into highly performant JavaScript in the asm.js format. In short: near native speeds, using C and C++, inside of the browser. Even better, emscripten converts OpenGL, a desktop graphics API, into WebGL, which is the web variant of that API.

Continue reading %A Beginner’s Guide to WebGL%


by David Voyles via SitePoint

Understanding the CSS Modules Methodology

In the ever-changing world of front-end development, it is quite hard to find a concept that actually makes a difference, and to introduce it correctly enough so that other people are actually willing to try it.

When we look at CSS, I would say the last big shift that happened in the way we write CSS (on the tooling side) would have to be the arrival of CSS processors, mostly Sass, probably the most well-known one. There’s also PostCSS, which has a slightly different approach but ends up essentially in the same basket – browser-unsupported syntax goes in, browser-supported syntax goes out.

Now a new kid has joined the block under the name CSS Modules. In this article, I’d like to introduce this technique, tell you why it has some good points, and how you can get started with it.

What is a CSS Module?

Let’s start with the explanation from the official repository:

A CSS Module is a CSS file in which all class names and animation names are scoped locally by default.

Now, it is a little more complex than that. Because class names are scoped locally by default, it involves some setup, a build process, and a bit of magic that is sometimes hard to grasp.

But eventually, we can appreciate CSS Modules for what they are: a way to scope CSS to a component and escape the global namespace hell. No more struggling to find a good way to name your components, because the build step is doing that for you!

How does it work?

CSS Modules need to be piped in a build step, which means they do not work by themselves. See this as a plugin for either webpack or Browserify. It basically works this way: when you import a CSS file inside a JavaScript module (such as, but not necessarily, a React component), CSS Modules will define an object mapping class names from the file to dynamically scoped/namespaced class names that can be used as strings in JavaScript. Allow me to illustrate with an example:

Below is a very simple CSS file. The .base class does not have to be unique on the project as it is not the actual class name that will be rendered. It is just a kind of alias inside the stylesheet to be used in the JavaScript module.

[code language="css"]
.base {
color: deeppink;
max-width: 42em;
margin: 0 auto;
}
[/code]

And here is how you would use it in a dummy JavaScript component:

[code language="javascript"]
import styles from './styles.css';

element.innerHTML = `<div class="${styles.base}">
CSS Modules are fun.
</div>`;
[/code]

Eventually, this will generate something like this (when using it through webpack with the default setup):

[code language="html"]
<div class="_20WEds96_Ee1ra54-24ePy">CSS Modules are fun.</div>
[/code]

[code language="css"]
._20WEds96_Ee1ra54-24ePy {
color: deeppink;
max-width: 42em;
margin: 0 auto;
}
[/code]

The way class names are generated can be configured to make them shorter, or to follow a specific pattern. It doesn’t really matter in the end (although shorter class names mean shorter stylesheets) because the point is that they are dynamically generated, unique, and mapped to the correct styles.

Continue reading %Understanding the CSS Modules Methodology%


by Hugo Giraudel via SitePoint

Authentication and Sharing in Android with the Google+ API

In this tutorial I will show how to connect your Android application to the Google Plus API and use it for login, getting and sharing data.

Find the completed project on GitHub.

Create Android Project

Open Android Studio and create a New Project, naming it as you wish. Click Next, choose Minimum API level 18 and click Next again. Choose Blank Activity as the first activity, name it LoginActivity and click Finish.

Continue reading %Authentication and Sharing in Android with the Google+ API%


by Theodhor Pandeli via SitePoint