Search In Site

20 June, 2013

How to Create Truly Skinnable Web Sites

Take your data and put it in an XML file
For example, a site's index page might look like this:<?xml version="1.0" encoding="UTF-8"?> <mySite page="index" title="Welcome to my site!"> <linkbar> <item type="link"> <uri>./faq.php</uri> <title>FAQ</title> <desc>Frequently Asked Questions about this site</desc> </item> <item type="form"> <action>./search.php</action> <method>post</method> <input type="text" name="search" maxlength="100"/> </item> <!-- other links --> </linkbar> <greeting> <para> Welcome to my site! </para> <para> Please check out all the sections. </para> </greeting> <news> <news-story> <date>November 29, 2001</date> <story>Some stuff happened.</story> </news-story> <news-story> <date>November 30, 2001</date> <story>Some more stuff happened.</story> </news-story> </news> </mySite>

Looks pretty simple, but it can be improved upon to make it even easier for us to maintain. Instead of adding a news story by manually editing the file, I'd like to pull the stories out of my database. That way, I can create a simple script to put my news in the database and then I can easily add news stories without having to FTP in to the server and edit the file.

We'll be using php's XSLT extension, Sablotron, to transform the XML file (discussed later on), so why not use its power to add dynamic content to the XML file also? It's easy to do. Just have php hold the XML data, pass it to Sablotron and have it pass the data to the XSL file. For example, to pull news stories out of a MySQL database and have it added to the XML file, we would do the following:
// code to connect to the database and pull the stories omitted for brevity. // $db_query holds an SQL query to pull news stories out of the database. $xsltArgs["stories"]="<news-story>"; while($row= mysql_fetch_array($db_query) { $date= $row["date"]; $story= $row["story"]; $xsltArgs["stories"].=" <date>$date</date> <story>$story</story>"; } $xsltArgs["stories"].="</news-story>";

$xsltArgs is an array. $xsltArgs["stories"] holds the XML for the news stories. This variable will be used later when the transformation takes place. If you want to add more dynamic data to your site, store it as XML in another slot of the array.

Now that we've created the XML file for the index page, we can create an XSL file that will be used by Sablotron to transform the XML file. Here is an XSL file that will transform the XML file into a simple XHTML web page.

<?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> <xsl:output indent="yes" encoding="utf-8" method="xhtml"/> <xsl:template match="/"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <title>My Web Site - <xsl:value-of select="mySite/@title" /></title> <meta content="My homepage!" name="Description" /> <meta content="My, stuff, cool page" name="Keywords" /> <meta content="ALL" name="Robots" /> <meta content="Copyright 2001 Joe-Webmaster" name="Copyright" /> <meta content="Joe-Webmaster" name="Author" /> <link href="main.css" rel="stylesheet" type="text/css" /> </head> <body> <br /> <xsl:call-template name="linkbar" /> <br /> <xsl:call-template name="content" /> </body> </html> </xsl:template> <xsl:template name="linkbar"> <xsl:for-each select="mySite/sidebar/item"> <xsl:if test='@type="link"'> <a href="{uri}" title="{desc}"><xsl:value-of select="title" /></a><br /> </xsl:if> <xsl:if test='@type="form"'> <form method="{method}" action="{action}"> <xsl:for-each select="input"> <input class="search" type="{@type}" name="{@name}" size="10" value="Search" maxlength="{@maxlength}" /> </xsl:for-each> </form> </xsl:if> </xsl:for-each> </xsl:template> <xsl:template name="content"> <strong><xsl:value-of select="mySite/@page" /></strong> <br /> <xsl:for-each select="mySite/greeting/para"> <p> <xsl:value-of select="."/> </p> </xsl:for-each> <hr width="454" align="center" /> <span class="news">News::</span> <br /> <div class="news"> <xsl:for-each select="document('arg:/stories')/news-story"> <span class="newstime"><xsl:value-of select="date" /></span> <div class="newsitem"> <xsl:value-of select="story" /> </div> <br /> </xsl:for-each> </div> </xsl:template> </xsl:stylesheet>
You could repeat this and create many different XSL files to output many different pages (such as a WML page for viewing on a WAP enabled device). If you stored more dynamic content in another slot of the $xsltArg array, you can retrieve it in your XSL file by using:document('arg:/<name of slot>')
where <name of slot> would be the name of the slot in the array.

