|
All answers provided by Markus Diersbock
Question: |
Unable to Delete File (Filename Too Long)
I have some files on my computer that I am unable to delete. The error I get is that the filename is too long.
|
Answer:
|
File and Folder names have a maximum size limit of 255 characters. Some applications, like Internet Explorer, will create files that exceed this limit. The problem arises when the filename and folder path have a combined length of over 255 characters (Fig 1), which will make Windows Explorer unable to delete them.
Luckily there is a relatively easy fix, if you create a temporary shared folder.
Follow these steps:
1) Navigate to the folder that holds the invalid file
2) Right-click folder and select Properties and the Sharing tab (Fig 2)
3) Select Share this folder
4) Enter a share name or use the default provided
5) Click the Permissions button and set Full Control to Allow for the user Everyone
6) Click the Ok buttons for both dialogs to apply the settings
7) Click the Start menu and select Run
8) Enter \\%username%\[share_name] (replace [share_name] with the name created during Step 4) and click Ok (Fig 3)
9) Delete the invalid file (Fig 4)
Tags: long file name, windows, share, delete
|
Question: |
Only What You Want
To prevent SQL Injection and other security breaches in my PHP scripts, I'm writing a
function to validate user submitted data. What invalid characters
should I parse out?
|
Answer:
|
It is easier to validate against data for what you do want, rather than trying to filter out what you don't. The best way to think about this, is to use the analogy of a night club guest list.
A night club uses a "guest list" to match those who they want to allow entry -- say 200 people. This is far easier to implement than using a "not-a-guest list", because that list would have to account for every person who is not wanted in the club -- which would be impossible to maintain with a population of 6.4 billion. But, this is exactly what many programmers try to do in their code.
They "scrub" the input, using various replacement routines on any invalid characters. The problem is, as in our night club analogy, that you can't foresee new additions that may arise in the future -- new exploits. So the better method is to only allow characters through that you deem valid. These would included letters, numbers, hyphens, periods, apostrophes, etc. And even better, you can accomplish this in one line with a regular expression:
$mystring = preg_replace("/([^'\-_.@A-z0-9\s])/","", $mystring);
This line is a catch-all, but you could build on this code by creating a function that uses a switch statement and multiple regular expressions that validate on specific strings like phone numbers, email addresses, social security numbers, etc.
See my VBScript version of the same example.
|
Question: |
Active Security
What is the best way to secure my ActiveX DLLs under IIS when using ASPs?
|
Answer:
|
Take a look at my previous write up from the Downloads Page: Link
|
Question: |
Out With the ASP, In with the PHP
My website used to be hosted
on a Windows 2000 server (and had ASP files) and is now on a LINUX server (and has PHP files). The problem is that many search engines
still have links to these
old files.
For example:
Old file: www.mydomain.com/myfile.asp
New file: www.mydomain.com/myfile.php
Obviously when the user hits that old ASP file they get a 404 PAGE NOT FOUND
error.
To not drop in the Page Rankings, I need to keep these files until the various
search engines index my new pages. I've set up some ASP files on my new server and have them redirect to
their PHP equivalents for a few of the important files. But when I do this,
Apache parses the extension and tries to download the file to the user,
rather than displaying it in their browser.
How can I get Apache to ignore the ASP extension or at least get it to
process the file like a PHP or HTM file so it can redirect? Also, if
possible, I'd like to have an email sent to me if a user hits one of those
files so I can keep track of which search engines still have these old
links. How do I do this?
BTW, I have a vhost account, so I don't have access to the server's config
files. |
Answer:
|
You can do this simply by adding a MIME type directive for PHP to a .htaccess file in the root directory of your website.
1) Create the .htaccess file with your favorite text editor and add the
following line:
AddType application/x-httpd-php
.asp
This directive treats ASP files as if they were PHP files.
2) Run chmod 644 .htaccess to allow public read permissions
3) The next step can be done in two ways: A or B.
A: The fastest is to create a symbolic link for the PHP file with an ASP
extension. This side-steps the browser redirection and makes it appear to
the user that they are in fact accessing the requested ASP file.
ln -s myfile.php
myfile.asp
B: But since you wanted an email to be sent to you, you'll need to create the
ASP file and add the PHP code to it. You can use the sample below:
$refer=$_SERVER['HTTP_REFERER'];
$script=$_SERVER['SCRIPT_NAME'];
$ebody="RefURL: $refer\nPage:
$script\n";
mail("you@domain.com",
"* * Redirect Notice * *", $ebody);
header("HTTP/1.1 301 Moved Permanently");
header("Location: ./about.php");
exit();
In this example, an email is sent with the referring page that displayed your
outdated link and the name of the ASP file. The script then redirects to the new PHP file.
Remember to run chmod on myfile.asp and set it to 645.
|
Question: |
Problem with XP on
Mini-Notebook
I just installed Windows XP SP2 on my Toshiba
Portege 3110CT. If my Port Replicator is attached, Windows will stop booting
after the splash screen. In the Event Log the error that occurs is "ACPI
BIOS Is Attempting to Write to an Illegal IO Port Address". |
Answer:
|
The BIOS on your notebook is outdated. You'll need to flash your BIOS to the
latest version 7.7 which you can download from
Toshiba (Info
Page) or from our
site if the file becomes unavailable.
|
Question: |
International Calling and Data
What's the best way to set up the iPhone for international calling and data (email, text msg)
|
Answer:
|
AT&T iPhones work great abroad.
Typically Verizon iPhones don't.
But, you'll have to call AT&T and get on their International Plan --
you can drop it again after you get back to the States.
But, if you want to use your iPhone to ROAM, it will cost you a
FORTUNE -- and if you use DATA your bill can be in the thousands.
Calls cost about $1.40/min and they round up to the nearest minute --
and you're charged for incoming calls, even if your phone is off.
EMAIL, TXT, SKYPE
===============================
It's best to only use the iPhone in the hotel, cafe, etc on a free
Wi-Fi Hotspot.
You can download your emails, text msg, send photos, download music
and movies, NetFlix, etc, for FREE.
If you call someone who has Skype on their phone -- the calls are FREE.
If you call someone on a landline or cell it will be a few cents a
minute (must buy credit).
You can also RENT your own Wi-Fi Hotspot for you and up to 5 friends
for about $15/day from TEP Wireless
http://www.tepwireless.com
Also, CellularAbroad
http://www.cellularabroad.com/data.php
(Both also rent smartphones)
MAKING CELL CALLS
===============================
Buying a cheap cell phone ($25) in Europe and buying SIM cards with
loaded minutes is the cheapest way to go.
The best would be to get a cheap Vodafone, Orange, T-Mobile, el al,
when you get to Europe and by SIM cards at any smoke shop, airport,
train station, newsstands, etc.
For example:
In England you buy a 120min SIM, and use it for in-country calls
(hotels, attractions, reservations, etc) -- it's about $0.10/min, but
RECEIVED calls are FREE.
So if each of your friends in your group have local SIMs, you call
each other for pennies a minute.
Make sure you buy EU Countries SIMs.
And if you want to call back to the USA, buy an International Calling
Card, to use with the cell, which will cost about $0.10/min
You can also call AT&T and get an "unlock code" for your iPhone, and
buy SIMs for that instead of buying another phone.
I like to have my cheap "Euro Phone" with me, so I don't get confused
and get hit with roaming charges with my main phone, then when I call
home I use Skype.
CAUTION!
===============================
If you choose to use your iPhone with AT&T, make sure you !!!TURN OFF
ROAMING!!!.
There are horror stories of people coming home to find they have a
$11,000 phone bill.
|
|
|
Notice: You are free to use any
information on this page for personal purposes. Information on this page cannot
be reproduced outside of this website without the affixed copyright notice (at
the bottom of the page) or the written permission of
SwingNote, LLC.
include("includes/footer.php");
?>
| |