Tutorials about HTML, CSS, PHP, Javascript, and Photoshop

  • Home
    Home This is where you can find all the blog posts throughout the site.
  • Categories
    Categories Displays a list of categories from this blog.
  • Tags
    Tags Displays a list of tags that has been used in the blog.
  • Archives
    Archives Contains a list of blog posts that were created previously.
  • Login
Ten20Five Editor

Ten20Five Editor

Ten20Five Editor has not set their biography yet

Welcome to part two of our series onbuying and running a successful franchiseIn this tutorial, and give you some useful resources for finding the best ones to invest in, we’ll take you through the steps involved in searching for franchise opportunities

Of course, Before you start your search, it’s important to have a clear understanding ofhow franchising works and whether it’s right for you

Assuming you’re clear on what you’re getting into and are confident that buying a franchise is the right move to make at this point in your life, it’s time to look for a franchise to buy

Drawing up a shortlist, from deciding on the type of franchise you’re looking for to searching for specific opportunities, So in this tutorial we’ll take you through the process, and asking for expert advice

By the end, you’ll be ready to go out and find franchises in your area with strong long-term prospects. You’ll still need to do some careful research before buying, and we’ll cover that in future tutorials in the series, of course. This tutorial is aimed at generating a strong shortlist for you to start investigating

Step 1: Set Your Criteria

Often, people let someone else choose their franchise for them. Or get approached by a salesperson, They get a particular opportunity recommended to them by a friend or colleague, and after a quick investigation they put down their money and get started, or see an ad

It’s important that you’re the one making the choice, While there’s nothing wrong with getting other people’s opinions. Even if you’ve had a particular franchise recommended to you, it’s still worth researching some others, so that you can make sure you’re getting the best deal

So start with establishing your own criteria for a franchise. Draw on the self-evaluation you did in the previous tutorial, and use it to define what sort of franchise you want to run

Franchising expertJim Coen recommends asking yourself which of these are most important to you:

  • Independence
  • Money
  • Freedom
  • Flexibility
  • Growth
  • Challenge
  • Variety
  • People

Look at your personal finances to establish the amount you can comfortably invest in the initial franchise fee and setup costs, Then. Just like any other business venture, it’s important not to over-extend yourself, As we mentioned before, because in a franchise, there will always be unexpected expenses no matter how well you plan. Leave yourself a cushion, so that you can survive a few setbacks without going under

And what risks you’re prepared to take, Think about how much money you want to make, how hard you’re prepared to work to make it. So decide whether you want a riskier business that could really pay off, Different franchises have different risk/reward profiles, or prefer to play it safer and receive a steady income. A fast-food restaurant that’s open from early morning to late evening every day of the week, Some franchises also require a big time investment—for example. Be honest about the hours you’re prepared to work, and how you’ll manage the commitment.  

Also consider your own interests. You’ll be spending a lot of time working at this franchise, so it’s great if it’s something you care about. For example, Some franchises are purely business opportunities—few people have a passion for convenience stores, and yet many people run them successfully. But if you have at least some interest in what you’re doing, it’ll make things much easier

Including at least the following:, The goal of this first step is to come up with a simple list of characteristics for the ideal franchise

  • Preferred type of business
  • Business size
  • Location
  • Any particular brands you’re interested in
  • Your budget
  • Amount of risk you’re prepared to take on
  • Hours you’re willing to work on a regular basis
  • Level of support you need from the franchisor

Step 2: Draw Up a Shortlist

It’s time to create a shortlist of actual franchises you’d be interested in researching further, When you’ve got a clear idea of what you’re looking for

But first start a spreadsheet, with your main criteria as columns, We’ll cover resources you can use to find these franchises in the next couple of steps, and space to add particular franchises as rows underneath

It could look something like this:

You can customize it, adding columns based on the criteria that you’ve decided are important to you, of course. The point is to have a place to capture all the information you’re about to find. There’s a lot of information available on the web and elsewhere, and it can become quite overwhelming. So whether you use this spreadsheet or another format, make sure you have a way of easily listing possible franchises and comparing their most important features. Your goal will be to come up with at least 10 franchise possibilities

Where do you find the franchises and the information you need to fill out your shortlist. We’ll cover that next

Step 3: Use Online Resources

And provide you with the data you need to start populating your shortlist, Online franchise directories can give you a good overview of major franchises available in your chosen industry

A great place to start your search isEntrepreneur’s Franchise 500 RankingsOr search by industry, You can either look at the overall rankings, or filter by characteristics like “low cost” or “fastest growing. ”

But remember that you have your own criteria, and they may be different from those used in the ranking, The rankings themselves are useful as an overall guide. So don’t feel compelled to shortlist only the top-ranked franchises. Drill down and look at the more detailed information in the profile of each franchise. And much more, You can find out how long each one has been in business, what kind of support is offered, what the setup costs are

The International Franchise Association also has a search page on its website.  Access their franchise directory In it, or conduct a more advanced search, by category or by investment amount, you can find franchises by keyword. Although not as much as on the Entrepreneur list, There’s also some basic information provided on each franchise.  

Some more useful than others, There are literally dozens of other franchise directories out there. Review a good list of some of the mostpopular franchise sitesAnd the criteria for listing each franchise, It’s a good idea to consider the motivation of each directory provider. You want to make sure you really are getting independent information

Either in general or in particular industries, Also look out for articles in the media about franchising. This piece inThe StreetHighlighting five top franchises and giving general advice and information on fitness franchising, for example, covers fitness franchises. Or this one inForbesLists the top 12 fast food franchises by single-store revenue

Keep in mind that there’s no shortage of information on the web, so your goal is not to findMoreBut to find more reliable information about the best ones, franchises. Stick to sources you can trust, and keep your main criteria in mind all the time. Concentrate on finding solid data that will help you fill out your shortlist, Instead of looking for recommendations about “hot” opportunities

Step 4: Check With Local Consultants and Brokers

