ad box 728 x 90
ad box 468 x 60
Hardware, Software, Code, PHP, ASP, Games, Reviews and Other Funky Stuff
Subscribe

Enter your email address:

Pic of the Month
Popular Posts

Archive for the ‘Web’ Category

How to easily center a div in the middle of the browser with CSS

I had to tackle this one recently, and didn’t want all the extra javascript libraries that go with the modal box window. I just needed to get a div and center it in the middle of the screen. Sounds easy enough hey, and it is once you know how. This works quite nicely cross most modern browsers, tested in Chrome, Firefox and IE. Ive included the inline CSS as well as the attached external CSS file.

Showing the demo of Centered Content

I just included this in a style tag but you can also assign it to a name in an external CSS if you wish ;)

First you have to know the dimentions of your div.

Mine was:

1
2
height: 200px;
width: 300px;

Then set the position to absolute.

1
position:absolute;

Then you need to get the top right hand corner of the div into the center of the browser using the top and left values as follows:

1
2
top:50%;
left:50%;

This will now make the corner of the div centered on the screen, but thats not really very helpful as is.

To get it right in the center, you need to set the margins to the negative of half of the width and height accordingly.

So if your width is 300px, then your left margin needs to be -150px; and the height is 200px; so the top margin should be set to -100px;

1
2
margin-top:-100px;
margin-left:-150px;

Right so now we have a nice centered div, which will stay centered even if you resize the browser window.

Also if you have issues with things appearing on top of your centered div you can always set the z-index of the div to a number greater than anything else on the page. Everything should start with a z-index of 0 unless it is set by something else like jquery or other css styles.

1
z-index:1;

Anyway back to the CSS in hand:

?Download style.css
1
2
3
4
5
6
7
8
9
10
.centered_div {
	height: 200px;
	width: 300px;
	position:absolute;
	top:50%;
	left:50%;	
	margin-top:-100px;
	margin-left:-150px;
	z-index:1;
}

and attach it to the div

1
2
3
<div class='centered_div'>
	centered content
</div>

or just do it the bad way, all inline ;) .. it works but its messy, and probably shouldnt be done this way.

1
2
3
<div class='centered_div' style='height: 200px;width:300px;position:absolute;top:50%;left:50%;margin-top:-100px;margin-left:-150px;z-index:1;'>
	centered content
</div>

You can see why the above method is not ideal especially if you had a large number of these div’s. Anyway it does work if you need something up quickly and dont already have a stylesheet.

Social Networks, Social Sites and Other sites that have hit the rich list.

Social Networks, Social Sites and Other sites that have hit the rich list.

Thought these dudes were quite interesting so this is what i found, good for a bit of inspiration ;) .

Coming in at Number 5.

