Category Archives: Web Development

Web Development Tools, Tips and resources for beginner developers!

brackets-logo

Brackets – Code editor for web developers!

brackets-logoBrackets is a free and open source, cross-platform code editor from Adobe. It’s specifically designed for web developers. It’s written in HTML/CSS/Javascript.

There are lots of cool features such as live preview for HTML, quick edit, built-in support for css preprocessors etc And it’s dedicated for web development so if you write a lot of HTML5/CSS3/Javascript then you may feel more productive with Brackets. The UI looks clean and minimal.

brackets

Getting started with Brackets

If you want to try Brackets – debian package is available for Ubuntu. It’s under active development, so there may be some new features/changes coming into the next release, you should checkout their project page on Github.

Also checkout this video :

pycharm-ide

PyCharm – Free and Open Source IDE For Python

PyCharm is a new IDE from JetBrains, built specifically for Python developers. It has tons of cool features that may improve your productivity a lot. If you want to give it a try then you should checkout the video explaining some exciting features of PyCharm.

 

Read full list of features here

PyCharm is available (version 3 is available now) in two edition – One is community Edition (free and open source version) and the other one is Professional Edition with some extra features for web developers (supports Google App Engine, Flask, Django, web2py, CoffeeScript and other templating languages, Remote development, SQL and more).

pycharm-ide

Download Pycharm for Ubuntu / Linux

You can download the *.tar.gz package from here.

Installation is straightforward (extract the package and run pycharm.sh), but you need to have Oracle JRE (1.6+) installed on your system. (As the official manual says, OpenJDK is not supported, at least for now).

So, if you’ve tried PyCharm, please share your experience through comments.

What is DNS Prefetching ?

As the name suggests, DNS Prefetching is the process of resolving domain names, in advance.

Suppose a user is reading a web page, he(or she) may or may not visit a link, referenced on that web page but if he(or she) does, the next page can be loaded a lot faster if  it uses DNS prefetching – because it won’t have any delay due to DNS lookup (which may takes up few milliseconds to a second or more, depending on lots of factors such as latency and whether the result is locally cached or not).

How to implement it ?

To add DNS prefetching to your website, just add an extra link tag (in head, of course), in the following format :

<link rel="dns-prefetch" href="http://example.com">

You can also control DNS prefetching at page level, using the meta tag (off means no prefetching, change it to on to enable it) :

<meta http-equiv="x-dns-prefetch-control" content="off">

Does any browser support it ?

Mozilla Firefox and Chromium/Google Chrome certainly supports this feature (with compatible syntax, the above style works well for both browsers), I’m not sure about other browsers. (I think Safari and Opera do, but you need to make sure)

Ref : http://www.chromium.org/developers/design-documents/dns-prefetching

play-logo

Getting Started with Play Framework : Ubuntu/Linux Mint

What is Play Framework ?

Play Framework is a simple and powerful web development framework for Java/Scala. It’s very inspired from Ruby On Rails framework, so it’s like Rails, but for Java/Scala (initially it supported only Java, but now it also supports Scala (a programming language, very similar to Java, with some functional features, designed to be as a better Java)). Unlike other complicated java web development frameworks, Play is very simple and highly productive.

play-logo

Play is a lightweight, fast and highly scalable web development framework, with web friendly architecture and features (stateless, low resource consumption, reactive model based on Iteratee IO etc). So if you’re a Java/Scala developer, who want to develop cool web applications – then Play is a great choice for you.

Installing Play Framework

You must have Java installed (JDK 6 or later), read this tutorial on installing JDK in Ubuntu / Linux Mint if you haven’t already done that. When you’re done setting up java development kit, open a terminal and type javac to make sure everything is setup properly.

Download Play Framework

Download the latest version of Play (currently, it’s v2.1.0) and extract it to your Home Directory (it can be anywhere, but you should have write permission).

Set Path Variable for Play

Add the play to your path variable. Suppose, you have extracted the play framework to ~/packages/play-2.1.0 directory. Then open a terminal and type :

export PATH=$PATH:~/packages/play-2.1.0/

Now, if you type play at the terminal, you should have play command available.

play-command

Creating your first app

Now, you have successfully installed the play framework – Let’s create a simple application “TestApp” (it will simply say : “Hello Play”, not any useful, but you get an overview).

play new TestApp

Now, it will prompt for few questions (Application Name, Java/Scala etc), then move into the application directory and start the application.

cd TestApp
play

