May 25, 2011

PHP 101! Hello, World!

Hey there everyone! You ready to get your first lesson in PHP? You bet your darn patooty you are! So you're here, you have an interest in the mystical land of PHP. But first, what in the world is PHP? PHP or Hypertext Pre-Processor is a very widely-used scripting language, practically developed for use with HTML. The meaning is in the name. Hypertext Pre-Processor, meaning that THIS comes BEFORE, THAT. And if you still don't get it: PHP is processed by the server before anything else. This opens up an incredible amount of opportunities for the PHP programmer! Of course this is all post-PERL but that's another story.

We have a very basic knowledge of what PHP is. Now we're going to learn how to use it! You're first program hooray! What you're going to need:

  1. Your favorite text editor(mine's TextMate); Notepad is a timeless classic.
  2. A server running PHP, XAMPP is great if you're into not paying for things!
  3. The ability to learn and study! Woo! Studying!
How about we get started already? I want you to open up your favorite text editor and type in these lines:

What do these do you ask? This is how you declare that you are writing a PHP script. These tags are the most important to any PHP programmer. Without them we are useless and all of our code will show up as text in the browser. Lets start by making our program say something:

Now, I'm not going to assume that you're an idiot. It's clear what this program does, but again we find ourselves asking "but Ditoway, why the hell are you making me do something this simple?" That's easy. This is your first understanding of the syntax of this programming language. First we have our opening tag <?php next comes the most common function in almost every programming language, the PRINT function. You can guess what this does. Yes. It print's the input you give it, in this case we give the PRINT function a string of characters wrapped in quotation marks and followed by a semi-colon. The semi-colon denotes the end of a general program statement.

Now I know at first this is all hard to understand, you'll have questions like "but why the less-than symbols and question marks? what's with the semi-colon". If you're asking yourselves these questions then you need to stop and re-read this entire post. I've explained it already. And if you still don't understand it re-read this fucking post. By now you know what we're talking about. So save that file as anything.php and move the file to your server or run it in your terminal if you know how. But before you do that try and guess the output.

If you got that right you're ready to move on to the next lesson. If you still have any questions leave me a comment and I will answer to the best of my ability. Thanks for reading and I'll see you next time!

Cloud9 IDE!!!

With that out of the way I'd like to tell you guys about an amazing IDE(Integrated Development Environment, for those less geeky than I) that I just happened to stumble upon deemed Cloud 9. By using this IDE you are required to use GitHub(a programming repository, a home for files basically) which is really awesome because this combination means you can edit your source code from any computer! I could go to my local library looking for books and maybe come up with a great idea and all I would have to do is log on to Cloud 9 and boom, I've added my idea.

It's exactly like using a desktop based IDE:

  • Hotkeys
  • Syntax Highlighting
  • There are even Themes for simulating different IDE's highlighting styles!
  • Debugging
  • In browser compiling!!!
And best of all it acts like an FTP program and automatically updates your Git repository! This is absolutely incredible and I recommend it to anyone. Sorry for the short post but I didn't have much time to get my thoughts down on... well, the computer. See you later!

May 22, 2011

Hello World!

Hey everyone! I guess this would be the post where I introduce my self and explain what I'll be using this blog for. In hope's to stay anonymous you can call me Dito [d-toe], and this, well, this is going to be my Haskell diary of sorts! A journal or story of my introduction to the mysterious and praised Functional Programming Language that is Haskell.

But first, a little background information. I'm a nineteen year old self-taught programmer from the Pacific Northwest. I've mastered PHP, XHTML, CSS, and Javascript. Beyond that I have a little knowledge of C and Actionscript. And so I thought, why not move on? And after a great deal of searching for a new language to learn I became obsessed with Haskell.

This blog will document my journey into becoming a fluent Haskell programmer. I will share my source code, explain what I've learned, basically give tutorials as I become able to. Please follow and if you have any questions to ask just post a comment and I will do my best to answer! Thanks for reading, catch you laters.