Dan Schaefer – SitePointhttps://www.sitepoint.com
Learn CSS | HTML5 | JavaScript | Wordpress | Tutorials-Web Development | Reference | Books and MoreFri, 09 Dec 2016 19:00:14 +0000en-UShourly1https://wordpress.org/?v=4.4.2A CRM with Neo4j and RESThttps://www.sitepoint.com/crm-neo4j-rest/
https://www.sitepoint.com/crm-neo4j-rest/#commentsWed, 28 May 2014 14:00:40 +0000http://www.sitepoint.com/?p=82343In a previous post, we briefly looked at the Neo4j database and created some simple Ruby API methods that leveraged our knowledge of the Cypher query language. We started to put together a simple CRM (Customer Relationship Management) application in an attempt to show how easily graph databases can navigate in a highly connected world. In this article, we'll continue building on the CRM example by zooming in on the management structure of a fictional sales organization and see how easy it is to make complex queries of the database.

]]>https://www.sitepoint.com/crm-neo4j-rest/feed/6Create a Neo4j Graph Database Using the REST APIhttps://www.sitepoint.com/create-neo4j-graph-database-using-rest-api/
https://www.sitepoint.com/create-neo4j-graph-database-using-rest-api/#commentsThu, 22 May 2014 14:00:44 +0000http://www.sitepoint.com/?p=81410In this two-part article, we'll work with the most mature and popular graph database, known as Neo4j. Neo4j is written in Java, but has interfaces for many languages, including Ruby. In the spirit of flexibility, we'll eschew the Ruby interface and instead take advantage of the REST API interface, which allows us to work with Neo4j using nothing more than the rest_client and json gems. The code in this article can therefore be refactored into other languages, like PHP, Python and perhaps even, JavaScript without much effort.

To make this journey, this article will focus on setting up Neo4j to implement a simple CRM (Customer Relationship Management) for a sales department. We'll briefly look at the Cypher query language that is used to communicate with Neo4j, and then we'll put information into the database using the API.

]]>https://www.sitepoint.com/create-neo4j-graph-database-using-rest-api/feed/3The Art & Science of Great Website Color Selectionhttps://www.sitepoint.com/website-color-selection/
https://www.sitepoint.com/website-color-selection/#commentsMon, 21 Apr 2014 16:30:05 +0000http://www.sitepoint.com/?p=80086Website designers often struggle over the selection of colors. With roughly ten million discernible colors to choose from, it’s no surprise that the decision comes with a lot of angst.

While some designers have formal training in art and graphics and are comfortable with decisions about color, the rest of us are forced to struggle with it. We look for rules and guidance and are met with opinions and platitudes.

Some decisions may seem obvious.

For example, you probably wouldn’t use blue for a Halloween-themed site. On the other hand, what color would you choose for a site dedicated to JavaScript programming?

In this article, we’ll break down the color selection topic into three parts.

We’ll begin by looking at some colors that indeed are hard-wired into our psyche (there’s not many of them) and then move on to discuss cultural and historical influences of color.

Finally, we’ll see how easy it is to create analogous and complementary colors once we’ve selected a baseline color.

Hard-Wired Colors

Let’s begin by reviewing a few truths about us humans: Our bodies are the result of a billion+ years of engineering. The sole purpose of all this engineering is to help individuals survive long enough to perpetuate the species.

Our base instincts are therefore hard-wired into our psyche as a means to ensure our survival. While our egos and sexual drive are the physical manifestations of this hard-wiring at work, more subtle qualities like our refined vision and associated ability to recognize patterns are used to help us gather all-important food.

]]>https://www.sitepoint.com/website-color-selection/feed/6Uno! Use Sinatra to Implement a REST APIhttps://www.sitepoint.com/uno-use-sinatra-implement-rest-api/
https://www.sitepoint.com/uno-use-sinatra-implement-rest-api/#commentsMon, 10 Mar 2014 13:30:34 +0000http://www.sitepoint.com/?p=78157The REpresentational State Transfer (REST) architecture provides a very convenient mechanism to shuttle data between clients and servers. Web services and protocols, like HTTP, have been using the REST architecture for many years, so it is a well-tested and mature concept.

Padrino is an excellent website framework that makes it easy to implement complex web applications in a lightweight environment. Although it's built on Sinatra, Padrino uses a Rails-like approach when generating code, establishing an organized file structure, and implementing database functionality.