Now all that is left to do is apply the XSL transformation to the XML file. To do this, I use php's XSLT extension, Sablotron. I should mention that Sablotron is not enabled in default php installations. To activate it on a *nix machine, run the following:

./configure --enable-xslt --with-xslt-sablot 

If you're being hosted by someone else, ask them to do it for you. I chose a server side transformation because many browsers lack the ability to do transformations on the client end. By doing the transformation on the server, you're guaranteed that the transformation will occur.

The simplest way to use XSLT in php is to pass the path to both the XML file and the XSL file to the xslt_run() function like this:

// First create an XSLT processor. $xh= xslt_create(); // $xsl holds the path to the XSL file. $xml holds the path to the XML file. xslt_run($xh, $xsl, $xml, "arg:/_result", NULL, $xsltArgs); $result= xslt_fetch_result($xh); // Finally, free the XSLT processor since we're done using it. xslt_free($xh);

The $result variable will hold the transformed page which you can then output using echo or do whatever else you may want to do.
The transformation process is a bit different on servers running PHP 4.1 and above. I believe, for completeness, I should explain how it is done. If you're running a lower of version of php, feel free to skip this part. With the advent of PHP 4.1, a new interface to the XSLT engine has been added. Now, to transform an XML file, one does the following:// First create an XSLT processor. $xh = xslt_create(); // Next, pass either two variables, one holding the path to an XSL file and one // holding the path to an XML file. $result holds the transformed data. $result= xslt_process($xh, $xsl, $xml, NULL, $xsltArgs); // Finally, free the XSLT processor since we're done using it. xslt_free($xh);

How To Create a Simple Search Engine In PHP


Before we actually make the search engine, we need to create a basic webpage that will have an input field where the user can enter his or her search query. I'm going to keep mine simple; feel free to make an elaborate one with lots of bells and whistles. The code for my page is below:
<html> 
<head>
<title>Simple Search Engine version 1.0</title> 
</head> 
<body> 
<center> 
Enter the first, last, or middle name of the person you are looking for: <form action="search.php" method="post"> 
<input type="text" name="search_query" maxlength="25" size="15"><br> 
<input type="reset" name="reset" value="Reset"> 
<input type="text" name="submit" value="Submit"> 
</form> 
</center>
 </body>
 </html>