Name: Andrew Michael
Site: Fast Hosts (http://www.fasthosts.co.uk/)
Age: 29
Value: $110+ Million

Looks like this guy knows his business, maybe a bit of luck played its role as well here.

Fasthosts is a provider of Internet access and hosting services based in Gloucester, England. The company also operates the domain name registration service UKreg and cloud infrastructure service Rise, and has operations in the United States.

Fasthosts was originally started by Andrew Michael, then aged 17, as part of an A-level school project. It became a limited company in 1999, and launched UKreg in 2000. The company specialised in providing services for small businesses, and in 2002 was listed as the second fastest growing technology company in the United Kingdom by The Sunday Times. In 2005 the company had a turnover of £20 million and made £5 million profit. The company also became known for hosting lavish Christmas parties for its staff; an event in 2005 costing £600,000 featured appearances from Jonathan Ross, The Darkness and Boney M. In 2006 Fasthosts was sold to German internet service provider United Internet for £61.5 million, netting Michael £46 million for his 75% stake. Michael remained as CEO until 2009, when he left to found Livedrive.

A hacking incident in 2007 prompted Fasthosts to temporarily shut down customers’ websites. The company noticed that its servers had been accessed in October and wrote to customers recommending that they change their passwords; in December after noticing “unusual activity” on some sites it closed down those that had yet to change their passwords until new passwords could be issued by post.

In 2008 Fasthosts acquired reseller Streamline.net, and also launched a reseller hosting service in the United States. Cloud infrastructure service Rise was launched in 2010. Fasthosts is the founding sponsor of The Great Exhibition 2012.

via http://en.wikipedia.org/wiki/Fasthosts

______ __ _

Coming in at Fourth Place (4th)

Name: Blake Ross and David Hyatt
Site: Mozilla
Age: 22
Value: $120+ Million

Together they took the browser world by storm.

Blake Aaron Ross

Blake Aaron Ross (born June 12, 1985) is an American software developer who is known for his work on the Mozilla web browser; in particular, he started the Mozilla Firefox project with Dave Hyatt, as well as the Spread Firefox project with Asa Dotzler while working as a contractor at the Mozilla Foundation. In 2005, he was nominated for Wired magazine’s top Rave Award, Renegade of the Year, opposite Larry Page, Sergey Brin and Jon Stewart. He was also a part of Rolling Stone magazine’s 2005 hot list.

Born in Miami, Florida. He created his first website at the age of 10. He began programming while still in middle school and began contributing to Netscape very soon after it was open-sourced. He worked as an intern at Netscape Communications Corporation at the age of 15, while attending high school at Gulliver Preparatory School, from which he graduated in 2003. Later that year, he enrolled at Stanford University, where he is now on a leave of absence to focus on work. He currently resides in nearby Mountain View, California.

via: http://en.wikipedia.org/wiki/Blake_Ross

David Hyatt

Dave Hyatt (June 28, 1972) is an American software developer currently employed by Apple Inc. (since July 15, 2002), where he is part of the development team responsible for the Safari web browser and WebKit framework. Hyatt was part of the original team that shipped the beta releases and 1.0 release of Safari. He is currently the Safari and WebKit Architect.

Before Apple, Hyatt worked at Netscape Communications from 1997 to 2002 where he contributed to the Mozilla web browser. While at Netscape, he also created Camino (then known as Chimera) and co-created Firefox (originally called Phoenix) with Blake Ross. He is credited with the implementations of tabbed browsing for Chimera and Firefox (the initial implementation for Netscape/Mozilla browsers, on which Hyatt based his work was created by HJ van Rantwijk, as part of his MultiZilla project at multizilla.mozdev.org).

Hyatt also created and wrote the first specifications for the XBL and XUL markup languages.

Hyatt studied as an undergraduate at Rice University and graduate at University of Illinois at Urbana-Champaign.

Hyatt developed, but no longer maintains, the software for Shadowland Six in his spare time; a forum and discussion server for the Shadowrun community. He also co-wrote published material for Shadowrun as a freelance writer, including the books Renraku Arcology: Shutdown and Brainscan.

He is also an active member of the W3C’s CSS Working Group. He was an editor of the HTML5 draft specification up through March 2010, at which time he resigned to concentrate on other endeavors.

via http://en.wikipedia.org/wiki/Dave_Hyatt

______ __ _

Third Place (3rd)

Name: Chad Hurley
Site: Youtube
Age: 30
Value: $300+ Million

Chad Meredith Hurley (born 1977) is the co-founder and Chief Executive Officer of the popular video sharing website YouTube. In June 2006, he was voted 28th on Business 2.0′s “50 People Who Matter Now” list. In October 2006 he and Steve Chen sold YouTube for $1.76 billion to Google.

Hurley worked in eBay’s PayPal division—one of his tasks involved designing the original PayPal logo before starting YouTube with fellow PayPal colleagues Chen and Jawed Karim.

Hurley was primarily responsible for the tagging and video sharing aspects of YouTube.

via: http://en.wikipedia.org/wiki/Chad_Hurley

YouTube is a video-sharing website on which users can upload, share, and view videos. Three former PayPal employees created YouTube in February 2005.

The company is based in San Bruno, California, and uses Adobe Flash Video technology to display a wide variety of user-generated video content, including movie clips, TV clips, and music videos, as well as amateur content such as video blogging and short original videos. Most of the content on YouTube has been uploaded by individuals, although media corporations including CBS, BBC, VEVO and other organizations offer some of their material via the site, as part of the YouTube partnership program.

Unregistered users can watch the videos, while registered users are permitted to upload an unlimited number of videos. Videos that are considered to contain potentially offensive content are available only to registered users 18 and older. In November 2006, YouTube, LLC was bought by Google Inc. for $1.65 billion, and now operates as a subsidiary of Google.

via: http://en.wikipedia.org/wiki/YouTube

______ __ _

Second Place (2nd)

Name: Andrew Gower
Site: Runescape
Age: 28
Value: $650+ Million

Man did i waste too much time playing this game, argh give me back those long lost years! Although i must say that i did prefer the classic runescape the the new version.

Andrew Christopher Gower (born 2 December 1978)[1] is a British video game developer and co-founder of Cambridge-based Jagex Ltd, the company he founded with Paul Gower and Constant Tedder. He is noted for writing the MMORPG RuneScape with the assistance of his brother Paul Gower. He remains its Lead Developer.

via: http://en.wikipedia.org/wiki/Andrew_Gower

______ __ _

First Place! (1st)

Name: Mark Zuckerberg
Site: Facebook
Age: 23
Value: $700+ Million

Yes they have just made a movie about it. Definitely on my to watch list.

Mark Elliot “Zuck” Zuckerberg (born May 14, 1984) is an American entrepreneur who co-founded the social networking site Facebook. Zuckerberg co-founded Facebook with fellow classmates Dustin Moskovitz, Eduardo Saverin, and Chris Hughes while attending Harvard. He is a 24% shareholder of Facebook

via: http://en.wikipedia.org/wiki/Mark_Zuckerberg

Extracting a zip file using PHP and Unzip

Ok here is a problem that has been annoying me for a while. Just in a personal project that im working on, and i finally sat down and figured out how to do it via PHP.

Now this is probably easy and known for most people but if you don’t know how to do it keep reading…

The challenge was, extract multiple files from a passworded zip that’s attached to an email. I know sounds easy, but what if you want the server to do it for you? Now this is running on a hostgator account with default settings and probably execute allowance as well.

After a few trial and errors the following code worked for me, this is the long winded version of it, you can shorten it if you like…:

1
2
3
4
5
6
7
8
9
10
11
12
13
<?php
$zip_name = "file.zip";
$pathtozipfle = "upload-path";
$destinationdir = "upload-path";
$passw = "password";
 
$extract_command = "unzip -P $passw $pathtozipfle/$zip_name -d $pathtozipfle/";
 
echo "Running: $extract_command"; // note probably better and safer to not echo this line as it will reveal the password. But as this is very insecure anyway it probably does not matter too much.
echo "<br><br>";
echo system($extract_command);
echo "<br><br>";
?>

Anyway this extracts file files with no major issues. If you want it to run without returning any data to the screen just run:

1
2
3
<?php
system($extract_command);
?>

If you would like to see what other options are available, and your version of unzip you can run:

?Download unzip.php
1
2
3
<?php
echo system("unzip -Z");
?>

Ah i remember the old days of windows 95 and such

33.6 modems connecting at 28.8, downloads at 6k a second would have been fast in those days. I remember getting a 33.6 modem for my 16th birthday, doesn’t really seem like that long ago now. Almost the only form of communication on the net that was in real time was mIRC and ICQ. Tombraider was the best game out on any system, one of the breakthrough games. Everytime you re-installed windows you had to spend about a day finding all the drivers for every single piece of hardware you had to get it all working again. I think I was even maxing out my resoloution on my 14 inch crt monitor at that time.

Even windows media player at that time had a crappy icon ;) . It was good though, so much out there and no one really knew about any of it. The internet back in 1998, in australia anyway was not really main stream at all. I watched the movies like the net and hackers and thought none of that could really happen. (i know its corny now) but back then it was all inspiring, and its good to look back.

