Archive for the ‘Programming Tips’ Category

Crons — A Simple Tool To Automate Your Business

Sunday, March 16th, 2008

How Crons can be an asset to  your business.

What is Cron?

Cron is the name of a time based scheduling program that enables Unix users to execute scripts, or commands, automatically at a specified time/date. It is generally used for system administration commands, for running a backup script, or for connecting to the internet and downloading your email.  Now you’re interested, right?  Email is something that almost everyone, certainly every business owner, can relate to. 

So how can you use Crons? 

Quite simply, If you want to automate something on your computer that runs more than once, you can use a cron.

But wait, we’re getting ahead of ourselves.  Let’s take a step back and examine exactly what a cron is. 

A cron is a daemon, yep another tech term – sorry.  A daemon is a program that only needs to be started once and then it will sit quietly waiting until it is required.  Most Linux distributions, versions of Linux designed from the original Linux base code called a kernel, come with Crons automatically installed and entered into the startup script. 

For example, you can write a cron to delete your temporary files.  You can designate it to delete them hourly, daily, weekly, or monthly. 

Even more useful for an internet business owner might be the ability send email messages to subscribers every morning at 5:00am.  You can set the cron job on your server to handle that every day.  You can even set your cron to send one email every day until all your email messages have been delivered.  You can schedule it to delete your website members with expired accounts, to receive an update on your subscribers from your mailing list manager and you can investigate your links on other websites if participate in link exchange programs.  Pretty useful, right? 

Another term you’re likely to come upon as you get into crons is the term Cron tab.  This is basically the command that creates the list of commands on your system and is not editable.  However, the crontab file, I know, the creators of the terminology must get a good laugh from confusing folks, the cron tab file is the actual list of commands and that is capable of being edited with a few commands.  Each user can have their own cron tab file. 

What does a Cron Look like?

The good news is that it is fairly simple.  You have a few fields you will use including:

Minute - denotes the minute of the hour that the command will run, anything between 0 and 59.

Hour – denotes the hour the command will run on and will be between 0 for midnight and 23 for 11pm.

Dom – this is the day of the month you want your command to run on.  For example the first day of the month would be denoted as 1.

Month – what month do you want to run the command, choices are 0-12 or you can write the name of the month out.  For example, October

Dow – stands for day of the week and you can choose 0-7 or write the day as it is normally abbreviated.  Example Sat would mean Saturday

User – is the person that runs the command.  You can specify a user but you do not have to.  You can also deny a user from using a cron with a simply deny command.

Cmd – is the command that you want to run.

Here’s what a typical cron command will look like.
 
Let’s imagine that you have installed a cgi script called task.cgi in your cgi-bin directory.  If you want to run this program each morning at 5:15am on Sunday, here’s what it will look like:

15 5 * * 0 /home/username/www/cgi-bin/task.cgi

30–represents the minute of cron work
23–represents the hour of the day
0–represents the Sunday.
The * represent every day, month, and weekday.

Scenarios you may face

Many distributions offer pre-configured cron jobs.  Different versions of UNIX store cron and support files in different locations and may use a slightly different format however if you have a Linux system you may be able to view these with the following commands:

• /var/spool/cron               main cron directory
• /var/spool/cron/cron.allow    grant access to the cron facility
• /var/spool/cron/cron.deny     revoke access to the cron facility

To set up a cron job your system may have a cron tab function on your web panel.  This is a simple interface that will allow you to click on a few buttons and set your cron job. 

The last option is that you will have to upload a cron job into your ‘cron.txt’ file.  There are four basic steps involved and they include Create cron.txt using your notepad application, uploading it using your telnet server, installing the txt file as cron file with the command ‘crontab cron.txt’, and then checking it to see if it works. 

Tips in setting up your cron jobs include:

• Occasionally check your cron to make sure if it is working.  For example you set your cron to send your ezine at 11.30 PM. Then you subscribe yourself to see it is working or not. Later you can unsubscribe yourself.

• If you are creating cron file first time and uploading it to your server, do it in ASCII mode.

• If you are setting the script path in your schedule, the path SHOULD be from your hosts server root. NOT your domain path.  Ask your host about the procedure if you are not sure of something.

• Script names are case sensitive on Unix. So be careful in entering the script name.
If you are creating cron.txt file and uploading, you should not allow spaces between them however you should have a space after your command.

Wrapping it up

It is easy to get excited about the possibilities of crons and automating your business and computer to work while you sleep without the extra cost of additional software.  Before you get carried away take the time to understand your server’s set up and capabilities.  Some systems are significantly more intuitive and programming crons is easy.  Others will require more attention and a longer learning curve.   This article merely scratches the surface of what crons are capable of and how to implement them. 

Social Bookmark #del.icio.us #Digg it #Earthlink #Furl #iFeedReaders #ma.gnolia #Maple.nu #Netvouz #Netscape #RawSugar #reddit #Scuttle #Shadows #Simpy #Spurl #StumbleUpon #Wink #Yahoo MyWeb

