Journal
PHONE: 912-423-2761
EMAIL: dorothy@webwizardworkshop.com
Quick Links
Services
Web Wizard Workshop - Development
Websites
Web Wizard Workshop - Advertising
Advertising
Web Wizard Workshop - Marketing
Marketing
Account Access
Web Wizard Workshop - Account Dashboard
Account
Web Wizard Workshop - My Profile
Profile
Web Wizard Workshop - Support
Support
Portfolios
Coming Soon
Websites
Coming Soon
Marketing
Coming Soon
Graphics
Sort by
Sorting direction

Setting Up Cron to Execute a Bat File Automatically and Routinely

CRON

Now that we've written the code. We need to upload it and build a cron job to execute it according to your desired schedule.

 

  • Using FTP or your CPanel File Manager upload the *.bat file to the location you want to put it.

 

  • From your CPanel open your Cron Jobs application

 

  • Set the scedule

 

  • Enter the path to the *.bat file you uploaded ending with the bat file name and extension. Something similar to this: home/hostinguseraccount/mail/domain.com/filename.bat, or home/hostinguseraccount/public_html/batch_files/filename.bat, or any other path/filename you choose to use.

Work Around Joomla's Tokin Issues

DATABASEDelima

After trying several recommendations made in the articles linked at the right, some users were still experiencing this problem. The quick fix to get them online as quick as possible was the clear the session table, which will result in everyone's session ending that was currently logged on. But it did allow for the users having the token issue to log on once the session table was cleared. So far only two writers are experiencing this problem, no one else. I even deleted thier site profile and generated them a new one, thinking since it was only these two guys and it happend to them no matter what browser or what computer they were on.  But that didn't work either.

Solution

I've developed this batch file that will clear the table every 12 hours. Once in the morning at around 5am to clear the way for their daily entries and then again in the evening around 5pm to clear the way for their evening entries. This batch file will carry out the task of clearing the session table without you having to manually do it yourself.

Options

There are two ways to clear a table.  You could trunacate the table, which is unreversable.  Or you could delete from the table, which is reversable.  I have chosen to trunacate because once a session ends, it ends. There's no need in retaining any indexes or primary keys.  Once a session expires, times out, or ends it should be removed; why hold on to it?

 

1. Create 2 files and name them as shown below.

a. emptytable.sql

b. emptytable.bat

 

Trunacate Table (unreversable)

4. In the SQL file you created in step one include the sql command line below replacing the red text with your own information

 

5. Repeat this as many times as you need to in that same file updating the table name with each line item. Be sure to enter only one command per line as seen in the example below:

 

6. Save the file and close

Delete From Table (reversable)

4. In the SQL file you created in step one include the sql command line below replacing the red text with your own information

 

5. Repeat this as many times as you need to in that same file updating the table name with each line item. Be sure to enter only one command per line as seen in the example below:

 

6. Save the file and close

 

7. In the BAT file (the second file you created in step one) include the statement below. This statement will be read by cron. This statement will direct cron to use the information included in the BAT file to process the SQL file.  Here be sure to update the user=, password=, and database= credentials with your own as well as the file name.

 

8. Save the file and close.

 

9. Upload both files to a location on you website's root or public_html. I've choses to create a folder on the root called batch_files and this is where I put most of them unless they have to be else where.

 

10. Then set up your cron job to pull the command in the bat file and set your cron schedule.

 

 

Browser Friendly Gradient

Gradient Background Script

 

Gradient Background Script Applied to Box

 

Simple Hit Counter

This is a simple script that can be used to add a simple hit counter to your site without installing exentions or third party script services that could slow you site down.  Simply copy the code in the grey section below and past it in your template's index.php file just before the </body> tag.

 

<?php
session_start();
$counter_name = "counter.txt";

// Check if a text file exists. If not create one and initialize it to zero.
if (!file_exists($counter_name))

echo "$counterVal"; ?>

Credit/Source: Hibbard

