Thursday, June 30, 2005

How to make a flash video recording on linux ?

It's rather easy -- first, you need vnc2swf, and a vnc server.
Start the vnc server on a second X port:

vncserver -geometry 1024x768 :1

Then you can launch vnc2swf:
vnc2swf out.swf :1

That will connect it to the vncserver running on localhost:1, and will output the swf file to out.swf. Start the recording by hitting F9; hitting it again will pause, etc.

Now, to add sound, there isn't a nice way of doing it... but what you can do (and that's what I did) is to launch a sound recorder application in parallel, and start the recording at the same time as the video. At the end of your video recording, you should have the video (out.swf) and a sound file from your recorder app, say "voice.aif". You then need to convert the sound file in mp3 (use the mp3 encoder lame for example).

After that, you just need to add the mp3 to the swf file, and you can do that using edit_vnc2swf :
edit_vnc2swf.py -o final.swf -a voice.mp3 out.swf


The last step is to create a html file containing the following section:

<object width="1024" height="768"
CODEBASE="http://active.macromedia.com/flash5/cabs/swflash.cab#version=5,0,0,0">
<param name="MOVIE" value="final.swf">
<param name="PLAY" value="true">
<param name="LOOP" value="false">
<param name="QUALITY" value="high">
<embed src="final.swf" width="1024" height="768"
play="true" align="" loop="true" quality="high"
type="application/x-shockwave-flash"
pluginspage="http://www.macromedia.com/go/getflashplayer">
</embed>
</object>


Note that you need to set the same dimension as the video, else you'll have artifacts.

And... that's it :-)

Sunday, June 26, 2005

STPalette 1.2

I uploaded STPalette 1.2, you can find it here: http://www.roard.com/gnustep/STPalette-1.2.tgz

The archive contains libStepTalkView, the StepTalkPalette, and CalculatorExample containing the sourcecode and the gorm file of the Calculator done in the flash demo...

Saturday, June 25, 2005

Flash Demo !

I just recorded a flash demo showing how to use Gorm + the StepTalk palette...
the link is http://www.xdev.org/gnustep/demo.html :-)
I'll probably make a release later today, or tomorrow (just to clean up the last things ;-)

Friday, June 24, 2005

Camaelon..

Just to show a screenshot of the StepTalk palette + StepTalkClass inspector + the calculator with Camaelon enabled :-)
(ok, there's one additional thing though -- the popup to select the return type of the method...)



Shiny, no ?

Thursday, June 23, 2005

It works :-)

After fixing a couple of bugs, I was able to code a simple calculator entirely in Gorm :-)



I need to finish properly the NSMethodSignature encoding, but after that I'll probably make a release.

integration in Gorm..

I have now a reasonably-working StepTalkClass implementing inheritance -- you can inherits from other StepTalkClass instances or from a normal ObjC class (well, only the methods.. the ivars aren't inherited..). I also started a new inspector in Gorm for managing a StepTalkClass, where you can add ivars and methods, and if you modify a variable in your method the variable correctly changes (eh, useful no ? ;-)

On the other hand, the object model is rather simple -- I don't have classes and instances, I just define ivars and methods. But for a first version that will be enough for most of the needs (you don't really use lots of instances in general for dealing with the UI..), although I think I will implements a class/instance system anyway (I have a StepTalkRuntime that keep tracks of the created classes..)

I have a slight problem at the moment, calling directly a "script method" in a StepTalkClass works, but for some reasons it doesn't in Gorm, so I need to investigate... it's a bit odd as I inform Gorm of the methods, and I can link a button to a method; I implement respondsToSelector: in StepTalkClass, but somehow I don't even get the message... well I'll see that this evening.

I had some problems with NSMethodSignature, by default the StepTalkClass methods returned an object and took only objects as parameters; so it was easy to build the signature (I actually used a convenient method available in STObjCRuntime). But for actions in gorm, the methodsignature must apparently have a void return value.. so I need to allow signature creation with different return values. Setting the signature by hand make it works though, so it won't be difficult. The other problem is that I can't seem to be able to return an int (not an object) from a script method, even if the NSMethodSignature is correct: I end up with a vacall error when I set the return value of the NSInvocation... I need to find a way, else it will be difficult to create for example NSTableView delegates ! :-)

Anyway, I hope that i'll be able to fix the remaining bugs soon and make a release. At least with it you will be able to create for example a calculator completely in Gorm (as in http://www.levenez.com/NeXTSTEP/IB_ex2.html). I think I'll make a flash video to show how it works :-)

