Mailing List

Enter your Email


Powered by FeedBlitz

RSS Feed

Entrecard

Links

Blogshares Links

Beginner's Guide to BlogShares
A guide about the BlogShares fantasy blog stock market.
Scared Bunny
BlogShares Price Tracker
This program that archives information about the BlogShares fantasy stock market. You can view graphs of any industry, and analyze your portfolio.

SproutWorks Projects

Digg Archive
A new experimental Digg page.
AJAX Pixel Editor
A Collaborative pixel editor currently in development.
Web promotion links
These tools help you get visitors on your website.
SproutPics
My photography Site
SproutZoo
My zoo photographs
Tag Cloud
A summary of tagged articles.
Found Photos
An automated page that thumbnails photos from another site.
SproutSearch
I designed this blog indexing tool, and it has accumulated over 6 million blogs so far.
Products
Some of the programs I've written.
RSS Feeds
RSS Feeds from the SproutWorks Forums
SproutTree Demo
A demo of a tree-drawing PHP script.
My Gallery

SproutWorks Chat
A chat room I programmed, most likely empty.
Link Exchange - Link Directory - Web Hosting

Sign In

Username:
Password:
Remember Me

sprout man
Posts tagged programming

sproutworks
Forums/SproutWorks
February 1st, 2005 8:08 AM PST
The gallery has received an overhaul it has needed for a long time. The codebase is now from the sproutpics.com site, which makes thumbnails and auto-scans multiple directory.

I also added a drawings section. I have many drawings to scan and upload.


sproutworks
I have written a new PHP script that counts the lines of code in a project. Currently, it does not recognize commented blocks, so all lines in a file are counted.

The code base for Sproutworks CMS is 21,692 lines. I don't know how this compares to other PHP CMSs, I'll have to research this.

http://sproutworks.com/codecounter.php


sproutworks
Forums/SproutWorks
March 9th, 2005 9:41 PM PST
The trees in the background of the page are generated with TreeSprouter, a new PHP program in development at SproutWorks. TreeSprouter "grows" trees by simulating growing branches.

The project is now at the "twig" level, further enhancements will produce a "leaves" build.


sproutworks
I am hosting sproutpics on my dreamhost account, which is mostly being unused. I have lots of extra disk space to play with, so I have written a LiveJournal aggregator. The basic concept is similar to SproutSearch (read an XML feed of blog information, store it, organize and display it). Since Dreamhost now offers PHP 5 hosting, I opted to switch sproutpics to PHP 5 so I could use some new functionality it offers.

Instead of using my own HTML parser, as I did with SproutSearch, I used SimpleXML to parse LiveJournal's RSS feed. I found this to work very nicely, it uses a lot less code than SproutSearch, and it's no doubt quite a bit faster as well.

You can see my modest page here:
http://www.sproutpics.com/livejournal.php


sproutworks
There has been a lot of buzz about this "AJAX" technology among web designer types. AJAX is a relatively new method of live communication between a web browser and a web server. AJAX is implemented with a client side scripting language, and a server side scripting language.

In my implementations of AJAX, I use JavaScript and PHP. So far I've only created a few trivial examples, but I hope to soon create something a bit more substantial.

My current AJAX projects are:

The chat room on this site. Messages are sent and retrieved as needed, avoiding wasteful page refreshes.

The counter that displays how long you have been viewing this site is another simple AJAX trick. It is a JavaScript that reports timings to the server, which tracks timing values across several pages.

If you click on this site a few times, you may notice that there are lines being drawn in the background. A script is transmitting your clicks to the server, and when you load a new page, all of your clicks are drawn into the background image using PHP and GD. It is not meant as a serious tool, at least not until I have added an inferface to control the drawing methods.

I have only created a few trivial examples of what AJAX can do, but I see great things on the horizon, for my own website and the web in general.

Check out http://maps.google.com for a really cool example of how intelligent browser/server communication can make a common task more intuitive.


sproutworks
I have been hearing about Ruby on Rails for last few months, so I finally thought I'd check it out. Ruby is a programming language, and rails is an application framework. For about the last 2.5 years, I have been writing my web applications in PHP. It's been working well for me. I feel like I'm relvatively proficient at it.