Used like it is above this code will throw your count to the very lower-left corner of the site. You'd have to scroll all the way to the bottom and then look in the lower/left corner of your browser to see it. It also defaults to #222222; which is practically black. So if you have a dark footer you may want to change the color, alignment, distance from the bottom of the browser window, or even the size.  To apply such customizations simply edit the last line in a manner as shown below but with your own specifications.

echo "<p align=center><span style='color:#ff9900;padding-bottom:25px;'>$counterVal</span></p>"; ?>

You can see a this code in action along with the edits of the last line as shown above at the bottom of this site.

Crazy Characters: One-Click-Fix

crazy charactersCrazy characters appearing in your content after a recent update or migration? If you've done like I did you will have already searched the world over for the cause and the solution. The cause, I discovered, seemed to be consistent, but the solution varied from one person to another.  Each one called for some knowledge of script. However, after much digging and failed trial running on the various solutions; I found a one-click-fix to this issue.

First understand that this happens because the web app you are using is reading you database based on the default encoding, currently utf8; where as at the time it was constructed it was encoded with another collation, latin1 for example. When the site was migrated or moved it exported as the original collation (say latin1) but imported as utf8. The config file would identify utf8 by default unless it was changed during the install of the web app.  In my case my guy was using WordPress on his site. It was reading the data as utf8, phpMyAdmin was showing the table properties to be utf8, but the data was actually imported into the database as latin1 collation.  The trick was to convert the data from latin1 to utf8. 

Many others will say you have to create another database, use shell to export, edit, and import into new database, and then edit the config file to fix. This didn't work as the file exported during the process wouldn't import. Others said simply to edit your config file to say latin1 instead of utf8. Others said take utf8 out of the config file leaving it as ' ' instead of ' utf8 '. These are not fixes and can cause complications with plugins and future updates.

This one-click-fix requires no coding (AT ALL); literally, not even a tiny edit. Here goes what finally worked for me:

  • Log into your cpanel
  • Open phpMyAdmin
  • Click on your database on the left, no any table, the actual database so that you should see the tables of the database and their properties listed on the right.
  • Looking at the tabs above the table click on Operations.
  • On the operations tab locate a section that says Collation where there should only be one field (which is a dropdown field) located in this section and it will be automatically showing what your current database's collation is; change this to very last collation in the list utf8_unicode_ci.
  • Click GO.

You're done. Literally one click and that was simply to change what was showing in the collation dropdown and click GO. How easy was that. 

Unfortunately this doesn't necessarily remove any 'crazy characters' previously thrown in but it will prevent new ones. Simply remove the existing ones.

Character Sets and Collation

 sqlA character set is a set of symbols and encodings and collation is a set of rules for comparing characters in a character set. Here is an example provided by MySQL in their 5.7 Reference Manual:

"Suppose that we have an alphabet with four letters: 'A', 'B', 'a', 'b'. We give each letter a number: 'A' = 0, 'B' = 1, 'a' = 2, 'b' = 3. The letter 'A' is a symbol, the number 0 is the encoding for 'A', and the combination of all four letters and their encodings is a character set...

"Suppose that we want to compare two string values, 'A' and 'B'. The simplest way to do this is to look at the encodings: 0 for 'A' and 1 for 'B'. Because 0 is less than 1, we say 'A' is less than 'B'. What we've just done is apply a collation to our character set. The collation is a set of rules (only one rule in this case): 'compare the encodings.' We call this simplest of all possible collations a binary collation...

"But what if we want to say that the lowercase and uppercase letters are equivalent? Then we would have at least two rules: (1) treat the lowercase letters 'a' and 'b' as equivalent to 'A' and 'B'; (2) then compare the encodings. We call this a case-insensitive collation. It is a little more complex than a binary collation...

"In real life, most character sets have many characters: not just 'A' and 'B' but whole alphabets, sometimes multiple alphabets or eastern writing systems with thousands of characters, along with many special symbols and punctuation marks. Also in real life, most collations have many rules, not just for whether to distinguish lettercase, but also for whether to distinguish accents (an 'accent' is a mark attached to a character as in German “Ö”), and for multiple-character mappings (such as the rule that 'Ö' = 'OE' in one of the two German collations)."

