May 7, 2008

Search and Replace Wildcard Characters in Dreamweaver

Search and Replace Wildcard Characters in Dreamweaver

Dreamweaver has a powerful search/replace ability which includes ‘regular expressions’. This allows you to scan and replace particular html without affecting data.

Here’s an example of how useful this is:

Let’s say you are harvesting content from Wikipedia and putting it on your own website. Though I don’t endorse that activity, it is allowed according to the GDFL and a lot of people do it. So, here’s a way to make it easy.

Let’s say you find a huge table full of data that you wish to use on your own website. Since Wikipedia has tons of links and junk in the code, you want to strip it all out. One way is to copy and paste into Excel, then save as a .csv or .txt file, thus stripping out the extra invisible formatting html code that was previously a part of it. Then, close and re-open the .csv or .txt into Excel, then copy and paste into Dreamweaver (or your HTML editor). While this works, Excel still seems to copy over some html formatting, such as <td height="17" … on every field of the table, which is annoying.

You can do a find/replace in Dreamweaver for height=”17” and leave the replace field blank. That would solve that problem, however, Wikipedia often uses footnotes which add [1] [2] [3] etc in superscript, such as the example below. The question is how do we delete these brackets from our copied table, but preserve the data. Good news- we can do that with Dreamweaver, using regular expressions.

Change from this:
<td height="17">Batman Begins[1][2]</td>
<td height="17">Superman</td>
<td height="17">Army of Darkness[3]</td>

Into this:
<td>Batman Begins</td>
<td>Superman</td>
<td>Army of Darkness</td>

If you had a huge table full of this with 100+ rows with 50 or more footnotes, it would take a long time to manually remove all of the brackets by hand. Here’s a way to automate it in Dreamweaver:

(Make sure you are searching the ‘source code‘ and that the ‘Use regular expression’ box is checked)