I started writing a content management system as I was learning PHP. As a result, it contains mixed programming styles. In the early days, I wrote procedural programs, and put all my scripts in my web root directory. Later I got a little smarter and made a directory structure of my scripts. I also started using classes and objects. This made things a lot easier to re-use later.

At some point I started using a template engine I got from a tutorial, and modified it to my liking.

My CMS now is around 25,000 lines of code, and only the newer parts are organized very well. I am always thinking of how I could improve the way it is all organized. After completing my first rails tutorial, I got some inspiration for how to overhaul my CMS. I need to build a moderately complex app with rails to get a clearer picture of what I need to do.

So, I think I will write an application framework for PHP, which borrows some concepts from rails. I like the way rails configures your .htaccess file to make simple urls. It can also make sense of database tables without needed to code any database specific stuff.



sproutworks
For the past few months I have been using PSPad as my primary text editor program. Most of the time I use it for writing PHP code, along with HTML, JavaScript, and other text files. PSPad is a free text editor with syntax coloring for many languages. It also has a code explorer, which is very handy for jumping to sections of your code. There is a color picker that makes hex color codes, spell check, an FTP client, project management, and other useful features. I would love to see a code indenting feature.

On the PSPad website (http://www.pspad.com), there are forums. I check the beta forum often, where beta versions are released usually every few days. I enjoy trying new versions and reading about what new features/bug fixes there are.

Previously, I was using PHP Designer 2005 most of the time, but since it has had a period of no new releases, I decided to check out PSPad. PSPad is a little faster and doesn't have visual glitches. I used to use HTML-kit most of the time, but the program hasn't been updated from build 292 in ages. It does have great plug-in support, however. I just read that a new plugoms interface is in development.
http://www.chami.com


sproutworks
SproutFramework

I have been hearing about Ruby on Rails a lot lately. I finally decided to try it to see what all the fuss is all about. I found a Windows installer that made installing Ruby easy. I installed Rails with Rubygems, a package manager for Ruby. Gems makes installing stuff really easy. I followed a couple tutorials I found on the rubyonrails.com. Even though I didn't finish my simple tutorials yet, I realize my Rails can help me to create web applications.

Rails is an MVC framework (model view controller) that is written in Ruby. I have heard about MVC before, but I haven't decided to check it out until now. From what I've learned so far, I have become determined to integrate MVC into my core web programming practices.

Scaffolding makes it simple to turn your database tables into a functional application. The scaffold is a generic program that provides basic viewing and editing of your data.

Rails also has generators that can start writing your code for you, when you want to move beyond the scaffolding. You can generate the code for models, views, controllers, and a few other things. The code will come with some default behavior, which you can modify to better suit your needs.

PHP Framework

Rails is great, but I have about 30,000 lines of PHP code that I wrote and I'd like to continue using. So I decided to write a framework in PHP that emulates some of the things I like about Rails. I thought about what features I wanted for a while, and about how I would structure my code. When it was time to write code, I wrote the DatabaseInterface class first.

DatabaseInterface

DatabaseInterface aims to serve a similar purpose as Rails' ActiveRecord. It asks the database about what a table's structure is, to pass along to the model. It also builds SQL and performs queries. The idea is to be able to do most things without needing to write queries by hand.

Model

The Model class stores information obtained from the DatabaseInterface, and defines relationships between sets of data.

Controller

The controller is where the data is processed, and tags are rendered. The tags are used by the View to produce the final output. The view reads templates which can contain references to the object being viewed, and other objects.

Zend PHP Collaboration Project

On October 20th, Zend announced that they are partnering with IBM to co-develop PHP technologies. They are making a PHP IDE based on Eclipse, an open source integrated development environment. I am really interested in trying this new product. I've been using PSPad, and I just installed Zend Studio 5 beta 2. Zend Studio's features are very nice. I haven't explored most of the new features yet. The code folding is nice. My main complaint is that Zend Studio uses almost 200M of RAM sometimes. I have no idea how it is implemented, other than it's written in Java.
Also announced was the development of a new PHP application framework. Maybe it will be considered the Rails of PHP.

Collaboration Site


sproutworks
I have been evaluating Zend Studio 5 beta 2 for my many PHP related projects. It contains the things I like about the older versions, and also some of the things that I dislike. I like the features it contains. The auto suggest feature is nice, but sometimes it delays my typing as it is loading. Zend Studio, written in Java, can be quite a memory hog. Sometimes it causes the Java process to consume almost 200M RAM. I think that's a bit much for an IDE. Then oddly, it can drop down to only a few megabytes. Also, the file open dialog box is annoying. It keeps putting me in the My Documents directory, which is not where my web projects are located. Despite it's performance shortcomings, I will continue to use Zend Studio, while keeping an eye out for their new Eclipse based IDE.


sproutworks
I've added some basic pagination to the RSS Search Engine. I made a script that draws an arrow and a page number for the page buttons.
http://www.sproutsearch.com/feeds

More features will be coming.

Also, sproutworks.com is now hosted at DreamHost. It's using PHP 5 and MySQL 5. I added a maze to the left column. This maze will link to a maze demo page.



sproutworks
I read in the PHP internals newsgroup, that Thomas Boutell is offering the GD library project to PHP. This would mean that the GD development project would be hosted on PHP.net servers, and managed by PHP people. I hope that they make this arrangement. I am an avid user of the GD library, and it is frustrating to see that the GD extension bundled with PHP still cannot create animated GIF images. It would be possible for a whole new generation of web animations to arise if the proliferation of up-to-date GD installations.


sproutworks
I have just optimized the performance of the Blogshares Idea Tracker's graph rendering program. The graphs are loading much faster now. The industry listing page now allows you to load the graph for any industry by clicking a button.


sproutworks
Forums/SproutWorks
September 23rd, 2007 4:45 AM PST
I have just added a new animation program to the logo area of this site. I have been working on variants of this system for a while. First, I wrote a JavaScript program that uses a drawing method similar to Google Maps. It uses square tile graphics, arranges them in a grid, and then moves them inside a scrolling area.

When a tile moves off the edge of the scrolling area, it is moved to the opposite side of the area. Before it is moved, the tile graphic is updated with the graphic that is appears on the opposite side that is scrolling into the scrollable area.

After I got a basic tile scrolling engine working, I made it work with several layers of tiles that can scroll at different rates. I then added the ability to make additional layers of objects that can be positioned anywhere. The animation at the top of this page uses this object layer system. I will make more interesting scenes as the engine becomes more sophisticated.


sproutworks
I have noticed a lot of queries of SproutSearch's main database table are getting slow as SproutSearch passes 8 million indexed blogs. I finally decided to do something about it after trying to add alter this table. I attempted to add a column that keeps track of the date and time of each blog's most recent post. The alter table command ran for at least 8 hours, and then MySQL either crashed or the admins killed my process. I attempted this a second time without making a new index, which also failed.

I figured I would just create a new table with the extra column and write a program to slowly copy everything over. The first version of this PHP program queried 10,000 rows of data from the old table and inserted them one by one into the new table. I set up a cron job to run this every 10 minutes. Once the new table started getting big, the cron jobs were overlapping, some records were not copied, and copy processes started backing up.

It dawned on me that I'd better learn something about MySQL optimization. I read some online articles and decided to try using mysqli_multi_query to copy the records. That would reduce the network overhead. The program ran several times faster but I wanted to look into other methods. I tried using prepared statements, which wasn't much better.

I found this excellent article (http://www.informit.com/articles/article.asp?p=377652&seqNum=4&rl=1) which said if I use the insert format like:

insert into table (column1, column2) values(val1, val2), (val1, val2)...

MySQL wouldn't have to flush the index after every insert. I made my program create a giant insert statement in this format. I tried it out and it only took a few seconds when the new table was empty. I modified the program to run 10 batches of 10,000 records, which would take a few minutes. This program has been running for a few days, and all my data is finally in the new table.

I am still having problems with the table being locked during lengthy select statements. It causes certain pages to hang for a long time. I am now copying all the data from a MYISAM table to a INNODB table because it has row level locking.


sproutworks
Presenting SproutWorks 3D Digg Explorer

www.sproutworks.com/digg3d.php

I have just put SproutWorks 3D Digg Explorer online. It is my latest attempt to display textual information in an interesting way. I use JavaScript with jQuery to script the interactive elements of it. It fetches a JSON string from my server, and creates a three dimensional scene using the data from it.