Note that this post is in context of building a web application.

Learning how to build a web application from scratch is not an easy undertaking. Certainly there is the actual task of learning how to program from the ground up that is challenging but I will warn you of the more subtle challenges you will face. Existing packages, libraries, frameworks and more are there to help you but can be a crutch. Understanding the trade-offs of writing your own library verse using a preexisting library is important. The second problem is knowing how to parse information you find online. People learn new things and love to share those things online all the time. Tutorials and screen casts will likely be plentiful, but beware that there may be holes in what you are learning. A fantastic example would be a basic tutorial on storing information to a database--it likely will not show you how to sanitize the data. In my opinion learning how to build solid web applications should then follow a basic formula to overcome these challenges: Learn the basics of web programming, pick up a framework, and then seek knowledge where needed.

Stay away from a framework in the beginning. Rails, Django, and other popular frameworks are absolutely essential tools for building web applications but they abstract a lot of the little things. Not understanding the little things can make debugging tricky. It can also lead to security flaws in your code. A good example of the little things includes parsing form input, interacting with a database, and routing traffic to its intended destination. Having an astute understanding of the building blocks will help you architect, debug, and develop solid web applications.

Once you are comfortable with the basics and could build a complex web application without the help of a framework you are paradoxically ready to use one. I suggest that your first framework be one that is highly popular so you can find tutorials and help as needed. Rails or Django are fantastic to pick up. Since you understand the basics you can then focus on using the best practices that these frameworks declare in their documentation to build a web application that can scale and is secure. You will not need to handle what will now be the mundane task of parsing form input or interacting with the database.

Now that you are comfortable using a framework you can seek more relevant knowledge that is applicable to what you want to do. Perhaps you are hoping to build a web application that shows real time updates for game scores and so you look into advanced AJAX techniques (or web sockets) for feeding the data to the user in a lively manner. Maybe you want to tackle something truly challenging such as converting m4a formatted files into mp3 formatted files. Programming really gets fun once you start tackling challenges that aren't quite as well documented. From here you will find the material more advanced, but with a solid understanding of the basics and a good framework to keep the basics out of your way you will be able to commit the mental capacity required to tackle the more challenging tasks.

In the end my advice is to have fun and work hard. Don't skip the basics, but understand that they are not the end point in programming. It is similar to learning calculus in mathematics. If you do not have a solid understanding of algebra you will struggle more than you need to. Build trivial things. Re-invent the wheel. This is how to best learn.

Best of luck!

TLDR: Pick a language, learn it, and then find a relevant framework and learn how to wield it.