Dr Nic

[Preview] Magic Announcements

While other people in the world have been doing real work, I’ve been on maternity leave. Thus in spare time, I’ve been cooking up something much more fun…

Today, you get to see a magic trick. No code to download, no brain cells to engage. Its Sunday after all. A day of rest, BBQs, beer, football, and magic tricks. Everyone knows that.

But I can’t show you the trick here in your feed reader… the lighting is terrible. Jump to my site for the live magic show itself.

…pausing…

Ok, at the top of the screen… I introduce to you the Magic Announcements. They are just brilliant, and good looking to boot.

Once you’ve read each one, you click on them to make them go away and they will never return. Once you’ve read the announcement of verson 0.7.1 of Dr Nic’s Magic Models, you will never see another announcement until a new version is released (be it 0.7.2, 0.8.0, or 1.0.0, etc). Nod your head with me, this is cool.

When you get your hands on this, it will be a pure Javascript install into any page (or domain of pages such as a blog). It will fetch announcements AND version change information from anywhere on the web, not just the presentation site. For example, the version information for the two projects are being retrieved from the project home pages themselves. This way, I never have to modify my blog to enter new announcements or versions: I just update the relevant data at the relevant place.

How cool is this? Imagine if you could plug the Magic Announcements directly into RubyForge or SourceForge, etc, and whenever you released a new version of your code to *Forge, your blog automatically started announcing it to your readers! Keep nodding, sexy, yes.

I’m still writing up the install/usage docco for it, but I hope to release it within a day or two.

But to give you some preparation time, for each project you want to provide announcements for, you will need to create files that look like this:

MagicAnnouncement.show('magicmodels', '0.7.1');

If you want to provide generic site announcements, like “Welcome to my website”, then it will look like this:

MagicAnnouncement.show('general_notes', 1,
  "Very rarely, you\'ll learn something here. Mostly, you'll just be entertained by the programming magic.",
  "<strong>Welcome to Dr Nic's Magic Castle of Programming Mystery</strong>");

In both cases, the 2nd argument is the announcement version number. The 3rd is an additional description (useful for version announcements and site announcements), and the 4th is for the header. You’ll normally want the header to be generated for you for version announcements, as per the Magic Models and Composite Keys announcements above.

Bonus: want to see the announcements again? Turn on the Debug Controller

Related posts:

  1. Magic Wiggly Lines => GuessMethod, by Chris Shea If you ever make time to code just for pleasure,...
  2. My railsconf sessions in my sidebar Jesse Newland got the JSON API a day ago and...
  3. Magic Multi-Connections: A “facility in Rails to talk to more than one database at a time” At this point in time there’s no facility in Rails...
  4. Spring Collection – the Modular Magic Models Dr Nic’s Magic Models are like cheating on your taxes...
  5. Meta-Magic in Ruby: Dr Nic Unplugged in Stockholm Last nights’ Ruby meeting in Stockholm had a great turn...

11 Responses to “[Preview] Magic Announcements”

  1. Hey thats awesome!
    Just…. MAGIC! I like your work, altough i dont write any software i could release… But if, i’ll use it…

    Keep up with that kinda stuff!

  2. Larry Kelly says:

    Cool! Though, I did expect to click on the magic announcement and be taken to someplace where I could read about the announcement in more detail.

  3. Dr Nic says:

    When you specify your announcements, you can include HTML. When the Magic Announcement home page is ready, I’ll provide a demo announcement with a link.

    Hmm, I guess the project version announcements could include links to project home pages by default too. That would be nifty.

  4. Sure looks great. They make it definetely easier to help people keep track of changes and things that you find cool. Any idea how search engines look at them, since they are cookie based?

  5. Dr Nic says:

    @RoRB: My guess would be that search engines wouldn’t see the announcements, unless they can execute the javascript.

    For project version announcements, the search engines will still be able to scrap rubyforge, etc to get updates there.

    I guess that if you need search engines to collect the information, you might want it to be more permanent that a one-time announcement, though.

    Cheers

  6. Since it’s scraping other sources of changes, that does make sense. If you wanted for example, “RubyNews.com” to keep a permanent record of all the scraped mods that your Magic Announcements script was generating, you’d want to post to a permanent page also like you said.

    I think this is a great application and i’m very excited to see something so fresh :)

  7. G says:

    Franks and beans!

  8. Matt Scilipoti says:

    I like this idea too. Keep them coming.

    Currently, it doesn’t remember what announcements I have already clicked on between sessions. For the Magic Models announcement, it appears that you are using a cookie named “magicmodels_ln”. I have two. Both are set to Exipres: at end of session and Content: 0.7.1. I beleive the second one was created when I “reset cookies” using the Debug Controller. general_notes_ln is set to Exipre at end of session as well.

    I don’t believe that it is due to settings in my browser. I have other cookies from you with valid Expire dates.

  9. Dr Nic says:

    @Matt – thanks for spotting the cause of this. I’d seen the symptoms but hadn’t taken the time to bugfix! ;)

    I erroneously assumed that if I set no expiry date, it would set one for me well into the future… not the end of the session. But upon reading the docco for the cookie.js lib:

    [expires] – Date object containing the expiration data of the cookie. If omitted or null, expires the cookie at the end of the current session.

    Ok, I’ve patched the code to set a cookie into the future. When I release the Magic Announcements code (which I can now do thanks to you!), it’ll be a tribute to man’s struggle to make things work without reading the instructions.

  10. Werbeagentur says:

    Thanks for the usefully informations. Could be learn a little bit about it!
    Thanks from Germany