Articles

Looking for good intro programming training and theory

Thursday, 6 December 2007 @ 16:11

So I understand the basic of HTML, the concepts of CSS (even if I am still a newb that can’t write it from scratch) and a master of design (;)). But Wade suggested I get some good intro theory training before diving straight into PHP.

Does anyone know of any good online courses or materials available for such a venture?

DefCon 15 Report

Wednesday, 8 August 2007 @ 11:09

It’s that time of the year again when hackers of all types get together for their annual celebration of discoveries made throughout the year. We call this DefCon, and every year, new exploits in software and hardware are released to the public.

I had the opportunity to attend the conference for my sixth year there (for the 15 years it’s been held now) along with more than 8,000 other hackers at the Riviera Hotel & Casino in Las Vegas, Nevada. Presentations were given on about 120 different subjects ranging from drive reanimation to international information warfare. More than $15,000 was raised to support the EFF. Breakout sessions were held for two full days on both wireless WEP and WPA cracking as well as lock picking.

Contests are also held every year including the infamous Capture the Flag contest designed to find the best team of network and server security gurus that runs continuously from the beginning of the conference to the very end. Hacker Jeopardy provides a test of knowledge of both technical details as well as political and related events. More than 10 other contests are also run including WarDriving, Lock Picking, DefconBots (build an automated robot to accomplish a specific task in the shortest amount of time possible), and a Mystery Box Challenge (you have no clue what you’re up against until the competition starts).

Highlights from this year’s conference included:

Selecting a few unique, random array items by shuffling keys

Sunday, 15 April 2007 @ 20:42

MGeary helped me clean a complex function—containing many lines and loops—up into four concise lines by utilizing the shuffle function. I thought that I would posted it here in case it helps anyone else. I was trying to randomly select five unique items from a multi-dimensional array and although I had achieved the results I wanted, his suggetion allowed me to shorten my code considerably.

$howmany_want = 5;
$author_keys = array_keys($authors);
shuffle($author_keys);
$author_keys = array_slice($author_keys, 0, $howmany_want);

OWASP’s WebScarab

Monday, 26 February 2007 @ 10:15

I’ve been using WebScarab for a while now, and thought I’d share it with those who aren’t familiar with it.  It’s a web security analysis application written in Java.  It has numerous included plug-ins with the standard install, including a spider, parameter fuzzer, session analyzer, HTTP/HTTPS interception/mangling, and much more.  OWASP once again proves their skill in creating a extremely useful tool.  Check it out!

PHP and the “@” Operator

Sunday, 7 May 2006 @ 16:56

I’ve noticed some confusion of late about the “@” operator and what it does and doesn’t do. To try to clarify this, I’ve written up a quicky article explaining some of the “@” operator’s nuances and provided some example code. Please comment if you find I’ve mistaken something. Enjoy!

Great Article on Dovecot

Thursday, 6 April 2006 @ 17:02

Here is a great article on setting up a secure imap/pop3 server with Dovecot. After using Courier for a while I moved to Dovecot after a few conversations with some guys on #utah and dataw0lf. Since then i have never looked back!

Read the article @ Linux.com

CodeIgniter: the PHP answer?

Monday, 20 March 2006 @ 6:32

We all like the productivity of Ruby on Rails but most PHP frameworks don’tseem to be quite right—some are too complex, some not stable enough,some not supported by ISP’s, etc. I’ve now tried most of them and myconclusion was to follow the “stupidly simple MVC” series to just writemy own code in a simple way but with some structure.

But I noticed several posters to that blog series mentionedCodeigniter as a great way to go with sort of the same philosophy.And today it was mentioned on Planet PHP. So I checked it out today, Wow!—it is really, really nice.

CodeIgniter is quite simple, nothing we couldn’t do ourselves butsomeone else has done all the coding. It follows some Rails MVCmethodology, but in a much more simplified way. And simple is reallygood because it gives flexibility which is the big advantage of PHP.CodeIgniter is very new, just released a few weeks ago.

For example, the main author is not finished with his active recorddesign so he only has support for MySql (and we usePostgrsql). But the framework is so simple, I can work around that fornow with skipping the active record stuff and just using standard dbcalls. (I can simplify that later when they finish the db architectureand add postgres support). The new Zend framework also takes the simple route too, and might also be a great answer but this approach seems even simpler.

Check out the codeigniter website�they seem very professional�the documentation is very good (great movie tutorials). Even the quality oftheir forum page is very good (apparently their cms product is verygood). I’m initially really impressed by this. I’m going to try it outtonight.

Valid XHTML re-code case study

Monday, 28 November 2005 @ 6:22

A gentleman popped into our IRC channel this evening asking for some help writing some HTML. He was having a hard time aligning some badges at the bottom of a column. Being all hopped up on birthday cake icing, I accepted the opportunity to write some code for the fun of it and recoded his page. I present to you now a case study in composing valid XHTL and good layout. In the process of exemplifying a possible solution to this man’s problem, I would like to illustrate how simple, lean, and user-friendly proper, valid code can (and definately should) be.

View original code. | View my code.

Now, if you attempt to validate the authors code, you will notice that it actually almost validates. So, what is the problem? Why didn’t I simply align his badges at the bottom of his column and move on? I will not take the time to critique his code completely here, but will offer the following general observations instead:

  1. tables should not be used for layout
  2. code should be lowercase
  3. indentation and tag pedigree should be visually logical and consistant
  4. it is 2005, there is no reason that all code shouldn’t be at least XHTML transitional
  5. style declarations should be contained within an external style sheet
  6. good code should not just be legible; it should be beautiful

