Re: [Pharo-users] any ihint how to do this
Thanks, next on my learning lists. Look for methods in both classes that can help me. Roelof Op 10-12-2018 om 23:30 schreef Richard O'Keefe: Having imagined collection count: [:each | ...] DO NOT IMPLEMENT IT! Check to see if it already exists. Hint: it DOES exists and has done since before Pharo. So 'pangrams are fun but this isn''t one' count: [:each | each isVowel] already answers 10. Something that may help you a lot is to visit the Collection class in the browser, and read every method in the 'enumerating' category. (You will benefit from looking at the others too, but we are staying focussed.) When you have done that, visit the SequenceableCollection class, and read every method in its 'enumerating' category. For example, you will certainly find #overlappingPairsDo:. Given that, you can add overlappingPairsAnySatisfy: testBlock self overlappingPairsDo: [:x :y | (testBlock value: x value: y) ifTrue: [^true]]. ^false And now you can test for two adjacent equal elements using aSequence oberlappingPairsAnySatisfy: [:x :y | x = y] On Tue, 11 Dec 2018 at 06:05, Richard Sargentwrote: On Mon, Dec 10, 2018 at 8:52 AM Roelof Wobben wrote: Hello, is there a way I can check if a word has 2 the same chars after each other I was hoping that '#groupby could help me but that one sorts so abba the aa is found or do I have to use a stream for that could I then also use that stream to check if a word contains 3 vowels ? I'll start with this question first, since it is the easiest to discuss. The brute-force approach would be to use #select: against the word to extract all the vowels. But a better approach, would be to imagine what you need and delegate it. So, we already have #select:, #reject, #detect:, and #collect: as patterns. Imagine a new method called #count:, and implement that. (For the purpose of the assignment, implementing #count: is probably overkill, unless you have many, many words to check.) Now, back to the first question. You want to iterate through the word "pairwise", where you examine each successive pair of letters. So, you want to iterate from 1 through n-1 and check whether the letter at the index is the same as the letter at the index + 1. That should be enough to get you going. I ask also on the discord app but no answer for a long time Regards, Roelof
Re: [Pharo-users] Unable to compile myself Pharo
On Fri, 7 Dec 2018 at 01:09, Alexandre Garreau wrote: > I didn’t find on the README enough informations (about which dir to use > and what to do once inside), but found some on a random blog on the web > [0], and now built it but it seems it only installed executable binary > stuff under the name of “squeak”, is this normal? are you sure it’s not > related to the “squeak-vm” debian package? > > [0] > https://pharoweekly.wordpress.com/2017/02/23/building-pharo-vm-as-simple-as/ Very sorry to add to your frustration. I only just followed that link to check which instructions you were using. Those instructions are deprecated (can anyone edit that page? or publish an updated one?) Please try... $ git clone g...@github.com:OpenSmalltalk/opensmalltalk-vm.git $ cd opensmalltalk-vm/build.linux64x64/pharo.cog.spur/build $ ./mvm Note this is the tip of development. Alternatively you could find the commit hash from the stable VM and check that out. Then try image pharo64.zip from http://files.pharo.org/get-files/70/ HTH cheers -ben P.S. @esteban, could we get a tag in opensmalltalk-vm repo to mark Pharo's stable VM build. A branch "pharo-stable" would facilitate one more step above ```git checkout pharo-stable``` to provide a smoother path for people wanting to compile the VM for the first time. This branch would fast-forward along the mainline when Pharo's next stable VM is determined. (I expect "squeak-stable" would also be useful to have) A tag "pharo-stable-20180618" would provide a permanent record for someone is using one of those stable-VMs in production who needs to branch off that point to apply a hot fix. Also, when it comes to the Pharo 7 Release, identical matching tags " pharo-release-7.0" in both opensmalltalk/opensmalltalk-vm and pharo-project/pharo would be useful.
Re: [Pharo-users] Unable to compile myself Pharo
Okay, now I ran it some stuff seems to be more okay, but it still segfaults: Segmentation fault Tue Dec 11 01:09:56 2018 /usr/local/lib/squeak/5.0-201812101325/squeak Pharo VM version: 5.0-201812101325 Tue Dec 11 00:52:05 CET 2018 gcc 6.3.0 [Production Spur VM] Built from: CoInterpreter VMMaker.oscog-eem.2488 uuid: 3d088675-fa5c-452e-8063-001ff1d4ab81 Dec 11 2018 With: StackToRegisterMappingCogit VMMaker.oscog-eem.2482 uuid: 7df020b4-6565-4768-9e4a-75bc5464ed95 Dec 11 2018 Revision: VM: 201812101325 galex-...@portable.galex-713.eu:doc/comp/src/pharo/opensmalltalk-vm Date: Mon Dec 10 14:25:06 2018 CommitHash: 14b6d3645 Plugins: 201812101325 galex-...@portable.galex-713.eu:doc/comp/src/pharo/opensmalltalk-vm Build host: Linux portable.galex-713.eu 4.9.0-8-686-pae #1 SMP Debian 4.9.130-2 (2018-10-27) i686 GNU/Linux plugin path: /usr/local/bin/../lib/squeak/5.0-201812101325 [default: /usr/local/lib/squeak/5.0-201812101325/] C stack backtrace & registers: eax 0xbf9683a4 ebx 0xbf9682c0 ecx 0xbf968358 edx 0xbf96830c edi 0xbf968190 esi 0xbf968190 ebp 0xbf968228 esp 0xbf968274 eip 0xbf968488 *[0xbf968488] /usr/local/bin/../lib/squeak/5.0-201812101325/squeak(+0x1df91)[0x4e1f91] /usr/local/bin/../lib/squeak/5.0-201812101325/squeak(+0x1fe1e)[0x4e3e1e] linux-gate.so.1(__kernel_rt_sigreturn+0x0)[0xb7790d10] /lib/i386-linux-gnu/libc.so.6(+0x75d91)[0xb74aad91] /lib/i386-linux-gnu/libc.so.6(getenv+0x1c)[0xb7462f5c] /usr/local/bin/../lib/squeak/5.0-201812101325/squeak(+0xca537)[0x58e537] /usr/local/bin/../lib/squeak/5.0-201812101325/squeak(+0x5b39a)[0x51f39a] /usr/local/bin/../lib/squeak/5.0-201812101325/squeak(+0x5ca8c)[0x520a8c] /usr/local/bin/../lib/squeak/5.0-201812101325/squeak(ceSendsupertonumArgs+0x2a4)[0x523034] [0x120008d] [0x1201128] [0x243a2f3] [0x4231f0b] [0x422938e] [0x4229344] [0x42293c8] [0x126e725] [0x120888c] [0x1201128] [0x126e4d6] [0x1229639] [0x1201128] [0x122964c] [0x12294f6] [0x121f74b] [0x12059c5] [0x121f6fb] [0x12010f8] /usr/local/bin/../lib/squeak/5.0-201812101325/squeak(+0x10edc8)[0x5d2dc8] Smalltalk stack dump: 0xbf9722c0 M UnixEnvironment>getRawEnvironmentVariableViaFFI: 0x150ae30: a(n) UnixEnvironment 0xbf9722f0 I FFICalloutAPI>function:module: 0x150ce10: a(n) FFICalloutAPI 0xbf972318 I UnixEnvironment(Object)>ffiCall:module: 0x150ae30: a(n) UnixEnvironment 0xbf972340 I UnixEnvironment>getRawEnvironmentVariableViaFFI: 0x150ae30: a(n) UnixEnvironment 0xbf972368 I UnixEnvironment>getRawEnvironmentVariable: 0x150ae30: a(n) UnixEnvironment 0xbf97238c I UnixEnvironment>getEnvironmentVariable:withEncoding: 0x150ae30: a(n) UnixEnvironment 0xbf9723b4 I UnixEnvironment>getEnvironmentVariable: 0x150ae30: a(n) UnixEnvironment 0xbf9723d4 M [] in UnixResolver(PlatformResolver)>directoryFromEnvVariableNamed:or: 0x142cff0: a(n) UnixResolver 0xbf9723ec M BlockClosure>on:do: 0x150a978: a(n) BlockClosure 0xbf972418 I UnixResolver(PlatformResolver)>directoryFromEnvVariableNamed:or: 0x142cff0: a(n) UnixResolver 0xbf972438 M UnixResolver>preferences 0x142cff0: a(n) UnixResolver 0xbf972450 M UnixResolver(FileSystemResolver)>resolve: 0x142cff0: a(n) UnixResolver 0xbf972474 I SystemResolver(FileSystemResolver)>unknownOrigin: 0x142cbc0: a(n) SystemResolver 0xbf972490 M SystemResolver(FileSystemResolver)>resolve: 0x142cbc0: a(n) SystemResolver 0xbf9724b0 M InteractiveResolver>unknownOrigin: 0x142cb80: a(n) InteractiveResolver 0xbf9724d0 M [] in InteractiveResolver>resolve: 0x142cb80: a(n) InteractiveResolver 0xbf9724ec M IdentityDictionary(Dictionary)>at:ifAbsent: 0x142cb90: a(n) IdentityDictionary 0xbf97250c M InteractiveResolver>resolve: 0x142cb80: a(n) InteractiveResolver 0xbf96e2d4 M FileLocator>resolve 0x150a7f0: a(n) FileLocator 0xbf96e2f4 I FileLocator>asFileReference 0x150a7f0: a(n) FileLocator 0xbf96e314 I PhLSettingBrowser class>preferencesFile 0x41dd830: a(n) PhLSettingBrowser class 0xbf96e334 I PhLSettingBrowser class>launcherStartUp 0x41dd830: a(n) PhLSettingBrowser class 0xbf96e34c M [] in PhLStartupManager class>startUp 0x41e80c8: a(n) PhLStartupManager class 0xbf96e370 M SortedCollection(OrderedCollection)>do: 0x4205a68: a(n) SortedCollection 0xbf96e394 I PhLStartupManager class>startUp 0x41e80c8: a(n) PhLStartupManager class 0xbf96e3ac M PhLStartupManager class(Behavior)>startUp: 0x41e80c8: a(n) PhLStartupManager class 0xbf96e3c8 M ClassSessionHandler>startup: 0x4205a48: a(n) ClassSessionHandler 0xbf96e3e8 M [] in WorkingSession>runStartup: 0x1392490: a(n) WorkingSession 0xbf96e40c M [] in WorkingSession>runList:do: 0x1392490: a(n) WorkingSession 0xbf96e424 M BlockClosure>on:do: 0x15055a8: a(n) BlockClosure 0xbf96e448 M [] in WorkingSession>runList:do: 0x1392490: a(n) WorkingSession 0xbf96e46c M Array(SequenceableCollection)>do: 0x1392678: a(n) Array 0xbf96e490 I WorkingSession>runList:do: 0x1392490: a(n) WorkingSession 0xbf96e4b8 I WorkingSession>runStartup: 0x1392490: a(n) WorkingSession 0xbf96e4dc I WorkingSession>start: 0x1392490: a(n)
Re: [Pharo-users] stfx.eu down
Hi Sven, Thanks for the heads up. stfx has been really useful when sharing playgrounds in workshops and hackathons, and of course we can wait until modernization ends. Cheers, Offray On 10/12/18 16:10, Sven Van Caekenberghe wrote: > Hi, > > This evening I somehow broke my stfx.eu server while doing an ubuntu dist > upgrade (an old AWS EC2 machine). > > This means several websites / web services hosted by that machine are down, > most notably mc.stfx.eu (hosting several of my packages) and ws.stfx.eu (used > for shared smalltalk workspaces). A couple of Zinc tests will also fail. > > For source code access, all my public repos exist both in an up to date form > on GitHub (http://github.com/svenvc) as well in the original form in > SmalltalkHub (http://smalltalkhub.com/#!/~SvenVanCaekenberghe) or SS3. > > The main problem there is that the distributed ConfigurationsOf and Catalog > entries will still point to the original. This is not a problem with git's > BaselineOf definitions. > > Although the machine will no longer boot, I managed to mount the original > volume on another instance so I can still access the whole filesystem. This > will make it possible to eventually recover most services. But this will take > time as these things never happen when it is convenient. It will give me an > opportunity to modernise the setup though, which is good. > > Sorry for the inconvenience. > > Sven > > > > >
Re: [Pharo-users] Testing User Agent from Zinc
cool On Tue, 11 Dec 2018 at 01:18, horrido wrote: > After much digging, I finally found the solution... > > From the req parameter in GET, I use: > > (req headers headers at: 'User-Agent') findString: 'Mobile' > > > > horrido wrote > > Is there any way I can check the user agent string from Zinc or Teapot so > > that I can determine whether the user is on a mobile device? > > > > I need to modify the HTML accordingly and it's really, really messy > trying > > to do this with JavaScript (navigator.userAgent) and conditionally > > inserting > > innerHTML. > > > > > > > > -- > > Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html > > > > > > -- > Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html > >
Re: [Pharo-users] Unable to compile myself Pharo
That sounds normal. "No stash" is not an error. You should see new files in directory ".git/hooks" which help give correct date to built VM to avoid "to old" message. btw, make sure you match your 32/64-bitness between VM and Image. cheers -ben On Tue, 11 Dec 2018 at 00:51, Alexandre Garreau wrote: > Le 07/12/2018 à 02h25, Ben Coman a écrit : > >> On Fri, 7 Dec 2018 at 01:43, Alexandre Garreau >> wrote: >> >>> I built the VM and when running the Pharo.image file got with curl by >>> the site, it runs but warns the VM is too old for this image (strangely, >>> since I built the git version), >>> >> That warning can occur if you didn't run "scripts/updateSCCSVersions" >> once on your fresh clone (as described in the repo README, but its a common >> miss) >> >> I recloned and did it, and it doesn’t seem it did something, as it pretty > quickly ended with only that output: > > galex-713@portable:~/doc/comp/src/pharo/opensmalltalk-vm$ LCALL=C > scripts/updateSCCSVersions No stash found. >
Re: [Pharo-users] stfx.eu down
I wonder if there is a way to get all the relevant configs in an image to point to the smalltalkhub repo instead of the mc.stfx.eu repo temporarily. In Pharo 6.1 if a person wants to switch away from the mc.stfx.eu domain in their ConfigurationOf* and BaselineOf* specs you can right click on a package in Nautilus, choose "Rewrite code" then choose "Rewrite code" again and paste each of the below into the box and save it to rewrite the repository definition. RBParseTreeRewriter new replace: '''http://mc.stfx.eu/ZincHTTPComponents''' with: '''http://smalltalkhub.com/mc/SvenVanCaekenberghe/ZincHTTPComponents/main'''; yourself RBParseTreeRewriter new replace: '''http://mc.stfx.eu/Zodiac''' with: '''http://smalltalkhub.com/mc/SvenVanCaekenberghe/Zodiac/main'''; yourself RBParseTreeRewriter new replace: '''http://mc.stfx.eu/Neo''' with: '''http://smalltalkhub.com/mc/SvenVanCaekenberghe/Neo/main'''; yourself to "fix" Zinc, Zodiac, and Neo respectively. Sven Van Caekenberghe-2 wrote > Hi, > > This evening I somehow broke my stfx.eu server while doing an ubuntu dist > upgrade (an old AWS EC2 machine). > > This means several websites / web services hosted by that machine are > down, most notably mc.stfx.eu (hosting several of my packages) and > ws.stfx.eu (used for shared smalltalk workspaces). A couple of Zinc tests > will also fail. > > For source code access, all my public repos exist both in an up to date > form on GitHub (http://github.com/svenvc) as well in the original form in > SmalltalkHub (http://smalltalkhub.com/#!/~SvenVanCaekenberghe) or SS3. > > The main problem there is that the distributed ConfigurationsOf and > Catalog entries will still point to the original. This is not a problem > with git's BaselineOf definitions. > > Although the machine will no longer boot, I managed to mount the original > volume on another instance so I can still access the whole filesystem. > This will make it possible to eventually recover most services. But this > will take time as these things never happen when it is convenient. It will > give me an opportunity to modernise the setup though, which is good. > > Sorry for the inconvenience. > > Sven -- Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html
Re: [Pharo-users] any ihint how to do this
Having imagined collection count: [:each | ...] DO NOT IMPLEMENT IT! Check to see if it already exists. Hint: it DOES exists and has done since before Pharo. So 'pangrams are fun but this isn''t one' count: [:each | each isVowel] already answers 10. Something that may help you a lot is to visit the Collection class in the browser, and read every method in the 'enumerating' category. (You will benefit from looking at the others too, but we are staying focussed.) When you have done that, visit the SequenceableCollection class, and read every method in its 'enumerating' category. For example, you will certainly find #overlappingPairsDo:. Given that, you can add overlappingPairsAnySatisfy: testBlock self overlappingPairsDo: [:x :y | (testBlock value: x value: y) ifTrue: [^true]]. ^false And now you can test for two adjacent equal elements using aSequence oberlappingPairsAnySatisfy: [:x :y | x = y] On Tue, 11 Dec 2018 at 06:05, Richard Sargent < richard.sarg...@gemtalksystems.com> wrote: > > > On Mon, Dec 10, 2018 at 8:52 AM Roelof Wobben wrote: > >> Hello, >> >> is there a way I can check if a word has 2 the same chars after each other >> I was hoping that '#groupby could help me but that one sorts >> so abba the aa is found >> or do I have to use a stream for that >> >> could I then also use that stream to check if a word contains 3 vowels ? >> > > I'll start with this question first, since it is the easiest to discuss. > The brute-force approach would be to use #select: against the word to > extract all the vowels. But a better approach, would be to imagine what you > need and delegate it. So, we already have #select:, #reject, #detect:, and > #collect: as patterns. Imagine a new method called #count:, and implement > that. (For the purpose of the assignment, implementing #count: is probably > overkill, unless you have many, many words to check.) > > > Now, back to the first question. You want to iterate through the word > "pairwise", where you examine each successive pair of letters. > So, you want to iterate from 1 through n-1 and check whether the letter at > the index is the same as the letter at the index + 1. > That should be enough to get you going. > > >> I ask also on the discord app but no answer for a long time >> >> >> Regards, >> >> Roelof >> >>
[Pharo-users] stfx.eu down
Hi, This evening I somehow broke my stfx.eu server while doing an ubuntu dist upgrade (an old AWS EC2 machine). This means several websites / web services hosted by that machine are down, most notably mc.stfx.eu (hosting several of my packages) and ws.stfx.eu (used for shared smalltalk workspaces). A couple of Zinc tests will also fail. For source code access, all my public repos exist both in an up to date form on GitHub (http://github.com/svenvc) as well in the original form in SmalltalkHub (http://smalltalkhub.com/#!/~SvenVanCaekenberghe) or SS3. The main problem there is that the distributed ConfigurationsOf and Catalog entries will still point to the original. This is not a problem with git's BaselineOf definitions. Although the machine will no longer boot, I managed to mount the original volume on another instance so I can still access the whole filesystem. This will make it possible to eventually recover most services. But this will take time as these things never happen when it is convenient. It will give me an opportunity to modernise the setup though, which is good. Sorry for the inconvenience. Sven
Re: [Pharo-users] any ihint how to do this
There are manuy words I think some 1000 . Aoc uses a lot of data for a challenge. I have to think well how to implent that new function im thinking now about select and size after that. Regards, Roelof Op 10-12-2018 om 18:04 schreef Richard Sargent: On Mon, Dec 10, 2018 at 8:52 AM Roelof Wobbenwrote: Hello, is there a way I can check if a word has 2 the same chars after each other I was hoping that '#groupby could help me but that one sorts so abba the aa is found or do I have to use a stream for that could I then also use that stream to check if a word contains 3 vowels ? I'll start with this question first, since it is the easiest to discuss. The brute-force approach would be to use #select: against the word to extract all the vowels. But a better approach, would be to imagine what you need and delegate it. So, we already have #select:, #reject, #detect:, and #collect: as patterns. Imagine a new method called #count:, and implement that. (For the purpose of the assignment, implementing #count: is probably overkill, unless you have many, many words to check.) Now, back to the first question. You want to iterate through the word "pairwise", where you examine each successive pair of letters. So, you want to iterate from 1 through n-1 and check whether the letter at the index is the same as the letter at the index + 1. That should be enough to get you going. I ask also on the discord app but no answer for a long time Regards, Roelof
Re: [Pharo-users] Testing User Agent from Zinc
After much digging, I finally found the solution... >From the req parameter in GET, I use: (req headers headers at: 'User-Agent') findString: 'Mobile' horrido wrote > Is there any way I can check the user agent string from Zinc or Teapot so > that I can determine whether the user is on a mobile device? > > I need to modify the HTML accordingly and it's really, really messy trying > to do this with JavaScript (navigator.userAgent) and conditionally > inserting > innerHTML. > > > > -- > Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html -- Sent from: http://forum.world.st/Pharo-Smalltalk-Users-f1310670.html
Re: [Pharo-users] any ihint how to do this
On Mon, Dec 10, 2018 at 8:52 AM Roelof Wobben wrote: > Hello, > > is there a way I can check if a word has 2 the same chars after each other > I was hoping that '#groupby could help me but that one sorts > so abba the aa is found > or do I have to use a stream for that > > could I then also use that stream to check if a word contains 3 vowels ? > I'll start with this question first, since it is the easiest to discuss. The brute-force approach would be to use #select: against the word to extract all the vowels. But a better approach, would be to imagine what you need and delegate it. So, we already have #select:, #reject, #detect:, and #collect: as patterns. Imagine a new method called #count:, and implement that. (For the purpose of the assignment, implementing #count: is probably overkill, unless you have many, many words to check.) Now, back to the first question. You want to iterate through the word "pairwise", where you examine each successive pair of letters. So, you want to iterate from 1 through n-1 and check whether the letter at the index is the same as the letter at the index + 1. That should be enough to get you going. > I ask also on the discord app but no answer for a long time > > > Regards, > > Roelof > >
Re: [Pharo-users] Unable to compile myself Pharo
Le 07/12/2018 à 02h25, Ben Coman a écrit : > On Fri, 7 Dec 2018 at 01:43, Alexandre Garreau > wrote: > >> I built the VM and when running the Pharo.image file got with curl by >> the site, it runs but warns the VM is too old for this image (strangely, >> since I built the git version), > > > That warning can occur if you didn't run "scripts/updateSCCSVersions" once > on your fresh clone > (as described in the repo README, but its a common miss) I recloned and did it, and it doesn’t seem it did something, as it pretty quickly ended with only that output: galex-713@portable:~/doc/comp/src/pharo/opensmalltalk-vm$ LC_ALL=C scripts/updateSCCSVersions No stash found.
[Pharo-users] any ihint how to do this
Hello, is there a way I can check if a word has 2 the same chars after each other I was hoping that '#groupby could help me but that one sorts so abba the aa is found or do I have to use a stream for that could I then also use that stream to check if a word contains 3 vowels ? I ask also on the discord app but no answer for a long time Regards, Roelof