I have just submitted the code for Sproogle 0.1 to dotgeek.org for their summer PHP 5 programming contest. A couple people in the dotgeek IRC channel have said it looks interesting. :) I already have a few ideas for the next version.
I need to make a page about Sproogle where you can download the source, view release history, documentation, etc.
I've known about PEAR, the PHP script repository, for some time, but I haven't bothered using it at all. Today I installed it on my site and installed a couple packages. I am going to look into using cache_lite to speed up my site, and benchmark to measure the results.
I ran across the
Bitflux Blog" while looking for PHP stuff, and I found a neat code tidbit. They had added a feature that called livesearch that would return search results while you're typing in the search box. Immediately I looked through their JavaScript code to find out how they did this. I quickly discovered that they were fetching the search results using a XMLHttpRequest object. This lets a JavaScript program fetch data from a server without having to refresh the page.
I had been working on a PHP based chat program, and figured that this XMLHttpRequest object might be the very thing I needed to make it work how I wanted. In all the PHP chat programs I found, the page had to be reloaded to see new incoming text. That does not look nice and it is a waste of bandwidth.
Armed with my newfound tools, I stayed up late the other night to start working on my new chat program. That night I wrote a program that could fetch the contents of the chat room. I couldn't figure out how to make multiple requests to the server. I also didn't know how to stop the HTML in the chat messages from displaying on the page.
Last night, I worked on this program again. I tried several different ways of making more than one request to the server per execution of my script. I gave up trying to get it to work in asynchronous mode, which I don't really need anyway. This allowed me to make more than one request.
With that problem solved, I made the program more efficient. Now the program polls the server every second, and if there are any new messages, it will send another request for them.
Next I tested my program with Internet Explorer (I normally use Firefox), and lo and behold, it didn't work. The problem was the way I was creating the XMLHttpRequest object. The next problem was that the chat room was not updating when I posted something. I figured IE was caching the server's response. I forced it to not cache anything by putting a random variable in my query string.
So my basic chat program is now working. I will integrate into my site shortly.
I am trying to think of some new ways to use live data on my site, having learned how to harness it with JavaScript.
This is a test post using IE... For some reason it is logged me out when I post something. I don't know why since I haven't changed the code on the site since I last tested my links feature.
There is now a simple way to post links on SproutWorks. Simply paste 1 link per line into the links field when you post something. Right now it simply inserts the links in the message, but I will add link name resolution and a better way to reference your links within a message.
http://slashdot.org
http://php.netIt works now :) I had a problem with the explode function and the difference between "\n" and '\n', if you know what I mean...
Today I tried to run my test web site I have running on my PC here. It wouldn't run any PHP script I tried. :( I am going to install RC 2 and see if that helps at all. I have been lazy and havent upgraded my copy of PHP 5 since beta 4.
Ok that didn't work. Now I am going to mess around with my mysql installation, maybe that is the problem.
I had to restart my mysql server for some reason... Now I am running PHP 5rc2 as well.
I started adding a simple way to post links in the forums. If laziness doesn't consume me, it should be up and running pretty soon. All I have to do is read links from a form input, validate them, and put them into HTML tags.
I just had this idea where I would put a texture map of the world in the background of the site logo, and then use a daylight/nighttime texture to show which parts of the world are in daylight, and generate this in real time on the site. I have to find out if PHP can load a 24 bit PNG with alpha transparency and actually draw it on top of another image correctly.
I guess I felt guilty about not creating anything cool today so I modified my image matrix script and made image matrix 2. Image matrix is a PHP script that creates an image out of thumbnails from other images.
Version 2 pulls the images from a database. It finds the latests images posted in a subject and then produces an image based on thumbnails of the images in the subject. Now I need to write a script that periodically creates these images and stores them in the database.
I wasn't very productive today computer-wise. I didn't think of a cool way to display SproutPaint in Flash. All I have done so far is to change the color scheme of my page slightly.
I found an interesting problem in Firefox. I am using sessions to track which subject the person viewing the forums is in. When there are mulitple tabs in a window, they share the same session, so if I were posting a message in 2 tabs in different subjects, the messages could post in the subject of the another tab (the one last clicked on). I will investigate this more.
Brandon