Although you can do a lot of research without leaving your computer, it’s still worth going out and meeting people in your local area to find out about opportunities you may have missed

So you can probably find one happening near you, Franchise expos are held regularly in many different locations. These events generally provide training and seminars, along with the opportunity to meet franchisors

That many of the people you meet will be trying to sell to you, Keep in mind, though. It’s best not to make any commitments on the spot, no matter how attractive an opportunity sounds. View the expo as an opportunity to find new franchises to add to your shortlist, Instead, focusing on gathering information and asking questions

Another good option is to find a local franchise expert—a consultant or broker who can give you advice and help you find good franchises

Though, You need to tread carefully. Many consultants and brokers don’t charge any fees to potential franchisees, which can seem like a good deal. But remember that they’re getting paid by someone, and that may affect the advice they give. Often they get commissions for recommending particular franchises

The Federal Trade Commission’sConsumer GuideWarns consumers to be aware of the following:

  • Franchise brokers may offer a limited selection of franchises
  • That selection may be based more on their commissions than your own interests
  • Some brokers “may steer you toward a more costly franchise to beef up their own commission. ”
  • Promised earnings figures may be misleading

The bottom line: a truly independent consultant is a wonderful resource for you in helping you identify good franchise opportunities. Knowledge and connections, They can bring valuable experience. But just as with the web resources we looked at earlier, you need to ask about the motivation of any franchise expert you deal with. What’s their incentive, Who pays them, and what are their criteria for recommending particular franchises

Or seems too good to be true, particularly if the “opportunity” is presented as urgent, Again, gather information, but don’t let yourself be sold on anything at this stage

Step 5: Compare and Refine

By following these steps, you should easily be able to create a shortlist of at least ten possible franchises. In fact, you’ll probably end up with a lot more. But sorting through the mass of franchises you’ve found, Your problem at this stage may not be finding enough suitable opportunities

And try to cull the list to something manageable, So the final step is to review what you’ve gathered. In the next tutorial, you’re going to learn how to research individual franchises in a lot more depth. So you don’t want to be looking at dozens of different franchises, It will involve a significant amount of work

Go back to your initial criteria, and compare them against the data in your shortlist spreadsheet. Which franchises tick the most boxes. Be ruthless in weeding out anything that doesn’t quite fit

Your goal should be to reduce your overall shortlist to about ten names. Sorting the list in order of preference, so that you know which ones to start researching first, Also try to prioritize them

As you’re attending expos and reading articles online, it’s easy to get swayed by particular opportunities that weren’t in your initial thoughts, but sound too attractive to miss out on. Although it’s fine to be open to new thinking, it pays to evaluate every opportunity against the criteria you set out to begin with. But are they right for, Those new ones you heard about may well be excellent businessesYou

Next Steps

Both online and in person, In this tutorial you’ve learned how to find good franchise opportunities. So that you’re clear about what you’re looking for and don’t get sucked into something that’s not suitable, You’ve seen how important it is to start by defining your criteria. You’ve found some useful resources for generating ideas and finding the data to fill out your shortlist. And you’ve done a quick comparison of the franchises on your shortlist to keep them to a manageable number and prioritize them for further research

The next step is to look into those priority franchises in more depth. Do more digging, The information you’ve gathered so far is a good start, but you’ll need to ask lots more questions, and really get a deep understanding of the details of each business before you invest. You’ll learn how to do all of that in the next installment of our series onBuying and running a successful franchise

Continue reading

Several years ago, researchers at MIT confirmed through a study that fonts can impact how we feel: A bad font can make us frown unconsciously, while a good font can make us feel happy.

If fonts can influence our emotions, then they can certainly impact the user experience.

A few weeks ago, I decided to find out how much of an impact fonts have on UX.

Through a series of split test experiments, I managed to improve my site’s engagement by 38%. I did this by changing nothing but the font styling of the site.

Before I go into the details of my experiment, I want to first explain why fonts can have a surprisingly large power over how our users interpret our content.

How fonts impact our emotions

Fonts affect our emotions in two ways.

Cognitive bias

Firstly, we associate certain connotations to specific fonts and font styles. This, like many other things in our world, is often influenced by our cognitive biases and the culture we grow up in. For instance, sans serif fonts are commonly used on official U.S. government forms. But, in England, sans serif fonts are more commonly used by tabloids.

The context in which different fonts are used changes how we feel when we see them.

Take a look at the two screenshots below from my company’s blog, featuring a guide on building a WordPress site, set using two very different fonts.

Notice how the same content can convey a vastly different message depending on the font you use to present it.

Version 1: The site’s normal fonts

Version 2: Comic Sans font

The second version comes across as far less trustworthy and professional. This is not due to the curvature and spacing of the letters or any other typographic characteristic of the font. It’s due to the fact we’ve learned to associate comic sans with childishness.

Objective readability

On top of all that, some fonts are inherently easier to read than others. And the harder our eyes and brains have to work to interpret a piece of text, the worse we report feeling afterwards.

Serif fonts were originally used by the print press, as serifs are proven to help the eye move from letter to letter faster.

When computers were first used, computer screens had low resolutions. Serif fonts had to be created using vectors, which just didn’t look right with the low pixel-density available back in the days. So, early designers defaulted to using sans serif fonts, which were created as bitmaps.

Screen resolutions have come along way over the past few decades. We’re at a point where pixels are barely recognizable up close. As such, serif fonts liked Georgia are becoming more and more popular.

Experimenting with fonts

When experimenting with fonts, the first question I wanted to answer was, of course, which font is best for our website?

I ran an initial split test on one of our articles where I tested three different fonts: Georgia, Arial, and Verdana.

We measured the performance of each font by the number of clicks on the article, in combination with behavioral metrics like bounce rate and time-on-page.

Here are text-block snippets of the fonts we tested so that you may get a visual idea about the variants we tested.


Georgia font being tested for UX.


Arial font being tested for UX.


Verdana font being tested for UX.

I anticipated that Georgia would win (because of objective readability) and Verdana would lose.