Creating objects (4 of 5)

Monday, 18 July 2005 @ 15:59

In the previous three object oriented programming articles written for jacwright.com, we introduced object oriented programming, spoke of thinking about a system object oriented, and discussed the importance of planning, even if only in one’s head. The next two articles, Creating Objects and Reusing Objects, delve into the meatier subject of writing objects. We will be discussing how to implement the plans we’ve made and the systems we’ve conceptualized. Without these principles, object oriented programming can become a mess instead of a blessing.
Encapsulate, Encapsulate, Dance to the Music (lyrics)

Encapsulation means keeping your business to yourself. Objects can’t be bothering others with their issues. Other objects have their own stuff to worry about. When we create an object it needs to have methods for other objects to speak with it, but it should rely on others as little as possible. There are two terms we use to describe how encapsulated an object is: “black box” and “white box”.

Black box describes an object that is completely encapsulated, closed up, secretive. We don’t know anything that’s going on inside of this type of object. We also can’t see anything inside it. We must ask it for anything and everything we want to know about it. For example, a black box object has “getters”? and “setters”? to access it’s properties. A getter or setter is simply a method that returns the object’s properties. So instead of looking at the object’s properties directly, we must request the properties through these methods.

White box describes an object that is not quite so into security. It doesn’t care if other’s know what it likes for breakfast or it’s favorite color. Often we access it’s properties directly. It may also require us to know more about it in order to use, making it not as easy to use. It may be more needy than a black box object, wanting us to find out about it. We may need to pass it’s properties around to it’s methods and/or call several of its methods to accomplish one task.

It’s Not Just Black and White

Although these terms, black box and white box, help give us a way to describe objects, it’s not so black and white. There are varying shades of gray in between. But black box is best, right? Well, again, things aren’t so simple. Writing a black box objects means that we need to take more time to write it’s getters and setters and make sure only necessary methods are publicly accessible. White box objects can be quicker to build and give us more control over the object. They also don’t have to be written to be needy. Black is generally more user friendly (because we don’t need to know more than we have to) and white is generally more flexible (because we have more control outside the object).

When is a good time to use black box, and when should we use white box then? Good question, glad I asked. If we are creating an object that we will be releasing to the world, or an object that is going to be reused over and over, or an object that we want to be used in just the right way and not any other, we would probably go with a darker shade of box. If the object in question is only going to be used once, if it will only be used by us, or if we want the object to be as flexible as possible.

Extend

Extending an object is having sub-objects based off of the parent. It helps us reuse code, but at the expense of greater portability. We may have a person class with child classes extending it of customer and employee. We may put the similar code in person that customer and employee both share, such as name, address, and a method to store the object. We can then put the unique code in the child classes. Employee will have payroll information and maybe a method to give a bonus. Customer will have a shopping cart and maybe an account.

Extending is a great way to reuse code, and it makes good sense. We are able to reuse code effectivly between related objects, and if there needs to be a change (for example, we now want to keep track of first name and last name seperatly for all people in our database) then we only need to change it in one place. We also can make the child objects fully black box so that nothing need be known about it. However, if we ever wanted to use our Employee class in another system, we would need to make sure we brought it as well as it’s parent class, Person, over to the new system.

Beware Family Trees

There is a caution to be added here. It may sometimes become tempting to create whole family trees, reusing code from the whole system. This is generally a bad idea. Inheritance may work best when it is only a few generations. The reason for this is simple. As stated above, if we wanted to reuse an object in another system, we would have to bring the whole tree over with the object. It also can start to become confusing with so many classes dependant on others. The only time I would suggest extending more than a few generations is when creating a system such as a framework, a component set, a module or something else that would always be packaged together. Even in these situations, there may be a better way to use functionality if it makes sense, and that is object composition.

Compose

Object composition is another way to reuse code. Unlike extending where we inherit methods and properties from parent classes, with composition we make an object with other objects. This could be likened to the human body, one complete object made up of many other objects. The body ties everything together, helping the heart, the braing, the lungs to all work together. The customer’s shopping cart in the previous example could become a seperate object that belongs to the customer. This may make more sense, to keep objects more simple. It increases organization. Of course, like anything else, to much of a good thing can be bad. We wouldn’t want the customer to have a name object which contains his first name and last name. We would start to have more objects than we knew what to do with if we were breaking them down so small.

Composition is used very often, most any object oriented programs. Larger objects are made up of smaller pieces. It also can be more reusable. The employee object could be used without needing his payroll object and other (non-essential) objects that make him up.

Object Creation

Creating objects is a balancing act. Many decisions are made (often subconsiously) about how encapsulated to make an object, how to extend it, and how to compose it. The road to becoming proficient at object oriented programming may often start out with too few of these principles implemented. Then, once they are learned, it may become overused, making systems too complex. Finally, a middle ground will be found when it is remembered that the underlying purpose of object oriented programming is not to reuse but to simplify and organize.

Teeny tiny PHP 5 manual install howto for gentoo

Thursday, 30 June 2005 @ 3:41

For those of us who use Gentoo and want all the power/speed/features/bragging rights of using PHP5, you know it can be tricky since the packages are hard masked for now.

For the impatient in all of us, here’s a really really short summarized set of instructions on how to install it with your current setup.

pages

categories

events

syndication

random members

Utah PHP Users Group

recent posts

recent comments

recent job announcements

search

administered by Anavi Design
colocated at Tier Four