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

What Is MySQL And Does Your Business Need It?

Saturday, January 12th, 2008

What Is MySQL And Does Your Business Need It?

What is MySQL?  

First released in May 23, 1995, MySQL is an open source database software.  It is part of a large and growing family of open source software including Linux, Apache, and programming languages PHP and Perl. 

However, unlike many open source products where the copyright is owned by the individual authors or distributors, MySQL is owned and sponsored by a single for-profit firm, MySQL AB, which holds the copyright to most of the codebase. They develop and maintain the system, sell support, service contracts, and proprietary-licensed copies of MySQL.

MySQL is a relationship database, which is a collection of items or tables organized into predefined categories or described tables from which data can be accessed or reassembled in many different ways without having to reorganize the database tables.  This format is enormously popular with more than 100 million copies of the software downloaded over the life of MySQL.  The popularity stems from the fact that the databases are easy to create and access.  Additionally, they are easy to extend, a new data category can be added without requiring that all existing applications be modified.

When creating a relational database, you can not only extend the data, you can define the domain of possible values in a data column and any additional constraints that you want to apply to the value of your data.  This makes your information significantly more valuable and user friendly.

Uses of MySQL

There are many uses of MySQL for a business and you can find many significant case studies at http://www.MySQL.com/why-MySQL/case-studies/.  Among them are many stories about how information generated from MySQL has saved IT teams thousands of man hours and thousands of dollars. 

Here’s an example of how you can use it for your business.  Consider a typical order entry database.  It might include the following columns for customer information:  name, address, and phone number.  

Another table might describe an order and have these columns: product, customer, date, and sales price.  This table and the relevant information could be used to show a report on all customers that bought products on a specific date. A financial services manager in the same company could, from the same tables, obtain a report on accounts that needed to be paid.

Craigslist uses MySQL to power more than 50 forums, among many other things, and Yahoo Finance uses it to aggregate headlines for its website.

Benefits of MySQL

Ease of use.   A basic knowledge of SQL and database manipulation is required however MySQL is logical and easy to use. This means you don’t have to spend as much time and money either training existing staff, or hiring developers.

Security. There are not a lot of databases that can compare to the security that MySQL offers.  It includes solid data security layers that protect your sensitive information.  Rights can be set to allow some or all privileges to either individuals or groups. Passwords are encrypted.  The access to your database can be controlled by a remote machine that can completely control what a user can view. The system can be locked down even more through the operating system.

Capacity and memory.  MySQL can handle almost any amount of data from only a few rows to as much as 50 million rows or more.  The default file size limit is about 4 GB.  It manages memory very well, which means it functions efficiently and speedily without crashing or dumping your information.  Additionally, MySQL server has been thoroughly tested to prevent memory leaks.

Unbeatable flexibility.  MySQL runs on many operating systems, including Novell NetWare, Windows, Linux, and UNIX

It supports several development interfaces including JDBC, ODBC, and scripting languages including PHP and Perl.  This enables you to create database solutions that run on all major operating systems, including Linux, UNIX, and Windows.

More than one person can access business information at a time. This means that a large group of people can access the information at once but there can also be several connections at one time.

Multiple storage engines, or types of table, allow you to choose which one is most effective.

Commit grouping, gathering multiple transactions from multiple connections together to increase the number of commits per second.

Technical support.  One of the drawbacks to many open source products is the fact that the support is sometimes nonexistent or slow to respond at best.  The products are free or close to free so it’s a trade off.  However, MySQL Enterprise offers support itself, including 24/7 30-minute response time and the support team has direct access to the software developers.

Licensing.  We’ve already discussed the fact that open source products are extremely cost efficient!  MySQL AB makes MySQL Server available as free software, but they also offer the MySQL Enterprise subscription offering for business users and dual-license it under traditional proprietary licensing arrangements for cases where the intended use is incompatible with the General Public License agreement.

Drawbacks of MySQL

Early versions of MySQL lacked many standard relational database management system (RDBMS) features, usually with the goal of trading guaranteed accuracy for speed. Many (but not yet all) such criticisms have been remedied in later versions of the software, including transactions and relational integrity constraints.

Some say that MySQL’s feature list leaves something to be desired, but its fans swear that a scaled-down feature set means you only have to deploy, configure and maintain what you need.

There are also a few common errors such as out of memory or packet too large they generally relate to the configuration of the server and are uncommon and the errors are fairly easy to remedy. 

Bottom Line:

The uses of MySQL are seemingly endless and for a business the information gathered is priceless. Combined with PHP, it can be used to create dynamic web pages.  If you’re using any type of web 2.0 technology like forums, online ordering, subscription forms etc…must utilize a database of some sort to gather and analyze the information.  When it comes to database technology, there really isn’t anything that beats MySQL for stability, price, and ease of use. 

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

Pros And Cons Of Linux - Is It Right For Your Business?

Monday, November 26th, 2007

Pros And Cons Of Linux. Is It Right For Your Business?

What is Linux? 

