What are We Talking About?

Symfony, the hot new framework for PHP web application development, can drastically reduce development times on intricate applications. By utilizing a framework and the Rapid Application Development, Agile Development, XP, or whatever development cycle you might like best, elegant code is easier to produce and maintain. With proper design patterns already in use, one simply needs to fill in the appropriate logic at each level, and let the application grow into being. For more information on Symfony the following resources are available:

This is all great, but not nearly as useful if we can't develop and test locally. To get a nice development area installed what do we need to do? The following steps outline how to setup a machine so that you can have a projects directory that will automatically map to a nice set of URLs with minimal configuration.

What Do We Need?

We need the following installed (Gentoo use flags are in parentheses):

  • apache
  • mysql
  • php (cli ctype reflection spl simplexml xml pcre session apache2 mysql pdo xsl)
  • symfony

What's the Setup?

So how do we turn a directory full of projects into something we can get at by browsing to http://localhost/project? Well, we start by symlinking (or just changing) the docroot to the directory we want to use.

# rm -rf /var/www/localhost/htdocs
# ln -snf <path to projects> /var/www/localhost/htdocs

What we want to do now is change the vhost declaration for the default virtual host in apache. It's only an addition of a few simple lines (placed after the docroot declaration):

AliasMatch ^/((?!cgi-bin|icons).+)/sf/(.*) /usr/share/php5/data/symfony/web/sf/$2
AliasMatch ^/((?!sf|cgi-bin|icons).+?)/(.*) /var/www/localhost/htdocs/$1/web/$2

<Directory "/usr/share/php5/data/symfony/web/sf">
  Options Indexes FollowSymLinks               
  Order allow,deny                             
  Allow from all                           
</Directory>

The last thing that needs to be done is make sure the default redirect in your symfony project's .htaccess file redirects to //index.php.

Conclusions

That should be all there is to it, but as always your mileage may vary. If you notice significant problems or shortcomings with this how to, please, leave a comment denoting that. I will update this guide appropriately as quickly as possible.

C++ Programming Students

April 16th, 2008

It's strange that I'm the only tutor for our Computer Science and Information Systems department, but I can live with that. What irks me though, is how these students come to gain their knowledge about programming.

To be fair I will not mention names, and not blame anyone. I truly believe this to be a simple matter of miscommunication, and easily solved. I also feel that the scope of these classes needs to be monitored a little more closely, and what follows is simply what I understand the classes should teach in an introductory programming class, and my understanding of what is being taught in our introductory programming classes.

The classes in question are our first introductory classes to C++, and then our follow up course. These courses together should leave the student comfortable with the basic constructs and built-ins of C++. It should also make them comfortable with classes, and working in an OOP(Object Oriented Programming) paradigm. The problem crops up in the transition between these two classes. It seems (and this I know because of my tutees) that their understanding of the basics gets muddled in the first class, and thus they cannot build upon this knowledge in the second class. I have heard many things about what may be happening wrong in this class to cause such a terrible calamity, but let us refocus and start by going over what should be covered in the first class in order to succeed in the following class and throughout the whole program.

In an introductory programming class it should be important for students to become familiar with functions, control structures, and various keywords (not all of them mind you just most of them). Thus they should be comfortable looking through a piece of code like the following, and have an understanding of the majority of it:

#include <cstdlib>
#include <iostream>

using namespace std;

int factorial(int n)
{
    if (n == 0)
        return 1;
    return n * factorial(n - 1);
}

int main(int argc, char argv[])
{
    if (argc != 2)
    {
        cerr << "You must pass a number to get the factorials!" << endl;
        return EXIT_FAILURE;
    }
    int n = argv[1] + 1;
    while (--n, n > 0)
        cout << "The factorial of " << n << " is " << factorial(n) << "." << endl;
    return EXIT_SUCCESS;
}

They should also be able to understand Makefiles (rudimentary Makefiles not automake or anything of its ilk), header files vs. source files, the stages of compiling and how to deal with different errors in each (i.e. A linking error versus a compilation error), and they should understand array mechanics (if not exactly what they are then how to use them). They should be able to put all of this together, and make a nice modular program that allows them to expand and reuse code in an intelligent way. Then if there is time (although this gets covered in great detail in the second class) a quick coverage of structs should ensue. At this point the education they should have gained from the first class should be enough of the basics that they understand the constructs of the langauge, and can start reading simple programs like the one above.

In reality, this goal (mind you this is my personal goal and does not reflect the goals of the professors or the department) was not met, and based on experience with people I'm tutoring who are in the second class at this time it is quite obvious where their shortcomings are. Those shortcomings are outlined below:

  • Lack of understanding about the looping control structures
  • Lack of knowledge as to how arrays function, and should be used
  • Lack of knowledge as to how the compiler actually takes the source code (possibly spread over many files), and makes an executable
  • Lack of understanding as to how to solve simple problems like manipulating all the entries of an array
  • Lack of understanding as to how to do a simple search, or utilize functions provided in an API(Advanced Programming Interface).