Friday, June 17, 2005

StepTalkClass !

Well, after messing a bit, I have now the following code working:


@implementation Transcript
+ (void) show: (NSString*) str
{
NSLog (@"<Transcript> %@", str);
}
@end

...

StepTalkClass* myClass = [[StepTalkClass alloc] init];

[myClass setName: @"NewClass"];

[myClass addIVar: @"Transcript"];
[myClass setTranscript: [Transcript class]];

[myClass addMethod: @"display: str"
withContent: @"Transcript show: str."];
[myClass display: @"Hello World!"];

...

<Transcript> Hello World!

...


:-)

Basically, it means I have objects written using StepTalk, integrated in the ObjC runtime. So what it really means is that we'll be able to develop complete applications in StepTalk, directly in Gorm :-)

Well, I still need to do a bit of work -- I need to hook that into the StepTalk palette, and add a reasonably good class browser in Gorm for theses "Steptalk classes", but it shouldn't be to complex.

I will probably have a Smalltalk-like browser, and in the future I'll try to implement some of the ideas described here...

Also, as the metamodel is easily modifiable (obviously :), it's possible to implement interesting things... first, I need to implement single inheritance, categories, class methods, class variables to the current simple model...

StepTalk "objects"

As I said previously, what I want now is "real" objects in Steptalk, not just scripts. Basically, to abuse the runtime thinking classes really exist as objective-c classes, while in fact they will be a special class containing dictionaries for its ivars and its methods, and that will execute theses methods (mere NSString containing a script) via Steptalk.

It's not done yet... but I have a basic behavior done: I can add a class to the GormClassManager, add a method to it, and connect a button to this virtual method. And that works -- clicking one button connected to the standard execute: method does something, clicking on a second button connected to the virtual method does something else :-)

So, well, it's not ready yet, but things looks good :-)

Wednesday, June 15, 2005

STPalette 1.1

I worked a bit on the steptalk palette today, and I added some nice improvements...

steptalk palette sshot


  • You can create script outlets on the fly -- no need to use the object1,object2,...object9 limitation.. :-)

  • I added a non-ui object that you can instanciate as any object

  • The StepTalkView is still there, but more like a button containing a script. And actually by default its target/action is itself, so when you click on it, you execute the script. To change the default image, just dragn'drop another on it :-)

  • added a connection inspector to only show the script outlets



So basically now, it's more useable imho :-) and starts to be quite nice.

Check the readme files for more infos. You can download it from here: http://www.roard.com/gnustep/STPalette-1.1.tgz

enjoy :)

StepTalk Palette 1.0 released :-)

Well, I had the time this evening to create a small libStepTalkView library (containing... the StepTalkView widget...) and correct a few things, so I thought it was good enough for a release ! For once I'm trying to do "release early, release often". Although I'm not sure about the latter... ;-)

Anyway, the whole package (libStepTalkView and StepTalkPalette) is here: http://www.roard.com/gnustep/STPalette-1.0.tgz

What's wrong at the moment ? well, it seems the StepTalkView class is not properly exported somehow, so you need to reload manually the class in Gorm (Classes->load class, load StepTalkView.h from libStepTalkView) before drag'n dropping a StepTalkView -- I guess that's probably easy to fix. Else it seems to work..

What I'd like to do now is to create outlets/actions on the fly (well, actually, tell Gorm about them) -- if I can do that, then I can create an object that will let you dynamically create "StepTalk objects" -- add instance variables, methods, etc. Each "methods" will contains a script, executed on the fly, and each instance variables will be passed to the scripts. Not completely sure about methods parameters, but I'll probably find a nice way to deal with them...

Anyway, if I can do that (and that seem doable..), then you could really program entirely in Gorm :-)

(although it probably won't be very fast, for sure... but for prototyping that would be quite useful I think, and if you need perfs, you can create an ObjC object!).

Have fun, and contact me if you have ideas :-)

Tuesday, June 14, 2005

Steptalk palette :-)

Making a StepTalk palette was quite simple, as it turned out...



Now I just need to build a proper framework and add a non-view StepTalk object in addition to the current one... :-)

Monday, June 13, 2005

Steptalk integration ..

Now that I have something mostly working on the "stack" side .. what would be neat is to have a way of adding some little code snippets directly in Gorm and link them to actions; it's not meant to replace ObjC coding, but in my "hypercard"-like idea, it's ok -- you'll use small scripts to do some of the things, and if you want really complex stuff you can use objc objects. Well I guess people could abuse the script system, but hey..