What is Flash and Does Your Website Need it?

Monday, March 10th, 2008

What is Flash, and Does Your Website Need It?

What is Flash?

Since hitting the market in late 1996, Flash technology has become one of the most widely-adopted ways to add animation and interactivity to websites, and sometimes form the basis for nearly the entire website itself.  The Flash Player is the free application that web users use to view Flash files, and is available for most operating systems and integrates into most web browsers.  Flash technology is distributed by Adobe Systems (which also distributes the popular Acrobat or “PDF” technology), which acquired the technology through a merger with Macromedia in 2005).

Flash files, which are also sometimes known as “flash movies”, have a file extension of “.swf”, and may be an object of a web page, strictly “played” in a standalone Flash Player, or incorporated into a Projector, a self-executing Flash movie with the .exe extension in Windows. Flash Video files have a .flv file extension and are utilized from within .swf files.

The most recent versions of Flash include a technology called “ActionScript”, which has the same syntax as JavaScript, but which has a different programming framework and associated set of class libraries. This ActionScript is used to create the user interactivity in many Flash movies.

Most recently, Flash is being used together with the XML capabilities of the user’s web browser to display dynamic and content in the user’s browser.  Because Flash technology provides more comprehensive support for so-called “vector” graphics than the web browser itself, Flash is a powerful addition to the capabilities of a the browser. This technology is currently in its early stages, and it’s likely to become increasingly powerful in the years to come.

Uses of Flash

The original uses of Flash focused primarily on non-interactive animations and movies.  This is likely due in part to the fact that the software (as well as the computers running the software) was not as powerful as today, didn’t offer the option of significant interactivity, and there were fewer developers with expertise in the relatively new technology.

Flash now permits such a high level of user interactivity that significant portions of a website can be built in Flash, and provide the user with an exciting way to navigate through the website’s content.

Flash is now also an increasingly popular way to display videos over the Internet.  YouTube uses Flash technology to display its movies to users, and the technology can be used to protect video content or force users to watch advertisements before the desired content is displayed.

Benefits of Flash

Free to Web Users.  The most recent version of Flash is always available for download, for free, from the Adobe website.

Versatility.  Flash players are available for use in all major operating systems (including Microsoft Windows, Mac OS, and Linux), and a number of other computing devices.

Wide Adoption Rates.  The Flash Player has already been installed on more than 98% of the Internet-connected desktop computers worldwide.  The current installation rates are even higher, over 99%, in the “mature markets” that include the U.S., U.K. and Canada.

Small Files.  The use of vector graphics, combined with other programming code, allows Flash files to be smaller than standard video clips and bitmapped graphics.  For files that are streamed to users, the smaller size will consume less bandwidth than traditional files.

Fast Player.  Compared to other web browser plug-ins (such as Java, QuickTime and Windows Media Player), the Flash Player has a small install size, a quick time to download, and will quickly initialize in the user’s browser.

Possible Time Savings.  By using the ActionScript programming language, you can save a lot of time by scripting instead of traditional animating techniques.

Adobe Integration.  Because of common elements across the technologies, you may be able to save time and resources if you use other Adobe creative products such as Photoshop, Illustrator or Dreamweaver) to develop your website.

Drawbacks of FlashCost to Developers.  Although the Flash Player is free for download to all users, the Adobe software that is needed to create the Flash movies is not free.  The current retail price of a license for the stand-alone Flash development tool is approximately $700.  There are less-expensive third-party options, but these software packages do not have the full host of features as the Adobe product.

Suboptimal Format for Some Types of Content.  If the content that you want to provide to your users or customers is in a single format (such as text or audio), then other technologies may provide better performance and consume less of your user’s CPU power than a Flash movie.

Small Files, but Maybe Not Small Enough.  Though Flash files are relatively small, their size may still be a problem (or at least a cause of great frustration) for users who are still accessing the Internet through a dial-up or slow DSL connection.

Temptation to Go Overboard.  Because Flash Technology is so powerful and flexible, there is sometimes a temptation to add more and more of the “bells and whistles” to the content that you want to publish.  Sometimes, though, this actually makes the experience worse for the user because it distracts from your message.

Getting Up to Speed.  If your developers have not used Flash before, then it may take some time to learn how to create the Flash movies you envision. Search Engine Issues.  Flash movie files are not themselves crawlable by search engines, which means that if you have important sales or other copy embedded in file, it will not be indexed by Google or any other search engine.

Because of its power and efficiency, Flash technology has been used to power many of the aggressive online advertisements.  In response, many tools and browser plug-ins are available for users to disable the Flash Player in their browsers.  If a user has Flash disabled and is not otherwise able to navigate your website, then they may leave your website and you’ll lose a customer or client.

Bottom Line

Flash technology can be a very powerful tool to make your website a compelling experience for your users.  However, you will need to be sure that your Flash implementation actually serves to help your users, and fits within your budget.

The video and audio players on our MemberSpeed plugins use flash technology in the media players.

Click here to see the how the video player works

