Pages

Showing posts with label programming. Show all posts
Showing posts with label programming. Show all posts

Tuesday, October 30, 2012

PY-04: Solving Problems, Part 2

In the last post, I covered how decrementing functions can be useful for finding the solutions to simple problems, notably for finding a cubed root of a value, "x". However, it is important to note that while decrementing functions are sometimes the best call, they are not always so. Our next lesson covers another method, by the name of exhaustive enumeration.


Before we begin, please note that open and close brackets, i.e. "[" and "]" respectively, will contain raw code.

Exhaustive Enumeration

Summary

Exhaustive enumeration is a function for solving problems by which the computer exhausts possible options in a systematic way, so that it can find the correct one. This is what is known in the world of programming as a "brute force" tactic for solving problems, because of its straight-forward methods.

As computers are so adept at computing instructions swiftly, once outlandish ways to solve problems are now useful realities. An example of exhaustive enumeration in real life (albeit a watered-down version) would be finding which answers on a multiple-choice test question are not correct, and by process of elimination (exhaustion), we can come to the correct answer more easily.

Friday, October 26, 2012

PY-03: Solving Problems, Part 1



Programs are very useful for the purpose of solving problems. Many programmers know this potential of programs, and use it to their advantage. However, all is not so straight-forward in the world of programming and problem-solving; there are as many ways to go about finding a solution as there are stars in the sky (perhaps more!).

All in all, the method by which you code a program for finding the solution to a problem is up to the programmer -- you. That is why it is important to learn some of the basic ways by which one can arrive at a solution. Only after you understand these ways, can you move on to more complicated problem-solving.

Before we begin, please note that open and close brackets, i.e. "[" and "]" respectively, will contain raw code.

Decrementing Function

The first method is the decrementing function. A decrementing function starts with a non-negative value, which is decreased each time the program repeats the function's loop. The function will loop so long as the starting value is non-negative, but once it is equal to or less than 0, it will terminate.

Wednesday, September 26, 2012

Understanding HTML and its Importance

In my last lesson on HTML, I covered some basic tags by which to code a webpage. Here's an example of a simple page code using tags from that post:


<html>
                <h1>Example page</h1>
                <br />
                <p> This is an example page. A clickable link can be found <a href="code-buddy.blogspot.com">here!</a>
</html>

This is incredibly simple, and would not pass as a real website today, but it does show the basic way in which HTML really works. Tags are nested inside other tags, but that's not all; while not quite necessary, I have used separate lines and indentation to make it easy to read our code.

I do this because anyone (including myself) who will inevitably come along to alter the code for any reason will have a tougher time deciphering it if it looks like this:

<html><h1>Example page</h1><br /><p>This is an example page. A clickable link can be found <a href="code-buddy.blogspot.com">here!</a></html>

While its certainly not impossible to read that particular piece of code, keep in mind that coding can easily span hundreds of lines, very quickly. Many decent pages have so many lines of code it would be a screwy task to even try counting them all!

So, the point is, keep your code clean and clear, for both our sake, and yours! 

Wednesday, September 19, 2012

The Basics of HTML, or How to Build a Page in One Post

The Basics of HTML
or How to Build a Page in One Post

With any luck, you will have found that subtitle to be quite appealing to your sense of impatience (or, perhaps more appropriately said, your sense of urgency). After all, the seemingly monolithic task of building a webpage would be excellent to have delegated to just one post. In just several hundred words, you can learn how to build a page from scratch!

Now, here comes the 'but.'

But, that webpage is going to be considerably low-quality. That's because even most poorly designed webpages required quite a bit of knowledge, coding, and debugging (rinse, lather, repeat). In the most basic languages, with a relatively small pool of different elements and attributes, there are only so many different interesting combinations available.

However, a foundation is necessary to learn anything, and this is especially true of coding. Many codes require foundational knowledge to even begin learning, and programming in general will sweep you up if you do not understand these foundations.

So we start with HTML, perhaps among the most basic of common coding languages available today. The best part about HTML, save its simplicity, is that it is everywhere. HTML makes up so much of what you see on the internet that I guarantee you wouldn't recognize anything if it were gone.

Wednesday, September 12, 2012

First post, and introductions

I suppose this is the most appropriate time to make an introductory post.

I am a college student in the United States with an interest in computer programming/coding. Currently, I am still in the process of learning this fascinating and useful subject, but I am already quite enthralled by its magnificence.

Computer programming is important to everyday life in so many ways that it has almost become too easy to forget about. As many people around the world now know at least some bits and pieces of computer programming and/or code, appreciation for this integral facet of science has exploded, creating an exponential increase in interest over time.