BenEskew.com Just another web developer's personal weblog.

Register.com Hosting 468x60
8Nov/090

PHP Tips and Help

For those of you who do not know me personally or formally, here goes a bit of helpful information.

I'm currently 30 years old and I've been learning and programming with PHP for a bit over 6 years. In these past six years I've basically taught myself the language using books, ebooks, and the Internet as references and resources...and boy have I learned a lot. I wouldn't say that even at this point I am at an "Advanced" level of understanding/experience with PHP. I'd rather say that I'm around the "Intermediate" level of understanding with it. I know the true possibilities of PHP mingling with the other technologies, so I believe my "intermediate" rating for myself is almost even pushing it.

Anyways, here's some PHP tips I've picked up along the way or learned the hard way through trial and error experience. :)

1. Single Quotes Are Faster Than Double Quotes (STRINGS)

Irregardless of whatever rumor you've heard, utilizing single quotes when concatenating strings is much quicker execution-wise compared to using double quotes because when double quotes are used the PHP parser parses the string looking for string names to parse before returning the string.

Slower:
echo "$name is its name.";

Faster:
echo $name.' is its name.';

2. Absolutely, Always Sanitize User Data (MySQL)

The user of your web application is never to be trusted. Absolutely make sure to sanitize ALL incoming data from the User before interacting with it and your web databases.
At the very least:

Utilize mysql(i)_real_escape_string (PHP4.3+)
mysql_real_escape_string (earlier versions use mysql_escape_string) makes sure to add slashes for required elements, also making sure to combat many SQL injection attempts. You could also use other functions like strip_tags which further help sanitize and limit abuse of your User data.

Be Sure to Use htmlspecialchars and htmlentities (STRINGS)
Be sure, when you print data which has been submitted by the User back to the screen that you properly sanitize that data using the PHP functions htmlspecialchars and/or htmlentities.

3. The Ternary Operator Is Your Friend

If you usually write a lot of if/else statements with very few lines of code or better yet one line of code, using the ternary operator can drastically help your application by shortening the lines of code down to one and also helping the readability of your code as a whole. Take the following example into consideration:

if($aString == '1'){
   $retVal = true;
}else{
   $retVal = false;
}

Wouldn't you rather use the following instead?

$retVal = ($aString == '1') ? true : false;

4. Regardless of their Rep, Don't Completely Follow Other Developers' Techniques

You could completely disregard even me with this tip, but you really shouldn't follow other developers coding techniques without studying them yourself at least. I've learned this one the hard way by utilizing (embarrassingly) short if/then and conditional statements for a year or so without completely studying the side-effects of using said statements. Always make sure your chosen coding techniques are efficient and agile.

This is just a short list of tips and help I have to offer you about PHP. In the future I will continue this series of posts with even more tips and help with PHP so stay tuned! :)

6Oct/090

JPL Announces Discovery of Largest Saturnian Ring

Today, NASA's Jet Propulsion Laboratory announced the discovery of the largest known ring system around Saturn, the second largest planet in our Solar System, and it's quite intriguing.

This new belt lies extremely far from the gas giant, beginning around 3.7 million miles (6 million kilometers) away from the planet and continues outward for roughly another 7.4 million miles (12 million kilometers). This ring is extremely thick as well, being 20 times the diameter of the planet. Phoebe, one of Saturn's farthest orbiting moons, circles within this newly found ring, and is likely the source of the rings material.

The information I have presented here is only a very little bit of the data collected from this new discovery. For more information please see the official press release.

Filed under: Astronomy, Science No Comments
6Oct/090

So You’re Developing a Web Application, aye?

When you first decide to create a website you're obviously hit with a first question...

"Should I use a pre-made content management system or does this website and/or concept need its own custom content management system?"

Depending on the type of website this question could be easily answered.

"Does this website need any further customizations than the chosen pre-made content management system can provide?"

The answer to the previous question could be no and then you could choose from a great number of varying pre-made CMS's like WordPress, Joomla, Nuke; just to name a very few, which will get you ready for content immediately.

But, what if you have a specific idea or concept that you want to put into action? Like something a bit more unique than a basic news-style or cookie-cutter web system. Well, then it starts getting a bit more complicated to execute your concepts.

One viable option is to install and modify multiple pre-made scripts which all do the varying tasks that you wish to have. I've seen this done contently with a few of my colleagues' projects. Although, I do not recommend this.

Another great option is to utilize development frameworks, like Zend framework for PHP and Ext JS for JavaScript. This option is great if you are limited to time and money, but can get quite cumbersome if you're also limited to knowledge and experience with these frameworks.

The best option in my opinion is to create everything custom yourself. It definitely takes much more time than other methods but the physical security of the structure of your application and the ease of future updates is better and easier to do in the long run, and is the best option for creating custom CMS's. One major reason to choose this method over a framework would be because usually your own code will be less-bulky and take less overall resources to run. But, of course this method by far relies heavily on the coding skills and habits of yourself or your developers, so always keep that in mind.