While I was right in guessing that Georgia would be the winner, I was wrong about Verdana. In fact, the variation using Verdana generated 29.1% more clicks than our original font (Arial).

We also noticed that the variation using Georgia had a much better average time-on-page, indicating that our users were reading more of the article. This was also confirmed using heat maps.

Experimenting on font size

After confirming that Georgia was the best performing font for our site, I wanted to know what size the font should be to provide the best readability and engagement possible.

Reasonably, I expected the larger the font, the more readable it would be.

Wrong again.

First I tested 14px vs. 15px vs. 16px.

Using the same methods outlined above, it turned out that 14px generated the highest level of engagement.

Note: I also increased the line height by one pixel for every pixel increase in font size.

This was surprising, as I’d previously read studies such as this one on how larger fonts can increase the amount of attention a reader gives to the text she’s reading.  And, anecdotally, many websites that are considered highly readable are using fonts over 20px in size.

To double-check the accuracy of my results, I ran an identical experiment testing 10px, 14px, 18px and 21px.

Again, 14px won.

To me, this only suggests what every experienced A/B tester will tell you: What works for one person may not work for someone else. For our blog’s design, and the font we’re using, and perhaps even for the content we post, 14px seems to be the sweet spot.

How changing our font affected user experience

So, what impact did all of this work have on our website’s user experience?

After rolling out the 14px Georgia font across the whole website, we noticed that our website’s average bounce rate decreased from 88.0% to 80.9% — a 7.1% improvement.

Our average pages viewed per session also increased from 1.21 to 1.43, an 18.18% improvement, and our average time-on-site improved by about 10 seconds.

As with all things related to split testing, don’t take my word for it. Use a split testing tool like VWO or Optimizely to work out which font resonates best with your readers, and which one generates the most engagement for you.

Related Content

About the Author

Marcus Taylor is the founder and CEO of Venture Harbour, a digital marketing studio that develops and grows a portfolio of online businesses.

The post How Fonts Affect the User Experience appeared first on Six Revisions.

Continue reading

Date manipulation is one of those development hurdles that we all must jump at one point in our career, and great tools go a long way in taming the beast.

The Moment.js library is that tool for JavaScript developers.

Since discovering Moment.js, an open source project, I’ve used it religiously to simplify validation, parsing and manipulation of dates on the client-side.

In this tutorial, I’ll help you get up and running with this ultra-useful JavaScript date library.

What is Moment.js?

Moment.js is a free and open source JavaScript library that removes the need to use the native JavaScript Date object directly. The library is a wrapper for the Date object (in the same way that jQuery is a wrapper for JavaScript) making the object a whole lot easier to work with.

The problem with JavaScript’s Date object isn’t the functionality it brings; it’s just extremely cumbersome to use as a developer. If you want to do complex parsing, validation and displaying of dates, you’ll end up writing a lot of code.

Moment.js also extends native JavaScript date capabilities with a variety of features, such as relative time, calendar time, durations and multi-language support. It has a seemingly endless list of plugins that allow for additional features like time-zone support, recurrence and Twitter integration.

Tutorial Information

In this tutorial, we’re going to take a look at Moment.js. The following are the things we’ll tackle.

  • Referencing Moment.js and displaying basic date outputs
  • Displaying formatted dates
  • Parsing dates
  • Detecting invalid dates
  • Correcting invalid dates
  • Adding and subtracting dates

There are demo pages for almost all the sections of this tutorial that demonstrate the code being discussed.

Alternatively, you can download all the demo files associated with this tutorial as a ZIP archive.

Download All Demo Files

Let’s dive in.

Referencing Moment.js and Displaying Basic Outputs

To get started, you’ll need to download Moment.js and reference it in your HTML document. You can also find the library at cdnjs.com (a public CDN for open source projects). Just search for the library using the term "moment.js".

The first thing we’re going to do in this tutorial is to reference the Moment.js library.

Then, to make sure it’s working properly, we’re going to instantiate a moment object and a JavaScript Date object, and then output their values.

The following shows you how to reference the Moment.js library in your HTML documents, as well as how to instantiate and display the values of the moment object and the JavaScript Date object.

<!DOCTYPE html>
  <!-- reference Moment.js library -->
  <script src="//cdnjs.cloudflare.com/ajax/libs/moment.js/2.7.0/moment.min.js" type="text/javascript"></script>

<h2>Moment Date</h2>
<!-- container for Moment.js output -->
<div id="displayMoment"></div>

<h2>JavaScript Date</h2>
<!-- container for JavaScript Date output -->
<div id="displayJsDate"></div>

<script type="text/javascript">
  // instantiate a moment object
  var NowMoment = moment();
  // instantiate a JavaScript Date object
  var NowDate = new Date();
  // display value of moment object in #displayMoment div
  var eDisplayMoment = document.getElementById('displayMoment');
  eDisplayMoment.innerHTML = NowMoment;
  // display value of Date object in #displayJsDate div
  var eDisplayDate = document.getElementById('displayJsDate');
  eDisplayDate.innerHTML = NowDate;


View Demo 1

At this point, the code-lengths of both the moment and native Date object look on par.

Displaying Formatted Dates

Things between moment and JavaScript Date quickly change, however, when we want to output even a simple, human-readable date display with the format of ‘Y-m-d’ (e.g. ’2014-7-1′).

Using JavaScript Date, this would be our code.

// use JavaScript Date to display current date in a div (#displayJsDate)
var NowDate = new Date();
var months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'];
var sDay = NowDate.getDate();
var sMonth = NowDate.getMonth() + 1;
var sYear = NowDate.getFullYear();
var eDisplayDate = document.getElementById('displayJsDate');
eDisplayDate.innerHTML = sYear+'-'+sMonth+'-'+sDay;

Moment.js makes our code terser.

// use Moment.js to display current date in a div (#displayMoment)
var NowMoment = moment();
var eDisplayMoment = document.getElementById('displayMoment');
eDisplayMoment.innerHTML = NowMoment.format('YYYY-M-D');

