Have you ever thought of cooling down your laptop a little bit extra? Are you anoyed of the fan-noice when you are watching movies?
Here are three unique and cool (hehehe) solutions. The first one, called the Waldic (water & air laptop direct input cooler) which was made for lowering the fan-noice while watching movies is a kind of attachment you put on the laptop-side. The temperature dropped from about 65*C to about low 40*C when activating the “water-mode”. That’s a nice laptop cooler.
Source: http://folk.ntnu.no/bardlund/hack.jsp
The second system is a forced-air system which like the air cooling systems on any regular car. The results from this method was brilliant.
The GPU peaked 80*C at 250mhz and when he mounted his cooling unit, he clocked it to 370mhz and it peaked at 69*C. Along with this he increased his fps with about 50% in BF2, from 50fps to 75fps.
Source: http://www.tacticalgamer.com/hardware-software-discussion/91613-110cfm-laptop-cooler.html
The third system is another air-cooler, which looks quite “cheap” but is supposed to work quite good anyway. Here’s a embedded video of the cooler:
Source: http://www.instructables.com/id/E0G2NZQYAFEZ7BDFSV
Thats some cheap and effective laptop coolers and some cheap performance boosts!
SimpleXML intro:
PHP4 had one pretty big drawback when you had to use external libraries to parse XML files. PHP5 had a number of XML libraries that solve this problem and one of the easiest is SimpleXML.
To test and use the function, a XML document is needed.
In this post we will use our own sitemap, located here: http://cdsrc.com/sitemap.xml.
As we write this (the document will change in future since it’s a sitemap), the document looks like this:
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 | <?xml version="1.0" encoding="UTF-8"?> <?xml-stylesheet type="text/xsl" href="http://cdsrc.com/wp-content/plugins/google-sitemap-generator/sitemap.xsl"?> <urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/09/sitemap.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9"> <url> <loc>http://cdsrc.com/</loc> <lastmod>2007-09-10T11:31:33+00:00</lastmod> <changefreq>daily</changefreq> <priority>1.0</priority> </url> <url> <loc>http://cdsrc.com/programming/php-random-password-generator-function.html</loc> <lastmod>2007-09-10T11:31:33+00:00</lastmod> <changefreq>monthly</changefreq> <priority>0.3</priority> </url> <url> <loc>http://cdsrc.com/programming/php-and-database-space-saving-tips.html</loc> <lastmod>2007-09-09T13:06:17+00:00</lastmod> <changefreq>monthly</changefreq> <priority>0.2</priority> </url> <url> <loc>http://cdsrc.com/linux/linuxbiggerthanwindows.html</loc> <lastmod>2007-09-09T12:45:00+00:00</lastmod> <changefreq>monthly</changefreq> <priority>0.3</priority> </url> </urlset> |
The documents structure is pretty easy to understand. All URL’s has a
There are a couple of methods you can use to load the XML file, one of them are to use file_get_contents() and another one, which we will use, will be shown here:
1 2 3 4 5 6 7 8 | <?php $url_location = 'http://cdsrc.com/sitemap.xml'; $sitemap = new SimpleXMLElement($url_location,null,true); foreach($sitemap as $url) { echo "Url: {$url->loc}<br />Lastmod: {$url->lastmod}<br />Changefreq: {$url->changefreq}</br>Priority: {$url->priority}<br /><br />"; } ?> |
There are no necessary comments to this as the code is pretty simple to understand. You access the “subfields” using $url->”subfield” and the counter goes through all the posts in the whole sitemap.
If we now would execute that script, we will get this output:
Url: http://cdsrc.com/ Lastmod: 2007-09-10T11:31:33+00:00 Changefreq: daily Priority: 1.0 Url: http://cdsrc.com/programming/php-random-password-generator-function.html Lastmod: 2007-09-10T11:31:33+00:00 Changefreq: monthly Priority: 0.3 Url: http://cdsrc.com/programming/php-and-database-space-saving-tips.html Lastmod: 2007-09-09T13:06:17+00:00 Changefreq: monthly Priority: 0.2 Url: http://cdsrc.com/linux/linuxbiggerthanwindows.html Lastmod: 2007-09-09T12:45:00+00:00 Changefreq: monthly Priority: 0.3
Thats a very great and easy way of using the “new” SimpleXML PHP 5.0 function!
Here’s a random password and string generator function for PHP.
It is totally free of use.
randpass(); Will give you a 8 characters long randomized string with numbers and letters.
The function also takes these arguments:
$numchars <-- The length in characters for the returned string.
$digits <------ Should the generated password contain figures? 1/0
$letters <----- Should it contain letters? 1/0
$sensitive <--- Both upper and lower letters? 1/0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | function randpass($numchars=8,$digits=1,$letters=1,$sensitive=0) { $dig = "12345678901234567890"; $abc = "abcdefghijklmnopqrstuvwxyz"; if($letters == 1) { $str .= $abc; } if($sensitive == 1) { $str .= strtoupper($abc); } if($digits == 1) { $str .= $dig; } for($i=0; $i < $numchars; $i++) { $randomized .= $str{rand() % strlen($str)}; } return $randomized; } |
To give an example of the code:
24 25 | echo "Generated password: \n"; echo randpass(12,1,1,1); |
The code above will result in:
Generated password: 4C8cly61h907
There are plenty of database space-saving functions out there and PHP has included some of them already. These two functions (or four actually) are already in the standard library which means that you got no reason to ignore them.
* Use ip2long() and long2ip() to store the IP adresses as Integers instead of storing them as strings, which will reduce the space from 15 bytes to 4 bytes. This will also increase search speed and make it easy to see if a ip falls within a specified range.
* Use gzcompress() and gzuncompress() to reduce the strings before you store them in a database. The gzcompress can compress plain-text up to 90%. The only reason why you shouldn’t use it is when you need full-text indexing capabilities.
There’s a funny article about “what if programming languages were cars” here. The author has some favourites of the languages, but most of them are funny and they all have a small or big amount of veracity. :D
A quote:
* Forth is a car you build yourself from a kit. Your car doesn’t have to look or behave like anyone else’s car. However, a Forth car will only go backwards.
* Lisp looks like a car, but with enough tweaking you can turn it into a pretty effective airplane or submarine.
It’s very funny and has comments about most of the most famous programming languages.
Linux has finally bypassed Windows 98.
According to W3counter which has a report of 33,640,022 unique visitors (2007/09/06), Linux has 1.34% of the market share, while Windows 98 is just slightly below it. Windows Vista has yet only 3.46%, while the big leader, Windows XP, has 83.48%. Mac OS X is still bigger than Vista with their 3.73% of the market.
The most common screen resolution is 1024*767 (49.54%) backed up by 1280×1024 (17.24%), 1280×800 (9.10%) and 800×600 (8.34%).
The most common web browser is still Internet Explorer 6.0, but IE 7.0 is climbing towards that spot.
Firefox X.X has about 25% of the market share, while IE has a total of 66.2%. On the third place comes Safari with about 1.75%.
The popular annualy programming competition, eGenting, is going to be held now again. The date is September 22th and there are as usual two categories:
* Graduate category for under 26 years old
* Professional category for 26 years old and above
The difficult part is as usual that all code should be handwritten with no use of computers.
The competition is held at in Genting Highlands, Malaysia, and the prizes are generous.
In the graduate category ( <= 26), the prices are:
1st Prize: RM6,000 + Job Offer
2nd Prize: RM3,000 + Job Offer
3rd Prize: RM2,000 + Job Offer
RM, the Malaysian currency, $1 = RM 3.8. (The Malaysian Ringgit has a fixed exchange rate to the USD).
In the proffesional category ( >= 27), the prices are:
1st Prize: Dell notebook computer worth RM4,000 + HP All-In-One Printer worth RM350
2nd Prize: 2 nights ex-Singapore cruise onboard SuperStar Virgo for 2 persons worth RM3,600 + HP All-In-One Printer worth RM350
3rd Prize: Dell desktop computer worth RM3,000 + HP All-In-One Printer worth RM350
The official domain is http://egpc.genting.com.my/.
There’s a very easy-to-use and free (open source) programming notepad available for all programmers.
The latest development version of this program has a feature called “keyword-based text clip insertion”, which is demonstrated in this embedded video:
This notepad-looking software is of great use if you are one of those notepad-maniacs.
For more information, see http://www.pnotepad.org/ and to follow the development phase, look here: http://sourceforge.net/projects/pnotepad/