Find:
<td height="17">([^<]*)\[[^"]*</td>

Replace:
<td>$1</td>

Result:
Dreamweaver will instantly strip out all the junk from your code and replace it with the core code while preserving your data. In this case, the wildcard variable will preserve anything between <td height="17"> and </td>.

Explanation:
The find is the prefix of the tags, then the wildcard variable that’s stored: ([^<]*) then, I wanted to remove the brackets, so I put one in, but since we’re using expressions, it has to be ‘escaped’ to tell it viagra next day we literally mean the bracket, so I put this \ before the [ then I added a non-stored wildcard variable (the other junk I want removed), so I added: [^"]* then the close tag </td>. Then the replace is the simple $1 variable between the tags which recalls the stored variable. Very cool!

Another challenge:
Let’s say you want to copy a huge list of links from Wikipedia and change them to our own links on our own website. Here’s an example:

Change from this:
href="/wiki/Army-of-Darkness">
href="/wiki/Raiders-of-the-Lost-Ark">
href="/wiki/Pulp-Fiction">

Into this:
href="http://www.domain.com/Army-of-Darkness.php">
href="http://www.domain.com//Raiders-of-the-Lost-Ark.php">
href="http://www.domain.com/Pulp-Fiction.php">

In Dreamweaver, select Find/Replace…

1. Check ‘use regular expression’
2. Do Find for:
href="/wiki/([^<]*)">
4. Replace:
href="http://www.domain.com/$1.php">
5. It preserves the variable inside

Without the regular expression, you could have done Find/Replace for the first part, but when you wanted to add the .php to the end, you’d be stuck. How else would you do it?

Pretty incredible, huh? You can automate the changing of links or anything on an entire website with thousands of links and pages in just seconds. All using the stored wildcard variable.

([^<]*) is stored (use $1 to retreive in replace)
[^"]* is unstored

You can also do Find/Replace to recall multiple variables at once, like this:

If multiple wildcards:
([^<]*) ([^<]*) ([^<]*)
Use:
$1 $2 $3

A tool like this can give you the power to harvest public domain or free content, manipulate data and repurpose it for your own site.


The regular expression you seek is: [^"]*

so if you want to change all these:

<a class="wildcat" href="lion.html">
<a class="wildcat" href="tiger.html">
<a class="wildcat" href="leopard.html">

to:

<a class="wildcat" href="bigcat.html">

you search for:

<a class="wildcat" href="[^"]*">

and replace with:

<a class="wildcat" href="bigcat.html">

(make sure you tick the match case & regular expressions + seclect 'source code')

Permalink • Print • Comment

How to trim down the size of your PowerPoint presentation

Date: April 14th, 2008

Author: Susan Harkins

PowerPoint presentation files can grow quickly. Graphics files, music, and all those custom viagra newsletter instructions really add up. There are a few things you can do to reduce the file’s size:

  • Reduce all graphics files to 96 dpi if you don’t need to print them directly from the presentation. For screen viewing, 96 dpi is the best you can get. To include files with a higher resolution is a waste.
  • Bitmap (.bmp) files are usually larger than other formats. If you’re using bitmap files, try converting them to .jpeg or .png. Even .gif is better than .bmp, but not quite as efficient as .jpeg and .png.
  • If the file suddenly grows in size for no apparent reason, save the presentation using Save As and give it a new name. This simple trick can reduce the file’s size up to 50%, but it won’t always work. This trick works with normal bloat.
Permalink • Print • Comment

How to e-mail a completed Access form

Date: May 6th, 2008

Author: Mary Ann Richardson

You are updating your employee database. You’ve just entered the name of the client company assigned to one of your employees and notice that some of the personal information on the form may be incorrect. You’d like to send a copy of the form to the employee for confirmation. Follow these steps:

  1. Open the form and navigate to the employee record.
  2. Click the selection bar to the left to select the employee’s record.

  1. Go to File | Send To | Mail Recipient (As Attachment). (In Access 2007, click the Office button and then click E-mail.)
  2. Select HTML (*.htm; viagra men *.html) or any other format, as required.

  1. Click OK twice.
  2. Fill in the address, subject, and your message and then click Send.

Your employee will receive an attachment containing a copy of the data entered into the form in datasheet format.

Permalink • Print • Comment

How to avoid an embarrassing mistake in Outlook

Date: October 15th, 2007

Author: Susan Harkins

Have you ever sent an e-mail to the wrong person? If you’re lucky, it didn’t matter. However, it could be an embarrassing and even critical error. For instance, let’s suppose you have two clients named John. You sent John Smith your regular fee schedule. Later, while negotiating a new project with John Smythe, you offer a discount. Oooops! Outlook just sent the discounted fee schedule to John Smith instead of John Smythe, as you intended. Just how did that happen?
It really isn’t Outlook’s fault. Usually, this kind of error occurs when you’re in a hurry or distracted. You type John into the To box, take the first hit, and send — without realizing that Outlook’s AutoComplete feature chose the wrong John. It happens….

There are two ways to complete an e-mail address:

  • Click the To button to view the Select Names dialog box, which displays names in first name order (unless you’ve changed the sort order). You select the name and continue.
  • You start typing a name in the To box. Based on the characters you enter, Outlook’s AutoComplete feature displays a list of possible choices. As you enter more characters, Outlook narrows the list.

The second method is the one that can get you into trouble. The AutoComplete feature updates its list so fast that it’s easy to select the wrong item. It’s a great feature, but prone to mishaps if you’re not careful. You can disable AutoComplete as follows:

  1. In the Mail window, choose Options from the Tools menu.
  2. Click E-mail Options.
  3. Click Advanced E-mail Options.
  4. Uncheck the Suggest Names While Completing To, Cc, And Bcc Fields option.
  5. Click OK three times.

The truth is, AutoComplete is helpful and you might not want to disable it. I use it almost exclusively.

Another problem is that Outlook maintains a history of all the addresses you enter, not just the ones you store in the Address book. These names make their way onto the AutoComplete list, even if you don’t want them. Additional names can throw a monkey-wrench into your routine if you don’t expect them. When one of these names shows up, simply delete it before it gets you into trouble.

Finally, the best advice is the least helpful. Try to slow down and pay attention to the AutoComplete viagra mail order list. Okay, I’m obligated to say that, even though I don’t always practice what I preach. Carry on as best you can, forewarned.

Permalink • Print • Comment

10 ways to prevent Access database corruption

Date: April 1st, 2008

Author: Susan Harkins

By Susan Sales Harkins and Gustav Brock

Nothing frustrates the full spectrum of Access users — from casual user to developer — quite like a corrupted database. With a little know-how, you might get lucky enough to repair the database or at least recover the data. Sometimes, a third-party product that specializes in recovering data from a corrupted database can help. But you could end up rebuilding and re-entering data. (Or rather, your replacement will rebuild and re-enter it.)

A more proactive approach to the situation is to avoid corruption in the first place. Here are some strategies for preventing your databases from becoming corrupted.

Note: This information is also available as a PDF download.

#1: Split your database

If more than one person will access the database, split it into two pieces: a backend that stores the data in tables and a front end that contains everything else (forms and reports). Access has a wizard that holds your hand through the process so there’s no excuse not to split a shared database. Name the two ends appropriately. Remember, the backend contains your “gold” — your data. With the data and interface objects in separate databases, you can easily replace the front end from a backup, if necessary. In addition, this setup makes enhancements easier to incorporate into your system.

There is some discussion about whether the front end should be stored on a network server (and shared) or on a local drive. This decision really has no impact on corruption, so the choice is yours. If possible, consider write-protecting a shared front end. If the worst happens and something destroys the front end, simply obtain a fresh copy of it to replace the broken one and reboot the local system.

#2: Store temporary tables in a backend

If a database creates, populates, and then deletes temporary tables, keep those tables in a separate backend database to prevent bloat. Name the additional backend accordingly, making its purpose obvious. This additional backend can be shared or local.

#3: Don’t use memo fields

Avoid using memo fields if possible. They often, indirectly, cause corruption. Even though the database in these cases often can be repaired, some content in the memo fields might be lost. If you need memo fields, keep them in separate tables and create a one-to-one relationship to the parent table(s). Even better, move memo tables to a separate backend database file and name the file accordingly, to indicate its purpose.

#4: Don’t store picture files

Usually, you shouldn’t store picture files in a database. If you must, treat them the same way you would a memo field (see #3). Access has no problem attaching tables from multiple backend databases.

#5: Create temporary tables to speed up queries

If you run complex or nested queries (where one query pulls data from others that hit still others), Access may write a lot of temporary data that you never see. Most often, this happens when a query that works with a small amount of data performs slowly, putting stress on the JET engine. If Access chokes during this process, you can end up with a corrupt backend file.

To prevent this problem, write some of the temporary data to temporary tables. There’s no universal method to recommend. Analyze the specifics and run some tests to find the best solution. However, sometimes the use of just one temporary table can minimize the chance of corruption and speed up the queries by a factor of 10 or more.

#6: Be careful with wireless networks (WiFi)

A connection may work fine, but multiple users or powerful neighborhood networks (or other noise sources) can abruptly cut off the connection. That can corrupt the database file if you are writing to it at the time. This type of interference isn’t a problem if users are mostly reading from the database.

#7: Be careful with WAN connections

A WAN connection that covers any connection from a local system to a server via the Internet can cause trouble. Reading the database may be slow but acceptable. However, writing to the database is error prone and can cause corruption. When bottlenecked traffic interrupts data transfer, Access times out, believing the connection has been lost. This behavior usually leaves the backend database in a corrupted state.

#8: Don’t put Mac and Windows users on the same network

If Mac and Windows users share the same network and experience problems, establish a separate network for database users. Macs are extremely noisy, and typical Mac applications generate vast amounts of network traffic when moving large graphics files and printing. In a shared environment, use only high-quality network components.

It’s best to keep the database traffic separate from the graphics traffic, as much as possible. You can accomplish this by allowing administrative workstations to connect directly to the server with the shared database via a local switch.

#9: Troubleshoot network hardware

If corruption just happens from time to time, you may have to deal with a network hardware issue. First, try to narrow down the workstation and swap the error-prone station with another. If the issue follows the workstation, you know that’s the source. It might be easiest to get rid of the workstation.

If the problem isn’t specific to the workstation, the error is most likely to be found in the connection from the workplace to the network switch — including the actual switch port. If the cable’s in good shape, swap the ports between the workstations. If the error source now swaps too, replace the switch; if not replace the cable. If cables aren’t permanently installed or don’t cross from floor to floor, you can try replacing them before swapping workstations.

#10: Check the server’s configuration

Sometimes, the configuration for the server where you’ve stored the shared backend database file is the culprit. You’ll need a specialist to track down and resolve this type of problem. There are several possibilities, from server parameters to a malfunctioning disc controller to a misconfigured RAID array.

You can temporarily move the backend file to a different viagra low price location, like one of the popular NAS devices or a shared folder on a workstation. If the problem with corruption goes away, call the specialist. If not, the corruption’s source is somewhere else (#1 through #9).

Permalink • Print • Comment
Next Page »
Made with WordPress and a search engine optimized WordPress theme • Sky Gold skin by Denis de Bernardy