Monthly Archives: October 2017

1900 Participants for the Pharo Mooc

Hi

The new session of the Pharo Mooc just started and you can still registered and have fun learning a cool system ūüôā

https://www.fun-mooc.fr/courses/course-v1:inria+41010+session02/about

 

stef

Advertisements

Open AL script

Hi Phil,

I did that using Ronie’s OpenAL binding and Merwann’s wav parser back in 2014-2015:

MCSmalltalkhubRepository
owner: ‘ronsaldo’
project: ‘OpenAL’

MCSmalltalkhubRepository
owner: ‘MerwanOuddane’
project: ‘WAVParser’

I did things such as (build yourself something derived from this code I did not check if it works):

MyClass>>example
WAVParser wavFromStream: (‘resources/music/spellNoise.wav’ asFileReference readStream binary readStream).
contextAttributes := ALContextAttributes new.
device := OpenALC openDefaultDevice.
context := device createContext: contextAttributes asList.
context process.
context currentDuring: [
“Create the buffer”
buffer := self makeBufferFromHeader: wav header data: wav data asByteArray.
“Create the source”
source := OpenAL genSource.
OpenAL sourcei: source param: AL_BUFFER value: buffer.
“Play the source”
OpenAL sourcePlay: source.
“Play for sometime ”
(Delay forSeconds: wav header soundDuration) wait.
“Delete the source and the buffer”
OpenAL deleteSource: source;
deleteBuffer: buffer
].
OpenALC nullCurrentContext.
context destroy.
device close.

MyClass>>makeBufferFromHeader: header data: data
| buffer |
buffer := OpenAL genBuffer.
OpenAL bufferData: buffer format: (self readFormatFromHeader: header) data: data size: data size freq: header sampleRate.
^ buffer

MyClass>>readFormatFromHeader: header
^ header channels = 1
ifTrue: [
header bitsPerSample = 8
ifTrue: [ AL_FORMAT_MONO8 ]
ifFalse: [ AL_FORMAT_MONO16 ] ]
ifFalse: [
header bitsPerSample = 8
ifTrue: [ AL_FORMAT_STEREO8 ]
ifFalse: [ AL_FORMAT_STEREO16 ] ]

I am pretty sure with a little work those things could work again. I have never succeeded in playing mp3 files from Pharo though (but I’m on mac and I remembered trying solutions that did not work on Mac but may work on other OS).

Have fun guys ūüôā

Libusb binding

Hello,

A bit late, there is a Libusb [1] binding (using UFFI) and support for the Human Interface Device [2] (that uses the binding but is written in pure Smalltalk) for Pharo.
Everything is on the github repository [3]. ¬ę¬†Install¬†¬Ľ ¬†and ¬ę Quick start¬†¬Ľ ¬†sections give you all you need to start using the project.
One could also have a look at the wiki [4].
It works on Linux but hasn’t been tested on Mac OS nor Windows (it should work since libusb library works on these platforms).
Do not forget to install the 32 bits versions of libusb on your computer.
The purpose of this library is to provide the ability to use USB devices directly from Pharo.
For example, one could get data from a PS3 controller, a mouse, a keyboard, an Arduino device, etc…
Cheers,
Julien
PS: I realised this project during an internship in TaMère SCRL company [5]. Thanks to them!
Links:

Last PR log

 

 

20442 open the welcome window

https://pharo.fogbugz.com/f/cases/20442

20462 An error in the Tests never break the build

https://pharo.fogbugz.com/f/cases/20462

 

20440 integrate ReferenceFinder

https://pharo.fogbugz.com/f/cases/20440

 

20461 Update Hermes to v2.2.1

https://pharo.fogbugz.com/f/cases/20461

 

20410 Undeclared variables should be compiled with explicit class UndeclaredVariable

https://pharo.fogbugz.com/f/cases/20410

 

20421 Email should run in a node and separate stage to be sent

https://pharo.fogbugz.com/f/cases/20421

 

20447 SystemVersion>>highestUpdate not initialized and nil

https://pharo.fogbugz.com/f/cases/20447

 

20459 Comment class ImportingResourceHelp

https://pharo.fogbugz.com/f/cases/20459

20444 FFIExternalStructurePlatformTests cleanup (is32/64bit)

https://pharo.fogbugz.com/f/cases/20444

20445 Uncategorized or wrongly categorized deepCopy, veryDeepCopy, shallowCopy and postCopy methods

https://pharo.fogbugz.com/f/cases/20445

 

20458 Two uncommented classes in Reflectivity package

https://pharo.fogbugz.com/f/cases/20458