Its funny what comes up when you google (images) for epic win

Lets just say i wasnt expecting these results… Well i thought it was funny anyway.

Try it, Google Images Epic Win ;)

Also i have to say i like the format of google images these days, how does it fit all those images in so well… its a mystery. (or an algorithm).

Google Image Search for Epic Win

wordpress blogs hacked, a new wordpress worm? or just a world readable wp-config.php file

wordpress blogs hacked, a new wordpress worm?

Well that will teach me for not updating my wordpress version like the admin panel has been reminding me to do for the last, oh lets say 6 months or so. I have had about 8 of my wordpress blogs that i administer hacked, and i know its all my dam fault. well lets say that i will be updating from now on.

It is being dubbed the wordpress worm (by me anyway ;) ).

What can they access? Basically if you are running a wordpress version older than 2.8.3 or 2.8.4 the file permissions were set wrong on the wp-config.php file located right in the root folder of your blog. So its world readable, problem with this is that wordpress stores your main database password username in this config file. doh!

After performing the update you should double check the permissions of the wp-config.php file, make sure they are not publicly readable. Change it to 700, rather than 755 which it is by default. If you have a bunch of blogs, this is going to be a real pain!

So how do i know ive been hacked? Well if your as lucky as me, you will have massive defacement of all your blogs, saying how great they are for being able to deface your blog. and linking to heaps of malware and crude images, most of the time they will post there “hack” on twitter with a record of the defacement as well, i found a few of my blogs listed on there, saying who hacked them. Who does that anyway, srsly.

