Re: [Pharo-users] How to grab a debug on Syntax Error?

2017-06-12 Thread Henrik Sperre Johansen
Depends on whether you have a SyntaxErrorNotification or a SemanticError. For SyntaxErrorNotifications, you can wrap in a handler block raising a debugger (and will see at which index in source the error is for). Handling automatically is very kludgey without changes to the way OpalCompiler fetche

Re: [Pharo-users] How to grab a debug on Syntax Error?

2017-06-12 Thread Henrik Sperre Johansen
Stephane Ducasse-3 wrote > You get a pop up but now idea how to do anything with it. You're supposed to edit the invalid source code in the popup, and save it. Then load will proceed using the corrected code. The title / tooltip for the popup could surely use some better explaining ;) -- View

Re: [Pharo-users] Are we able to run pharo images in a read only environment?

2017-07-05 Thread Henrik Sperre Johansen
Sven Van Caekenberghe-2 wrote >> On 27 Jun 2017, at 21:15, Sven Van Caekenberghe < > sven@ > > wrote: >> >> >>> On 27 Jun 2017, at 21:00, Esteban A. Maringolo < > emaringolo@ > > wrote: >>> >>> Interesting experiment. >>> >>> It would be good to know how fast does the image boot and start >

Re: [Pharo-users] Compiling lots of method source without debugger

2017-08-04 Thread Henrik Sperre Johansen
Patrick Scherer wrote > Hello everyone, > > This is my first time here so I hope this is the right place to ask > questions. > > In an attempt to move lots of code from VA Smalltalk to Pharo, I need to > compile a lot of methods whose code may or may not work due to missing > classes in Pharo etc

Re: [Pharo-users] Lazy-initialization patterns

2017-08-07 Thread Henrik Sperre Johansen
Esteban A. Maringolo wrote > 2017-08-05 19:21 GMT-03:00 Peter Uhnak < > i.uhnak@ > >: > >> If I want to initialize the value in a separate method (typically for >> testing or reuse), then I prefer to avoid state mutation there and >> instead I return the result. >> >> MyClass>>#property >>

Re: [Pharo-users] Problem compiling method source - genPushLiteral: out of range

2017-08-18 Thread Henrik Sperre Johansen
The limitation is inherit in the object format/ instruction set, you can find some previous discussions at http://forum.world.st/Max-source-method-length-Max-string-length-Max-change-set-size-td3531169.html#a3535281 and http://forum.world.st/More-than-256-literals-referenced-td4676669.html#a4676972

Re: [Pharo-users] Writing XML

2017-09-14 Thread Henrik Sperre Johansen
Jimmie Houchin-5 wrote > I still do not know how to do this correctly. But I have something that > seems to work for the moment. > > Using #asUTF8Bytes > > f nextPutAll: (writer write contents asUTF8Bytes). > > Now the file is in UTF-8 and normal size. openForWriteFileNamed: opens a binary st

Re: [Pharo-users] Problem with input to XML Parser - 'Invalid UTF8 encoding'

2017-10-09 Thread Henrik Sperre Johansen
XML expects a prolog in the document itself defining the encoding, if absent, the standard specifies utf-8. So when you use an XML parser to parse an HTML page, it will disregard any HTTP encodings, interpret the contents as an XML document with missing prolog, and try to parse as utf8. When you u

Re: [Pharo-users] Problem with input to XML Parser - 'Invalid UTF8 encoding'

2017-10-09 Thread Henrik Sperre Johansen
In a class named XMLHTMLParser, you may expect that logic to be expanded a bit beyond the basic XML spec though. But since there are multiple potentially correct definitions, there will always be failure cases. Not to mention, in addition to XML/HTTP, HTML4/5 also define (different) meta tags for

Re: [Pharo-users] RBRuleIfNotNilDo usage

2017-11-14 Thread Henrik Sperre Johansen
Stephane Ducasse-3 wrote > I wonder if we packaged somewhere the removed deprecated method. > We should do that but since we do it manually I guess that this is ad-hoc. > > Stef > > On Sun, Nov 12, 2017 at 2:45 PM, Alistair Grant < > akgrant0710@ > > wrote: >> Hi Stef, >> >> On 12 November 2017

Re: [Pharo-users] P3 timeout

2017-12-07 Thread Henrik Sperre Johansen
Sven Van Caekenberghe-2 wrote >> On 5 Dec 2017, at 01:00, Pierce Ng < > pierce@ > > wrote: >> >> On Sun, Nov 26, 2017 at 07:17:51PM +0100, Sven Van Caekenberghe wrote: >>> Added P3Client>>#timeout[:] option (thx Pierce Ng) >> >> Thank you, Sven. >> >>> About Zdc streams. They have their own de

Re: [Pharo-users] Is there a way to stop arrays sorting automatically?

