The webshop Thinkgeek.com offers several cool geek clothes.
One of my favourites is the Wi-Fi tshirt which is powered by three batteries and shows if theres any Wi-Fi signals nearby.
http://www.thinkgeek.com/tshirts/generic/991e/
Another cool product is the “There is no place like 127.0.0.1″ tshirt which can be found here:
http://www.thinkgeek.com/tshirts/generic/5d6a/
That’s some great geek clothes!
Ever thought of having external content in a DIV without using iframes?
Iframes are ugly and will not validate properly in strict XHTML so therefore a solution for this is needed.
The solution we will use is a very simple PHP function that will grab the content from the page and then display it properly.
So how do we replace that iframe with something else? How can we create an iframe without an iframe?
This solution is widely used as proxy-scripts around the web and it is by far the most simple.
If you’re only aiming to replace an iframe you can do it easily with the file_get_content PHP function.
1 2 3 4 5 6 7 | <?php function displaycontent($url) { $content = file_get_content($url); echo $content; } ?> |
And if you are aiming for a simple proxy-script, you can just add a str_replace command and replace all hrefs with some additional characters:
1 2 3 4 5 | function displaycontentproxy($url) { $content = file_get_content($url); $content = str_replace('href="', 'href='proxy.php?url=', $content); } |
A very simple solution to the iframe problem. Solved?
There have always been a problem of advertising systems when you pay for pageviews instead of adviews.
It can be a scenario when you buy advertising on a site where they have 200k pageviews a month for $50. Great deal you think for yourself but when the campaign has started you don’t get any visitors coming since your ad has been placed so well-folded that no one ever sees it.
Your ad was placed in the very footer of the site and all the content is placed on the first half of the page which means that the site may get 200k pageviews but your ad is only shown for those who scroll down to the bottom of the page.
It’s here the ajax magic comes into play. With a piece of ajax code you can actually record how many REAL views your ad get and not how many pageviews the site has.
To show this, we have put up a .html site with the code added where you can see how it works. There is no hocus pocus about this, it’s real!
http://cdsrc.com/uploads/adajaxmagic.html
For those who not dare to click it, you can see the code here:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | <html> <head> </head> <body> <div id="status" style="position:absolute; left:150px; top:300px; border:4px solid black;">Status div</div> <div id="content" style="height:100%; width:400px;border:4px solid orange;">Hello, this is the main content</div> <div id="content2" style="height:20%; width:400px;border:4px solid lightgreen;">Some more content</div> <div id="adhead" style="width:100px; border: 1px dotted black; height: inherit;" > <div id="ad" style="width:100px; height:inherit; border:1px dotted green;"></div> </div> <script type="text/javascript"> function findPosY(obj) { var curtop = 0; if(obj.offsetParent) while(1) { curtop += obj.offsetTop; if(!obj.offsetParent) break; obj = obj.offsetParent; } else if(obj.y) curtop += obj.y; return curtop; } function findAdCallback() { adRef = document.getElementById('ad'); statusRef = document.getElementById('status'); statusRef.innerHTML = 'Ad is not shown'; if ((document.body.clientHeight+document.body.scrollTop)>findPosY(adRef)) { statusRef.innerHTML = 'Ad is shown partly'; } if ((document.body.clientHeight+document.body.scrollTop)>(findPosY(adRef)+adRef.clientHeight)) { statusRef.innerHTML = 'Ad is shown completely'; } } adCallbackId = window.setInterval('findAdCallback()',500); adRef = document.getElementById('ad'); adRef.innerHTML = 'This is a fat ad<br/>Ad ad ad ad'; </script> </body> </html> |
You see, it wasn’t that extreme!
Use the ideas wisely!
The Japanese blogger Hamachiya2 has found a single line of code that crashes IE 6.0.
(I believe it’s a Japanese)
What a suprise that it’s IE that takes the hit..
The Internet Explorer series, escecially < 6.0, is the hardest browser to get your site working for. The design is always destroyed when you take a look in IE.
So it's not a big suprise that this magnificent code makes the IE browser to scream..
<style>*{position:relative}</style><table><input></table>That’s the magic words that makes the “beautiful” Internet Explorer crash.. That’s got to hurt badly!!
If you want to try it, do it here:
http://cdsrc.com/uploads/iecrash.html
Amazing piece of code.. But does it look that horrible?
I guess most of you already use google to find just anything, but with some additional commands you can find warez with ease!
If you’d like to search for some music by iron maiden, you simply write:
site:divshare.com mp3|wma|ogg Iron maiden
site:divshare.com mp3|wma|ogg means that you search on divshare only and only displays results with a mp3 file, wma file or ogg file.
To find some videos, you just replace the mp3|wma|ogg part with the extensions you want to search for, in example:
site:divshare.com mp4|wmv|avi|mov|flv Britney Spears
That will bring you some results with your favourite Britney Spears.
To search for archives, just use:
site:divshare.com rar|zip|exe
That’s a very easy but useful google hack.
Before you comment, this is a quite lame script, however, it is quite useful as both information and other matters as well. Most people hate spamming but even though you hate it, the source code can be used as something else.
This script will spam a target site with some non existing traffic. You won’t be able to fool web analytics with this script since they will see that you’re from a single IP so there’s no reason to try.
The full source can be viewed at the bottom of this post so you don’t have to copy and extract every piece because of the comments.
Well, let’s get to the point:
In the beginning of the script, we activate error_reporting so we will get some errors written if something goes wrong:
1 2 | <?php ini_set('error_reporting', E_ALL); |
After that piece, the configuration follows. Referer, spam-location and the number of hits will be written here:
3 4 5 | $referer = "http://thereferersite.com"; // Where the traffic should be sent from $spamsite = "http://www.thespamsite.com"; // The spam site location $times = 1; // Number of times you want to traffic spam a site |
To continue this, we get the header part. Here we will have the User-agent, which referer we have and which site we have targeted:
6 7 8 | $header = "GET / HTTP/1.1\r\nHost: $spamurl\r\n"; // Start of the header $header .= "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6\r\n"; // Which useragent. XP, English, Firefox 2.0 $header .= "Referer: $referer\r\nConnection: Close\r\n\r\n"; // Which referer to use and close the connection |
When connecting with a socket you need to know which port you should pass through. PHP has a function to do this, called getservbyname. This will most likely use port 80. A full list of which service for which port is found here. We also convert the spam location site to an IP address.
9 10 | $port = getservbyname('www', 'tcp'); // Get the port to use when connecting to the www using tcp. $ip = gethostbyname($spamsite); //Gives you the IP instead of DNS |
So now we have finally got to the action part. We start with a for-loop that makes this sequence the number of times we wrote in the configuration part. After that, we create a socket with AF_INET, SOCK_STREAM and SOL_TCP.
AF_INET shows that we are using a IPv4 Internet based protocol.
SOCK_STREAM gives us a reliable, sequenced full-duplex stream which the TCP protocol are based on.
SOL_TCP basically means that we use the TCP protocol.
Then we initiates a connection using socket_connect with our socket we created and the ip address of the target site along with their www port, usually port 80.
A couple of error reports later we find the code “socket_write(..” which is a function that writes the socket with the header we have written before and the length of the buffer. This is followed up by socket_close() which just closes the connection, and then by the randomization part that just makes the script sleep for some milliseconds.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | for ($i = 1; $i <= $times; $i++) { echo "Number: $i\n"; // Create the socket! $socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP); if ($socket < 0) echo "socket_create() failed:\n".socket_strerror($socket)."\n"; // If something fails, what? // Connect to site using the socket you created $result = socket_connect($socket, $ip, $port); if ($result < 0) echo "socket_connect() failed ($result):\n".socket_strerror($result)."\n"; // If something fails, what? socket_write($socket, $header, strlen($header)); socket_close($socket); // Closes the socket $sleep = rand (10, 70); // For randomization echo "Sleeping: $sleep\n\n"; sleep ($sleep); } ?> |
It wasn’t harder then this!
Now you can use this code to create some more funny scripts that are not lame by default (spamming is).
Remember to turn on the sockets extension in your php.ini file if you didn’t have that before. Uncomment the extension=php_sockets.dll line.
The whole source-code is here:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | <?php ini_set('error_reporting', E_ALL); // Give you all PHP errors reported // ////Some of the configurations // $referer = "http://thereferersite.com"; // Where the traffic should be sent from $spamsite = "http://www.thespamsite.com"; // The spam site location $times = 1; // Number of times you want to traffic spam a site // //// Now we'll write the header that should be sent // $header = "GET / HTTP/1.1\r\nHost: $siteurl\r\n"; // Start of the header $header .= "User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.6) Gecko/20070725 Firefox/2.0.0.6\r\n"; // Which useragent. XP, English, Firefox 2.0 $header .= "Referer: $referer\r\nConnection: Close\r\n\r\n"; // Which referer to use and close the connection // //// A couple of more facts before the action statrs // $port = getservbyname('www', 'tcp'); // Get the port to use when connecting to the www using tcp. $ip = gethostbyname($spamsite); //Gives you the IP instead of DNS // ////Let's spam the site with the $times number of times! // for ($i = 0; $i < $times; $i++) { echo "Number: $i\n"; // Create the socket! $socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);// AF_INET means IPv4 Internet based protocols. // SOCK_STREAM = sequenced, reliable, full-duplex stream. The TCP protocol is based on this. // SOL_TCP means that TCP will be used. if ($socket < 0) echo "socket_create() failed:\n".socket_strerror($socket)."\n"; // If something fails, what? // Connect to site using the socket you created $result = socket_connect($socket, $ip, $port); if ($result < 0) echo "socket_connect() failed ($result):\n".socket_strerror($result)."\n"; // If something fails, what? socket_write($socket, $header, strlen($header)); // Writes the socket, using the header we wrote earlier and the length of the buffer socket_close($socket); // Closes the socket $sleep = rand (10, 70); // For randomization echo "Sleeping: $sleep\n\n"; sleep ($sleep); } ?> |
The TIOBE company has an own list of programming language popularity where you can check programming language popularity.
This list is not even near 100% accurate but gives you a very good hint of which language to use and more likely which language to NOT use when developing an advanced software. The index itself is built upon a not so sophisticated method, which is basically to search the major search engines with this term:
+”<language> programming”
and count the number of hits received.
That’s why the list is not that accurate but it still gives you a rough estimate of which languages that are growing and which are not.
The top 20 popular programming languages in September 2007 is (the % is of total market share):
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | Java 21.701% C 14.908% Visual Basic 10.748% PHP 10.204% C++ 9.938% Perl 5.416% C# 3.583% Python 3.025% Javascript 2.722% Ruby 2.065% PL/SQL 1.860% SAS 1.395% D 1.370% Delphi 1.224% ABAP 0.706% Lisp/Scheme 0.633% COBOL 0.630% Lua 0.572% Ada 0.566% Fortran 0.478% |
To notice from the source both c++ and c is falling in line, although it’s not much. You can also note that PHP is actually more popular then C++. This could be because of PHP’s simplicity compared to C++ which generate more “newbie-questions” about PHP rather then C++.
The top climber, Lua, is not a very known programming language. Lua is most known for homebrewed software for Playstation Portable and Nintendo DS. On a later matter, the language has been used to create scripts in World of Warcraft, which most likely is the reason for the huge climbing (thanks Sickwookie comment #1). The language itself is claimed to be a mix of Python, Icon, Scheme and Lips.
The list from 21-50 can is here (the % is of total market share):
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | Transact-SQL 0.452% Pascal 0.429% ActionScript 0.407% FoxPro/xBase 0.387% Awk 0.383% MATLAB 0.364% IDL 0.326% Prolog 0.313% ColdFusion 0.297% Logo 0.249% Bash 0.221% RPG 0.198% Tcl/Tk 0.187% LabView 0.178% Haskell 0.147% Smalltalk 0.145% CL (OS/400) 0.133% Forth 0.119% Natural 0.116% Erlang 0.109% VBScript 0.102% APL 0.101% REXX 0.088% Objective-C 0.084% OCaml 0.082% Icon 0.079% Postscript 0.076% Lingo 0.075% ML 0.074% R 0.072% |
Chinese hackers have successfully hacked into Pentagon. It is claimed as the most successful cyber attack on the US defence department quoting american officials.
One of the US senior officials said that Pentagon had ponpointed the exact origins of the attack. Another person, familiar with the event, said that there was a “very high level of confidence.. trending towards totalt certainty”. The defence ministry in Beijing declined to comment this action (2007-09-03).
Source: Financial Times
Microsoft loses the appeal against the EU antitrust ruling.
They are now fined $600 million because the implementation of Windows Media Player in the Windows operating systems.
“This is a great day for European businesses and consumers,” said Thomas Vinje, who heads the legal team for the European Committee for Interoperable Systems (ECIS). “This decision opens the prospect for dynamic competition in the software industry. No more user lock-in, no more monopoly pricing,” he said.
Microsoft still have the right to implement Windows Media Player in their operating systems but customers will have the opportunity to not include it.
The official google blog posted an article about 10 “little known” gmail features.
Most tips are quite unusual for most people I guess but most of them could be used efficiently.
The 10-6 tips are here: 10-6
The 1-5 tips are here: 1-5
The number one tip were a “Create event” function, the second tip was “offline chat”, and the third was “advanced search”. Three great functions I’ve never used.
Could be useful for somebody atleast!