It's a pretty basic page so I'm not going to explain alot of it. Basically, the user will enter the first, middle, or last name of the person they are looking for and hit enter. The contents of the input field will be passed to a php script named “search.php” which will handle the rest.
Now that the page is out of the way, let's create the actual script. First, we need to connect to the database using mysql_pconnect() and select the table using mysql_select_db(). Next, we want to parse the value passed to the script to see if it contains any invalid input, such as numbers and funky characters like #&*^. You should always validate input, don't rely on things like JavaScript to do it for you, because once the user disables JavaScript all that fancy validation goes down the toilet. To check the input we are going to use a regular expression, they are a bit confusing and will be explained in a later tutorial. For now, all you need to know is that it will check to see if value passed is a string of characters. All right, enough chatter, here is the first part of the script:
<?php mysql_pconnect("host", "username", "password") or die("Can't connect!"); mysql_select_db("Names") or die("Can't select database!"); if (!eregi("[[:alpha:]]", $search_query)) { echo "Error: you have entered an invalid query, you can only use characters!<br>"; exit; }
Now that we've done that, we will form the search query.
$query= mysql_query("SELECT * FROM some_table WHERE First_Name= '$search_query' OR Middle_Name= '$search_query' OR Last_Name= '$search_query' ORDER BY Last_Name");
Look confusing? I'll explain, what's happening is, we're asking MySQL to search all the rows in First_Name, Middle_Name, and Last_Name for a match to the query entered by the user; then, take the results of that search, alphabetize the results by Last_Name.
The rest of the coding from now on is a breeze. We will get the results from the query using mysql_fetch_array( ), and check to see if there is a match using mysql_num_rows(). If there is a match, or matches, we will output it along with the number of matches found; if there isn't, we'll report to the user that we couldn't find anything.
$result= mysql_num_rows($query); if ($result == 0) { echo "Sorry, I couldn't find any user that matches your query ($search_query)"; exit; } else if ($result == 1) { echo "I've found <b>1</b> match!<br>"; } else { echo "I've found <b>$result</b> matches! <br>"; } while ($row= mysql_fetch_array($query)) { $first_name= $row["First_Name"]; $middle_name = $row["Middle_Name"]; $last_name = $row["Last_Name"]; echo "The first name of the user is: $first_name.<br>"; echo "The middle name of the user is: $middle_name.<br>"; echo "The last name of the user is: $last_name.<br>"; } ?>
I added that extra if statement so that when we report how many users we've found, its output will be in proper English. If I we don't, the script will echo "I've found 1 matches" which obviously isn't good grammar :P The rest of the script loops through the results and prints them to a webpage. That's all, we've finished the script! The entire script is included below:
<html> <head> <title>Simple Search Engine version 1.0 - Results </title> </head> <body> <?php mysql_pconnect("host", "username", "password") or die("Can't connect!"); mysql_select_db("Names") or die("Can't select database!"); if (!eregi("[[:alpha:]]", $search_query)) { echo "Error: you have entered an invalid query, you can only use characters!<br>"; exit; //No need to execute the rest of the script. } $query= mysql_query("SELECT * FROM some_table WHERE First_Name='$search_query' OR Middle_Name= '$search_query' OR Last_Name='$search_query' ORDER BY Last_Name"); $result= mysql_numrows($query); if ($result == 0) { echo "Sorry, I couldn't find any user that matches your query ($search_query)"; exit; //No results found, why bother executing the rest of the script? } else if ($result == 1) { echo "I've found <b>1</b> match!<br>"; } else { echo "I've found <b>$result</b> matches!<br>"; } while ($row= mysql_fetch_array($query)) { $first_name= $row["First_Name"]; $middle_name = $row["Middle_Name"]; $last_name = $row["Last_Name"]; echo "The first name of the user is: $first_name.<br>"; echo "The middle name of the user is: $middle_name.<br>"; echo "The last name of the user is: $last_name. <br>"; } ?> </body> </html>

It's All Done !!!

What is a Computer trojan horse

What is a trojan?
A trojan horse could be either:
a) Unauthorized instructions contained within a legitimate program. These instrcutions perform functions unknown to (and probably unwanted by) the user.
b) A legitimate program that has been altered by the placement of anauthorized instructions within it. These instructions perform functions unknown to (and probably unwanted by) the user.
c) Any program that appears to perform a desirable and necessary function but that (because of unauthorized instructions within it) performs functions unknown to (and probably unwanted by) the user.
Under a restricted environment (a restricted Unix shell or a restricted Windows computer), malicious trojans can't do much, since they are restricted in their actions. But on a home PC, trojans can be lethal and quite destructive.

Why the name 'trojan horse'?
In the 12th century B.C., Greece declared war on the city of Troy. The dispute erupted when the prince of Troy abducted the queen of Sparta and declared that he wanted to make her his wife, which made the Greeks and especially the queen of Sparta quite furious.
The Greeks gave chase and engaged Troy in a 10-year war, but unfortunately for them, all of their efforts went down the drain. Troy was simply too well fortified.
In a last effort, the Greek army pretended to be retreating, leaving behind a hude wooden horse. The people of Troy saw the horse, and, thinking it was some kind of a present from the Greeks, pulled the horse into their city, without knowing that the finest soldiers of Greece were sitting inside it, since the horse was hollow.
Under the cover of night, the soldiers snuck out and opened the gates of the city, and later, together with the rest of the army, killed the entire army of Troy.
This is why such a program is called a trojan horse - it pretends to do something while it does something completely different, or does what it is supposed to be and hides it's malicious actions from the user's prying eyes.
During the rest of this text, we will explain about the most common types of trojan horses.