2018-01-02 Thread Henrik Sperre Johansen
Ben Coman wrote > On 31 December 2017 at 04:00, Andy Burnett < > andy.burnett@ > > > wrote: > >> I suspect I am missing something very obvious, in which case could some >> kind soul put me straight? >> >> I have the following code >> >> col := OrderedCollection new. >> (1 to: 9) permutationsDo:

Re: [Pharo-users] [ANN] Orientation

2018-01-02 Thread Henrik Sperre Johansen
Julien wrote > Hello, > > I developed a small framework to model orientation (north, east, south, > west). It defines some common operations that can be done on such objects > (turning, getting the opposite orientation, moving on n steps on a > discrete grid from a given position following certai

Re: [Pharo-users] mac address on windows

2015-05-06 Thread Henrik Sperre Johansen
A few easily fixed Type/pointers to Types mixups, and a slipup where two different classes are confused for the same aside, the real show stopper, if I haven't missed something entirely, is that the struct parser/NB in general does not handle const sized arrays*, which is used in a few of the requi

Re: [Pharo-users] OrderedCollection get all lines

2016-05-11 Thread Henrik Sperre Johansen
There's also PositionableStream >> #nextLine which lets you write code like [readStream atEnd] whileFalse: [(self regexMatch: readStream nextLine) ifNotNil: [:matchingLine | "Record match somewhere here"]] Cheers, Henry -- View this message in context: http://forum.world.st/Ordered

Re: [Pharo-users] StampClient produce only and dealing with heartbeat

2016-05-20 Thread Henrik Sperre Johansen
+1. Testing the RabbitMQ client (very cool, BTW) some time ago (which is structured the same way with a single event loop), I ran into the same kind of issues Holger describes; for example, bursts of incoming data would cause a heartbeat to not be sent in time, and the server would drop connections

Re: [Pharo-users] UDP Socket primitive failure

2016-11-02 Thread Henrik Sperre Johansen
I'm amazed that ever works, as (in general, maybe mac is special,) you need to specify the ipv4 address as a ByteArray, not a string. (OSCMessage for:{'/mixer.volume'. 1 . 0.2})sendTo: #[127 0 0 1] port: 57120 Cheers, Henry -- View this message in context: http://forum.world.st/UDP-Socket-pri

Re: [Pharo-users] How does Boolean ifTrue work?

2016-11-02 Thread Henrik Sperre Johansen
CodeDmitry wrote > Why don't Smalltalk or Smalltalklike languages have checked interfaces? > The compilation occurs at runtime but it is still technically a > compilation, why don't languages allow implementing interfaces at runtime? > The type information is there, and the source can load the list

Re: [Pharo-users] global exception handler mechanism

2018-02-16 Thread Henrik Sperre Johansen
You can also override #defaultAction on Exception, and install a custom UIManager subclass implementing unhandledErrorDefaultAction: (sent by UnhandledError #defaultAction, receives the error as argument). Would be nice(r) if UIManager had a defaultUnhandledErrorActionBlock: setter, but it's not t

Re: [Pharo-users] Bitwise operations in ByteArray (slicing, etc.)

2018-03-06 Thread Henrik Sperre Johansen
Esteban A. Maringolo wrote > Hi Richard, > > Certainly a BitStream is beyond what I initially thought. > > But it could be of some use to play with it, is it available somewhere > with a friendly open source license? > > I might give it a try using it for my generator (tests are already > passin

Re: [Pharo-users] New Files in Pharo - Migration Guide, How To's and examples

2018-03-20 Thread Henrik Sperre Johansen
This is great! And, +1 on the need for some more convenience constructors... Word of warning (which would be nice to mention in the guide); using writeStreamDo: and manually constructed buffered writers will not #flush the buffered stream automatically on close, so it's crucial this is done manua

Re: [Pharo-users] New Files in Pharo - Migration Guide, How To's and examples

2018-03-20 Thread Henrik Sperre Johansen
EstebanLM wrote >> On 20 Mar 2018, at 12:56, Henrik Sperre Johansen < > henrik.s.johansen@ > > wrote: >> >> This is great! >> And, +1 on the need for some more convenience constructors... >> >> Word of warning (which would be nice to mention in

Re: [Pharo-users] Slower

2018-04-05 Thread Henrik Sperre Johansen
HilaireFernandes wrote > After some more investigation, I think it is not the greated bottleneck. > > When I render points not as discs but as Square, Athens is happy. I > guess the Cairo way of doing this is very slow because its seems Cairo > does not come with dedicated disc rendering code, i

Re: [Pharo-users] How to LAN feature

2018-05-07 Thread Henrik Sperre Johansen
HilaireFernandes wrote > Computer should be on a same network, however not sure about swtich in > between. > > Does UDP broadcast required particular privilege on the host? > > Thanks > > Hilaire > > Le 06/05/2018 à 13:31, Norbert Hartl a écrit : >> If it is on a single network this should be

Re: [Pharo-users] How to LAN feature

2018-05-08 Thread Henrik Sperre Johansen
Ben Coman wrote > mDNS would be an interesting facility to include in the main Pharo release > image, > perhaps making it very easy for our "live" systems to locate each other on > a local network without external infrastructure. > > > cheers -ben mDNS and SSDP are pretty much interchangeable, i

Re: [Pharo-users] How to LAN feature

2018-05-14 Thread Henrik Sperre Johansen
Julián Maestri-2 wrote >> >> (impossible without the added networking prims, and still unreliable >> whether it will find the correct ones with...) >> > > The problem seems to be here: he->h_addr_list[0] its a list of addresses > and only the first one is used. That's the "old" ipv4 primitive. T

Re: [Pharo-users] On UDP broadcast

2018-05-22 Thread Henrik Sperre Johansen
HilaireFernandes wrote > Thanks Sven for the indications. > > Of course I already looked at this Test, but I got lost. I looked at it > again, and wrote something like: > > | socket data | socket := Socket newUDP. socket setPort: . > socket waitForConnectionFor: 2; waitForDataFor: 5

Re: [Pharo-users] Set Rounding mode for IEEE floating point operations

2018-05-23 Thread Henrik Sperre Johansen
fesetround()/fegetround() are part of C99, and amazingly, also present in the Windows CRT, it might be possible to try to do this with FFI only? IIRC the numerical model is supposed to act identical across platforms; whether it would actually affect anything depends on how the VM achieves that; I

Re: [Pharo-users] a basic hash question

2018-07-30 Thread Henrik Sperre Johansen
jgfoster wrote > Werner, > > I would say that you are right, this is a problem. A (not un-common) > source of subtle bugs in Smalltalk is missing this rule that equivalent > objects must have the same hash. In GemStone the objects are not > equivalent (I’m not arguing that this is right, just that

Re: [Pharo-users] a basic hash question

2018-08-01 Thread Henrik Sperre Johansen
Richard O'Keefe wrote > @James Foster: 100%. There are no exceptions. > > > On 1 August 2018 at 02:05, James Foster < > Smalltalk@ > > wrote: > >> To what extent is it required by ANSI that objects be of the same class? >> Does Pharo treat a String and a Symbol as equivalent if they have the

Re: [Pharo-users] Pharo 7 file streams guideline

2018-08-07 Thread Henrik Sperre Johansen
Guillermo Polito wrote > On Tue, Jul 31, 2018 at 6:29 PM Damien Pollet < > damien.pollet+pharo@ > > > wrote: > >> Hi Sven… a couple questions: >> >> - is there a preferred order of composition between the encoding and >> buffering streams ? If yes, it the same for read and write stream, or >> re

Re: [Pharo-users] RBPattern syntax

2019-02-19 Thread Henrik Sperre Johansen
Manuel Leuenberger wrote > Hi, > > I am looking into the RB pattern language for refactoring and I am having > trouble matching and replacing non-trivial pattern. Given the following > excerpt, I want to match "b shape > > ." and replace it with "b shape: [ :x | x > > ]" > > b shape ci

Re: [Pharo-users] Windows 64bit, long filename issue but after a second load, how to categorise and report this?

2019-02-21 Thread Henrik Sperre Johansen
Tim Mackinnon wrote > Hi Ben - while I understand the description below - why would it work the > first time (no errors) and then fail the second time in a fresh image? Are > we really sure its just down to non-determinism of the load process > (possibly - but it seems very suspicious to me). There

Re: [Pharo-users] How to write out simple Json?

2019-02-28 Thread Henrik Sperre Johansen
Tim Mackinnon wrote > Just to add more flavour to this - it seems quite wordy that we have to do > this (or equivalent) to write some config. > > ex := OrderedDictionary new > at: 'track' put: 'pharo'; > at: 'language' put: 'smalltalk'; > at: 'exercises' put: ( >

Re: [Pharo-users] doWithIndex: or withIndexDo: ?

2019-03-12 Thread Henrik Sperre Johansen
#doWithIndex: for me. Both because it's the selector I'm used to from other dialects, and the parameter order [:element :index | ] makes more sense to me. Cheers, Henry -- Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html

Re: [Pharo-users] question about FFI

2018-11-26 Thread Henrik Sperre Johansen via Pharo-users
--- Begin Message --- Yuriy Babah wrote > in Playground i'm doing: * > #(2 3) doWithIndex: [:each :i | xm at: i put: each]. > #(3 4) doWithIndex: [:each :i | ym at: i put: each]. * > > whot i'm doing wrong? So, you're putting 2 at index 2 of xm, and then writing 3 past end of array, and in ym yo

Re: [Pharo-users] question about FFI

2018-11-26 Thread Henrik Sperre Johansen via Pharo-users
--- Begin Message --- Nevermind me, hadn't had my coffee yet, for some reason I didn't see it was doWithIndex: you were using :/ Still a bit scary that FFIExternalArray at:put: doesn't perform bounds checks... Cheers, Henry -- Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.htm