So, the obvious way to add scripting is to use Steptalk, Stefan Urbanek's script engine for GNUstep. Furthermore, Steptalk isn't tied to a specific language (actually it can support a smalltalk-like language and scheme, and we could have something else like ruby in the future...).

I had a look to F-Script but I was disappointed by its IB palette.. basically it's not really useable for what I want ;-) -- even if I didn't want to use it, I was wondering how the palette was working, as I thought it permitted what I want... in fact, it kinda does, but by setting manually the targets/actions of objects in the script .. bah :-) -- I want something more easy to use.

Well, I compiled Steptalk on OSX to play a bit with it, and I'm trying to think about how the palette could work to provide an environment as easy to use as possible... F-Script palette's idea of defining a bunch of outlets (object1, object2, .. object9) on the F-Script view where you link objects to have them accessible from the script is a bit crude, but for a start it will do the work. Though I think it should be possible to create a custom editor/connector that will let you add outlets on the fly, which would be a better way. Need to ask greg about that :-)

So the idea is to create a Steptalk palette that will contain a "Steptalk object" (which will contains a steptalk environment and
a text containing the script). You will be able to connect outlets to this object (and theses outlets will then be accessible from the script), and also use it as a target (so you could connect a button to it, when the button is clicked it will execute the content of the script). That won't be a perfect system and not as transparent as visual basic / hypercard (eg, click on the button, you get a window with the corresponding code executed onClick), but that would be a start. This "Steptalk object" won't be a view, but we could have a simple view so you could put the script on your windows (this view won't show when the program is running...).

Something that could be interesting too is to use custom widgets that already contains a steptalk object, with their target/action set to it. For example, the Stack could (and probably should) contains such an object. Same for the cards. And we could have a custom button containing a steptalk object too, which will then permit the "I click on the button and the code appears" scenario...

Sunday, June 12, 2005

update on the hypercard idea...

Well, after backuping OSX, then formatting my hard drive, then reinstalling the backup image on it.. I was able to easily install ubuntu on my powerbook, and now I've got a working gnustep env :-)
Ok, no touchpad support, no wifi support (damn you broadcom !), no luminous keyboard support... but it works :-)

So I was able to start recoding a palette for Gorm.. with a bit of help from gregory casamento, it now works :-)
Well, sort of. It's not persistent in "test mode" yet. And I need to finish my IB Editor subclass to support the Card connections (eg, connect something to the Card, not just to the Stack object). So what's working ? Well:


  • There's a palette containing a Stack object -- you can drag'n drop it on you window

  • The Stack object contains one Card by default, and you can drag'n drop things on it (buttons, textfields...)

  • There's a Stack inspector, so you can add new cards, and navigate through the existing cards

  • There's also the possibility of creating a card from an existing one (eg, the second card will be a copy), which I need to implement the "background elements" thing, useful in the database case


So what needs to be done ? Well, as said before, add connection support to the Card view (so you could for example add a button that when clicked go directly to the card); then add persistency to the cards (I will probably just encode them for a first try... perhaps in the future something with CoreData (if we have a clone ..) or GDL2 ? or a custom solution ? but who knows, simply using encoding will perhaps be good enough for the use I expect, eg, very small databases...)

So anyway, good progresses... and now I have a much better idea about palettes ;-) so i'll probably do some more -- for example, a palette containing NSArray/NSDictionary could be rather useful, particularly if they have an editor to let you add data, and particularly in my "hypercard"-like scenario.. then, I'll just need a Steptalk palette ! :-D

Saturday, June 11, 2005

Hypercard and Gorm ?

