60: The Code Igniting Karmic Koala
2009-12-13
Download MP3 For Geekons Episode 60
Pop-Up: Ubuntu 9.10
- Well, it has been about a year since I reviewed Ubuntu, which means two new versions have come out!
- You have been spared the 9.4 review, but let's talk about the Karmic Koala.
- Preface: I am only using 64-bit operating systems unless otherwise noted, Ubuntu is no exception.
- Installation
- Fairly simple if you use your whole hard drive
- Moderately simple if you use the remaining portion of your hard drive
- Still a little annoying if you want to use only a small portion of the free space on your hard drive
- Boot
- Faster boot time than previous (each version is faster than the last)
- Elegant glowing Ubuntu logo during pre-boot
- equally elegant progress bar and wallpaper while loading the final steps.
- Shut Down
- holding down the power button for a manual shut down might take longer...
- really, once you confirm you want to shut down it can't be longer than 5 seconds...
- hope you saved everything!
- Usage
- All the standard apps are there by default: web, office, email, etc.
- Improved device support (once again an incremental improvement for each version)
- MUCH better wireless network management built-in!
- Better methods of choosing default audio hardware, but still feels kludgey and would definitely be confusing for a novice.
- Restricted (closed) drivers and software such as video card drivers, Adobe Flash, and Sun Java are all very easy to install and update.
- Updates are automated as usual.
- Acquiring software is much smoother and user-friendly in the new "Software Center" that replaces the "Add/Remove Applications" utility.
- 3d effects are simple to activate (and partially enabled by default when hardware acceleration is present), but the config utility still isn't included by default... weird!
- Software
- Basically the same software as always, but with newer versions.
- Pre-Release of Inkscape!!! Normally Ubuntu waits until several months after an Inkscape release, but this time they are ahead of the curve and it works great!
- Firefox 3.5 pre-installed
- Adobe Air works... sort of...
- Google Chrome (beta) works, but has some odd quarks here and there.
- General Speed
- Surprisingly, I've gotten used to 64-bit Linux and other than startup and shut down I don't feel a huge difference.
- Microsoft has done something sneaky somewhere to cheat, but I now prefer Windows 7 64-bit because it is faster than Ubuntu 64-bit!!?!
- Much faster than 32-bit windows operating systems.
- On-screen animations are very smooth and fluid.
- 4 out of 5 stars, Ubuntu is a mature desktop Linux distribution, which means it is rock solid and supports tons of hardware, but it also means they should have been able to do something to compel me to move from Windows permanently by now, and flaky Adobe Air support and confusing audio settings just make it a hair too annoying to use over Windows 7...
Geek-Tweak: How to write MVC PHP with CodeIgniter
- Ruby on Rails has brought the MVC code patterns into the spotlight, making several web developers very happy.
- Fortunately for us PHP developers, there are TONS of framerworks for us that use MVC in a language we already know!
- CodeIgniter is simply one of many of these frameworks. (Symfony being the most popular, CakePHP being the highest in Google searches, and at least 10 others that have been adopted by several large websites.)
- I chose CodeIgniter because of simplicity, and because I read a tutorial about it when researching the Doctrine ORM.
- So what is an MVC and ORM, and why should I care?
- ORM
- ORM stands for Object-Relational Mapper
- ORMs handle all of the SQL so you just handle objects
- Easily create, modify, and maintain large databases without ever touching SQL.
- Incredibly ideal for storing data you can think of as objects with attributes.
- A topic for a future Geekons episode, since codeigniter doesn't even come with an ORM.
- MVC
- MVC stands for Model, View, Controller
- MVC is a code design pattern that can be implemented in several languages.
- One primary goal is to separate data from display from business logic.
- Model = Data (think database layout/schema)
- View = Display (think actual web page that displays content)
- Controller = Business Logic (think the script that pulls data from the Model, decides what to do with it, and then crams it into a View)
- So how do I make use of all of this?
- Install CodeIgniter on your webserver (tutorials available on their website)
- Extract the system folder to a local folder on the server (not accessible from the web)
- Edit the index.php file to point to that folder
- Edit the config.php and database.php files from the config folder with your server's settings
- Make a database (I use MySQL managed with phpMyAdmin)
- Make your models
- Models are basically custom PHP classes you make that interact with your database.
- All database activity should happen in your model.
- You can use the Active Record instead of SQL to select, insert, and update data in your database.
- You might have a blog model that does all your add/edit/retrieve functions, and another authentication model that handles all your users and groups
- Make your views
- Views are traditionally the HTML content of your site with PHP variables that have all the dynamic content (if any).
- I love to make template views and use variables to choose what CSS files, JS files, and content files to load.
- Make your controllers
- Controllers are basically the brains of the operation, these are the files that actually get run when you access a URL on your website.
- When you type in yourwebsite.com/blog/about then codeigniter loads the blog controller and executes the about function.
- The about function might pull some data from the database by loading your blog model and executing one of those functions. Possibly: $this->blog->get_about();
- After it grabs the data, it loads the "about_us" view and passes it the data it found in the database.
- Controllers should handle all of the server-side logic that determines what data to retrieve or insert, and what to do with that data.
- If you wrote a page that allowed people to post blog entries on your website, the controller would check to make sure they have permission to post, might add a few details for the database based on who is posting (such as flag the entry as a guest entry), and would then call the proper Model functions to have the data inserted.
- Depending on whether or not an insert is successful, the controller might also display a success or error message by calling the appropriate view and sending it some details.
- Controllers are basically the brains of the operation, these are the files that actually get run when you access a URL on your website.
- Wrap your head around how URLs get sent to controllers
- If I had a folder inside my controller folder called "blog" and then had a file with a class in it called "entries", and that entries class had a function called "view" that accepted the argument $entry_id, then I could execute that by going to yoursite.com/blog/entries/view/1 to view the first entry.
- Obviously you would want to consider this when creating your controllers, because you want a website that is flexible but simple.
- You can also override how codeigniter routes things in the configroutes.php file.
- Add some finishing touches
- I always make my URLs look a little nicer by removing index.php from them using the rewrite script found at http://codeigniter.com/user_guide/general/urls.html
- Make an awesome website using codeigniter and send a tweet to @geekons for me to check out and mention on a future episode!
- Install CodeIgniter on your webserver (tutorials available on their website)
View-Source: A spiritual guide to programming
- We just learned about the MVC code patterns, which is a great way to write a large software application.
- If you listened to this podcast and decided not to use MVC code patterns, then the result would be code that is more difficult to manage and expand on in the future.
- God's word also maps out several patterns, but His are obviously more than just for software development, they are for life in general and are designed to help us worship and serve Him.
- He gives us specific guidelines on how to handle situations, how to break free from sin, and how to serve Him best.
- In Matthew 7:24-27 we are told about the popular story of two men who built their house, one on a rock and one on sand. The house on the rock withstood storms and the house on the sand was demolished.
- The first guy, we'll call him Frank, listened to the MVC code patterns from God and wrote his software based on a strict obedience to the guidelines. Throughout the years as his client's business changed he was able to quickly modify the controllers to fit the new business models without having to change the views or the database too much.
- Frank got raises and could afford all the remote controlled helicopters he could ever want.
- The second guy, we'll call him George, listened to the MVC code patterns from God. Yup, George was sitting there right next to Frank in church listening to God's programming practices.
- George decided he could more quickly write all of his program in one huge script instead of following God's patterns. It really was faster and easier! George got a bonus for finishing his client's work early.
- Then George's client decided he wanted one small thing to be changed, and now George had to rewrite all of his code, and he couldn't figure out where to change it so he got fired and now has to save up for the newspaper to make paper airplanes.
- Obviously God's life patterns are more important than simple programming patterns, and the consequences are infinitely more severe.
- Just because we hear God's word and learn it, doesn't mean we please God. He wants us to actually put it into practice.
Key Verses: