Article ATYP CodeSOD: Making Progress

CodeSOD: Making Progress

by
Remy Porter
from The Daily WTF on (#ATYP)

Whenever a program needs to perform a long running process, it's important that it supplies some sort of progress indicator, so the user knows that it's running. Sometimes it's a throbber, a progress bar, an hourglass, or the infamous spinning beachball of death.

ajax-loader.gif
Ready for Geocities"

Carol inherited this PHP code, which wants to use a series of dots ("".")

/*snip */$count = 0;while ($task) { /* run the task */ $count++; if ($count == 50) { $dots = "."; if ($dotCount == 2) { $dots = ".."; } if ($dotCount == 3) { $dots = "..."; } if ($dotCount == 4) { $dots = "...."; } if ($dotCount == 5) { $dots = "....."; } if ($dotCount == 6) { $dots = "......"; } $dotCount++; if ($dotCount >= 7) { $dotCount = 1; } }}/*snip */

Let's wait and see if the original developer can come up with a better idea

inedo50.png[Advertisement] Use NuGet or npm? Check out ProGet, the easy-to-use package repository that lets you host and manage your own personal or enterprise-wide NuGet feeds and npm repositories. It's got an impressively-featured free edition, too! TheDailyWtf?d=yIl2AUoC8zAkaptF0iu8Fg
External Content
Source RSS or Atom Feed
Feed Location http://syndication.thedailywtf.com/TheDailyWtf
Feed Title The Daily WTF
Feed Link http://thedailywtf.com/
Reply 0 comments