View Demo 2

You’ll notice we had to add a lot of set-up code for our specific date format output in the native solution, and only a simple method called .format() in the Moment solution.

The string argument that we passed into .format(), which is 'YYYY-M-D', is the format that we’re asking the Moment.js library to return the date in. The Moment.js website has many format options conveniently listed in a table here:

Now that we’re familiar with the process of displaying and formatting the current date, let’s move on.

Parsing Dates

The Moment initializer will take a parameter and set the Date object to that date.

<h2>Output Date</h2>
<div id="output"></div>

<script type="text/javascript">
  var Date = moment('July 1, 2014');
  var eDisplayMoment = document.getElementById('output');
  // display output in the preferred format
  eDisplayMoment.innerHTML = Date.format('YYYY-M-D');

One detail to note is there’s no standard that browsers adhere to when parsing dates. Fortunately, the Moment.js library provides additional parameters that allow us to specify the exact pattern we’re passing in to help us avoid cross-browser inconsistencies.

For consistency across all browsers and platforms, the above code should be parsed like the fowlloing.

<h2>Input Date</h2>
<div id="input">July 1, 2014</div>

<h2>Output Date</h2>
<div id="output"></div>

<script type="text/javascript">
  // get the input date from #input div element
  var input = document.getElementById('input').innerHTML;
  // use moment() with input value and a string format pattern as arguments
  var Date = moment(input, 'MMMM D, YYYY');
  // display the parsed date in a div (#output)
  var eDisplayMoment = document.getElementById('output');
  eDisplayMoment.innerHTML = Date.format('YYYY-M-D');

View Demo 3

The Moment.js website has another table displaying the available parameters that we can use for parsing:

As the value we’re parsing is rarely entered by hand, it’s important to know that we’re actually parsing a date value.

Consider the input '2014-14-14' — this is an impossible date. In this case the moment() function will actually return the string 'Invalid Date' if you try to parse it.

However, there are additional tools available to us for detecting and correcting an invalid date values.

Detecting Invalid Dates

To detect an invalid date, Moment.js provides us with the isValid() method. It returns a simple boolean value (true or false), enabling us to determine the next course of action in our code logic in case the date value is not a valid one.

The other detection method available is invalidAt(). This method is more specific, it will tell us where our date value is invalid. It will return an integer between 0 and 6, the meanings of which can be found in the following table.

Integer Error location
0 Years
1 Months
2 Days
3 Hours
4 Minutes
5 Seconds
6 Milliseconds

So, in the example of '2014-14-14', the invalidAt() function would return 1 because 14 is an invalid month (only 1-12 are valid month values).

Correcting Invalid Dates

When would you ever be able to correct an invalid date? If you haven’t worked with dates at length before, this one might stump you. However, there are more variables at play than just the date itself: We must also consider how we’re getting the date and who is providing it.

Often, we ask people to enter dates and, despite our best efforts and flashy tooltips asking them to input in a specific date format like "d/m/y", they ignore our instructions and provide "m/d/y" anyways.

We can go back to the date-parsing call we made earlier and add a second parsing parameter (you can have more than two options) by passing in a string array of various possible date formats as a fallback.

Let’s use the date January 1, 2014 as our input example. We’ll input 14/1/2014 and 1/14/2014 expecting an input of D/M/YYYY.

<h2>Input Dates</h2>
<div id="input1">14/1/2014</div>
<div id="input2">1/14/2014</div>

<h2>Output Dates (1 format)</h2>
<div id="output1"></div>
<div id="output2"></div>

<h2>Output (multiple formats)</h2>
<div id="output3"></div>
<div id="output4"></div>

<script type="text/javascript">
  var correct = document.getElementById('input1').innerHTML;
  var incorrect = document.getElementById('input2').innerHTML;
  var Date1 = moment(correct, 'D/M/YYYY');
  document.getElementById('output1').innerHTML = Date1.format('MMMM D, YYYY');
  var Date2 = moment(incorrect, 'D/M/YYYY');
  // will display 'Invalid Date' in #output2 because input format is incorrect
  document.getElementById('output2').innerHTML = Date2.format('MMMM D, YYYY');

  var Date3 = moment(correct, ['D/M/YYYY','M/D/YYYY']);
  document.getElementById('output3').innerHTML = Date3.format('MMMM D, YYYY');

  // will try to parse using two potential date formats
  var Date4 = moment(incorrect, ['D/M/YYYY','M/D/YYYY']);
  // will display correct date format
  document.getElementById('output4').innerHTML = Date4.format('MMMM D, YYYY');

View Demo 4

You’ll notice that with just one string argument, if the input doesn’t match, you will output 'Invalid Date'.

However, if you provide an array of string formats as the argument, the first parsing option that works will be used. This is great for removing or anticipating possible user errors.

Adding and Subtracting Dates

One of my favorite features in the Moment.js library is it conveniently has date-manipulation methods, such as .add() and .subtract().

For example:

// current date
var Date = moment();

// add 7 days to current date
document.getElementById('currDatePlus7d').innerHTML = Date.add('days', 7);

// subtract 8 hours from current date
document.getElementById('currDateSub8h').innerHTML = Date.subtract('hours', 8);

// add 5 years and 3 months to current date
document.getElementById('currDatePlus8h').innerHTML = Date.add({years: 5, months: 3});

View Demo 5

The Moment.js library will handle edge-cases elegantly. For example, using the native JavaScript Date object, adding one month to August 31 will result in October 1. This same operation performed by Moment.js will correctly produce September 30.


Moment.js is an excellent tool to have if you regularly end up working with client-side date parsing, formatting and validation. It has plenty to offer in terms of speeding up JavaScript development in this area. To see the project’s source code, head over to its GitHub repository. To learn more about its features, check out the official docs.

Related Content

About the Author