20446 Properly categorize finalize and finalizeValues

https://pharo.fogbugz.com/f/cases/20446

 

20443 SDL_Event not initialized

https://pharo.fogbugz.com/f/cases/20443

 

20435 The CI process should fail if the conversion fails

https://pharo.fogbugz.com/f/cases/20435

 

20415 Restore the extra morphic worlds properly on startup

https://pharo.fogbugz.com/f/cases/20415

 

20434 use Ring2 during the bootstrap

https://pharo.fogbugz.com/f/cases/20434

 

20431 Move initialization of Color, InstructionStream and SmallInteger

https://pharo.fogbugz.com/f/cases/20431

 

20437 Uncategorized methods in RFCondition and RFMessageNode

https://pharo.fogbugz.com/f/cases/20437

 

20436 Pull request URL in build information e-mail is wrong

https://pharo.fogbugz.com/f/cases/20436

 

20423 Add health check that all class instance variable names in the system are lowercase

https://pharo.fogbugz.com/f/cases/20423

 

20429 ContextTest>>#testSetUp is dependent on Opal

https://pharo.fogbugz.com/f/cases/20429

20433 Fix the parsing of the PR description when sending the mail

https://pharo.fogbugz.com/f/cases/20433

 

20428 ClassTest (Kernel-Tests) is dependent on System-Changes

https://pharo.fogbugz.com/f/cases/20428

20424 standalone SUnit tests are failing after integration of the new version of Hermes

https://pharo.fogbugz.com/f/cases/20424

 

The story around PharoMinimal

Hi,

What is the story around PharoMinimal and related images ?

Is there a writeup somewhere with instructions ?