SQL

 sqlSQL is a Simple Query Language used to access, display, and manipulate data stored in a database, whether written for a data management program or a website.

Cascading Style Sheets (CSS)

 cssCSS stands for Cascading Style Sheets. Its function is to describe how elements are displayed on a website and usually comes with templates used as a starting point to the development and design of a website. They saves a lot of work and control the look and feel several web pages all at once. All sites have atleast one, most have many where they are using more than one template for various components or have third party extensions, each having their own CSS file. Generally, most updated templates will have more than one CSS due to today's technologies and the growing need for mobility and fluid layouts where websites need to be able to adapt to the device they are being viewed on. CSS Drives all of this in the background.

Buttonize Your Link

 buttonBasics

Provide the text of the button. Let's say I want to create a button for visitors to click on and email me but I do not want my email address visible for spambots to bombard my inbox.  My text might be "Contact Me"

Now we want to link the text to mailto:This email address is being protected from spambots. You need JavaScript enabled to view it.. We'll hyperlink it like we would any other text or image; right-click > insert/edit hyperlink > in the URL field type in mailto: followed by your email address. Ok. Now your text should like something like This email address is being protected from spambots. You need JavaScript enabled to view it.. Pretty simple. But what if you want it to be a button.

Buttonize It

With everything we've covered in the basics this is what your script would look like when you look at the text editor side of your editor panel.

 

<a href="mailto:This email address is being protected from spambots. You need JavaScript enabled to view it.">Contact Me</a>

 

Now we want to apply a button attribute by setting a class to the link. We do this by determining what class in our CSS apply button settings. In my case I could  use btn-primary or button. So our script becomes what you see below and our link becomes: This email address is being protected from spambots. You need JavaScript enabled to view it.

<a class="btn-primary" href="mailto:This email address is being protected from spambots. You need JavaScript enabled to view it.">Contact Me</a>

Next we set the target; where do we want the link to open to? New tab, new window, or parent page. Typically it will be a new tab or new window. The attribute for this would be _blank and our code becomes what you see below. This email address is being protected from spambots. You need JavaScript enabled to view it.

 

<a target="_blank" class="btn-primary" href="mailto:This email address is being protected from spambots. You need JavaScript enabled to view it.">Contact Me</a>

We like the fact it is a button but we don't want this one to feel and look so cramped. How can we add space between the edges of the button and the text. This will require some CSS and a css suffix. We'll open our CSS file and locate the class btn-primary (or which ever class you used in the samples above). This is what I see:

 

.btn-primary

The radius attributes govern the turn of the corners and the color governs the color of the text in the button. One could also apply a background. In my case the background is governed by other areas of my theme/template. Okay, now lets make some edits without changing the original class .btn-primary. We are going to add a suffix to this and apply our own look. Below the css for .btn-primary we are going to add a section for email.btn-primary where email is our css suffix. We are then going to add some padding and change our radius. It should look like this:

 

.btn-primary

 

Lets apply our new css settings to our button by adding 'email' to the class so that the code looks like what you see below but with what ever class suffix you chose to use. Our button becomes: This email address is being protected from spambots. You need JavaScript enabled to view it.

 

<a target="_blank" class="btn-primary email" href="mailto:This email address is being protected from spambots. You need JavaScript enabled to view it.">Contact Me</a>

 

 If we did not want any radius as all, we would simply replace the 10px with 0px. This can work with any URL, not just an email address. Simply enter the http url in the URL field when inserting/editing your hyperlink of the text. Feel free to comment if this was useful to you or if you have a question.

Buttonize Your Link

 buttonBasics

Provide the text of the button. Let's say I want to create a button for visitors to click on and email me but I do not want my email address visible for spambots to bombard my inbox.  My text might be "Contact Me"

