Script Perfect

         Random snips of code and bugs

Archive for September, 2009

Social Networking Addiction

Posted by Tim On September - 7 - 2009

Hold on I’m Tweeting. See my comment on FB? Yep, I Dugg it and told my friends on Linkedin. How many different networking sites do we need? I will leave that to the masses to decide. The addiction to these popular networking sites is amazing. Just look at the competition with Facebook, Google and Microsoft, they are all trying to get the best street price on their new drug and get the masses addicted. It does not matter, almost everyone is hooked with no rehab in sight.

This is not really that important, utilizing these tools and becoming a dealer is where the traffic and money is hiding out. Search engine optimization is still an important factor but the modern algorithms of the most popular search engines utilize these mass gatherings of people. Getting your link across these networking meccas means massive traffic.

Read the rest of this entry »

Designing Websites for Mobile Devices

Posted by Tim On September - 7 - 2009

Since the iPhone many cell phone manufacturers are developing their own version of app stores and creating mobile content to try and attract a larger user base. Blackberry (RIM) has made some drastic changes, until recently their mobile phones came with a bite sized amount of memory that could be used for applications. Now that the iPhone and similar phones are out they have bumped their internal memory way up and added microSD capabilities to try and compete.

What this means for web developers is that you have a large potential to attract a rather neglected group of people. Everyone who has a crackberry, iPhone, or mobile Palm is basically walking around with a mini computer strapped to their belt waiting to find your site. Developing a mobile platform is easier than you may think.

Read the rest of this entry »

PHP Regex Crash Course

Posted by Tim On September - 6 - 2009

Regex, or regular expression is used to match characters in a string, the problem with using it is knowing how to use it. As with many things it takes practice and memorization to fully understand and commit it to memory. Regex is a powerful tool and can shorten many tasks such as validating email addresses, redirecting users with mod_rewrite, and searching for illegal characters in a submitted field.

PHP uses two very powerful statements to utilize regex, the first is called preg_match which takes a string and tries to match the pattern you provide it. The second statement is preg_replace which will do the same as preg_match with the exception that it will replace the pattern it finds with some other string you provide. I say only two here and some of you may be thinking “liar!” so I will mention a few others, there is ereg and eregi, they do basically the same things that the preg functions do, just not as fast or powerful. These are the only ones I will be covering, there are several preg functions besides these that you can research at your own pace.

Read the rest of this entry »

PHP File Upload Progress (APC Fetch PECL)

Posted by Tim On September - 4 - 2009

You would think that tracking file upload progress would be a given now, from your browser you can create websites, edit pictures and communicate with millions of people. Only a few sites will actually show you your upload progress and they are few and far between. If anything they will show you a nice animated gif that gives you the illusion your file is being transferred.

It is very possible to track upload progress but I have some bad news for some of you. If you are hosted on a shared server like Hostmonster, BlueHost, etc… then odds are you will not have the right privileges to install the required modules. For those of you that have access to your own server or the capability to get it installed then read on.

Read the rest of this entry »

Rounded Corner DIV With Only CSS (Round Div)

Posted by Tim On September - 3 - 2009

Technically there is not a way to make true rounded corners with DIV’s without some sort of trickery. If you want to create nice rounded div containers for your content you still can without using images. The method is actually rather simple and makes the CSS look like we have round corners by using borders in a different way.

Want to see how this amazing feat was accomplished? Keep Reading

Read the rest of this entry »

Mod_Rewrite Tutorial for WAMP (modrewrite mod rewrite)

Posted by Tim On September - 3 - 2009

There comes a time where you feel like shoving your head in a car door and slamming it repeatedly, this is that time. Mod_Rewrite made easy, as easy as it gets I guess, it’s like saying “Learn Quantum Physics in 24 Hours”. Well maybe that is not a fair comparison, either way if you are not familiar with regex and/or you are trying to implement mod_rewrite into an existing site you may need to set plenty of time aside to get it all working correctly.

This tutorial is tailored around WAMP for those looking for an easy way to get started shortening those url’s in preparation for that day you upload to the web. This tutorial will break down in a few simple steps how to enable mod_rewrite, how to write your first few basic rules, and some of the common pitfalls.

Read the rest of this entry »

Easy LightBox With Scriptaculous and Javascript

Posted by Tim On September - 2 - 2009

Lightbox
I searched far and wide to find a basic lightbox that was not only lightweight but easy to install. It was just one of those nice touches I wanted to add to my site but did not want to spend a lot of time doing so. Needless to say I could not find a simple solution so I spent some time and made my own.

This is broken down into a few small and simple sections, first the CSS which we will use to display our lightbox followed by the HTML and Javascript to activate it. In order for this to work correctly you must have script.aculo.us set up on your site.

A working demo may be seen by clicking here.
Read the rest of this entry »

Multiple Sites or Domains, One Server, One DB

Posted by Tim On September - 2 - 2009

While messing around with some of my other sites I ran into a major problem. I had developed a great deal of conent for the main site and thought it would be great to make a seperate site for mobile users. The new site would of course be much smaller and compact but still allow the majority of data from the main site to be viewed.

When I started developing the mobile siteĀ  hit a brick wall, I could not connect to the database on my main site even though both sites were on the same server. I tried connecting to localhost as well as the IP address, specifying the db name or calling it from the query. Needless to say it tooks hours to figure out what was going on so here is my solution.

Read the rest of this entry »

About Me

I am an independent web developer and webmaster of many sites. The main goal of Script Perfect is to provide answers to some of the hard to find questions when it comes to website design and coding.

Twitter