Linux is an operating system, like Microsoft Windows, MacOS, or Unix.  It was created as a hobby by Linus Torvalds, a student at the University of Helsinki in Finland.  What most people don’t know about Linux is that its source code is available to anyone.  The Linux source code is called the kernel and it is the base of the Linux operating system.  Because the source code or kernel is free, it has enabled hundreds of companies and individuals to release their own operating systems based on the Linux system.  These operating systems or formats are often referred to as Linux distributions. 

Each distribution has its own set of features and functionality that makes it unique.  While Linux is generally considered free-ware and people associate that with no cost, that is not always the case.  Some distributions are available for download for free and others are available on CD or floppy disk and have a small charge associated with them. You can find a list of distributions at http://www.linux.org/ and a list of applications at http://www.Linux.org/apps/

Because if the adaptability of Linux it has been embraced and supported by a number of operating systems and software programs.  For example, IBM, Hewlett-Packard and other giants of the computing world have embraced Linux and support its ongoing development and openoffice.org and Mozilla run on Linux.  US retailing giant Wal-Mart began selling Linux systems back in 2002 -  if Wal-Mart isn’t mainstream, nothing is. 

What are the benefits of Linux?

Many people fear that Linux is going to be difficult to work with or that it will be difficult to find software that will run on Linux however Linux is a very standard operating system, compatible with just about any software you need.
 
Beyond being a standard operating system, Linux supports open source software which makes it a very economical operating system, especially if you program your own software.  It offers many free or low cost applications which include, basic desktop applications like web browsers, email programs, word processing programs, spreadsheets, graphics programs, and file managers.

Linux can easily operate as a central server for your business. With Linux, you can serve your own web pages up for public consumption and handle your own email.

Linux doesn’t require top of the line hardware though many recommend you have at least 256 MB of RAM and at least 4 GB of space in your hard drive.

Linux is considered to be extremely stable and doesn’t need to be rebooted periodically to maintain performance levels. Think about the last time you sat at your computer and it froze.  Not fun, right?  That doesn’t happen with Linux if it is configured correctly. 

Linux isn’t going to be replaced anytime soon and when bugs are found in the system, a developer are quickly on the job and often times a solution is offered within a matter of hours, not months or years like many other operating systems.

Linux is also fast and can handle a number of tasks at the same time. 

Linux also claims to be one of the most secure operating systems isn’t plagued with the viruses that other operating systems generally deal with. 

Linux is free from having to upgrade it or deal with proprietary file formats and licensing fees.  You don’t have to register it due to its open source format.  

You can have both Linux and windows on your computer.  (You’ll have to partition them on your hard drive and you can only boot them one at a time.)

Drawbacks of Linux

There is no 1800 customer service number to call.  However, most distributions offer a support number or email to call if you find a bug.  They also generally come with installation instructions.

You cannot run applications for MS windows on Linux.  However, there are Linux emulators or applications that enable you to run some windows applications on your Linux system.  They operate like a translator.  Some of these ‘translation or emulator’ products are free and others are available for a price.

Linux is not able to run some advanced financial applications or reproduce some proprietary multimedia formats.

Tips and Advice:

Choose a popular distribution has a large developer community. A large developer community means that you’ll find the programs that you need easily and you will be able to install them with the same ease. The more well-known distributions have prepared programs in ‘packages’ that are easy to install. On top of this, there are tools designed especially for a particular distribution to manage these packages to make sure that programs run correctly right away. The website Distrowatch.com maintains a comprehensive list of the most popular distributions.

Get the latest version of your chosen distribution.  The newer the Linux distribution version, the better the hardware support. The number of glitches you’ll get in the installation process decreases with the newness of the version of Linux you choose.

Consider paying for your Linux distribution.  It is true that you can get a full-featured Linux operating system free of charge by downloading it from any number of sources. This is an excellent alternative to an operating system like Windows, which either comes pre-loaded with a newly purchased computer (which gets figured into the cost), is bought separately or copied ‘illegally’. In most people’s experience, the popular Linux distributions are easy to install. However, if you do run into some glitch (normally hardware related), you may have a frustrating experience. Although there are a number of excellent Linux support forums out there, personalized advice on your particular problem may be hard to find.

Use an appropriate computer.  if you want to use Linux to do the same things that you would with Windows XP or Mac OS X, then you’ll need the newest computer you can get your hands on. Avoiding ‘elite’ video cards and new, exotic hardware will also work in your favor because you won’t have to deal with hardware support which may be inferior to hardware support from other operating systems. 

Bottom Line:

Linux is a fantastic and powerful operating system that can handle most or all of your operating needs.  It is secure, fast, reliable, and generally extremely cost effective.  When purchased or obtained through a reliable distributor and installed and configured correctly there are virtually no drawbacks to running Linux.  Additionally, you don’t have to give up your windows if you don’t want to.

MemberSpeed Content Management software can run on any Linux Any Linux based Hosting Platform (Preferably RHEL 3 or above).
 

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