Now we want to link the text to mailto:This email address is being protected from spambots. You need JavaScript enabled to view it.. We'll hyperlink it like we would any other text or image; right-click > insert/edit hyperlink > in the URL field type in mailto: followed by your email address. Ok. Now your text should like something like This email address is being protected from spambots. You need JavaScript enabled to view it.. Pretty simple. But what if you want it to be a button.

Buttonize It

With everything we've covered in the basics this is what your script would look like when you look at the text editor side of your editor panel.

 

<a href="mailto:This email address is being protected from spambots. You need JavaScript enabled to view it.">Contact Me</a>

 

Now we want to apply a button attribute by setting a class to the link. We do this by determining what class in our CSS apply button settings. In my case I could  use btn-primary or button. So our script becomes what you see below and our link becomes: This email address is being protected from spambots. You need JavaScript enabled to view it.

<a class="btn-primary" href="mailto:This email address is being protected from spambots. You need JavaScript enabled to view it.">Contact Me</a>

Next we set the target; where do we want the link to open to? New tab, new window, or parent page. Typically it will be a new tab or new window. The attribute for this would be _blank and our code becomes what you see below. This email address is being protected from spambots. You need JavaScript enabled to view it.

 

<a target="_blank" class="btn-primary" href="mailto:This email address is being protected from spambots. You need JavaScript enabled to view it.">Contact Me</a>

We like the fact it is a button but we don't want this one to feel and look so cramped. How can we add space between the edges of the button and the text. This will require some CSS and a css suffix. We'll open our CSS file and locate the class btn-primary (or which ever class you used in the samples above). This is what I see:

 

.btn-primary

The radius attributes govern the turn of the corners and the color governs the color of the text in the button. One could also apply a background. In my case the background is governed by other areas of my theme/template. Okay, now lets make some edits without changing the original class .btn-primary. We are going to add a suffix to this and apply our own look. Below the css for .btn-primary we are going to add a section for email.btn-primary where email is our css suffix. We are then going to add some padding and change our radius. It should look like this:

 

.btn-primary

 

Lets apply our new css settings to our button by adding 'email' to the class so that the code looks like what you see below but with what ever class suffix you chose to use. Our button becomes: This email address is being protected from spambots. You need JavaScript enabled to view it.

 

<a target="_blank" class="btn-primary email" href="mailto:This email address is being protected from spambots. You need JavaScript enabled to view it.">Contact Me</a>

 

 If we did not want any radius as all, we would simply replace the 10px with 0px. This can work with any URL, not just an email address. Simply enter the http url in the URL field when inserting/editing your hyperlink of the text. Feel free to comment if this was useful to you or if you have a question.

Webmail Retention System

webmailTrouble with hitting your webmail quota repeatedly? Dealing with a law or policy requiring retention? Need a retention system to routinely and automatically backup webmail on the server and clean out old ones without getting rid of them? Here are instructions for creating a system that will:

  1. Backup/Zip webmail older than X days every X days where 'X' equals the number of days.
  2. Send the zipped backup to another directory outside the mail system for storage & retrieval for audits or legal matters
  3. Remove webmail that was zipped in step 1
  4. Remove zipped backup files that are older than X days.

Steps for accomplishing this include:

  1. Open a new txt file using Notepad, comes free with Windows on any machine
  2. Save that file as 'any_name_you_want.bat' or as 'webmail.bat' so long as the file extension is *.bat
  3. Use the code below as a sample and enter your own information
  4. Save the file. You may close it but to open and edit it you'll need to right-click > edit. Double clicking or opening it any other way will make it execute the command and with it sitting on you PC and not on your server, it wont do you any good.

Sample Code:

Now lets break this code down piece by piece so you have a better understanding of how it works.  The first two lines manage your quota without joepardizing your retention.

The first line has two parts: 1) finds files older than 30 days; 2) zips those files that are older than 30 days. The -mtime is referring to when the file was last modified/accessed; not created since webmail does not store its creation date; only the modified date. The +30 means items older than 30 days since its last modification. The last part does the zipping to a location of your choosing.  The _$ (date +$F) in the second part tags the current day's date onto the end of the file name which not only ensures that it doesn't over right the last backup done for this user but also helps anyone searching for an old archive to identify the time frame and correct zip to download/retrieve.