Click here to see how the audio player works

Click here to see the audio player in action by listening to any of these podcasts.

Social Bookmark #del.icio.us #Digg it #Earthlink #Furl #iFeedReaders #ma.gnolia #Maple.nu #Netvouz #Netscape #RawSugar #reddit #Scuttle #Shadows #Simpy #Spurl #StumbleUpon #Wink #Yahoo MyWeb

What is Apache? How it Affects Your Websites

Tuesday, February 5th, 2008

Apache Defined -  What It Is, What It Does, And How It Affects Your Business…

What is Apache?

Apache, is an HTTP web server that is developed and maintained by an open community of developers under the Apache Software Foundation.  “The Apache HTTP Server Project is an effort to develop and maintain an open-source HTTP server for modern operating systems including UNIX and Windows NT. The goal of this project is to provide a secure, efficient and extensible server that provides HTTP services in sync with the current HTTP standards.”

Apache is noted for having had an integral role in the initial growth and development of the World Wide Web and was the first practical alternative to the Netscape Communications Corporation web server.  Today, Apache rivals the biggest Unix based servers in functionality and performance. 

Uses

Apache used to serve both static content and dynamic Web pages on the World Wide Web.   The quick and dirty definition of a server is a Software that sends web site pages back to browsers.  The benefit of Apache is that it is

Apache is used for many other tasks where content needs to be made available in a secure and reliable way. One example is sharing files from a personal computer over the Internet. A user who has Apache installed on their desktop can put arbitrary files in the Apache’s document root which can then be shared.

Additionally, some programmers test their web application code on a local server, installed with Apache.  Programmers developing web applications often use a locally installed version of Apache in order to preview and test code as it is being developed.

What does it mean to you?

If you host your own website, or plan to, then you will need a server.  Apache has many benefits that are discussed in the next section.  Among them is the fact that it is free and it is extremely stable and widely acceptable.  But what if you don’t host your own website?  Why should you care about Apache?  Maybe you won’t, however if you’re doing any kind of programming, say you’re going to add some scripts or applications to your website, you will want to make sure the language you use is compatible with Apache. 

Benefits
 
Quite simply, Apache is free. 

It is available for a wide variety of operating systems including Microsoft Windows, Novell NetWare, Linux and Mac OS X.

Apache supports a variety of common language interfaces including mod_perl, mod_python, Tcl, and PHP.

Virtual hosting allows one Apache installation to serve many different websites.

Apache features configurable error messages, which will help guide your visitors to the right area of your website rather than lose them all together.

Apache can run on virtually any hardware platform, which means you don’t have to go out and buy new hardware.

Apache is extremely secure, partially because it has such a long history and is so widely used.  The open source nature of it also means that there are a committed group of people working on making Apache the best server software available.

Apache interfaces with just about any database including commercial products like Oracle, Sybase, DB2, and Informix and open source databases like MySQL. This is important if you want to access statistics about your website traffic and usage, if you want to track customer information, orders, accounting numbers and reports, create forms, forums, and other various database uses.

Apache is generally safe from the variety of viruses that commonly attach Microsoft Web servers.

Because of its size and success, Apache has attracted numerous developers from around the world. These wonderful developers have created modules, or blocks of code designed to do things like letting you run CGI scripts whenever a file of a certain type is requested. Many of these modules can be found at http://modules.apache.org/.  And Apache is intuitive enough that it is easy to create a module if you can’t find what you need and there are many books written on the subject.

While tech support is not what you might get from a commercial software product, a product you’ve paid tons of money for, Apache does offer bug reporting services, forums to discuss how to solve problems and they are quick to find solutions to bugs and security issues.  Additionally, any security issues or bugs reported are posted on the organization’s website along with updates to resolve them and users can subscribe to a mailing list to receive bug reports and updates in your email box.

Drawbacks

Apache has of late, since 2006, lost some of its market share.  Most of this share has been lost to Microsoft Internet Information Services and the .NET platform.

No real technical support.  Here is the quote you will find on the Apache website, “With millions of users and fewer than sixty volunteer developers, we cannot provide personal support for Apache. For free support, we suggest participating in a user forum.”  That being said, there are numerous commercial support companies available. 

Bottom Line

Even if you never decide to host your own website, plan to set up a web server, or even want to test code before you integrate it into your website, it is helpful, and beneficial to educate yourself about the uses and benefits of Apache simply because it affects your business.  As your company grows you will likely want your website to be more than a static page.  Apache, and all of its flexibility, enables your business website to not only become more interactive but to provide you a number of resources to research and connect with your customers.  Apache is sponsored by Google, Yahoo, and HP just to name a few which means it isn’t going anywhere anytime soon.  Plus…it’s free!

Social Bookmark #del.icio.us #Digg it #Earthlink #Furl #iFeedReaders #ma.gnolia #Maple.nu #Netvouz #Netscape #RawSugar #reddit #Scuttle #Shadows #Simpy #Spurl #StumbleUpon #Wink #Yahoo MyWeb