In future related articles I'll delve into the world of custom web application development, focusing primarily on custom code development, but I'll also be wading the waters of framework deployment and utilization of pre-made code libraries and their integration into your own web applications.

Stay tuned. :)

23Sep/090

HTML 5…The End All Be All…Almost

The evolution of the HyperText Markup Language has definitely been a long one and now is finally coming to a crossroads where it will be putting out of business many other technologies developed in the past to handle HTML's inadequacies. The new version of HTML is almost ready for professional trials and to say the least I'm pretty excited about it...and I'm sure many others are as well.

To start, the HTML5 syntax is no longer based on SGML (the kind-of parent of the older HTML versions), but will be backwards compatible of course. Second, an obvious change is the complete drop of purely visual elements, like the "font" and "center" elements, along with new element additions to handle basic layout presentation, like "nav" and "footer". Also, the addition of elements like "audio" and "video" will make it easier than ever to embed those types of objects into your HTML pages.

One major improvement to the language is the addition of Scalable Vector Graphics. With SVG you can literally add graphical elements into a web page with ease using simple element tags with their various attributes and values. This alone is a HUGE improvement compared to what is needed in order to accomplish things like this at present using older versions of HTML and XHTML. (Presently you need to utilize and embed other technologies and/or code libraries like Flash, MS Silverlight, dojox.gfx, or Java to accomplish this.)

Another awesome addition is the use of APIs. The APIs will include everything from utilizing offline storage databases to embedded document editing.

One other major improvement in my eyes which I'd like to mention is the error handling abilities within the new specification. The HTML5 specification gives detailed rules for lexing and parsing, with the intent that different compliant browsers will produce the same result in the case of incorrect syntax. What does that mean? No more jacked up looking web pages because of non-compliant code embedded within them. You will be able to safely update your pages without the entire world laughing at your non-compliant code jacking up your pages.

Enough rambling from me, here's an awesome HTML5 introduction video produced by Brad Neuberg from Google Developer Programs:

 
Further reading:

HTML5 Specification Overview (DEV)
HTML5 Specification Working Draft
HTML5 on Wiki

22Sep/090

Who Am I and What Do I Do?

I've been asked time and time again by acquaintances and some friends even "what do you do for a living? Every time I see you, you're wearing casual clothing (shorts & sandals) even when you say you just got done working." Well, as I've told many the same thing I just don't feel like explaining this all of the time so I'll just explain that now for at least all of you who browse by this site.

My name is Ben Eskew, obviously, and I've been a professional web developer/programmer for the past five years. I've been developing web projects for entrepreneurs and corporations for years and have finally settled into developing projects for myself recently. Hmm, that still may have not cleared anything up for most of you so I have a bit of explaining and definitions to do. Here we go.

No, I am not a web designer. Web designers paint the house, I make the house.

No, I am not some d-bag that goes around posting unsolicited ads on message boards and social networks (I actually dislike most social network platforms.) And, no, I will not stoop to those levels just to make a few bucks...my honor is worth way more than anything you could tempt me with.

I'm a programmer through and through. I began my love affair with programming and web development in early 1995 when I discovered how easy it is to create programs to automate tasks for me on my new PC at the time. I first began programming with Visual Basic, at the time I believe it was version 4, and absolutely fell in love with how easy it was to play with...compared to C and Java and the other lower-level languages around. I eventually came to a point where I wanted to create a web presence and began teaching myself scripting and the HTML language.

HTML was like kids play to me compared to creating apps with VB so I obviously learned very quickly and began creating basic pages and whatever using the free hosting sites at the time like Geocities and 50megs (embarrassing to admit but it's true). I had life problems and such between those times and the turn of the decade so there wasn't much output coming from me during those times except I did teach myself JavaScript. Sometime between 2000 and 2001 I stumbled on to the newly created PHP scripting language (some people classify PHP as a programming language, but this is false during that time...although nowadays it technically is both as it incorporates the usage of object oriented programming techniques) and began teaching myself everything I possibly could about it...from the history of PHP/FI to its current state as the newly created PHP3. Thus, my love affair with PHP and Linux was born.

I eventually found employment with several entrepreneurs and hit a good stride when I created my first content management system which I could use as a website skeleton for my various web projects on Linux OS machines. That content management system is still alive today (although is extremely different, and actually completely revamped from its original state now) and I've created hundreds of various projects using it. During this time and up until a few years ago I was involved with these entrepreneurs in creating their projects, which were mostly within the adult industry by the way, and gained much needed marketing knowledge.

Recently, I've formed a business entity, Killer Media L.L.C., and am finally beginning what I set out to do years ago...delving into the travel industry by way of information gathering/display and social platform engineering. My first major contribution to Killer Media L.L.C. is QueryVegas.com, which I began work on in late 2006 but have only recently been able to put major work time into it. It is currently in constant development and is technically just a prototype...but is in beta testing mode as it is very functional.

In the near future I plan to open an office either in Riverside, CA or Huntington Beach, CA for corporate use.

For those who have rejected my past employment attempts...ouch, you surely turned away the wrong guy, and now that should be completely obvious.

Sorry for the rambling! :)

