For Loop

More useful stuff about loops. This leaves the impression that the middle part of a given loop should be a test, but I’m wondering how a sub-loop happens.

For loop – Wikipedia, the free encyclopedia

Three-expression for loops

This type of for loop is found in nearly all languages which share a common heritage with the C programming language. It is characterized by a three-parameter loop control expression; consisting of an initializer, a loop-test, and a counting expression. A representative example in C is:

for (i = 0; i < 10; i++)
/* loop body */

The three control expressions, separated by semicolons here, are from left to right the initializer expression, the loop test expression, and the counting expression. The initializer is evaluated exactly once right at the beginning. The loop test expression is evaluated at the beginning of each iteration through the loop, and determines when the loop should exit. Finally, the counting expression is evaluated at the end of each loop iteration – even if continue is called – and is usually responsible for altering the loop variable.

In most languages which provide this type of for loop, each of the three control loop expressions is optional. When omitted the loop test expression is taken to always be true, while the initializer and counting expressions are treated as no-ops when omitted. The semicolons in the syntax are sufficient to indicate the omission of one of the expressions.

Post 470 by dglp

Published on June 14, 2010 ~ 08:17 AM

Posted in theory | No Comments »

Conditionals, and Loops

I’ve been busy trying to automate the production of nodes for my Morcego installation, and find myself hung up on how to script an interative process for making similar links.
After much searching and head-scratching, I’ve found something that’s not quite an Aha! moment, but does make sense of something I’ve puzzled over.

Conditional (programming) – Wikipedia, the free encyclopedia

Else If

  • By using Else If, it is possible to combine several conditions.
  • Only the statements following the first condition that is found to be true will be executed.
  • All other statements will be skipped.
  • The statements of the final Else will be executed if none of the conditions are true.

Post 468 by dglp

Published on June 13, 2010 ~ 10:40 PM

Posted in theory | No Comments »

BSA Courier

Some years back, a friend told me of a sit-up-and-beg type bicycle that had been abandoned outside her place. So I collected it, put air in the tires, replaced cables, and put new batteries in the lantern. I haven’t used it much, and think it’s been more than a year since I last rode it. So it’s time to find it a new home.


It’s a BSA Courier; a 23 inch 5-speed, apparently from when that company was owned by Raleigh, probably in the 80s. I thought there might be a web-based record of production dates and numbers – as there are for Pashley, so did a bit of searching. I haven’t found any such details, but did come across a photo of the same model at a site called Re-Buy-Cycle. I also found some other sites dedicated to retro cycles, including, where ‘if it’s old school, it’s in’. Cool.

I guess that means the thing might be worth £20/£30. But I’m more inclined to find it a charitable use, so may make enquiries at some of the bicycle charities.

3 April 2011: in the end, I gave it to the splendidly conceived and newly-formed Birmingham Bike Foundry co-operative, some months back. I’m sure it got loving attention and a good home.

Post 466 by dglp

Published on June 10, 2010 ~ 07:47 AM

Posted in Rag | 1 Comment »

Knackered Shredder

Three days ago one of the neighbours put some electronic gear on the street for passers-by to scavenge. It was an old Apple printer and monitor, a box of cables, and a Woolworths paper shredder. There’ve been times a shredder would have been useful, so I snagged it. The feed was jammed, so I reckoned it just needed opening and cleaning.

I took it home, plugged it in, and as expected, the spindles weren’t turning. I opened it, cleared out the paper, and sure enough, the thing started working. So I closed it back up and tested it on a piece of paper. It jammed. One one piece of paper. Hmph.

I guess that means the nylon gears have worn, or their grip on the spindles has slipped, or maybe the motor itself has lost torque. So I’ll have to explore further.


I’ve entertained visions of a hand-cranked shredder – while wondering how I might fit such a thing – and of turning into a compost cruncher – not that it would be much good at it.

There’s also the prospect of gutting it, using the motor for something else entirely.

Post 462 by dglp

Published on June 9, 2010 ~ 08:03 AM

Posted in Bag | No Comments »