Posts Tagged ‘tech’
Mar
Deploying Sinatra on Passenger
by joe in tech
We often make use of the great Ruby micro-framework Sinatra in our daily work. It’s a great way to Ruby-ify a site when you don’t need all the bells and whistles that come with Rails. To deploy a site with it though, I had to do a little bit of research, and finally came up with this small Rack recipe that I hope might help out someone trying to do the same.
require 'rubygems'
require 'path/to/sintra' # I often vendor it inside the app folder with a path like 'vendor/sinatra/lib/sinatra.rb'
set :public, File.expand_path(File.dirname(__FILE__) + '/public') #Include your public folder
set :views, File.expand_path(File.dirname(__FILE__) + '/views') #Include the views
set :environment, :production
disable :run, :reload
log = File.new("/path/to/log/files/sinatra.log", "a") # This will make a nice sinatra log along side your apache access and error logs
STDOUT.reopen(log)
STDERR.reopen(log)
require 'app_name'
run Sinatra::Application
Thanks to John Nunemaker and Chris Schneider for the reference!
Mar
Web Tech Words Explained
by joe in tech
In the tech industry, with the amount of tech words and acronyms flying around, it is pretty easy to lose track what people are even talking about. So we thought it’d be nice to explain some of the major ones that cause confusion to our clients from time to time.
What is HTML/CSS?
HTML and CSS are the two languages that describe to your web browser how a page should look. Neither HTML nor CSS are true programming languages with loops and commands, rather they are just markup languages that just define the layouts and styles of a web page. When you access a web site, your browser receives HTML/CSS code, analyzes it, and displays the page elements according to the code. So for instance, if I coded some text using the <strong> tag to bold some text, like this:
<strong>bold</strong>
A person viewing the page would see the text show up, like this:
bold
Every site must eventually be put into HTML/CSS in order for the web browser to display it correctly.
What is JavaScript?
JavaScript is a powerful scripting language designed to make websites more interactive. It’s built right into most web browsers, so it doesn’t require any extra installation. JavaScript is great for running small scripts within your browser to save from having to make a separate request to the server. This results in faster interaction between the site and the user, as well as less requests to the server. We often utilize JavaScript in our sites to help validate forms, pull information to and from the server, and a few visual effects.
What is AJAX?
Along with JavaScript, you may hear AJAX come up from time to time. Many people think that AJAX is its own language, but in fact, it is just a feature of JavaScript. In fact, AJAX stands for “Asynchronous JavaScript and XML”, so you can even see “JavaScript” in it’s description. But what is it exactly?
Here’s an example. Often you might come across a form on a site that you need to submit. So normally, you might:
- click the submit button
- the browser contacts the server and send your information over while you look at the hourglass icon on your mouse cursor
- the server receives the information and processes it
- the server generates a response and sends it back
- the browser refreshes, taking away control from you and loads a new page containing the response while you wait
This whole process might take from 5-10 seconds normally, but no one likes to wait. Can’t we make it faster? Enter AJAX. What AJAX allows a site to do is cut out the waiting part. With a form using AJAX, the same processes are run, but in the background. That means the hourglass icon and the page refresh are eliminated, giving control of the page back to the user. So with AJAX the process becomes:
- you click the submit button
- all requests are handled in the background, allowing you to still interact with the website.
What is Ruby?
Straight from the official Ruby website “[Ruby is] a dynamic, open source programming language with a focus on simplicity and productivity. It has an elegant syntax that is natural to read and easy to write.” We love Ruby because even with it’s simple and elegant coding style, it packs a lot of power within fewer lines of code than many other scripting languages. We often use Ruby in the backend code to handle most of our custom web applications and for a few normal sites that just need a little extra power in them.
So what is Ruby on Rails then?
Ruby on Rails, often just called “Rails”, is a web application framework created in 2003 by David Heinemeier Hansson. A web application framework is essentially a codebase that is designed to help alleviate the common problems associated with web development. Rails provides a developer with well tested database access, session handling, and templating libraries, letting us focus on creating the actual site. This tends to speed up development time, and, combined with Ruby’s powerful and elegant syntax, creates easy to maintain code for the future.
What is PHP?
PHP is another open source scripting language, in fact, it is considered the most used language for server side scripting. PHP is very flexible, and due to its wide support in the web development community, it’s very easy to deploy in most server environments. We use PHP in the backend code for a few sites as well, just like Ruby. Both Ruby and PHP have different advantages and disadvantages, so we often decide which to use on a per project basis.
What is SEO?
SEO is short for “Search Engine Optimization,” or essentially “Ways to get your site to rank well in Google, Yahoo, and other search engines.” Google, Yahoo, and others keep their ranking algorithms a secret, but over time, certain patterns have emerged that indicate more or less how a search engine bot judges your site. For instance, sites that are constantly updated with rich content and news tend to be ranked better than sites that just sit statically; or having a quality site link to your own can give a nice ranking boost for your targeted keywords. However, as the search engines are constantly refining their algorithms, SEO tips and tricks are constantly changing.
Well hopefully this clears up a bit about a few of the technologies we’re involved with everyday. We can’t touch on every one though, or the post would be far too long to read, so we’ll save those for future posts.