Bradley Holbrook is a senior software developer for Click4Time Software Inc. He has been designing and developing web applications for over 15 years. Connect with Bradley via This email address is being protected from spambots. You need JavaScript enabled to view it. .

The post Working with JavaScript Dates Using Moment.js appeared first on Six Revisions.

Continue reading

Meteor is a full-stack development platform that makes it easier than ever before to build real-time web applications. This tutorial will get you up and running with Meteor in no time.

What is Meteor?

Meteor will enable you to build web applications much faster — even ambitious ones that seem like they were developed by big teams with big budgets — using nothing but JavaScript, CSS and HTML. And, what’s more, with Meteor, you’ll simply have more fun because it’s optimized for developer-happiness.

Originally known as "Skybreak" back in 2011, Meteor has since raised $11.2 million in venture capital, grown an active and dedicated community and has become "the hot new thing" in the world of web development.

Meteor did all that even before reaching its version 1.0 release (currently, it’s at 0.8.2, but the releases are coming big and quick).

There’s a lot to love about this web development platform, here are a few of them:

  • You don’t have to be a seasoned developer to make a start. If you’ve never made a web application before, Meteor is one of the easiest introductions to the craft, while still being incredibly powerful enough to be the only platform you’ll ever want to use.
  • Your web applications are real-time by default. In the majority of cases, you don’t even have to think about making your applications real-time. You work as you normally would, and the real-time features just happen. This means less code and shorter development cycles.
  • The community is extremely helpful. You won’t be left alone if you embark on your journey into Meteor. There’s blogs and books and screencasts and all the other sort of help you could possibly want.
  • Meteor is open source. A GitHub repo is available if you want to dive into its inner workings (or even contribute to its development).

If you’re not quite sold on the Meteor JavaScript framework yet, check out the official Meteor site and this popular tutorial screencast from the creators of Meteor.

Screenshot of Meteor front page.

A Meteor Tutorial for Beginners

In this tutorial, I’ll share an introduction to Meteor that anyone with a basic understanding of JavaScript can follow. If you know what "variables" and "functions" are, you’re good to go. If not, read this free online book first.

Especially if you’re a web designer looking to add "and developer" to your job title, this tutorial should act as a fun little nudge in the right direction.

In this tutorial, we’ll build a very rudimentary blogging app together. Doing this will allow us to explore the most powerful features of Meteor by way of a functional web app example.

Preview of the results of this Meteor tutorial.

View Demo

Let’s get started.

Step 1: Install Meteor

Note: The following installation instructions are for Mac OS X and Linux. If you’re on Windows, visit win.meteor.com to learn how to install Meteor. If you’re already familiar with command line interfaces (CLI), the following are just basic commands that you probably already know regardless of the operating system you currently use.

To begin, open the command line. On Mac OS X, this is the Terminal application. If you’re on Linux, the name of the command line interface can vary, but since you’re using Linux, I’ll assume you know what it is.

Issue this command:

curl https://install.meteor.com/ | sh

The command above will start the installation process. It’ll only take a few seconds and, just like that, Meteor is installed and ready to use.

Step 2: Create a Project

For every web application we develop, we’ll need to create a project.

But before we create a project, to keep things nice and tidy, let’s create a folder that will store all of our Meteor web applications.

Use the following command to create a directory named "Meteor" in your computer that will store all of your Meteor projects:

mkdir Meteor

Let’s navigate into the "Meteor" directory with the change directory command:

cd Meteor

Now we’ll create our first Meteor project. We’ll name our first project HelloWorld. Just use the following command:

meteor create HelloWorld

The command above will create a "HelloWorld" folder that contains three base files:

  1. HelloWorld.html
  2. HelloWorld.js
  3. HelloWorld.css

A Meteor app can grow beyond these first three files, but they’ll be enough for this tutorial.

Step 3: Launch Your Local Server

By default, our project contains some code for a demo application.

To see this demo application, move into our project’s directory:

cd HelloWorld

Once you’re in the HelloWorld project directory, launch the local server by issuing the following command:

meteor run

That command will now let us see our app through a browser simply by navigating it to the following URL:


You can use whatever browser you prefer, though I recommend Google Chrome because of the browser’s built-in developer and debugging tools, such as its JavaScript console which we’ll be using in this tutorial.

The default app template should resemble the following:

If you click the button that says "Click" it doesn’t seem to do anything. But something is happening though.

Chrome’s JavaScript console

Whenever you click on the "Click" button something is happening. To see it, in Google Chrome, go ahead and do the following:

  1. Click on the Menu icon (located at the top-right of the window)
  2. Hover over to the Tools option
  3. Select the JavaScript console option

Alternatively, you can press Option+Command+J (Windows: Ctrl+Shift+J) to open up the JavaScript console.

The JavaScript console is the client-side equivalent of the command line. This will be a powerful tool as you’re developing your Meteor apps.

The command line runs on the server (where the application is hosted) while the JavaScript console runs on the client (in the user’s browser).

With the JavaScript console open, press on the "Click" button again. You’ll see a message appear in the console with each press of the button:

JavaScript console showing a click event recorded by Meteor.

That’s the extent of what’s happening, you pressed the button, so it’s not so exciting.

We’ll be using the console again in this tutorial, so please leave it open.

Step 4: Create a Collection

Usually, this is where most tutorials would show how to create a user interface with Meteor, but I think it’s easier to start by talking about the database. It’s not as sexy of a subject compared to the UI, but it’s a more pragmatic one.

Meteor uses MongoDB by default, but there will be more RDMS options coming in the future.

MongoDB in itself is a huge topic, but it’s one of the easier databases to use as a beginner because there’s a lot of things you don’t have to think about (for example, it’s good at avoiding injection attacks by itself, unlike SQL).

We’re now going to use the database by creating a collection.

A collection is equivalent to an SQL table. For example, if we were making a WordPress clone, we’d create a collection for posts, a collection for pages, a collection for comments, a collection for users, and so forth. There’d be a collection for each type of data.

Let’s create our first collection: Open the HelloWorld.js file in your favorite code editor, delete everything in it and replace it with:

new Meteor.Collection('posts');

In this tutorial, we’ll pretend that we’re creating a blogging platform, so here, we’re making a collection named "posts" that will store data such as post titles, post contents and post statuses (i.e. whether the post is published or still a draft).

We do, however, need a convenient way of referencing the collection we just created, so we’ll amend our code by slapping an object name in front it. How about we call this collection, "BlogPosts"? Update the code block above so it now looks like this:

BlogPosts = new Meteor.Collection('posts');

Note: We’re intentionally not using the var keyword since we want this to be a global variable that we can access through all of our files.

Save our HelloWorld.js file, switch to your browser, and enter the name of the following code block into the JavaScript Console.


You should receive a response that confirms the collection exists, which is all we need for the time being.

Step 5: Manipulate Your Collection’s Data

Inside the JavaScript Console, enter the following:

  title: 'Hello World',
  content: 'Content goes here.',
  published: true

Note: Newlines and extra spaces in the JavaScript console are ignored, so the above can be written in one line. The formatting above is for readability.

 We just used the insert function to create a document inside our collection. A document is equivalent to a row in a SQL table. We’ll create a new document for each blog post in our web app.

It’s worth pointing out that:

  • We don’t have to design the structure of our collections. The structure is created on the fly. When we need a new field, we just define it.
  • We can mix and match data types. We have strings in the first two fields (title and content, but the third field (published) is a boolean field (i.e. it can only hold the value of either true or false).

So that we have data to work with in the next few steps of this tutorial, insert a few more documents (like 5 or so) into the BlogPosts collection via the JavaScript console using the same code block as above.Try to use different values for the title and content fields, and alternate between true and false for the published field.

Step 6: Retrieve the Data

In a moment, we’ll create a template that shows a list of blog posts.

Before we do that though, we need to create a JavaScript function that retrieves the blog posts from our collection.

In the HelloWorld.js file, add this code block below the previous one:

Template.listBlogPosts.post = function(){
  // code goes here

The code above might look weird and abstract to you, so let’s break it down:

The Template portion searches through all the templates in our project. We haven’t created a template yet, but we’ll get to that in a moment.

The listBlogPosts part is the name we’ll assign to our soon-to-be template. We can name our templates whatever we want.

The last part, post, is an arbitrary name for our function that we’ll soon reference.

Within the function block we created above, we write the code that will retrieve all the blog posts, like so:

Template.listBlogPosts.post = function(){
  return BlogPosts.find();

So now we have this function called post() and, within the post() function, we return the entirety of our BlogPosts collection.

We only want this code running on the client. Do do this, let’s wrap our code in an isClient conditional statement:

  Template.listBlogPosts.post = function(){
    return BlogPosts.find();

All code inside this conditional will only run in the user’s browser (and the rest of the code in this tutorial will be placed inside this conditional).

That’s all the database talk for the moment.

Let’s start delving into the so-called "magic" of Meteor: Templating.

Step 7: Create a Template

To move onto the design part of this tutorial, open the HelloWorld.html file, delete all of its content and replace it the following:

  <title>My Blog</title>
  <!-- code goes here -->

Notice that we didn’t use <html> tags, nor have we manually included any CSS or JavaScript files. This is because Meteor will do all this for us.

Beneath the code block above, let’s create our first template:

<template name="listBlogPosts">


If you save the file and switch back to the browser at this point, the template won’t appear. Why? Because we have to reference it, giving us complete control over where and when the template appears.

Between the <body> tags, write:

{{> listBlogPosts}}

When we use double-curly braces ({{ and }}), we’re using the Spacebars templating syntax that comes packaged with Meteor. Spacebars allows us to make our templates dynamic. The greater than symbol (>) is specifically used when referencing a template.

Step 8: Displaying Data

Inside our listBlogPosts template, add the following block of code:

<template name="listBlogPosts">
  {{#each post}}

Here, we’re looping through the data returned by the post function we created earlier. It lets us display a list of blog posts from our BlogPosts collection and the fields associated with each document. (In the code above, we’re showing the "title" field.)

To make our template look a little nicer, update our code above so it now looks like this:

<template name="listBlogPosts">
<div id="content">
  {{#each post}}
    <div class="post">
      <div class="entry">

Now we can open the HelloWorld.css stylesheet, write whatever styles rules we like, and they’ll all be applied to our template’s HTML elements.

Step 9: Retrieving Specific Data

At the moment, our app will display all of the blog posts from our collection, rather than just the posts that have the published parameter set to true.

To fix this, update the post() function from this:

Template.listBlogPosts.post = function(){
  return BlogPosts.find();

…to this:

Template.listBlogPosts.post = function(){
  return BlogPosts.find({ published: true });

In the above code, we’ve passed the published parameter into the find function, allowing us to retrieve only the published posts, i.e., all documents that have published: true.

Step 10: Create a Form

While we’re never going to build a complete blogging application in a single tutorial, we could at least build an Add New Post web form that will act as the interface for adding new content into our rudimentary blogging engine. Earlier, in Step 5, we added new documents in our collection through the JavaScript console, and now we’ll create an interface for this process.

First, create a new template in our HelloWorld.html file:

<template name="addPostForm">
  Title: <input type="text" id="titleField"><br />
  Content: <textarea id="contentField"></textarea><br />
  Publish? <input type="checkbox" id="publishedField"><br />
  <input type="submit">

There’s nothing remarkable about this form template. The only detail worth noting is that each field has a unique id attribute that we’ll soon reference.

Also, don’t forget to reference the following somewhere between the <body> tags so the user can see our form (just like with our listBlogPosts template in Step 8):

{{> addPostForm}}

To make this form do something, switch to our JavaScript file and, inside the isClient conditional, write the following:

  // code will go here

Here, we’re using the events function to attach an event listener to our addPostForm template.

Events are things like clicks, double-clicks, scrolling, mouseovers and form submissions. They’re things that occur when a user is navigating our web application, and we can write code that reacts to them.

In this example, we’ll create an event listener that is triggered when our form is submitted:

  'submit form': function(){
    console.log("Form submitted");

This is what’s happening with the above:

  1. First, we use the submit keyword to define the event type to watch out for. There’s a range of event types available, all of which can be found in Meteor’s official docs.
  2. Second, the form keyword references all the form elements within our template, so this is where we’re simply attaching our event listener to the one and only <form> element in our web app.
  3. Third, we associate a function with our form submission event, and it’s within this function that we write the code we want to execute when the ‘submit form’ event happens. In this case, a simple message that reads "Form submitted" will appear in the JavaScript console when the form is submitted.

There’s a problem though, since whenever we submit the form, there’s a slight flicker. This is because forms have a default behavior that we need to disable so it no longer interferes with our code.

To disable the form’s default behavior, update the code block above so it now looks this:

  'submit form': function(event){

Note: After updating the code block and removing the console.log() invocation, you’ll no longer see the "Form submitted" message in your console.

We’ve done two things:

  1. We’ve created a function argument named event that we can reference withing the 'submit form' function as the current instance of the event while it’s occurring.
  2. We used the preventDefault() function on the current event, which stops our form from behaving how it would usually behave.

With that housekeeping out of the way, let’s make our form do something useful.

Step 11: Getting Data from Inputs

The end goal is to have the data from our form inserted into the BlogPosts collection that we created earlier. To move us towards this goal, let’s grab the data from our form fields. This is a two-step process.

First, we pass another function argument into our 'submit form' function, which we will name template:

  'submit form': function(event, template){

We’ve added the template argument to allows us to search through the template that our event is attached to. In this case, we can search through the addPostForm template from within our event.

The second step of our process is to perform three searches. We can do this like so:

  'submit form': function(event, template){
    var titleVar = template.find('#titleField').value;
    var contentVar = template.find('#contentField').value;
    var publishedVar = template.find('#publishedField').checked;

The above invokes the find function that will search through our templates using their HTML IDs, i.e. #titleField, #contentField, #publishedField, as the references for the relevant input fields, and then pulling the values from them. We then store these values in some variables: titleVar, contentVar and publishedVar.

Note: For the third variable, publishedVar, the value will either be true or false based on whether or not the "Published?" checkbox is checked.

Below these statements, we use the insert function to move the data from our form and into the BlogPosts collection:

  title: titleVar,
  content: contentVar,
  published: publishedVar

At this point, the code should resemble this:

  'submit form': function(event, template){
    var titleVar = template.find('#titleField').value;
    var contentVar = template.find('#contentField').value;
    var isPublishedVar = template.find('#isPublishedField').checked;
      title: titleVar,
      content: contentVar,
      published: publishedVar

Now, the form should work as expected. When you submit data through it, it will automatically appear in our app’s interface as long as the "published" option is checked.


We’ve only scratched the surface of Meteor, but we’ve also covered the most essential core concepts that you’ll continue to use during your career as a Meteor developer.

Our final blogging application might not be particularly grand, but:

  • We wrote very little code in a very short amount of time
  • The application functions in real-time without us doing anything special

I hope you’re now at least a little bit curious enough to explore Meteor a little further. It’s an increasingly popular web app platform that has many great years ahead of it.

Related Content

About the Author

David Turnbull is the founder of Meteor Tips, a site that publishes tutorials about the Meteor JavaScript framework, and author of Your First Meteor Application. David’s been working on the Web since he was 12 years old. Follow him on Twitter @meteortips.

The post Getting Started with Meteor appeared first on Six Revisions.

Continue reading

You can never be too careful, When it comes to sensitive data like credit card numbers, user addresses or social security numbers. You have to ensure to your users that the information they provided to you is safe on your servers. In this article, I will show you how you can make your sensitive data secure. This part will focus on the lower levels of security, like network and the server

Picking the Right Service Provider

The first thing to consider is your service provider. The rules are the same, VPS or even have a dedicated server, It does not matter whether you are only using hosting

Avoid Supercheap or Free Offers

But there are few reasons why you should avoid these kind of offers when choosing your provider, This rule applies to almost every buy that you make. Going too cheap will cost you more in the long run than the more expensive options will, In this business. In terms of hosting, Or, your app could land on an overpopulated server with too much traffic on it

The situation is similar - you will share the machine with too many people, If it's VPS. On the other hand, cheaper dedicated servers will usually have questionable hardware. Not only does this mean that your users will have a bad experience, but that your applications will also be more vulnerable to attacks. When going the cheaper route, it's much easier to DDoS such machines and extract the sensitive data

Check Their Security

Try to contact them directly (calling them is the best option) and ask them, how do they secure your application and data, If the provider's website tells too little about the security. But as you are their potential client, so they will probably not tell you what model of the firewall they use (if they do, they will try to assure you that they do what they can to secure their clients' data, Of course some of the information may be confidential, run away - it means they will also tell that to the potential attacker). Here are a few questions that you should consider asking:

  • How many people besides you, will have access to the server
  • What happens to the disks that are replaced (do they recycle them or sell to someone)
  • Is it possible to request tape backups of your data
  • If so, who will have access to them

In Case of Disk Failure, Request the Broken One

These things just happen from time to time. Request the provider to send it to you, But when one of your hard drives fails and there was some sensitive data on it. As they are happy they don't have to deal with recycling, Some of them will send it for free. Usually much cheaper than the market price since it's broken, Some will sell it to you. It may seem weird to buy a broken hard drive, but when you realise that the informations about your users or clients may leak somewhere because of that drive, you will realize that it's worth the cost

Isolate Your Servers

Disable it), It's a good practice to unplug the Internet connection from servers that don't need them (a golden rule to server security - if you don't need it. Your database server's security will greatly improve if you will only allow access to it over the LAN from your other machine(s), For example. Of course this is an option, only if your servers are in the same hosting center. So it's really easy to switch back to development mode later), Some of the providers will do it for you if you ask them to (I've even seen such options in one or two web-based admin panels. If it's not possible, don't try to disable it yourself by messing up the network interfaces. From my experience, their tools will detect that your machine does not have access to the Internet and they will try to "fix" it for you

Update Your Operating System

As with all software, operating systems are prone to bugs. You should update your operating system when it's possible to avoid attacks that exploit such defects. Also make sure you are running a stable (avoid experimental builds at all costs) long-term support (LTS) version of your favorite operating system. You don't want to wake up some day and see that the version you installed a few months ago, just died and is replaced by something entirely new

Block Ports & Disable Unused Services

Everything that is enabled on your server is a possible security threat. So to minimize the risk of some of the services failing and exposing you to attacks, you should disable everything that you don't need. Depending on your operating system, there are plenty of tools available to accomplish this task. For exampleSysv-rc-confOn Debianmanual stanzaOn Ubuntu (and everything using upstart) andMsconfigIf you have to use Windows

The situation is pretty much the same with the ports. You should deny access on all ports but 80 (for HTTP traffic), In most cases (HTTP(S) server plus SSH access), 443 (for HTTPS) and 22 (or any other port of your choice for SSH). This will make sure that even if you install some faulty software, so make sure you check what you are installing, it will not be exploited by a potential attacker - more likely it will fail by itself and cause a lot of trouble. You really don't want to guess the names of directories after the flawed file manager goes berzerk and renames them to random strings (and that is one of the less painful accidents that may happen), Believe me

If you have multiple HTTP servers running on different ports (for example multiple Node. You should use, js apps)nginxApacheOrVarnishTo proxy the traffic from port 80 to the appropriate ports for all of your servers

Change Passwords Frequently

This may seem obvious, but many people forget to do it. They may hold back from wreaking havoc over your machine and just stay low-profile, The reason for this practice is that after someone successfully hacks into your system, silently downloading all of your data or waiting for the right moment to strike. Changing the passwords frequently makes his work harder. If you have other users connecting to your server, you should force them to change their passwords periodically. On Linux systems, this can be done with thePasswdCommand. Warning them about it seven days before that date:, Use this syntax to make the user's password expire in 14 days

Sudo passwd --maxdays 14 --warndays 7

Where>username<Is the name of the user that will have to change their password in 14 days. There is an article aboutpassword policy in Windows ServerOn Microsoft Technet

Disable Root Access

You should never allow someone to log in as "root" using SSH - this is a major security threat. If someone cracks your password using a bruteforce attack, it'sGame over


If you don't have any other user yet, create one using theUseraddCommand (if you just type it and hit enter there will be a nice wizard that will help you creating the new user). Now make sure you haveSudoInstalled on your system and type:

Sudo -V

Install it using, If you don't have itApt-get install sudoThen you can enable it for the user you have just created:

Adduser  sudo

Where>username<Is the name of the user you just created. Now edit the/etc/ssh/sshd_configFile. Find this line:

#PermitRootLogin yes

And change it to:

#PermitRootLogin no

Now restart the SSH service and you are good to go:

/etc/init. D/sshd restart


Disabling the Administrator account on WindowsIs described on Microsoft Technet. Generally it will be disabled by default, but you should check yourself, to be sure that is the case

Use an Antivirus

For some, but there are people who think they don't need an antivirus (AV) software on their server, this is obvious. So many time I've heard, "Hey, I'm running Linux, I don't need any AV - there is no malware for Linux!". Compared to Windows the number of malicious software is a very little number, Sure. But why would you compare. It's a fact, It exists. And it can infect your machine

Of course AV is not always needed and in some cases it may do more damage than it's worth. For example, if you allow your users to upload anything on your server, youMustUse such software. But if you are in progress of developing something and you test it on your server with AV on, it may be reported to be a virus and you may have a hard time figuring out what happened


To make your system perform better with antivirus software, you should exclude some directories from the scan. This is a tradeoff between complete security and maximum performance. There is a great article onwhat you should do with your AVOn Windows Technet. There is also agood one for LinuxOn Symantec Connect Community

Accessing Your Server

The way you access your server is also important. Here are few tips on how to access your server securely:

Never Connect From Public Hotspots

This is a common mistake. Never use a public wi-fi hotspot to access your server. You don't know who is running it - it may be someone who is just spying on everyone who is connected to the access point. Even if the owner of the hotspot is not such a person (for example in a very popular coffee shop), if it's not secured, someone else may be sniffing on everyone using it (man in the middle attack). Be cautious - if you were accessing your server using SSH before and now it has a different fingerprint (your SSH client should notify you about it) abort the connection and try to find another access point, If you really have to use a public hotspot to access your server (for example your ultra-important application went down). Different fingerprint means someone who is connected to your network intercepted your communication and is trying to trick you into sending him your password

Use Secure Connection Channels

Using FTP to upload files to your server is not a good idea. So if someone can intercept your communication, The data is not encrypted, he could change what you are uploading so instead of some patch to your app you will get malicious software on your machine. Always use SSH for shell access and SCP to transfer files (it's based on SSH). These protocols use strong encryption to avoid such incidents

Use Verified Software

Use software from official sources like your operating system's package repository or trusted software provider. Never download any software you use to connect to your server from suspicious websites - it may be infected and communication between you and your server may be sent to the attacker. Don't try to find precompiled packages for your system - it's safer to compile it yourself or look for an alternative, if your favorite software is provided by the author only as source code, For example

In Conclusion

Hopefully this article has helped you in protecting yourServerFrom attacks and malicious software. In the next part of this article, we'll focus completely on the third layer of security - yourApplicationItself. So stay tuned where I will show you techniques that you can use to protect your application from attacks and intrusions

Continue reading


Thank you so much! We are very happy with our new website. It is easy to use and all of our customers tell us, they love it.

Contact Us

  • 13245 Atlantic Blvd. #4352
    Jacksonville, FL 32225
  • 904-240-5823