Transcendental function programming

Written by Charles Douglas Wehner

Continued from page 1

But is thatrepparttar BEST? That depends upon your processor.

Every time you add something to a logarithm it is like multiplyingrepparttar 107760 antilogarithm. Some processors will multiply quickly, others not. Sorepparttar 107761 trick of SHIFTING a number is a good substitute for multiplication. Copyrepparttar 107762 number. Shift it right. Addrepparttar 107763 number you first thought of. You have multiplied by ONE-AND-A-HALF without multiplying.

So you can create table of logarithms of one-and-a-half, one-and-a-quarter, one-and-an-eighth and so on. From these you can build an antilogarithm algorithm that differs from McLaurin-Taylor.

And what happens whenrepparttar 107764 number of shifts exceeds halfrepparttar 107765 number of bits inrepparttar 107766 mathematics? Eureka! an unexpected move! Check Mate.

The program has terminated in only a quarter ofrepparttar 107767 expected time!

Books have been written about chess. Rather fewer have been written about transcendental machine-code mathematics. These things are commercial. They are closely-guarded trade secrets.

I had spent some years developingrepparttar 107768 most exquisite tricks, and was prepared to writerepparttar 107769 definitive manual onrepparttar 107770 subject. However,repparttar 107771 British government stole everything from me - leaving me only withrepparttar 107772 memory of many an elegant "game".

What should I do? Should I continue to hide my knowledge? No. I hastily put down in writing as many salient points as I could remember. Perforce, these are just summaries ofrepparttar 107773 techniques involved. There was no time to dwell upon detail. However, those who need to knowrepparttar 107774 reasoning behindrepparttar 107775 inner core of floating point, and have time to delve and ponder, may well find this page to be a treasure-trove of programming ideas.

The algorithms can be seen at

Charles Douglas Wehner

Born in 1944, Charles Wehner was involved in the design of computers in 1962 before becoming a design engineer and technical author in photoelectrics, nucleonics and radar.

PHP in the Command Line

Written by Robert Plank

Continued from page 1

Tip: Pipe your cron jobs to /dev/null if you aren't doing anything withrepparttar output, because some hosts e-mail yourepparttar 107759 results and no one needs an extra piece of useless e-mail every day.

Just change torepparttar 107760 page of your choice. However it's important to know thatrepparttar 107761 "archive" you're taking will only be a snapshot of that page on a particular day.

What I mean by that is, if you're archiving a blog page every day, this archiver won't archive that page on a particular day, it'll just be archiving what was there at that time. So it's not useful for everything, but it's good if you have access to a page that changes constantly, once a day, whose results you'd like to store.

Add that line above into your crontab file. These days every host has a control panel so there should be a place in there to add cron jobs. If you'd likerepparttar 107762 archiver to run at a time other than midnight, or if it should run weekly, monthly, or whatever, try this tool I've made for you:

I've designed itrepparttar 107763 same way Task Scheduler is setup, you can enter a certain time, run only on weekdays, run only on certain days ofrepparttar 107764 week. Anything you want.

This tip doesn't take care of everything... for example, wget won't saverepparttar 107765 images on a page unless they're referenced by full URLs. Inrepparttar 107766 next installment of this article series I'll be showing you how you can use PHP to make up for some ofrepparttar 107767 things wget can't do (like grabbing images).

Here's my solution: utorials/commandline/

It's notrepparttar 107768 most perfect script inrepparttar 107769 world, but it should do what you want most ofrepparttar 107770 time. If you'd like to delve into what it does, I've added comments within so you can see what it does. I've commented allrepparttar 107771 functions and a few ofrepparttar 107772 important parts ofrepparttar 107773 code.


But wait, you want to use it in a crontab, which is run fromrepparttar 107774 command line. You can't just do something like:

php get.php?url=

Because it'll try looking for a *file* named all that, complete withrepparttar 107775 question mark and all. So what if you have ten different URLs to grab off ten different crontabs, but you only want one script.

How would you do all that? It's a long brutal ordeal so prepare yourself. Ready?

php get.php url=

Yeah, that's all there is to it. PHP's pretty cool like that, it takesrepparttar 107776 arguments afterrepparttar 107777 file name and stores them inrepparttar 107778 same array you'd check anyway.

One thing you might notice is that every time you run PHP fromrepparttar 107779 command line, it gives you something like this:

Content-type: text/html X-Powered-By: PHP/4.3.3

your output here...

Those first couple of lines arerepparttar 107780 HTTP headers. But we're not using HTTP (not loading it from a browser), so inrepparttar 107781 command line it's better to call php withrepparttar 107782 "-q" option, like this:

php -q get.php url=

The "q" stands for quiet, and will refrain from giving yourepparttar 107783 HTTP headers. If you're just pipingrepparttar 107784 script to /dev/null (to nothing) in a crontab, it doesn't really make a difference but you should try to make this a habit when running PHP fromrepparttar 107785 command line.

That's enough for you to at least get started. If you still feel liking poking about withrepparttar 107786 things PHP can do inrepparttar 107787 command line, you can try prompting a user for keyboard input, like this:

echo "Give me your name: "; $data = fopen("php://stdin", "rb");

while (1==1) { $chunk = fread($data, 1); if ($chunk == " " || $chunk == " ") break; $input .= $chunk; } fclose($data);

echo "Hello $input! ";


Remember, that only works when PHP is run fromrepparttar 107788 shell.

If you have PHP installed in Windows on a local machine of yours, you can also see what happens when you try to read (and write) to filehandles like "COM1:" and "LPT1:" ... yep, you guessed it,repparttar 107789 serial port and printer port. If PHP isn't installed onrepparttar 107790 computer you're using now then don't bother. But it is possible to use PHP to print and interact with your peripherals as well.

You're welcome.

Robert Plank is the creator of Lightning Track, Redirect Pro, Rotatorblaze, and others.

An easy way to display the content saved by this article's script is explained in chapters 15 and 16 of his book, "Simple PHP":

You may reprint this article in full in your newsletter or web site.

    <Back to Page 1 © 2005
Terms of Use