This piece cleans up after itself. It deletes all the files it just zipped and sent away to storage. Know that the -mtime +days must be the same in the first and second line or you could end up deleting mail permanently without meaning to, loosing your record and possible compliance.

 

This line manages your retention. It finds and deletes all the zipped files in the archive directory you chose in second part of line one that are older than X days. In this case we are using +2557 (which equals 7 years). That said, the path provided in the second part of line one must match the path written in this line.

Now that we've written the code. We need to upload it and build a cron job to execute it according to your desired schedule.

  1. Using FTP or your CPanel File Manager upload the *.bat file to the location you want to put it. I'd recommend putting it in the mail/domain.com/ directory, but not inside any particular user folder.
  2. From your CPanel open your Cron Jobs application and set the scedule and enter the path to the *.bat file you uploaded ending with the bat file name and extension. Something similar to this: home/hostinguseraccount/mail/domain.com/webmail_backup.bat.
  3. If you have more than one user you can repeat this code as many times as needed in the same document replacing the user path accordingly. I would recommend creating a structure similar to the existing mail structure where each archive for each user goes to their own folder in the archive directory; again making sure the paths for each are correct in the code.

Displaying a PDF in an IFrame

 pdfPDF downloading instead of displaying in the browser. Perform the following tasks for the Adobe Reader and your preferred browser. If this still doesn't fix the problem, you may need to uninstall Adobe reader from your machine and re-install it. Then reperform the steps for Adobe Reader again.

Adobe Reader:

1. Click Start and go to the Programs list.

2. Find and open Adobe Reader.

3. In Adobe, go to the Edit menu and select Preferences.

4. Under 'Internet', make sure the box for 'Display PDF in browser' is unchecked. Click OK to save your changes.

Internet Explorer:

1. Go to the Tools menu and click on 'Manage Add-ons'.

2. Click on the drop down menu "Show" to display "All Add-ons".

3. Select Adobe PDF Reader and click the Disable button.

Chrome:

1. Type (or copy & paste), this into the address bar:    chrome://plugins 

2. On the next page, to disable plugins, click to disable Chrome PDF Viewer       

             

Firefox:

1. Go to the Tools menu and click on 'Options'.

2. Click on the Applications tab.

3. Find Adobe Acrobat Document and change the preferred action to 'Always Ask'* or 'Use Adobe Reader'.

* 'Always Ask' means every time you click on a link to open a PDF, you will be prompted for a response as to how you'd like the file to be handled.

Safari:

1. Click on the file to open it in Preview.

If you receive a 'Please wait...' message and the file does not open, hover your mouse near the bottom of the window to reveal the Preview toolbar. Click the icon second from the right to open the file in Preview. For more information, please see Setting Adobe Reader to open PDF files.

Source: LWOnline.CustHelp.com, an online Q&A community where you can find answers or ask questions and get an answer.

Additionally, make sure your browser and addons are all up-to-date.  A new addon does no good if its not compatible with an older version of the browser and vice verse.

Using the following HTML code PDF's can be iframed into an article as long as you have included the mime type (application/pdf) and have ensured that your site's editor is configured to allow iframes.

//*<iframe src="http://webwizardworkshop.com/images/pdfs/Content%20Management%20w%20images.pdf" scrolling="auto" width="100%" height="1050px" ></iframe>*//

Free Quote

Domain Checker

Check Domain Availability

 

  

 

WHOIS Detail

 

  

 

Available Domain Extensions

Logo ORG Grayscale HTag
531x235 info
DOTBIZPC
dotMobi 

Reversed High 1208
Dot TV Logo
Logo .com 

JPG file
Logo .net 

JPG file
US R RGB
ICM 102 Web Banner 2 mark your spot

Access Your Account

Login

Login is required to view your quotes, invoices, and account info.

For a username reminder or a password reset to your WWW account, use the links above.