About TheJoey.Net

TheJoey.Net is the weblog of Joe Casabona, a web developer who attends the University of Scranton, now for Graduate Studies. He is real bad at writing these about pages and hates writing in the 3rd person...more

**The layout is new and there might be some bugs. If you see any, please email me at Joe@Casabona.org

Archive for the 'Code' Category

Scrubs Quotes

I don’t do too many things on a whim, but the other night when I saw a group dedicated to having a Scrubs Quotes Facebook application developed, I couldn’t help myself. As a big fan of Scrubs, as well as a developer, I thought I might try my hand at it. I tinkered a little with Facebook apps and it seemed easy enough. I set out that night to do that app, and finished it the next day.

I figured I did not need a database for this project. Just a text file with a quote per line. I’d throw in some HTML when needed, and the last two characters of the file are the person’s initials. For example: Hey, Girl's Name - <strong>Dr. Cox</strong> pc. In the processing of each line, I use the initials to display the picture of the character in the profile.

For a project like this, following Facebook’s Step-by-Step Guide is all that’s necessary. Facebook provides great documentation on creating apps, and as long as you know some programming language, you should be able to pick it up pretty easily. For those of you who have Facebook, you can check out the app here. If you don’t have Facebook, I’ve provided screen shots.

In the near future I hope to add more quotes, and make it more user interactive by allowing them to add their own quote to their profile if they don’t want a random one.


Comp Sec

A problem that all web developers people in the computer field face is security. When creating your application, website, server, you have to take into account what kind of security measures you must take to protect yourself and your users. However, you have to make sure that these measures don’t horribly inhibit the users. Twice over the last couple of months I have ran into server trouble where I felt the server disallowing certain actions strongly inhibited my ability to create a good website.

The first occurred in October, while I was creating a website for a client. They wanted to be able to upload images to the server, to add them to the site. This required me to set the permissions on sections of the site to 777 (all can execute). There are numerous web apps out there that do this, and if the programmer does it right, security is not a huge issue. However, the server I was working decided (after years of me using it), they were going to reset the permissions every 6 hours for ’security’ measures without notifying it’s customers. Never mind that I spent hours debugging a script I knew was working. How can one make a sophisticated web app without being able to change the permissions for more than 6 hours at a time?

More recently, I am working on a website that would send emails through a php script using the standard mail() function. Only, due to ’security reasons,’ the mail() function is disabled. Now I cannot report bugs automatically, nor can the user use the current contact form. Sure, the mail() function could be exploited, but so can almost anything when dealing with a scripting language. Are they going to disable SQL in fear of SQL injection statements?

The point is that if these servers are going to disable certain, very useful functions, what are they providing as an alternative for their users? They are choosing a little bit more security in exchange for strongly inhibiting their users from creating more user driven web applications.


Winn C&C

The Winn Site is a project I have been working on for a couple of months now. The guys wanted a brand new site- the one they had was, umm, bad. They also wanted an online catalog that they could update, along with the ability to update tournament dates. With that in mind, I got started.

The design I gave them was a pretty basic XHTML/CSS layout. The logo was one that they supplied, so I went with that color scheme. I used divs to organize the soon-to-be large amount of information in an aesthetically pleasing way. The challege with the design of this site was that they could add as many products they wanted whereever they wanted, and the design had to be able to handle it. The great part about the site, however, is the programming aspect of it. I created a number of functions to print the catalog info, as well as add, edit and delete to/from the site. The back end I wrote is totally custom, password protected, and designed to be pretty ‘liquid,’ meaning easy to update and manage. They have the ability to add products, including uploading a picture [how to on that in a later post], add tournaments, with custom date and time functions, and add categories which automatically become part of the navigation. They can also edit anything, and delete anything. The product page is the best page on the site, using flow control to change what exactly is displayed on the site. The user can also sort any information on the product pages and there is a search function, making finding any product very easy to do.

All in all it was a good experience, and I learned a lot. I did have experience in coding CMSs before this, such as on my own sites, but this was my first real updatable online catalog. In the near future they hope to add a shopping cart, which it looks like I will also be doing for them. Later!


This semester I am taking a class where it was recently decided the primary language will be C. While I did dabble in C a little bit last semester, I didn’t do all that much. This evening I did our first assignment, which was a simple “Hello World” program in C, programmed on a UNIX machine I telneted into. Here is my slightly more complicated program and some explanation:

C

While I would be able to achieve this by printing printf("Hello World");, I wanted to illustrate character arrays and pointers in my program. I stored the string “Hello World” in a character array, because C does have a String object, or any objects for that matter. This will probably be the hardest thing for me to adjust to in C. The line that reads float *ad= &prt is simply assigning a ‘pointer’ variable. In C you can access the actual memory address of anything variable in the program. this is what ‘ad’ is. ‘&prt’ is the actual value stored in the variable ‘prt’. Without the &, I would be getting the address of ‘prt’, and not the actual value. I then print the string, and the address the string is stored in.

I understand that anyone who has never seen C probably thinks this is very difficult, but I hope to add a few more posts about C, looking more in depth into pointers, addresses, and printf(), among other things. Later!


Facebook

For all the people out there with Facebook, an online social site for college and now high school students all across America, it got some new features. CollegeV2 has an extensive write up on it here, but I wanted to add my 2 cents in.

First is the Facebook API. An API is an “Application Programming Interface,” which basically amounts to developers being able to use some of facebook’s programming to make their own 3rd party applications. What it means is (probably) a bunch of new websites and resources for those of us who have a facebook account. And if you are a programmer, you get the opportunity to create some of that 3rd party software and be recognized on the site. If anyone has any ideas, I’d love to help.

Joseph Casabona's Facebook profile

What you see to the left is a facebook badge. It is a little add on you can put on your website, blog (live journal, blogger, xanga, etc.), or even your myspace, and it displays whatever information you choose to display from your facebook profile. Mine will be added to the about page, and probably won’t change much. It also links directly to your profile.

Finally, Facebook Notes. It’s kind of like a blog, but they aren’t calling it that. You can write notes for yourself, about your friends (linking your friends in the note), add pictures, and import your blog, which I did. It seems like a pretty cool idea, and looks A LOT nicer than the MySpace blog.

That’s all I got! Let me know if you find anything new, or what your thoughts are on the aforementioned in the comments! Later!