Filed under: General, Rants No Comments
13Sep/090

Use Ext JS Without Paying for the Bandwidth!

Ever since Ext JS has become so popular amongst other web developers there has been a huge influx of interested developers. One of these such interests has evolved into a huge help to the Ext JS community as a whole. On November 18, 2008 Abraham Elias of Ext success posted an article titled Ext CDN - Custom Builds, Compression, and Fast Performance. Ever since it's been easier than ever to include the amazing Ext JS libraries to your projects and websites.

The company CacheFly has graciously stepped forward to contribute their valuable resources to the Ext JS project. Thank you CacheFly.

12Sep/090

LCROSS: First Steps to Colonizing Space

Ever since man has discovered its place within the Universe we've been energized by the thoughts of colonizing other bodies other than the Earth. When we landed on the Moon we were at the pinnacle of our goal which was to place a man on the Moon. After which we followed a non-existent approach to space exploration by simply only having interests in launching satellites for quite some time.

It's about time we start seriously thinking about colonizing space, yes? Enter, LCROSS: Lunar CRater Observation and Sensing Satellite.


(Above) Artists rendering of LCROSS moments before lunar impact.

 
In April 2006, NASA selected the LCROSS proposal for a low-cost, fast-track companion mission to the Lunar Reconnaissance Orbiter (LRO). The main LCROSS mission objective is to confirm the presence or absence of water ice in a permanently shadowed crater near the lunar south pole.

LCROSS launched with the Lunar Reconnaissance Orbiter aboard an Atlas V rocket from Cape Canaveral, Fla., on June 18, 2009. After launch, the LCROSS shepherding spacecraft and the Atlas V's Centaur upper stage rocket executed a fly-by of the moon on June 23 and entered an elongated Earth orbit to position LCROSS on a correct trajectory to impact the lunar south pole on October 9, 2009. On final approach, the shepherding spacecraft and Centaur will separate. Both spacecrafts will then impact and do their jobs.

Finding water ice on the moon will be crucial for the beginnings of colonizing...don't think I really needed to explain that but yea.

I'll be posting news data about this mission and others so stay tuned.

For more information about the Lunar CRater Observation and Sensing Satellite click here.

12Sep/090

Hubble Space Telescope Better Than Ever!

Since its placement in near-Earth orbit on the 24th of April, 1990 the Hubble Space Telescope has been taking amazing images of interstellar space like none have before. Recently the telescope has undergone an upgrade, or more known throughout the NASA community as a "surgery" of sorts and is back in action.


(Above) Gravitational Lensing in Galaxy Cluster Abell 370. Credit: NASA, ESA, the Hubble SM4 ERO Team, and ST-ECF

 
Pictured above is the gravitational lensing effect observed of Galaxy Cluster Abell 370, probably one of the most interesting effects observed in the observable Universe so far.

"Galaxy clusters are the most massive structures of the universe, located at the crossing of the filaments of the cosmic web of dark matter. The most massive clusters can contain up to 1,000 galaxies and intergalactic hot gas, all held together primarily by the gravity of dark matter."

These observations were made with Hubble's Advanced Camera for Surveys (ACS) in its Wide Field mode on July 16, 2009. The composite image was made using filters that isolate light from green, red, and infrared wavelengths.

Be expecting the Hubble Space Telescope to ensure many more astronomic breakthroughs in the near future. Oh, and by all means don't forget to browse through The Hubble Space Telescope's NASA Homepage.

12Sep/090

Graphics Chips Reaching ‘human-eye’ Quality

Brooke Crothers of CNET wrote a very enlightening article recently about Eyefinity, which is a multi-display technology that will be part of future Radeon graphics chips that have been designed to use up to six (all connected) high-definition displays that can achieve up to 12 times 1080p high-definition resolution, which approaches eye-definition optical clarity.


(Above) Tom Clancy's Hawks at 5760x2400 resolution spanning six monitors employing the Display Port 1.1 interface. Credit: AMD

 
This is absolutely HUGE news to the gaming community first and foremost of course. And here I thought I was cool with my triple monitor setup. :(

Be sure to check out that article linked above if you're interested.

Filed under: Tech News No Comments
11Sep/090

WE WILL NEVER FORGET!

We Will Never Forget this tragic day. All you did was piss us off and make us stronger!