Archive for the 'Programmation' Category

Page 3 of 4

My C++ challenge

Make a Tic Tac Toe game in less than 125 lines. (for two players) Then a Tic Tac Toe game with CPU AI in less than 200 lines. (Human vs CPU) The computer will be unbeatable. The code will be published when done, don’t be afraid :)

Change your K2 header color via the K2 Options Panel

This small modification should allow anyone to modify his template header background-color via the K2 Options Panel. Don’t forget to use the RGB code WITHOUT the # before the color code.
functions.php Don’t forget to rename.

“Setup has detected that another program requires the computer to reboot.”

Finally found the fix to this annoying bug when trying to install Visual Studio 2003. Thanks to www.knowdotnet.com.
Instead of renaming the PendingFileRenameOperations registry entry, I simply deleted it, since I had already rebooted several times and whatever program was supposed to clean up the entry obviously was not going to do it.
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager

PHP + CSS Text Replacement followup

Since I have finished my semester, I thought I “restart” programming a bit. Here’s a small contribution to the script. This is a separate script that would run in conjunction with image.php and gives you the ability to split the words to make single letters, which makes long texts to images possibles. Beware of bandwidth cost though, they are MASSIVE! This might be ressource hungry, I’d recommand having cache on so it can cache each letters. You can use the function image(); to translate your text into images. If you have any problems, drop a comment with the problem you’re experiencing.
Source: Text to image Version 1.0.1 Alpha
This is a simple script using http://www.artypapers.com/csshelppile/pcdtr/ text to image script. This script breaks words apart so each letters can be printed invidually and if the image is not shown, you’ll see the text instead (composed by each letters the image was suppose to show. Usage: INSERT at the beginning of your page in a PHP section // Call the texttoimage script include(“text.php”); TO USE: call the function image() with the text as a parameter. ex. image(“I want some coffea”); Version 1.0 Alpha + Variable text to make a 1 call include(text.php?text=your text here); 1.0.1 + Using preg_split instead of str_split for PHP 4.0 compatibility
To do list:
  1. Make each letter a different color

PHP + CSS Text Replacement

I’ve recently found the script http://www.artypapers.com/csshelppile/pcdtr/ that allows you to use your own font to write headers (like my articles headers) and is then converted into an image using GD and PHP power. It’s pretty good if you want to use special fonts that no one has on his computer. I’d only suggest you a small fix (if it’s not working fine the first time):
//Define the GD environment variable putenv('GDFONTPATH=' . realpath('.'));
In image.php, you should put this right after
Additional documentation on PHP’s image handling capabilities can be found at http://www.php.net/image/ */
Really useful for someone who’s trying to get the script to run but it simply won’t (it gives a “Error: The server could not create this heading image.” message if you don’t have this putenv line) The only thing I’m looking up to is to make the possibility to use + without using the %2B because it mess up my titles :(