This article briefly introduces the Padrino framework and how it can be used to create a simple admin interface within a Sinatra-like environment.

A Brief Introduction to Sinatra

In a nutshell, Sinatra is a DSL (Domain-Specific Language) that processes HTTP connections. Specifically, Sinatra compares incoming user requests with entries in a list. When the first match is found, Sinatra executes the associated code and sends the results back to the user.

For example, consider an HTTP GET request arriving on this URL:

[ruby]
www.example.com/product/shoehorn/index.html
[/ruby]

The DSL code within your Sinatra implementation may look like this:

[ruby]
get 'product/laces' do
haml :show_laces
end

get 'product/shoehorn' do
haml :shoehorn
end

put 'order/shoppingcart' do
haml :cart
end
[/ruby]

In the above code, the words get and put may look like Ruby commands, but in reality, they're part of a filter that looks for HTTP verbs like GET, PUT, POST and DELETE.

]]>Eye-Catching Animations with GreenSockhttps://www.sitepoint.com/eye-catching-animations-greensock/
https://www.sitepoint.com/eye-catching-animations-greensock/#commentsWed, 19 Feb 2014 17:00:01 +0000http://www.sitepoint.com/?p=76455Eye-catching website animations can really grab attention and help increase conversions. Unfortunately, animations are never easy to create. Website developers spend many hours designing, reviewing, and revising their animations before turning them loose on the world. While many developers use the Adobe Flash platform to simplify the arduous task of tweening objects on a timeline, the lack of Flash support on mobile devices has many developers turning to JavaScript.

To support the increasing demand for JavaScript animation, software vendors have created some amazing development tools. One of these vendors, GreenSock, provides some very useful and mature tools for tweening objects and putting them on a timeline. These tools are mature because GreenSock is not new to this business; they have created -- and continue to create -- animation tools for Flash ActionScript, and they have ported these tools to support JavaScript.

In this article, I'll briefly describe the GreenSock tools for tweening and timeline construction.

A Brief Introduction to Tweening on a Timeline

Animation developers use "tweening" to fill in frames of animation between two points in time. (The word "tween" is derived from the word "between.") For example, when a developer wishes to animate a ball rolling from point A to point B, she need only draw a picture of the ball at each endpoint and let the computer fill in the frames between.

Animation developers use timelines to move their animations along. For example, the developer specifies precisely when the ball gets released from point A and when it arrives at point B. Additionally, the developer uses an "easing" function to govern how the ball accelerates and decelerates along its path. Easing gives the appearance that the ball conforms to familiar laws of physics.

Tweening on a timeline can get very complicated, especially when there are several objects moving around the screen, each with its own path, speed, and timeline. It gets even more complicated when revisions need to be incorporated after the design review. It turns out that it's far easier to revise tweens and timelines programmatically rather than graphically. In other words, instead of arduously redrawing frames with revision, you simply change some of the numeric variables.

The GreenSock Tools

There are four main animation libraries from GreenSock: TimelineLite, TimelineMax, TweenLite and TweenMax. The "Max" versions extend the "Lite" versions in an object-oriented way, providing more functionality at the price of a slightly larger file size. You can generally use these libraries for free; however, I recommend purchasing a licensed tier and becoming a part of "Club GreenSock." This provides you with the latest beta versions as well as some cool extensions. Also, your license applies to both the JavaScript and ActionScript versions.

The names of the GreenSock libraries are self-explanatory: The "Tween" libraries allow you to tween visible elements around the screen, and the "Timeline" libraries allow you create independent timelines on groups of objects. Note that an object can be a part of more than one timeline.

Let's look at a simple example to see how tweening on a timeline works with the GreenSock tools.

]]>https://www.sitepoint.com/eye-catching-animations-greensock/feed/1Visualizing Data with D3https://www.sitepoint.com/visualizing-data-d3/
https://www.sitepoint.com/visualizing-data-d3/#commentsFri, 07 Feb 2014 17:00:43 +0000http://www.sitepoint.com/?p=76167D3.js is a relatively new addition to the JavaScript toolbox. The three D’s stand for Data Driven Documents. You may have heard that D3 is just another JavaScript graphing library, but that’s only partially true. Indeed, D3 does produce excellent graphics, but its real value lies in its ability to respond dynamically to changes in […]