Archive

Archive for December, 2010

Lights, Camera, Squeak

December 30th, 2010 7 comments

Alan Kay said the computer is not a tool, but a new medium. In order for users to fully express themselves with a computer, it is important to integrate previous forms of expression into a more-powerful whole.

I have a working proof-of-concept to play any video file that QuickTime can handle in Squeak Smalltalk (or Pharo with slight modifications). This prototype is Mac-only.

If you have Gofer and Metacello installed, you can install the current version in Squeak 4.1 and Pharo 1.1.1 with:

Gofer new
    squeaksource: 'MetacelloRepository';
    package: 'ConfigurationOfFFI';
    load.

    ((Smalltalk at: #ConfigurationOfFFI) project latestVersion) load.

    Gofer new
        squeaksource: 'SophieGoldDig';
	package: 'SpdQT';
	load.

Then, blow your mind by playing a video in-image with:

aURI := URI fromString: 'file:///path/to/video.ext'.
movie := QuickTimeMovie openMovieFromURI: aURI.
m := SqueakMovieMorph openOn: movie.

Usage:

  • click on the morph to play/stop the video

Issues:

  • extra processes may be left running (FIXED)
  • Pharo 1.1.1: this will work after two errors – for both, go into the debugger and remove the isFinalizationSupported checks. (FIXED)

For our lazy/skeptical friends, here is a Flash video (.flv – H.264, 320 x 216, Millions; AAC,
Stereo, 22.050 kHz) playing in Squeak 4.1:

UPDATES:

  • fixed bug that left extra processes running when a movie was stopped and then restarted
  • package now loads correctly in Pharo 1.1.1
Categories: Smalltalk Tags:

Digging Cool Code out of Sophie

December 13th, 2010 2 comments

OpenSophie (“software for writing and reading rich media documents in a networked environment”) did a lot of great stuff that never made it back to Squeak Smalltalk (on which it was built). I just ported mp3 playing to current Squeak/Pharo, and there are many more treasures to be unearthed.

Here’s how to get started:

  1. Download the last Squeak-based version here
  2. Start the image either:
    1. With a current Squeak VM passing it this changeset, which unlocks it for development (select to file in entire file from the menu that pops up).  On the mac, you can do it like this from Terminal (n.b. Squeak VM Opt is inside the VM bundle):
      "path/to/Squeak VM Opt" /path/to/Sophie.app/Contents/Resources/sophie.image /path/to/Sophie105PrepForDev.st
    2. By launching the Sophie one-click app
      1. Bring up a user interrupt (Cmd-. on the Mac)
      2. Click the “Debug” button
      3. In the debugger, DoIt the following:
        1. (World findA: SophieRootMorph) delete.
        2. Transcript open.
        3. SophieApplication open.

You will find yourself in a Squeak image with an OpenSophie application running in a SystemWindow.

If you rescue any code, share it with the community! And if you make sure to cut and paste the OpenSophie license into it (e.g. in a class comment), it seems you’re in the clear*.

* not legal advice. I’m not a lawyer.

UPDATE: To start exploring a book programmatically, evaluate:

SophieApplication singleton activeBook
Categories: Pharo, Smalltalk, Squeak Tags:

Playing mp3s in Squeak Smalltalk

December 13th, 2010 No comments

Squeak’s VM has an mp3 plugin, but there doesn’t seem to be any access from the image. So I dug into OpenSophie (version 1 of which was based on Squeak) and yanked out some code.

You can now play mp3 files in Squeak and Pharo!

Instructions:

  1. Just load the SophiePort package from http://www.squeaksource.com/SPDProjectUpdates
  2. Then try:
    song := StreamingMP3Sound onFileNamed: '/path/to/yourFavorite.mp3'.
    song play.
    "song pause."

Notes:

  • It works in Squeak 4.1 and Pharo 1.1.1 on Mac OS 10.6.5
  • I am unclear about the license – Sophie has one license, the code itself seems to be SqueakL. Do your own investigation.
  • There were checks like the following that had to be removed for Pharo 1.1.1: “WeakArray isFinalizationSupported ifFalse:[^anObject]“. I’m not sure of the implications of removing them
Categories: Pharo, Smalltalk, Squeak Tags:

Debugger Driven Development

December 4th, 2010 4 comments

An amazing feature of Smalltalk is that you can create methods right from the debugger.  This fits nicely with “write the code you wish you had.”

  • First, you write a test calling whatever methods you want (even if they don’t exist)
  • When you run the test, a debugger pops up with a create button

  • Like magic, with a push of that button, a method skeleton appears in which you fill the implementation

Field Report

Now this is where things get creepy…  It’s after midnight, and I just want to finish one last thing.  You see, I’ve been implementing a very basic Cucumber-like framework for acceptance tests in Squeak, and there’s just one thing left to do.  I’ve got helper methods that turn given/then/when descriptions into methods that define the steps, like this:

As you can see, #given: transforms the description string into a camel case method name.

All I had left to do was handle the case where the method didn’t exist yet.  In cucumber, templates are passed to the command line to be pasted into the step definition file.  Oh, I’ve got it, the transcript is like command line output, I’ll paste it there!  Let me just see what this debugger is about…

When I took a closer look, I started laughing and couldn’t stop…

Smalltalk handed me a magic Cucumber-step-definition-template-generator!  I checked one more item on my todo list and clicked the magic button.

windows 7 product key

windows 7 product key

windows 7 key generator

windows 7 key generator

free winrar download

free winrar download

winzip activation code

winzip activation code

free winrar

free winrar

winzip free download

winzip free download

winrar free download

winrar free download

winrar download free

winrar download free

winzip free download full version

winzip free download full version

windows 7 activation crack

windows7 activation crack

windows 7 crack

windows 7 crack

free winzip

free winzip
\n