Friday, March 22, 2013
Pointers and Functions Pointers in C
Pointers gave me a huge headache while learning C, especially function pointers, so I wanted to share some YouTube videos with ya'll that helped me out a lot.
Sunday, March 17, 2013
LYNX the text-only web browser
Ever wish you could surf the web without all the annoying, distracting ads and pictures? You can with Lynx. According to Wikipedia, Lynx is the oldest web browser still in active development, it started 21 one years ago, way back in 1992! Its really great for obvious reasons, plus its lightning fast and quite easy to use.
Get it for Windows here: http://www.vordweb.co.uk/standards/download_lynx.htm
and follow the installation instructions provided on the site.
It's actually much easier to install for Linux users, simply open up the terminal and type:

A few tips:ENJOY!
Get it for Windows here: http://www.vordweb.co.uk/standards/download_lynx.htm
and follow the installation instructions provided on the site.
It's actually much easier to install for Linux users, simply open up the terminal and type:
sudo apt-get install lynx
Once you've finished, just type:
lynx
and it should start right up.
A few tips:
Type G to enter the URL of the website you like to visit
Press the left arrow key to go back one page
Press the right arrow key to go forward one page
Navigate through the page with the up and down arrow keys
Type H to view the help menu
Python Installation and First Program
If someone were to ask me which programming language to learn first I would say without a doubt Python. It is quite easy to learn compared to other languages and it is capable of creating nearly any type of program. So naturally, I am choosing to teach you Python on this blog. I will start with the the installation and then we will create our first program together.There are 2 current builds of Python, 2.7 and 3. For this tutorial series I am going to be used 2.7.
So first head on over to http://www.python.org/getit/
If you are on a Windows or a Mac just scroll down and download the appropriate build.
For Linux users, bring up your terminal, in Ubuntu the shortcut should be CTRL+ALT+T and type:
Okay once you are finished with that I want you to bring up the interactive python shell. For Windows users, you should be able to find it in your start menu. For Mac and Linux users, you should be able to open up the Terminal and type 'python' without quotes. You'll know once you are in the Python Interactive Interpreter because you'll see some text and then a prompt that looks like this:
In programming, like math, we store information in variables. So for example if I wanted to store the number 5 I would have to give it a name first, so I'll name it number. The format must be as follows, the name on the left and equals sign and then the value to be assigned on the right, like so:
Once I enter that in.. nothing happens! Well actually there is more going on here than meets the eye. Try this:
Ah, now we can see! It saved our number. Let's try a string (a string is what we call text in programming). In programming, it is traditional to create a 'Hello, World!' program for the first program. Which is basically just a program that prints 'Hello, World!.' Well let's change it up a bit, try this:
Open up a text file and save it as 'whatsup.py' and enter the following into the file:
Okay now let's test our first program. On Windows just double-click your file, on Linux and Mac you should be able to do the same. What happened? Can you guess why?
First we asked the user for their name and stored it in a variable using the function raw_input(). Then we concatenated the string using + signs. This is what we must do if we want to edit a string together with a variable. Try and experiment with this a bit in the Python Interpreter. First place a string in a variable and then try and concatenate it in a sentence. For example:
See the new text goes in parenthesis and the variable does not. If you have any questions or comments feel free to leave me some feedback!
So first head on over to http://www.python.org/getit/
If you are on a Windows or a Mac just scroll down and download the appropriate build.
For Linux users, bring up your terminal, in Ubuntu the shortcut should be CTRL+ALT+T and type:
sudo apt-get install python2.7
Okay once you are finished with that I want you to bring up the interactive python shell. For Windows users, you should be able to find it in your start menu. For Mac and Linux users, you should be able to open up the Terminal and type 'python' without quotes. You'll know once you are in the Python Interactive Interpreter because you'll see some text and then a prompt that looks like this:
>>>
In programming, like math, we store information in variables. So for example if I wanted to store the number 5 I would have to give it a name first, so I'll name it number. The format must be as follows, the name on the left and equals sign and then the value to be assigned on the right, like so:
>>> number = 5
Once I enter that in.. nothing happens! Well actually there is more going on here than meets the eye. Try this:
>>> print number
Ah, now we can see! It saved our number. Let's try a string (a string is what we call text in programming). In programming, it is traditional to create a 'Hello, World!' program for the first program. Which is basically just a program that prints 'Hello, World!.' Well let's change it up a bit, try this:
Open up a text file and save it as 'whatsup.py' and enter the following into the file:
#!/usr/bin/env python
yourname = raw_input('Enter your name: ')
print "What's up " + yourname + "? Welcome to Python!"
Next make sure you save the file, also make sure (this step is a MUST) that all your text in your whatsup.py program is aligned to the left margin, if not the program will not work. This is because in Python, spacing is used to separate various parts of a program (we will go into this more in a future post).
Okay now let's test our first program. On Windows just double-click your file, on Linux and Mac you should be able to do the same. What happened? Can you guess why?
First we asked the user for their name and stored it in a variable using the function raw_input(). Then we concatenated the string using + signs. This is what we must do if we want to edit a string together with a variable. Try and experiment with this a bit in the Python Interpreter. First place a string in a variable and then try and concatenate it in a sentence. For example:
>>> sometext = 'Bill'
>>> print "What's up " + sometext
See the new text goes in parenthesis and the variable does not. If you have any questions or comments feel free to leave me some feedback!
Google-Fu Part 1
Most of us use Google on a daily basis and as you know, sometimes the results can be overwhelming. There are a few simple tricks that can help us narrow our searches down that I'm going to share with you. This is possible using something called 'search operators.'
For example, if you want to search for something very specific, like where you would only want to return results that contain your keywords, you can encase the keywords in quotations. So say you wanted to search for hotels in Kansas City, you could do this:
The results that Google brings back will only contain those keywords you encased in the quotations. Pretty cool huh?
Okay, on to the next one. Say you want to search within a certain website, you could do this:
Can you guess what will happen there? You will be searching within the site textfiles.com for the keyword programming. You can also mix and match the operators to get more specific results. So if we were getting too many results we could type:
What about if you would like to search for a certain file type? Say PDF format with the file name being something like python programming? You could go about that like this:
All of these search operators are really great if you want to narrow down you search results in Google, or you are looking for something very specific. It is really great also for journalists who are looking for some particular information, or a student doing research. Really the applications are endless and once you get the hang of it, it will shave a lot of time off your internet searching. I hope this helps some of you. If ya'll enjoyed this leave me some feedback and I may just do a follow-up with some more advanced search operators. God bless!
For example, if you want to search for something very specific, like where you would only want to return results that contain your keywords, you can encase the keywords in quotations. So say you wanted to search for hotels in Kansas City, you could do this:
"Hotels in Kansas City"
The results that Google brings back will only contain those keywords you encased in the quotations. Pretty cool huh?
Okay, on to the next one. Say you want to search within a certain website, you could do this:
site:textfiles.com programming
Can you guess what will happen there? You will be searching within the site textfiles.com for the keyword programming. You can also mix and match the operators to get more specific results. So if we were getting too many results we could type:
site:textfiles.com "c++ programming"
What about if you would like to search for a certain file type? Say PDF format with the file name being something like python programming? You could go about that like this:
python programming filetype:pdf
All of these search operators are really great if you want to narrow down you search results in Google, or you are looking for something very specific. It is really great also for journalists who are looking for some particular information, or a student doing research. Really the applications are endless and once you get the hang of it, it will shave a lot of time off your internet searching. I hope this helps some of you. If ya'll enjoyed this leave me some feedback and I may just do a follow-up with some more advanced search operators. God bless!
Foreword
The aim of this blog is to teach programming to those who are interested. Most of the content will be oriented towards beginners but there will be some more intermediate/advanced/obscure stuff as well. There will also be quite a lot of stuff on here relating to Linux because it is my favourite OS and the one I happen to use most frequently.. I highly recommend it (namely Ubuntu if you're new to Linux). If you have any questions feel free to drop me a line.
Subscribe to:
Posts (Atom)