This list will be updated appropriately as I gain more knowledge on what the students actually know. Thus this list may have inaccuracies and shortcomings, and may not reflect reality.

The list goes in in much the same fashion here after, and this is obviously a product of the class not fulfilling its primary purpose of laying down a foundation that the students can build on. To better achieve this goal it may be necessary to at the very least recommend some supplemental texts (see list at the end of this article for recommended books for the various programming courses).

Now, what I've heard reports of in this class is that (1) these concepts outlined above are not getting covered in the detail that is required of them in the subsequent classes (which only confirms what I've observed in students), and (2) there has been a report that a new teaching tool "Alice" was used in the introduction class.

The first point appears to be just a shortcoming of the class, and could be ameliorated by simply spending more time and going over more examples of the concepts in question.

Also, the students themselves need to realize that they control their education, and must participate for a class to truly be successful for them. When entering a class, students should think to themselves what do I want from this class, and how can I have this class help me achieve that goal? By asking questions and looking for more material on the specific area of study the student is interested in they can get a much more fulfilling experience and better understanding of the topics involved, but may hit a point where they just can't keep up with the class and need further assistance that isn't self-guided. Tutors are available from the tutoring department, and should not be shied away from. If you really want to learn the material you have to be willing to get help and help yourself towards that goal. That's only part of the problem, students who do try are still having a hard time within the status quo.

The second point requires that I do not put forth my personal opinion, but does require that I state its purpose (from the Alice website):

Alice is an innovative 3D programming environment that makes it easy to create an animation for telling a story, playing an interactive game, or a video to share on the web. Alice is a freely available teaching tool designed to be a student's first exposure to object-oriented programming. It allows students to learn fundamental programming concepts in the context of creating animated movies and simple video games. In Alice, 3-D objects (e.g., people, animals, and vehicles) populate a virtual world and students create a program to animate the objects.

In Alice's interactive interface, students drag and drop graphic tiles to create a program, where the instructions correspond to standard statements in a production oriented programming language, such as Java, C++, and C#. Alice allows students to immediately see how their animation programs run, enabling them to easily understand the relationship between the programming statements and the behavior of objects in their animation. By manipulating the objects in their virtual world, students gain experience with all the programming constructs typically taught in an introductory programming course.

In conclusion, it is my perception that there is a missing communication link in the way these classes are handled, but it's not just between the professors of the two classes (they seem to not have a smooth break between the classes), it's between the students and the professors that the communication has really broken down. The students must speak up for their education or they may see it going down a path that does not maximally further their education. This is wider spread than just the simple class example I've given here. Almost everywhere one looks, it seems that students are becoming more lethargic; pushing to just get through the courses. There is a lack of genuine interest in the education being provided, and more of a view that college is now a necessity to continue in society. Unfortunately, that has begun to be so, but we can still fight for the freedom of our minds.

Supplemental Books for CSIS Courses:

  1. 152
  2. 252
  3. 352

XBOX 360

October 1st, 2007

I finally broke down and purchased an XBOX 360 with Halo 3. It is an incredible improvement over the first system, and is backwards compatible. The first intriguing thing about the system from a networking perspective is their idea of "Open", "Moderate", and "Closed" NAT. I didn't know that this was possible, but after a few sniffing experiments later I learned a few things:

  • XBOX Live uses port 3047
  • XBOX Live uses UDP
  • XBOX Live thinks open NAT means that port and protocol is forwarded to your XBOX through the NAT device.

This leads me to the conclusion that the XBOX Live and Vista ready devices are just engineered to provide holes in your network. I suppose this is fine for most, but what if you want that security back?

Linksys WRT54GL

May 26th, 2007

Today I received a new WRT54GL (Linksys Wireless Router). Upon setting the thing up to take the place of my old access point, MN-700 (Microsoft Wireless Router), I found that there are a couple of annoying quirks to this type of router:

  1. If it's supposed to be a bridging device, don't use the WAN port. This is by far the worst design flaw I've seen. If I select router vs. gateway (which are the only options I received) I expect the WAN port to get bridged into the 4-port switch. This is not the case, and caused me an hour of headaches.
  2. Is a shared key necessary for RADIUS authentication (I'm researching this one, but it seems a little paranoid)?

Otherwise, the thing is incredible. I can be on the far side of my house in the basement, and only get as low as approximately 50% connection status for wireless. I also have a couple of new to do items:

  1. Set up a local LDAP for user authentication, and set up pam properly (thank goodness I've done this before).
  2. Get FreeRadius running, and hooked into the LDAP server.
  3. Set up the new WRT54GL (Linksys Wireless Router) to work with the RADIUS server for authentication.
  4. Look into IPSec, and see if it is feasible for communication encryption once the RADIUS authentication is over.