Dual DB Schema Setup with Drupal

Submitted by Sergey Cheban on Mon, 07/28/2014 - 20:47

Anyone that has worked on an enterprise level Drupal application knows that having the transactional consumer data separate from your content will save you time and headaches during a release. With Drupal this is very much possible and it's fairly easy to setup. This can be setup with the DB on a separate server or on the same server where you currently have your Drupal DB residing.

The first thing that you will need to do is edit your "settings.php" file for you drupal installation and add the following array block to configure your second schema:

Developing your first iOS Application

Submitted by Christian Crawford on Mon, 07/28/2014 - 16:04

Developing an iOS application may seem like a daunting task for one to complete, especially if you are not familiar with the Objective-C language and its syntax. However it’s actually not all that difficult to create a basic hello world like application with very little knowledge of the language. If you are familiar with the C programming language the code should look somewhat familiar.

Drupal Module Folder Organization

Submitted by Dan Slater on Mon, 07/28/2014 - 15:16

Organization is important for any Drupal site larger than the simplest of blogs. It is paramount for multi-site installations that are already bulky with numerous site folders, themes and subthemes. I have observed that if I don’t maintain a good organizational format within my multisite structure, I can very quickly become lost locating specific files and lose precious productive time.

Making Vim Syntax Highlighting Work Inside Git Bash

Submitted by Dmitry Boychev on Mon, 07/28/2014 - 11:06

If you have used Git Bash and its Vim, which both come as one package, you have probably stumbled on the issue of making syntax highlighting work.

Whenever you type the command “vi file_name” in Git Bash and type, for example, some php code, you will see the plain white text on the black background. To try and fix the issue, you would just type the command “: syntax on”, because it always worked, right? Well, not so much with the Git Bash Vim scenario.

Creating CSS3 WebKit animations

Submitted by Jordan McLemore on Tue, 07/22/2014 - 13:05

WebKit is a layout engine software component for rendering web pages in the browser. It can easily be used to give HTML elements animations and properties involving movement. In this article I will be explaining some example code I wrote below. No Imports are required to use WebKit.

You begin by declaring the Webkit and the time length -webkit-animation: rotation 1.5s linear 1; . -webkit-animation and -webkit-transform are the only WebKits I am using, although many others exist, such as -webkit-transition.

Creating a responsive webpage

Submitted by Jordan McLemore on Thu, 07/17/2014 - 10:51

Having a responsive website is almost mandatory in modern web development. The way people view websites has changed. People use their phones and tablets almost more than their desktops and laptops. This means people will be viewing your site on mobile devices. Luckily, there are a couple ways to handle this. Javascript and jQuery are likely the most interesting and advanced way of handling this obstacle. However, if you want to keep things nice and simple with full functionality, simply use CSS3 media queries. Here is an example.

 

Easily creating a GUI in Java using Jframe in NetBeans 8.0

Submitted by Jordan McLemore on Tue, 07/15/2014 - 10:33

This guide will show you a quick introduction on using the JFrame tools in NetBeans to easily create a GUI for your java programs. NetBeans provides a user interface that allows you to very easily generate your GUI without having to hand code it yourself. This will organize your code and allows you to easily add logic and operations to your buttons, text fields, and more.

Getting Started with Wordpress Plugin Development

Submitted by Mark Tsibulski on Sat, 06/28/2014 - 21:13

Writing plugins for Wordpress may seem like a daunting task if you're new to Wordpress. But all it takes is a good starting point to get the ball rolling. Today I'll show you how to get started with your first simple Wordpress plugin. For this example, we will be making a plugin that automatically adds an image to all new posts.

First, you will need to make the appropriate directories and files. In your /wp-content/plugins/ directory, make a new folder with your desired plugin name, and a .php file with the same name.

Choosing between PHP, Lua, Go

Submitted by Jitesh Doshi on Fri, 06/27/2014 - 18:59

I have recently spent quite a bit of time trying to come up with a better way to implement RESTful service that serve data in JSON. This is because most of our work these days involves writing client-side JavaScript apps that present a rich UI in the browser and then do all server-side interactions via AJAX. In pursuit of the best way to implement RESTful service on the backend, I have tried my hands at Go programming language, D programming language, Lua and of course Java and PHP. I was assuming that the Go or Lua would be much faster than PHP. Well, it turns out that at least without special optimizations, that is not the case.

I wrote the following programs to compare their performance:

<?php

header('Content-Type: application/json');

$db = new PDO('mysql:host=localhost;dbname=db;charset=utf8', 'user', 'pass');
$stmt = $db->query("SELECT * FROM node");
$result = array();
$result['list'] = $stmt->fetchAll(PDO::FETCH_ASSOC);
echo json_encode($result);

 

<?php

define('DRUPAL_ROOT', getcwd());

require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
drupal_bootstrap(DRUPAL_BOOTSTRAP_DATABASE);
// drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);

header('Content-Type: application/json');

$stmt = db_query("SELECT * FROM node");
$result = array();
$result['list'] = $stmt->fetchAll(PDO::FETCH_ASSOC);
echo json_encode($result);

 

json = require "cjson"

function json_result(key, data)
  local result = {}
  result[key] = data
  ngx.say(json.encode(result))
end

function json_error(...)
  local result = {}
  result["message"] = string.format(...)
  ngx.status = ngx.HTTP_INTERNAL_SERVER_ERROR
  ngx.say(json.encode(result))
end

mysql = require "resty.mysql"

local db, err = mysql:new()
if not db then
  json_error("failed to instantiate mysql: %s", err)
  return
end

db:set_timeout(1000) -- 1 sec

local ok, err, errno, sqlstate = db:connect{
  host = "127.0.0.1",
  port = 3306,
  database = "db",
  user = "user",
  password = "pass",
  max_packet_size = 1024 * 1024
}

if not ok then
    json_error("failed to connect: %s: %d %d", err, errno, sqlstate)
    return
end

result, err, errno, sqlstate = db:query("SELECT * FROM node")

if not result then
  json_error("failed to query: %s: %d %d", err, errno, sqlstate)
end

json_result("list", result)

 

The above programs simply query a table and return all rows and columns from that table as a JSON array.

And then I hit the above programs with a bit of load using 'ab' HTTP load testing command. Following are the results ...

Tags

Creating the parallax effect using Javascript and CSS

Submitted by Jordan McLemore on Tue, 06/17/2014 - 12:50

The parallax effect, or scrolling parallax effect, has become popular on modern websites. My favorite example of the parallax effect is implemented on http://boy-coy.com/. You may be thinking to yourself that this looks difficult to implement, but actually it's incredibly easy. The most difficult part will be creating the images and deciding how to make them move and work together.

Subscribe to