Archive for Software
Styling Readonly and Disabled Inputs in Forms using CSS.
No preamble needed…
Readonly:
*[readonly] { /* CSS for all nodes with readonly attribute */ } input[readonly] { /* CSS for input nodes with readonly attribute */ } textarea[readonly] { /* CSS for textarea nodes with readonly attribute */ } select[readonly] { /* CSS for select nodes with readonly attribute */ }
Disabled:
*[disabled] { /* CSS for all nodes with disabled attribute */ } input[disabled] { /* CSS for input nodes with disabled attribute */ } textarea[disabled] { /* CSS for textarea nodes with disabled attribute */ } select[disabled] { /* CSS for select nodes with disabled attribute */ }
Notes:
Works with:
readonly=”[anything]”
readonly
disabled=”[anything]”
disabled
Steven
Install Gnome on Ubuntu Server.
I made my new box out of bits found in my cupboard after my last cleanup.
All I needed it for was VMware Server.
However there came a time where I needed to hook it up to my projector, and play a video.
So here is the easy way to install the default Ubuntu desktop:
apt-get install ubuntu-desktop
Yep, that’s all!
Steven
P.S:
If you don’t want it to start at boot:
nano /etc/init.d/gdm
and make line 2: exit 0
I am an Zend Certified Engineer!
Well, I finally made some time to go down the the testing centre. And I passed, becoming an Zend Certified Engineer!
Windows Home Server announced at CES
This is just for the people who didn’t know, not that I care. FreeBSD to the max!
HTTP Authentication with PHP running as CGI
While developing a project using two factor authentication, with a key fob, I needed to use HTTP Basic Authentication over SSL, to prevent XSS as the project was a web based proxy. Now I had PHP5 running as a module, but PHP4 as CGI. There was the problem HTTP Authentication isn’t available under PHP running as CGI.
First you need to configure mod_rewrite:
.htaccess:
RewriteEngine on
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
What that will do is feed the base64′d user:pass into an environment variable named HTTP_AUTHORIZATION.
Then just add this above your script:
list($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']) = explode(’:’ , base64_decode(substr($_SERVER['HTTP_AUTHORIZATION'], 6)));
That splits up the username and password, and makes it look as if you were running PHP as a module.
So for a sample script:
// split the user/pass parts
list($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']) = explode(’:', base64_decode(substr($_SERVER['HTTP_AUTHORIZATION'], 6)));
// open a user/pass prompt
if (!isset($_SERVER['PHP_AUTH_USER'])) {
header(’WWW-Authenticate: Basic realm=”My Realm”‘);
header(’HTTP/1.0 401 Unauthorized’);
echo ‘Text to send if user hits Cancel button’;
exit;
} else {
echo ‘Hello, ‘.htmlentities($_SERVER['PHP_AUTH_USER']).’
‘;
echo ‘You entered as your password: ‘.htmlentities($_SERVER['PHP_AUTH_PW']).’
‘;
}
?>
Steven
The Easy Way to Turn That Old PC Into Something Useful! (Part 2)
This is the easiest part:
Windows:
Install Peer Guardian and utorrent
Download your hopefully legal content!
Linux:
Download: XAMPP
Install, this is a very easy installation!
Enjoy your webserver/filesever!
Regards,
Steven Roddis
The Easy Way to Turn That Old PC Into Something Useful! (Part 1)
Ok, you have an old computer that you will never use as your main pc, however you would either:
- Like to share files around the home.
- Use it to
illegallylegally download music/movies/tv shows overnight. (To help save your peak dl’s) - Turn it into a webserver
- Your introduction to another OS eg. linux.
- Something else
deconstructive. (Likeworld dominationmaking peace)
So let’s start with the OS (Operating System):
Windows or Linux?
If you want to run do file sharing or a webserver: Linux
Downloading Stuff: Windows
Hang on a sec, Windows??? on an old PC. Oh.. yeah we can use something like 98?
No… Windows XP pro on an old pc, it can be done!
My choice of Windows was because Peer Guardian and utorrent run on it. (For “borrowing” music, games, tv shows. (You name it)
Installing the OS:
- Windows:
Get a copy of windows 98+ (utorrent works on 95 but PG doesn’t and our next program doesn’t support NT or 95 either)
Installing windows is easy, with XP you just pop in the disc, and follow the steps.
Or you could look at some of these guides if you are really stuck:
- http://www.windowsreinstall.com/
- http://www.theeldergeek.com/clean_installation_of_windows_xp.htm
- http://www.winsupersite.com/showcase/windowsxp_sg_clean.asp
- http://windows.radified.com/
Note for this example I am using Windows XP Pro :
So what is all this fuss about putting windows [running fast] on an old pc?
The Software from LitePC makes it possible. Get the version for your OS.
Yes, you could get it illegally, but they do a dam good job, so I would pay for it. (There is a FREE version)
If you need help, again you can drop me a line, or look at the knowledge base.
Now you have a fast windows based pc, and you are ready for the next step. :)
- Linux:
Step 1: Find a Linux Distro…
I love easy to install, easy to use, (and fast) ubuntu would be your best bet.
How can I get ubuntu?
Download and Burn it:
http://www.ubuntu.com/download
Get it shipped to your FREE:
How do I install it?
- A very easy install, make sure you BIOS is set to boot off CD, then pop the cd in. when it says boot: on the screen, and an ubuntu logo appears, type server. And the install starts. Just follow the easy prompts, and when it asks you to erase the disc select the option that is automatically selected. It is a very simple task! :)
Configure Remote Access:
Linux (Ubuntu):
First we need to enable the root user:
So login and type:
sudo passwd root
su
(You now use that account so type exit to logout and then log back in again as root.)
Type:
apt-get update
apt-get install ssh openssh-server
Beautiful!!!
Now to access we need a SSH Client.
Windows:
Putty (You just need Putty)
Mac OS:
If you are using Linux (as a client) you can install ssh (In ubuntu: apt-get install ssh)
Putty is very easy to use: ie. just type in the IP Address of the computer, and all good.
How to find the IP Address:
ifconfig (it is ipconfig for windows)
Will tell you all that you need to know! :)
Windows:
You have two choices here if you are using XP Pro or 2000:
Remote Desktop (RDP)
Or VNC
My Favourite VNC Server: TightVNC (Did I mention the price?? Free!)
If you don’t have either XP Pro or 2000 then you will have to use VNC.
Part two is coming soon!
Breaking Text Based Captcha is Easy!
Today, I still don’t remember how I got to this blog post but anyway I saw that they had a text based captcha.
The blog author claims that it prevents spam, which it does! Because it added an extra layer of uniqueness to his code and unintelligent spam bots don’t realise. Anyway now for the breaking:
//Break Text Based Captcha:
$regex = ‘#/>\s+
\s+
$page = getpage(’http://pooteeweet.org/blog/259/p/1′);
preg_match($regex, $page, $matches);
$n1 = intval($matches[1]);
$n2 = intval($matches[3]);
$op = $matches[2];
switch ($op) {
case ‘+’:
$INTresult = intval($n1+$n2);
break;
case ‘-’:
$INTresult = intval($n1-$n2);
break;
case ‘/’:
$INTresult = intval($n1/$n2);
break;
case ‘*’:
$INTresult = intval($n1*$n2);
break;
default:
die(’Illegal Operation’);
break;
}
echo $INTresult;
?>
Note that my framework has a function getpage which is just a simple (well quite advanced actually…) curl function.
There you have it $INTresult is the answer to the math problem.
Yes this is a very simple text captcha but breaking a more advanced one wouldn’t require that much more effort.
Regards,
Steven Roddis
/bin/rm: Argument list too long.
After forgetting to add “2>&1″ to the end of my cron job that runs every minute I ended up with a lot of “mail” in my Maildir, about 600,000! So I thought that I could do a simple “rm 11*” (Each file started with a 11)
But I ran into a problem: “Argument list too long.”
So after researching this problem I found out why (It has to do with not being able to fit the supplied argument list and environment into the 128K buffer)
I also found a solution: find . -name ‘11*’ | xargs rm
Three minutes later my Maildir was clear!
Regards,
Steven Roddis
