a secretSneak to the quiet readers of secretGeek...

don't blog this anywhere else, m'kay?

i'm working on two new versions of the "world's simplest code generator"

the web version is listed here: wscg

it includes a link to a google group i created: World's Simplest Code Generator where i ask for new 'patterns': go on write a few....

there is a cool new feature i haven't written yet, and oh i haven't included the funky help file i had in mind either... i expect this will be out in time for the 'official' release notice.

[ this version has already been mentioned in the comments at the daily wtf... such non-bliss... :-(... ]

if you are brave and powerful (ahh, go on, I know you are) you can use this new version of the world's simplest code generator to write all your own code.

failing that, plese use your meager allotment of time on this earth to become a software inventor.

Or, failing that, my good dear reader, plese implement some ideas i haven't had time fore: xpl, or ftl or seXml.

(it includes custom 'loops'... and will soon include custom 'constants'...'

 

how reddit encourages mediocrity.

html, ocr,
ah but i do like reddit otherwise

i remember reading a statistic like this once:

"in 1926, charlie chaplin was voted the best actor in hollywood. he was also voted the worst actor in hollywood."

I don't know what year it was. i don't know what the competition was. Point is that he was both first and last.

The same thing happens all over the place. I've seen people listed as both the "best" and "worst" dressed in the same dumb competition.

This pattern is known as "You either love it or you hate it!" and a lot of the good stuff fits this pattern.

(continues...)

At the website Reddit, you can give a positive vote, or a negative vote. Negative votes cancel out positive votes.

If the reddit system was used everywhere, charlie chaplin would've been a nobody. each of his 'worst actor' votes would've cancelled out one of the best actor votes.

Due to the flawed voting system at reddit, the highest rated articles are not the most popular, but something more obscure and bland. They're the ones which have the highest ratio of love to hate. Reddit promotes the kind of articles that you either love, or don't care about.

Take Paul Graham for example. He's a middle of the road easy listenin kind of guy. Either you love him or, shrug, who cares? And he's very popular at reddit.

Enough of this. Here's a quote that says it so much better than I could:

from: Death by Risk Aversion at Creating Passionate Users.

The only ironic thing, and which threatens to derail my whole idea, is that the article 'Death by Risk Aversion', is one I stumbled across on Reddit.

 

Tip o the day: Copy Text from MessageBox/Msgbox

use ctrl-C to copy the text from a messagebox

You learn a little every day.

Today I learnt that you can use Ctrl-C to copy the text from a message box in windows.

Hence given the following MessageBox:

use ctrl-C to copy the text from a messagebox

Hit Ctrl-C, and the following will be copied to your clipboard:

---------------------------
How to Copy from a messagebox
---------------------------
This messagebox contains a long message which
we don't want to retype. Typing is for idiots.

An amazing thing Atli taught me is that you
can use Ctrl-C to copy a message from a
messagebox.
How undiscoverable is that??
---------------------------
OK
---------------------------

Thanks to Atli -- chief developer of TimeSnapper.

 

VS2005 Tip: Which file am I working on?

track active item in solution explorer

I have it on good authority that the option "Track Active Item in Solution Explorer" is OFF by default in Visual Studio 2005.

(It was on for me... but my build is... kind a weird)

In this case, you won't know which exact file you're working on: only its name. This is a huge pain if you've got multiple projects that each contain files with the same name (e.g. "Web.config")

So if this is a problem for you... head into Tools | Options | "Projects and Solutions" | General and check the check box for "Track Active Item in Solution Explorer"

Good night!

track active item in solution explorer: off by default for web profile

(oh here's why it's sometimes on, sometimes off: "By default, the C# profile has this disabled, while the Web profile has this on" -- thanks to Scott Guthrie)

 

FTL: Faster than Light -- Functional Text Language

Ftl: faster than light (functional text language)

Stick with me on this one. This is one of those little ideas that turns into a gigantic concept and you soon realise you lack the time to ever implement it. At the end I ask for help in creating a prototype. Volunteers welcome.

Lately I've been translating an Excel-based system into a web application. And it's made me think about the underlying differences between spreadsheet functions and other programming tools.

Functions in spreadsheets are back to front. This is a user-friendly and very powerful twist.

Watch...

In a spreadsheet... we put a formula in the cell that will ultimately hold an answer...

A1B1C1
  =A1+B1

Change any referenced cell and the value is recalculated. We change A1, then C1 is recalculated...

A1B1C1
18 18

We change B1... and C1 is recalculated...

A1B1C1
182442

If we wanted to represent this same behaviour in javascript... it all happens back to front. We wouldn't add any code to the C1 item at all. Instead we add code to the referenced cells, A1 and B1. We do this by adding our old friends, 'event handlers'.

A1B1C1
182442
OnChange='Calc_c1();'OnChange='Calc_c1();'
Function: 
function Calc_c1() {
 var a1 = document.getElementById('A1');
 var b1 = document.getElementById('B1');
 var c1 = document.getElementById('C1');
 c1.value = a1.value + b1.value;
}

(Okay okay... in practice it's trickier than that: you first parse each 'cell' into an int or float, and remember to treat blank strings as zero... but I digress...)

You also use a similar 'event-driven' approach in a windows forms program, such as Visual Basic or Delphi.

So, to get the sort of function that an excel user takes for granted, a javascript or windows programmer has to put event handlers all over the place...

Now, what I'd like to play with is a programming tool that uses the back-to-front-spreadsheet model of programming and yet is nothing like a spreadsheet.

I'm picturing a wiki-style webpage, where you can edit the content of the page. But you can also attach 'spreadsheet-style Formulae' inside controls. Or even inside the text of paragraphs.

Here's a dirty mockup, or 'DMU' as i like to call it. (It's a conceptual mockup only -- it doesn't actually do anything)

The following paragraph contains an embedded function.

Mouse over this paragraph to read the formula. Or click to edit.

THE FORMULA

or click to edit

Expenses

Groceries

Rent

Car

Total 482

You have to mouse over the elements in the above panel to understand the mockup. The paragraph that says "Total 482", for example, is named "p9" (because it is the ninth paragraph) and contains a formula that says "@Sum(t1..t3)" , meaning, "Add up the value of the three text boxes".

Okay -- so what I've got is a panel where each element is automatically given a name, much like the way cells in a spreadsheet are automatically named.

(Perhaps you could also give an element a custom name, say that second textbox might be named 'RentTextBox')

On mouseover you can see the name and formula of an element. (Perhaps it would be shown in a textbox fixed to the top of the screen, in much the same way a spreadsheet shows the current cell's content or formula at the top of the form.

If you click on a formula you can edit it, or even possibly break it into more elements.

When you click in a textbox you would be able to select it's value. But if you press "F2", you would instead see the underlying formula, (if there is one).

Finally, you can edit the whole page at once by clicking a button -- much like how 'edit' works on a wiki page.

If it was working as it should, then clicking on the edit button would show a textarea containing this text:

The following paragraph contains an embedded function.

Mouse over this @p2.Type to read @p3.ToLower(). @p4.ToSentence()

THE FORMULA

or click to edit

[124]

[201]

[157]

__Total: @Sum(t1..t3)__

Notice that text boxes are represented very simply using square brackets. I know that clashes with some existing wiki standards, but i have to say i really don't care.

Notice also that the deault numbering scheme is one-based, not zero-based. Again, I really don't care.

I can't schedule in time to do a better demonstration of this idea until, say 2041. But if you have time to work on it, I've got a fairly decent spec underway, so ask for details.

Also -- i call this thing "Functional Text Language" -- or "FTL" for short, which is of course a sci-fi term for "Faster Than Light" (Travel). I've been watching a lot of Battlestar Galactica recently. My wife is a huge fan

Here's how you'd use FTL to represent other elements, with and without functions and values:

FTLRenders a bit like...
[] check box check box
[x] check box check box
[ ] text box text box
[fred]
() yesyes
(x) yesyes
((x) male ()female ()) unknown

Note the double brackets used to mark a group of radio buttons
male female unknown

Note the double brackets used to mark a group of radio buttons


[@t3*t1]
[male;female;unknown;^]
[male,0;female,1;unknown,2;^]
[male,0;*female,1;unknown,2;^]

Okay, that's my esoteric idea of the week. Give it a go if you can!

 

Fajax -- the fake alternative to ajax

Put these two tags in the head of your html document:

<META http-equiv="Page-Enter" content="blendTrans(Duration=0.2)">
<META http-equiv="Page-Exit" content="blendTrans(Duration=0.2)">

That's it. You've implemented Fajax: the fake alternative to ajax.

The blink that occurs on postback is no longer visible, most of the time.

Okay, it's a dirty nasty trick. Don't flame me, troll me, spam me or DoS me. I feel terrible as i write these words: blendtrans is a Microsoft function. In non-ie browsers it will have no effect.

How does it work?

When a page posts back (for example when you click a button on a form), it normally causes a screen flicker as the page is redrawn. In a lot of cases the screen that is redrawn is very similar to the previous screen, and the flicker is an annoyance, disrupting the user's experience. The Blendtrans function causes the old page to blend smoothly into the new one, rather than flickering.

A lot of the time, this gives an identical effect to an ajax style http request. The page appears to have stood absolutely still as just one part of it is updated.

This simple trick alone gives you about 50% of the benefit of ajax, with a 1% of the effort. Having said that, it's absolutely limited to that one visual benefit, and limited to one browser.

To get the full benefits of ajax, you will of course need to use ajax, not fajax. ;-)

Note that these effects are best not overused.

as seen on the daily grind
 

Latt blixt tycka om litvak.

Sometimes, when I'm trying to fix bugs in code... I feel just like that swiss craftsman in an early woody allen sketch.

He sits at a desk, with a little jeweler's loupe in his eye. He works hard at his craft, meticulously carving with his knife. He cuts holes in cheese. Gets paid two cents a hole.

In comes his brother and says "Latt blixt tycka om litvak."

The subtitle reads "Stick to your cheese."

I slap my knee in wonder. That's exactly how i feel!

 

Dirty Larry

Weather enthusiasts may know that a big cyclone, codename Larry, struck Queensland last week.

(Footnotes: Queensland is a state of Australia, and I live in queensland. A cyclone is the same thing as a hurricane, only it's in the southern hemisphere and hence spins clockwise instead of anti-clockwise.)

My wife and i were on holiday in the affected region at the time. It was exciting, windy, etc. We survived and we're back.

Here's a diagram.

cyclone larry
 

VB 6 Developers, lend me an err...

I need some VB 6 developers to dig deep into their memory... and tell me if you've ever used a control called the Mabry Barcode Control (barcod.ocx).

I'm doing some fixups on an old VB 6 system in my spare time, and it uses the Mabry Barcode Control. Unless I can find a license key for this software, I can't re-compile the project.

The "order now" screen is broken at Mabry's website, and I've tried writing to the company numerous times. Now I just want someone to share their key with me so the project can move forward.

Rewriting the barcode sections is not really an option right now. It may need to become one soon, though.

Whadda ya say VB 6 gurus?>

 

Ultra Mobile PC: A Boon to Private Health

thumb-driven keyboardultra mobile pc: i bet you get sore hands

The laptop has ensured a steady flow of neck injuries amongst its users (read: victims).

But the new 'Ultra Mobile PC' should add nerve disorders of the hand, wrist, elbow and shoulder into the mix!

An exciting time to work in the private health industry!

On a good day you might see a bit of thumb paralysis as well, thanks to the nifty-at-first-glance 38 key keyboard.

what sort of strain is going through that outstretched left hand?