Hypercard ? Never used it, but always heard good things about it.. (starting from Dave Small's articles ;-)
So in another round of web procrastination, I tried to find more infos about it. Turns out it was quite interesting, and modern incarnations such as Revolution are quite cool too.

So what's cool with Hypercard ?


  • You could say that it was one of the first easy to use "gui builder" -- you just drag'n drop elements on your screen, click on them to open a script function that will be triggered (for example when the user click on the element), etc. And it's not limited to widgets, you can draw, add images, sound... More than a gui builder, Hypercard was the first multimedia authoring system..

  • You program it using Hypertalk, a "natural" programming language (ie, close to english, rather lax). Interesting.

  • The real interesting bit: everything revolves around the concept of Stacks of Cards. Basically, you start with a stack containing one card. You can have more than one card in a stack (duh), and only one card is displayed at a time. So, a card is a "screen" if you want. And then you have the possibility to navigate through the cards, going from one card to another, to add cards, etc. Which is basically a hypertext (or hypermedia in that case) system. Now, the other great thing is that cards are persistants : if you add something to a card, it will stay. If you quit hypercard, restart it, reload your stack, what you added on the card is still there. Combine that with the ability to specify some of the elements on a card as "background elements" (meaning they'll be there on any cards of the stack) and you have a really simple method to define databases. Which is why Hypercard was also considered as a database. Pfew, quite a lot of possibilites, no wonder Apple's management had a hard time figuring it out ;-)



An example of creating a database: Just create a new card, add some textfields... add buttons to navigate (prev card, next card) and a button to add / remove a card. Set the textfields as background elements. And voila ! you're done ! Now you can run your stack, fill in the card, and when you need to add a new card, just click on the button. Great no ? In addition Hypercard could easily search through a stack, so it wasn't difficult to add search possibilities too.. And if you need to add a new information ? just add a new textfield :-)

So to sum up, quite a neat system. As I never used it, I perhaps misunderstood some of the possibilites, but playing a bit with Revolution, I'm not too far from what I describe..

I now understand more why lots of people liked it -- it was really a great system for "non programmers" to actually do great things with their computer. It's a shame Apple didn't push it more...

Anyway... I needed to explain all that to introduce my idea : Gorm is the InterfaceBuilder-like program for the GNUstep framework. You could say it's just another "gui builder" ... and you would be rather wrong ! Because instead of limiting itself to describe UI elements layout.. it really only deals with objects. Live objects. Which means you can even try your user interface, link buttons to actions, etc., all without compiling. And it's any objects -- not just graphical objects.

When you set options of the elements on your UI, you really work on the objects themselves. Then the UI is saved -- in fact, the objects graph is simply serialized in a file. When your GNUstep (or Cocoa) program starts, it just load this serialized graph of objects back in memory. That's the great thing with InterfaceBuilder and Gorm : you can set up a lot of things directly, without writing a line of code. The other good thing is you can define your own palettes of objects :-) so at the end, you can build complex program simply by drag'n drop... well, that's the idea anyway. Recent Apple's additions to the Cocoa API goes toward that (NSController, CoreData...).

So what's my idea then ? Well, it occured to me that you could simply have two objects -- a "Card" object and a "Stack" object, and put them on a Gorm (or IB) palette. The "Card" object will accept other objects (textfields, images...) and will also be in charge of saving their state. So there you'd have a persistant Card. The "Stack" object will maintain a collection of Cards, and will answer to messages like "go to card #2", "go to next card", or "create a new card".

Thoses two objects will provide you with Hypercard-like functionalities -- just start Gorm, select the "hypercard" palette, drag'n drop a Stack view on your window, and then add what you want on it. Want another card, open the Stack inspector and add one. Add new objects on it. Add some buttons on your window, and link the buttons' actions to some methods of the Stack or of the current card. And of course, instead of widgets, you could drop images or sound ... why not ?

Now, imagine we'd have a Steptalk palette to create scripts objects... and voila, you have an hypertalk-like system :-) -- all that inside Gorm (or InterfaceBuilder), leveraging the Gorm's UI builder possibilities. Imagine now we add a few nice graphical transitions or other niceties... and you end up with a rather good multimedia authoring system that generates binaries :-)
-- and if you want to add your own objects to it, to extend it.. well, it's still Gorm and GNUstep, so you can easily do that, obviously :-)

Ok, that was a long post... :-)

So in short, the idea sounds quite cool to me, and I actually started to implement a palette with thoses two objects on InterfaceBuilder (MacOSX). Sadly, palette creation isn't that well documented and I ran into a couple of strange problems .. so ... I'll do that with Gorm first, it'll be easier. Didn't start with Gorm for a very simple reason -- since Tiger, my GNUstep/OSX installation is b0rked. In the end, I'm installing a linux distrib (ubuntu PPC) ... Should be easier to have a working GNUstep environment ! :D

First Post...

Well, I finally decided myself to open a blog. What for ? hm.. mainly to record my thoughts and ideas about computer science, programming, etc. I'm not really into writing personal stuff about me :-)

At least it will give me with a known place where I can write things and find them later...

Just the bare minimum about myself: I'm 26, french, in the middle of my PhD. I live in Wales, UK. Crap weather, but nice place and nice people.

I'm involved with some free software projects, mainly GNUstep and Étoilé. Which is why I'm writing in english rather than in french, as many of the things I plan to write here will likely concern thoses projects.

We'll see how it turns out !