I also found a file put on there, that allowed them to get shell access to the whole site it was called wp-ini.php, if you have a look in this file you can see the password and username and port that it has been setup for allowing the hacker to come back whenever they feel like and upload or download files, or do basically whatever they feel like with your blog.

Another thing that i noticed on the hacked blogs was if you had a look at the files via a ftp client, you can see that there timestamp has been removed. Some of the blogs were just totally stuffed and i had to disable the hosting accounts for good, which is sad really as i had spent quite a bit of time on setting them up. Ah well live and learn i spose.

You think, why would people want to hack my blog? well if they can, they will. Sux but true.

I actually had a few blogs that i had upgraded, but the passwords had already been farmed or something i think and they got re-hacked after, which sux a lot, and most of them were not repairable, so i have just shut the accounts down for the moment. I just had a look at my wp-config.php and the permissions were still 755 even after the upgrade. Well ill change them to 700 anyway just to be safe.

I think all of my blogs were running the wordpress version 2.7.9 or something along those lines. Argh i should have upgraded!

Another suggestion for protecting your wordpress blog was to modify the .htaccess file, you can add the wp-config.php file too it for some added protection.


# protect wpconfig.php

order allow,deny
deny from all

i actually found that code a few years ago on a very old post here. why didnt i listen! :)

So anyway moral to the story is Upgrade your WordPress blogs! Do it now! I was actually holding back as i have a few custom plugins that would have broken a bit if i upgraded to the latest version of wp, well there all upgraded now and its a hell of a lot better having a broken plugin than it is having a hacked wordpress blog.

I havent actually tried the following plugin myself, but i have heared its great for totally saving all of your current wordpress blog including settings and then re-importing it into another blog. I think im going to do that now using WordPress to WordPress Import

Here are a few other posts that may help you out if you are looking for more info on hacked wordpress blogs.

Let’s Kill IE6

Internet Explorer 6 is outdated and insecure, it looked terrible, but many users still using it.

Adding the NOTIFICATION on your site to help phase out Internet Explorer 6 forever. They tells visitors using Internet Explorer 6 that they need to upgrade to the current version or switch to another browser right now.

kill ie6

Install On Your Website

Let’s kill Internet Explorer 6, copy and paste this code before your closing tag.



You’re using Internet Explorer 6 to browse webpages right now, our website will work better for you if you upgrade to Internet Explorer 8 or switch to another browser.

FileZilla 3.3.2

So what the hell is FileZilla Anyway?

FileZilla Client is a fast and reliable cross-platform FTP, FTPS and SFTP client with lots of useful features and an intuitive graphical user interface.

im looking for a good free ftp client, is filezilla any good?

well as it goes, its not a bad ftp client really, and its free. I personally prefer Cute FTP myself, but that does cost a little bit of moola unless you want to use the 30 day trial. for, well.. 30 days. you will probably end up buying it it’s that good. If your that into FTP clients anyway ;)

does anyone else like FileZilla?

People over there on CNet seem to like filezilla, giving it a 4.3 stars out of 372 votes. So not too bad really. They also recon that FlashFXP is another contender in the ftp software for windows category, so you might wanna check that one out as well! :)

Got any other coments on FileZilla?

“Good!”

by JoyceNgo on November 25, 2007

Pros: FTP programs I found were either very expensive or bloated. I’m glad there’s a FREE alternative out there that’s even available for my flash drive’s U3! Very good product and I recommend it to those who don’t want to spend on FTP programs!

Cons: None for now, it does what it says. And as long as it uploads and transfers, it’s very good :)

“Best in the Class”

by ozcando on November 22, 2007

Pros: The best FTP program out there on the net and that’s for free.

It is intuitively designed and built for easy usage.

Cleverly fast and is continously updated. It will auto update itself by letting you know of a new update. Beats paying $30 for a lite paid version of other ftp programs.

Cons: it will not convert file casing for you. It will transfer the filename as is. Developers should be careful when coding html pages with case sensitive web servers. Other than that everything is fantastic.

“Very easy to understand and use”

by VE7JNE on March 29, 2010

Pros: Clearly organized and gives on-the-fly information

Cons: I haven’t had any problems in the first week.

Summary: I was able to use this utility after a single glance. It is organized in a way that lets you use it as a simple transfer tool or as a much more complicated program. I am glad I chose this one. I use Firefox and this program just races along.

“Excellent – easy to use and does the job well.”

by BallenGuy on March 30, 2010

Pros: Connected first time – while other’s needed more configuration

Cons: None – very easy!

Summary: Get it! The best for me,

So there you have it, check out FileZilla if your in the market for a nice free FTP Client! :)

Download it Here