Now, you will have the play prompt, So you can run the application –

[TestApp]$ run

Open your browser and type the address http://localhost:9000, the default page should appear.

welcome-play-app

Now, open the file App/Controllers/Application.java in your favorite text editor (Emacs, Vi, gedit etc) or IDE (geany, Eclipse etc) and replace the existing return line (in index method) with this :

return ok("Hello Play");

Now, visit the address http://localhost:9000 (or refresh if it’s slready loaded) and you should see the “Hello Play” greetings. Yeah! our first useless app is running :)

hello-play

Recommended Resources For Further learning!

openshift

Heroku Alternatives : For Deploying Rails Applications

Heroku is a cool PaaS (Platform as a Service) for deploying Ruby on Rails applications. It has even a free plan to help you get started (although, it has issue though – often the dyno becomes idle, so I won’t consider it for any real world projects/experiments) but the problem is – as you need more resources, it can easily get quite expensive and slow(if you don’t overthrow more dynos). By the way, if you’re aware of the Heroku’s Routing Secret (causing horrible response time for Rails applications) then it’s the time to look for alternative options.

What are some good alternatives to Heroku ?

Heroku is a Platform as a Service, so it lets you concentrate fully on the application development, by taking care of the server administration stuffs. So, If you want similar experience then you should try Redhat’s OpenShift or Cloud Foundry.

openshift

1. OpenShift

OpenShift is a free and open source PaaS for deploying web applications (supports all cool frameworks such as Ruby On Rails, Sinatra, Django, Node.js etc). They also provide a free plan to get you started – with 3 small gears for free! (gears are resource units, each with some limited amount of RAM (512 MB) and disk space (1GB)). For Rails , currently supported databases are MySQL, MongoDB and PostgreSQL.

Deploying Rails applications is also very easy (checkout an example rails app demo on github).
Know More on OpenShift

2. Cloud Foundry

Cloud Foundry is another PaaS platform for deploying web apps, it’s an open and scalable platform, from the VMware. It also supports a number of frameworks and tools.

checkout Cloud Foundry Project for more details and you can find a Core provider for Cloud Foundry.

There are lots of awesome Cloud Foundry providers including AppFog.

AppFog – it’s a PaaS built on Cloud Foundry, they also have a free plan with 2GB RAM, 50GB bandwidth etc to help you get started.

About AppFog

If you need more control over the things, then IaaS (Infrastructure as a Service) may be best suitable for you. AWS(Amazon Web Services) is the best option for that (Google has also offered similar services such as GCE(Google Compute Engine) but it’s very new and lacks a lot of features).

3. AWS

AWS offers complete set of services for building highly scalable web applications. It has S3 (scalable storage), EC2 (virtual servers on demand), Block Storage, Cloudfront (CDN), Cloudwatch, RDS (Relational Databases such as MySQL), DynamoDB (NoSQL store), Route 53, VPC, SES (Email Notifications), SNS (Push Notifications) and lot of other cool services to help you quickly build, deploy and scale.

checkout AWS services and features

Recently, Amazon has also announced a PaaS service, based on the top of their existing AWS services – Elastic Beanstalk, with the aim of simplifying deploying/managing applications.

4. VPS

Virtual Private Server (VPS) is a good option for small or medium sized predictable web applications. You can easily setup Capistrano for automated deployment. Once the things are setup, VPS management is not so hard as it seems, especially if you got a reliable and awesome VPS provider such as Linode or Digital Ocean (plan starts at $5/mo with 512 MB RAM, 20GB SSD and 2TB Bandwidth, not sure checkout the review of digital ocean)

If you’re not sure, where to begin then checkout this guide about deploying Rails applications to VPS

5. Cloud 66

Cloud 66 is an Application Stack Management as a Service, it’s a platform for provisioning, configuring, deploying and managing your web applications. it allow you to easily deploy (to any infrastructure such as VPS, AWS, Joyent Cloud, Rackspace and more) and scale, so you don’t have to worry about your configuring/monitoring your servers anymore. You also get a free plan to try (includes deploying to 1 server).

Cloud 66

Thank You for reading so far :) Checkout my recent fun projects  created using sinatra : this one on jumble and other one for generating funny slogans (fun weekend projects)

Learning Rails ?

Check out this interactive video course on Ruby on Rails at Treehouse.

Update #1. Fixed some typo.
Update #2. Added AppFog.
Update #3. Added Cloud 66.
Update #4. Added more details about OpenShift gear