Right now the minimal (Metacello) image based on Pharo 7 is used only as intermediate step in building of the full Pharo and the only real (successful) attempt to use it for something else is PharoLambda (https://gitlab.com/macta/PharoLambda).
In general it can be used for building of own (server) applications. E.g. this way you can install and run Teapot on it:
./pharo¬†Pharo7.0-metacello-32bit-d13eed2.image¬†config¬†http://smalltalkhub.com/mc/zeroflag/Teapot/main¬†ConfigurationOfTeapot¬†–install=stable
./pharo¬†Pharo7.0-metacello-32bit-d13eed2.image¬†eval¬†–no-quit “Teapot on GET: ‘/welcome’ -> ‘Hello World’; start.”
You can load baselines from the Git repositories too but we currently do not have any command line handler for it so you need to do it using “eval” command or *.st¬†flile. Something like this:
Metacello new
baseline: ‘Seaside3’;
repository: ‘github://SeasideSt/Seaside:master/repository’;
load
To make it more usable we probably should extend it with SUnit and Fuel. If you want to extend it with some packages from vanilla Pharo, you should load them using FileTree from your local Pharo repository clone.
Gofer it
url: ‘filetree:///path-to-my-pharo-repository-clone/pharo/src’;
package: ‘Multilingual-OtherLanguages’;
package: ‘Multilingual-TextConverterOtherLanguages’;
load.
It still needs some care. E.g. some classes from Zinc are not properly initialized (I know about DigitalSignatureAlgorithm MD5NonPrimitive RxMatcher RxParserRxsPredicate SHA1 ZnByteEncoder ZnConstants ZnMimeType ZnNetworkingUtils ZnServer ZnSingleThreadedServer TextConstants TextAction TextStyle).
I tried to load Seaside into it today (from the example above) and it failed (some strange error probalby related to Unicode processing). But we will fix it. If you will tell me what exactly you need we can make it work together as in case of PharoLambda.
followed by
Hi Pavel,

Thanks a lot for the explanation. To summarise: 70-minimal is the one with monticello and metacello in it that can load code via the config handler.

I was confused, because that failed for me.

Now, first doing

$ ./pharo pharo-minimal.image eval ‘ZnMimeType initialize’

fixed my loading problem. I also did the following because some of my project don’t separate tests (I known ūüėČ

$ ./pharo pharo-minimal.image eval –save ‘Object subclass: #TestCase’

With those fixes I was able to load different projects

$ ./pharo pharo-minimal config¬†http://mc.stfx.eu/Neo¬†ConfigurationOfZTimestamp –install=stable

$ ./pharo pharo-minimal config¬†http://mc.stfx.eu/Neo¬†ConfigurationOfNeoConsole –install=bleedingEdge

The image remains equally fast in startup

$ time ./pharo pharo-minimal.image eval ZTimestamp now
2017-10-08T16:55:00Z
real    0m0.062s
user    0m0.025s
sys     0m0.029s

And it works perfectly as a server, like

$ ./pharo pharo-minimal eval –no-quit ‘NeoConsoleTelnetServer new start’ &

$ telnet localhost 4999
Trying 127.0.0.1…
Connected to localhost.
Escape character is ‘^]’.
Neo Console Pharo-7.0+alpha.build.172.sha.d13eed2f80fe19f29fd85ede8c4809d6a6986d4f (32 Bit)
> get
known metrics:
system.status – Simple system status
memory.total – Total allocated memory
memory.free – Free memory
memory.gc – Garbage collect, return free memory
system.uptime – Image uptime human readeable
system.uptimeseconds – Image uptime seconds
system.date – Current date
system.time – Current time
system.timestamp – Current timestamp
process.count – Current process count
process.list – Current list of processes
system.version – Image version info
system.mcversions – Monticello packages version info
> get process.list
Delay Scheduling Process
Low Space Watcher
Idle Process
WeakArray Finalization Process
NeoConsoleTelnetServer port 4999
NeoConsoleTelnetServer port 4999 Connection Handler
> SessionManager default startupList collect: #handledId

#(#SmallInteger #Delay #ProcessorScheduler #OSPlatform #FileLocator #MCMethodDefinition #WeakArray #FileStream #MultiByteFileStream #EndianDetector #Symbol #LanguageEnvironment #Stdio #NonInteractiveTranscript #WeakFinalizationList #DiskStore #BasicCommandLineHandler #SourceFileArray #ASTCache #UUIDGenerator #InternetConfiguration #ZnLogEvent #ZnServer #Color #UIManagerSessionHandler #ZTimestamp)
>
Bye!
Connection closed by foreign host.

Image size remains ~11Mb.

Very nice !

Seaside on minimal Pharo 70

Hi,

I was successfully able to run Seaside on the minimal Pharo 7.0. After the release cleanup the resultant image has about 12.4 MiB.
The loading script expects that in the working directory you have the Pharo repository clone (in a floder named ‘pharo’). You should modify the loading script to point to your real Pharo repository clone. This clone is needed to load SUnit into the minimal image. You should have¬†PharoV60.sources reachable from the image.
The Seaside is loaded from my fork (github://pavel-krivanek/Seaside:minimalPharo/repository). I had to create a modified version because the original baseline broke the ZincHTTPComponents.
The strange line:
Smalltalk vm parameterAt: 25 put: (Smalltalk vm parameterAt: 25) * 50.
…sets the garbage collector. Without this the Seaside loading can fail on insufficient object memory.
wget -O –¬†http://get.pharo.org/70-minimal¬†| bash
pharo Pharo.image loadSeaside.st –save –quit
pharo Pharo.image startSeaside.st –no-quit
Starting of the image takes about 0.1 s on my machine.
Cheers,
— Pavel

Fun with UI Avatars

I came across https://ui-avatars.com, a web service that creates avatar images based on some parameters.

From Pharo, the shortest invocation would be something like
Making use of the full builder interface of ZnClient that would look more like
ZnClient new
https;
host: ‘ui-avatars.com‘;
addPath: #api;
queryAt: #name put: ‘Albert Einstein’;
queryAt: #size put: 128;
queryAt: #color put: ‘FFF’;
queryAt: #background put: ‘0D8ABC’;
queryAt: #rounded put: true;
accept: ZnMimeType imagePng;
enforceHttpSuccess: true;
enforceAcceptContentType: true;
contentReader: [ :entity | ImageReadWriter formFromStream: entity readStream ];
beOneShot;
get.
Anyway, it is cool to have an environment that makes this kind of experimentation so much fun.
It is probably easy to implement this avatar image generation directly in Pharo …

Bugfix and enhancements release v0.2.5 for OSSubprocess

Dear all,

I have just released a new bugfix and enhancements release v0.2.5 for OSSubprocess as you can see in [1].
This new release is thanks to the awesome work of Guillermo Polito [2]. He found a problem (and a fix) that would hung/block the Pharo image in a wait state. This problem has been forever and I have faced it myself. It would only happen when using #waitForExit and under certain scenario.  Because of that, I recommend everyone to move to this release.
Aside from that serious bug, he has also done quite some improvements in the tests and in the Travis setup. Once this PR [3] has been merged and SmalltalkCI updated, our Travis build [4] should show all green builds for Linux/OSX and Pharo 5.0 and 6.1.
I have also copied the configuration into Pharo 5.0 and 6.0 catalog so as of tomorrow, it should be there.
Cheers,