Remote Administration Trojans
These trojans are the most popular trojans now. Everyone wants to have them trojan because they let you have access to your victim's hard drive, and also perform many functions on his computer (open and close his CD-ROM drive, put message boxes on his computer etc'), which will scare off most computer users and are also a hell lot of fun to run on your friends or enemies.
Modern RAT'S (remote administration trojans) are very simple to use. They come packaged with two files - the server file and the client file (if you don't know which is which, look for a help file, a FAQ, a readme or instructions on the trojan's homepage). Just fool someone into runnig the server file and get his IP and you have FULL control over his/her computer (some trojans are limited by their functions, but more functions also mean larger server files. Some trojans are merely ment for the attacker to use them to upload another trojan to his target's computer and run it, hence they take very little disk space). You can also bind trojans into other programs which appear to be legitimate.
RAT'S have the common remote access trojan functions like:
keylogging (logging the target's keystrokes (keyboard functions) and sometimes even interfering with them, thus being able to use your keyboard to type instead of the target and say weird things in chatrooms or scare the hell out of people), upload and download function, make a screenshot of the target's monitor and so on.
Some people use the trojans for malicious purposes. They either use them to irritate, scare or harm their enemies, scare the hell out of their friends or enemies and seem like a "super hacker" to them, getting information about people and spying on them or just get into people's computers and delete stuff. This is considered very lame.
There are many programs out there that detects the most common trojans (such as Nemesis at blacksun.box.sk, which also detects people trying to access your computer), but new trojans are released every day and it's pretty hard to keep track of things.
Trojans would usually want to automatically start whenever you boot-up your computer. If you use Windows, you can get b00tm0n from blacksun.box.sk (note: at the time this tutrial was released, b00tm0n was not ready yet, but it should be ready some time before year 2,000, so if you're reading this after Y2K, b00tm0n should probably be available at blacksun.box.sk). Under Unix, we suggest getting some sort of an IDS (Intrusion Detection System) programs to monitor your system.
Most Windows trojans hide from the Alt+Ctrl+Del menu (we havn't seen any Unix program that had the ability to hide itself from the processes list yet, but you can never know - one day someone might discover a way to do so. Hell, someone might have already did). This is bad because there are people who use the task list to see which process are running. There are programs that will tell me you exactly what processes are running on your computer (such as Wintop, which is the Windows version of the popular Unix program called top). Some trojans, however, use fake names and it's a little harder for certain people to realize that they are infected.
Also, some trojans might simply open an FTP server on your computer (usually NOT on port 21, the default FTP port, in order to be less noticable). The FTP server is, of course, unpassworded, or has a password which the attacker has determined, and allows the attacker to download, upload and execute files quickly and easily. For more info about FTP servers and FTP security.

How RATs work
Remote administration trojans open a port on your computer and bind themselves to it (make the server file listen to incoming connections and data going through these ports). Then, once someone runs his client program and enters the victim's IP, the trojan starts receiving commands from the attacker and runs them on the victim's computer.
Some trojans let you change this port into any other port and also put a password so only the person that infect this specific computer will be able to use the trojan. However, some of these password protections can be cracked due to bugs in the trojan (people who program RATs usually don't have much knowledge in the field of programming), and in some cases the creator of the trojan would also put a backdoor (which can be sometimes detected, under certain conditions) within the server file itself so he'll be able to access any computer running his trojan without the need to enter a password. This is called "a backdoor within a backdoor".
The most popular RATs are Netbus (because of it's simplicity), BO (has many functions and hides itself pretty good) and Sub7 (lots of functions and easy to use). These are all Windows RATs.
If you havn't done so already, it is advised to get some RAT and play around with it, just to see how the whole thing works. Using RATs for legitimate purposes
Some people use RATs to remotely administer computers they are allowed to have access to. This is all good and fine, but anyway, you should always be careful while working with RATs. Make sure you have legal access and the right to remotely administer a computer before using a RAT on it.

Password Trojans
Yes, password trojans. Password trojans scour your computer for password and then send them to the attacker or the author of the trojan. Whether it's your Internet password, your Hotmail password, your ICQ password or your IRC passwords, there is a trojan for every passsword. These trojans usually send the information back to the attacker via Email.

Priviledges-Elevating Trojans
These trojans would usually be used to fool system administrators. They can either be binded into a common system utility or pretend to be something unharmful and even quite useful and appealing. Once the administrator runs it, the trojan will give the attacker more priviledges on the system. These trojans can also be sent to less-priviledges users and give the attacker access to their account.

Keyloggers
These trojans are very simple. They log all of your keystrokes (including passwords), and then either save them on a file or Email them to the attacker once in a while.
Keyloggers usually don't take much disk space and can masquerade as important utilities, thus making them very hard to detect. Some keyloggers can also highlight passwords found in text boxes with titles such as 'enter password' or just the word password somewhere within the title text.

Destructive Trojans
These little fellows do nothing but damaging your computer. These trojans can destroy your entire hard drive, encrypt or just scramble important files and basically make you feel very unpleasent. I wouldn't want to bump into one in a dark alley.
Some might seem like joke programs, while they are actually tearing every file they encounter to pieces.

Joke Programs
Joke programs are nice, cute and unharmful. They can either pretend to be formatting your hard drive, sending all of your passwords to some evil cracker, self-destructing your computer, turning in all information about illegal and pirated software you might have on your computer to the FBI etc'. They are certainly no reason to worry about (except if you work in tech support, since unexperienced computer users tend to get scared off pretty easily by joke programs.

Protecting Yourself Against Trojans
Under Unix

If you are working on your PC, DO NOT work as root! If you run a trojan as root, you can endanger your entire system! The whole point in multi-users on a single-user system is limiting yourself in such cases (or in case you want to prevent yourself from doing anything stupid). Switch to root only when you NEED root, and when you know what you're running. Also, remember that even if you're working on a restricted environment, you still put the passwords and files you still have access to to risk. Also, if someone has a keylogger on your system, and you type in some passwords (especially the root password), they will be logged!
Also, DO NOT download any files from untrusted sources (small websites, underground websites, Usenet newsgroups, IRC etc'), even if it comes in the form of source code.

Under Windows
Windows is a whole lot different in this aspect. Limiting yourself under Windows is quite an annoyance. It is almost impossible to work like that, in comparison to Unix.
Also, make sure you don't run any untrusted software. There are much more evil Windows trojans for Windows than Unix, since people are more motivated to write trojans for Unix (because of all the security Unix imposes). Also, when running on a restricted Windows environment, you cannot just act like you're so protected and all. Remember that people can still steal passwords owned by the restricted user, and also, some trojans can break into administrator priviledges and then compromise your entire system, since Windows imposes such lame security.

How To Upload and Download Binary files to Usenet


HOW TO UPLOAD

The purpose of this article is to explain how to upload and download binary files to a newsgroup, with a particular attention to large files sent in multiple posts. Since most newservers limit the size of binary files attached to the messages, you may split a large file into smaller chunks and attack them to several messages. As a general rule, if the file you want to send is larger than 1Mb you'll have to split it into smaller files.
The most popular tool to split large files into chunks in the Windows environment is Mastersplitter, which purpose is "to split large files in order to move them via floppies or for transmission via E-mail." It also can Join chunks or Compare them to verify they are the same of the original file. All you have to do is to launch Mastersplitter, enter the name of the large file you want to split, enter the size (for example, 700Kb).
Anyway, splitting files is not so hard, and you can easily write by yourself a file splitter in C or in QBasic.
It's better not to create too many small chunks because some of them could be lost passing from newsserver to newsserver, and you'll have to repost them, in order to satisfy all the audience. A size of about 700Kb should be good, considering that binaries attachment are encoded, and grows of 1/4 of their original size, and the addictional bytes required for the header and the rest of the body of the message, so that the total size of the message will be lower than 1Mb.
Once you have splitted the file, you can post it to the newsgroup. Make sure the newsserver to which you'll send your messages accepts posting (i.e. it's not a read-only newsserver), and accepts binary attachments. Here you can find a list of free NNTP servers: http://www.ElfQrin.com/mine/nntpserv.html
Since attaching every chunk to a message and then send it it's a long and boring duty, you can use an automatic tool such as Autopost. With Autopost you can put all the files (single files or chunks of a larger file) you want to post in a directory, for example C:\TEMP, then you can launch the program and click on the "Settings" button to enter the option window in which you can enter the NNTP server you want to use (Host), login info (username and password) in case you are not useing a free server, the Header information (Name, Reply-To, Organization), and a prefix to the Subject (the Subject of every post will be made by your Prefix, followed by the file name and [1/1] that means the message has 1 binary attachment. Sadly autopost doesn't add the size of the attachment which is an useful information, especially if who downloads it has a slow connection), the directory containing the files you want to send, and the destination newsgroup. When you are finished with the options, you can click on OK, and then you can start posting by pressing the "Post" button.
If you are doing it for the first time, you can try to post something to alt.test or even better, since they are binary files, to alt.binaries.test : it's not a Good Thing to send binary files to non-binary newsgroups, even if the server allows you to do that. Also when you'll make your actual post, make sure that it's "on topic" with the newsgroup you choose. You'd better lurk in a newsgroup for at least one/two weeks before to make your first post.
A last note about netiquette: make sure you are not using ALL CAPITAL LETTERS not only in the body of your message, but also in your name and subject.

HOW TO DOWNLOAD

To download files from a newsgroup, of course you need to have access to that newsgroup first. So you'll need a program to read newsgroups and a NNTP server that carries the newsgroup you want to open. If your ISP doesn't have a NNTP server, or it has but it doesn't carry the newsgroup you like, or it only gets a few posts for that newsgroup, you can try one of the free NNTP servers from the list at the URL provided above.
For what concerns the application, a browser like Netscape or IE is good enough. If you want to try a specific news agent, you may try Forte Agent. Forte Agent can also automatically split and rejoin large files. To open a newsgroup from a browser, you have to enter in the location field (the one in where you normally enter the URL of a webpage) the "news" protocol followed by the DNS or the IP address of the NNTP server you intend to use, and the name of the newsgroup you want to open, such as in this example: news://news.unina.it/alt.binaries.pictures.animated.gifs
The content of a newsgroup looks similar to your normal mailbox: you can read the posts by clicking on them. If they have an attachment it usually will appear as a link at the bottom of the message. All you have to do is to right click it and save it to disk. If they are chunks of a large file, name them with a progressive number (for example "File1", "File2", "File3", or just "1", "2", "3"...), to make things easier when you'll have to rejoin them. If the attachment is a picture it will be shown directly, unless it is encoded, or you have disabled this function, in case your news agent allows it (on Netscape 4.5+ you can disable image loading with Edit|Preferences...|Advanced| and then uncheck "Automatically load images"). Anyway, in this case you also can right click the picture and save it to disk.
It may happen that the message you opened is not what you expected to, for it has nothing to do with the topic of the newsgroup, because it can be a message posted or crossposted to the wrong newsgroup, or more likely spam (commercial message), or a message posted by a "troll" (annoying person who don't believe in free speech online and flood newsgroups he doesn't like with fake messages). In this case ignore the message and open another one, as a general rule don't even reply to trolls: that's what they want to enhance their otherwise low self-esteem (because they are happy to know someone considered them) and increase flood on the newsgroup. Send your complains to his ISP, instead. If the newsgroup is moderated, moderators will simply delete posts from spammers and trolls (however moderation is generally not a Good Thing, because it's anyway a form of censorship). If you are using a browser, you'd better disable JavaScript inside the messages to prevent spammers to redirect your browser to their website. On Netscape 4.5+ you can do that with Edit|Preferences...|Advanced| and then uncheck "Enable JavaScript for Mail and News".
Binary attachments for their same nature (as they are binary files attached to an otherwise pure text file) are encoded in some way, but generally your news agent can decode them automatically, in a transparent way for you, still some encoding can't be decoded "on the fly" (like Base64) and if you are downloading a picture, you'll see a link to save instead of the picture, even if you enabled the images. Some agents, such as Netscape, don't have a direct support for UUencoded (one of the first encoding systems. UU means "Unix to Unix") attachments, and you'll receive it as a file in this format:
begin PERMISSION_MODE FILENAME
UUencoded data
`
end

as in the following example:

begin 644 europe.jpg
M;2XN+BXN+R\N+B\O+BXN+BXN+R\N+B\O+BXO+RXO+RXN+B\ON+B\O+BXN
M"AM;-#LV2"`@("`@+R`@7`H;6S$[,3%("AM;,CLQ,4@@("`@<("\*&ULS
`
end
The encoded data is a series of lines of ASCII text characters which are normally 60 characters long and begin with the letter "M". When UUencoded files are saved as stand alone files, generally have an ".uu" or ".uue" extension.
If you get this kind of attachment, and your agent doesn't offer a support for it, you have to decode it "manually" first. You have to proceed this way: Copy the whole body of the message (usually with CTRL+A to select all, followed by CTRL+C to copy it), then paste it (CTRL+V) on a good text editor. Don't use the standard Windows Notepad because it can't handle large text files and have problems with some special characters. The best Notepad replacement I ever found (and I've tried them all) is JGsoft EditPad which is also almost freeware (actually Postcardware: the author expects that you send him a postcard if you decide to keep his software, even if there's no expiry time nor nag screens). Download it, unzip it, rename editplus.exe as notepad.exe, copy it in your Windows directory (normally C:\WINDOWS) overwriting the original file, and forget the ugly Windows Notepad as ever existed (note: if you want to keep a copy of the original Notepad, copy it elsewhere but don't move or rename it, because Windows will redirect the File Types to the renamed/moved program). Another excellent text editor mainly meant for coders is EditPlus (shareware), but it has too many functions to be considered a simple Notepad replacement, so I'd rather install it as a second text editor.
However, once you have it in your text editor, delete all the lines which aren't part of the UUencoded file (everything above the "begin" line and below the "end" line) and save it to disk with the name you want. Now you can decode it with Shell Decode Extension or Aladdin Expander. Remember to delete the UUencoded file you saved after decoding it, for it will be only a waste of space on your hard disk.
If the file you are downloading has been UUencoded and then split in multiple chunks, it may happen that single chunks doesn't have the "begin" and the "end" lines. In this case, after you have deleted all the useless lines, leaving only the ones that begin with a "M", manually add the begin/end lines, as in the following example:
begin 644 File2
M;2XN+BXN+R\N+B\O+BXN+BXN+R\N+B\O+BXO+RXO+RXN+B\ON+B\O+BXN
M"AM;-#LV2"`@("`@+R`@7`H;6S$[,3%("AM;,CLQ,4@@("`@<("\*&ULS
end
If you have several chunks of a large files on your hard disk, now it's time to rejoin them. You can do that with a tool such as MasterSplitter, or manually, from the MS-DOS command line. In this case you can use the COPY command like in the following example:
COPY /B File1+File2+File3+File4+FileN DestFile.ext
Where DestFile.ext is the name of the destination file name with the appropriate extension (.MPG for MPEG movies, .MP3 for MP3 audio files, .JPG or .GIF for pictures, and so on...)
The option /B is necessary because you are joining Binary files. If you try to join binary files without the /B option, they will be treated as ASCII (pure text) files, and the copy process will end as soon as the computer will meet a byte with a value of 0, because it will consider it as an End-Of-File (EOF) marker.
If you have several chuncks and you can't put all of their names in a single MS-DOS command line (there's a limit of 127 characters for a single command line), you'd better join them in larger chunks first, as in the following example:
COPY /B File1+File2+File3+File4+File5+File6 File1-6
COPY /B File7+File8+File9+File10+File11+File12 File7-12

COPY /B File1-6+File7-12 TheMovie.mpg
If there are some missing chunks, you can post a message asking to the original poster or to someone else who got all the posts, to post the missing chunks again. It would be nice to have a second newsgroup dedicated only to reposts (a kind of "subnewsgroup"), to don't bother people that got all the parts of the file. Before to ask, you can try to open that newsgroup from another NNTP server. Since news posts are passed from a server to another, it may happen that your server didn't get all the posts, but you could find them in another one which has a better "feed" (it gets posts from more newsservers) and a longer history (it keeps old posts for a longer time).
However, if you can't get all the chunks but the file you were downloading is an MPEG movie, still you can join the chunks you got, if you have at least the first chunk which contains the MPEG header information. You'll notice some weird effects when two non contiguos chunks join. Another interesting peculiarity of MPEG files is that you can view them during the downloading. When you open a message containing a MPEG video, stop it as soon as the link with its file name appear (on Netscape), then right click on the link and save it to disk, so that the file will be saved directly from the Internet to the disk. Now you can make a copy of the file (click on the file name, then press CTRL+C followed by CTRL+V) and launch it while the rest of the file is still to be downloaded. This is useful to see if the video you are downloading is actually what you expect, rather than a video you already have with a different name, spam, or something that could be inconvenient for you.
To see at least a frame of the MPEG video, you should wait until you got at least the first 35Kb (actually it depends from the width/height, color depth and resolution of the video), while if you want to have a more precise idea of the first second of animation, you should wait until you got 75/100Kb. The same peculiarity apply to MP3 audio files and also to JPEG images.

If the file you have downloaded is an executable file, DELETE IT AT ONCE. Never run executable program files downloaded from a newsgroup. They are VERY likely to be trojans or viruses (especially if the program was posted in a newsgroup in which are expressed unpopular ideas). Even if you trust the sender, you can't be sure if instead is someone who forged his identity.
A trojan can format your hard disk, work as a hidden server that keeps a "back door" open to intruders, or send your e-mail address and other personal information to someone else on the Internet, if you are online, or next time you are online. If for some reason you think you have absolutely to try that file, and you can't download it from somewhere else at least check it with an Antivirus such as McAfee before, which however is a good thing to do for any executable file you downloaded from the Internet, or more specifically from a website you've never been before.

HOW TO VIEW A FILE DOWNLOADED FROM A NEWSGROUP

If the file is compressed, you have to decompress it first. There are many compression formats but most common one is ZIP that might be associated with other kind of compressions. However the extension of the file will look like .ZIP, .GZIP, or .TAR.ZIP . WinZip can handle them all, and if you installed the WinZip shell extension you can right click on the file and choose Extract to... from the context menu. For more compression types you can try Aladdin Expander, which also handles typical Mac compressed files such as .HQX or .SIT (StuffIt).
Now that you have uncompressed the file, you can open it.
Microsoft Windows MediaPlayer handles almost all the audio/video formats. Be sure to have the latest version installed. Another freeware alternative is TornaPlayer. If the file is an MP3 you may want to use a better and most specific player as WinAmp.
Pictures in almost any format can be opened with ACD-See (shareware) or IrfanView (freeware). For more (and uncommon) graphic formats you can try a professional application as Corel Photo-Paint. With PhotoPaint you can also edit pictures to adjust colors, contrast, or sharpness. In this case you should save the file with the same name, but adding an "r" as a suffix to the file name: is a good rule to don't never change the name of a picture, especially if it's part of a series.

 
Twitter Bird Gadget