Re: [Pharo-users] How to silently generate and remove code

2015-04-05 Thread Thierry Goubier

Le 04/04/2015 18:02, stepharo a écrit :

Thierry

this means that generating ring objects would help you?


Maybe. Or maybe unifying Ring with what RB already does with its models 
(RBClass, etc...), and ensuring that Opal can work with those (at least 
do the bindings part, count the literals, etc...).


I feel like Pharo has three competing ways of modeling software items: 
MCDefinition stuff, Ring, RB stuff.


Thierry


I guess so.

stef

Le 30/3/15 16:25, Thierry Goubier a écrit :

A use case:

the ability to test and debug the code generation part of SmaCC.

SmaCC, when compiling a parser, generates dozens of classes and
hundreds of methods, some of those very long, as a sequence of
refactorings (and optimise them).

Then SmaCC apply them all in one step.

I'd dream of having a virtual environment where I could test-compile
and check all those methods, via a system browser, before they are
compiled.

Thierry

2015-03-30 9:10 GMT+02:00 Marcus Denker mailto:marcus.den...@inria.fr>>:


> On 29 Mar 2015, at 10:32, stepharo mailto:steph...@free.fr>> wrote:
>
> Before that I would like that the compiler outputs classes
definition in an environment (that can be the default one) but
that can be the one
> I want and specified from the outside of the compiler.

For installing, it is the ClassInstaller that does that (and yes,
it has an environment).

What the compiler does not have is to look up references e.g. to
symbols regarding to an environment, but that is because we
don’t have that concept right now in the system in general.
globals/class vars are requested from the class (which defines its
environment).

So in general, we first need a use case, else it is not clear what
to do…


Marcus









[Pharo-users] PUnQLite NB error

2015-04-05 Thread Bernat Romagosa
Hi list,

I'm trying to get Masashi's PUnQLite package to work in Pharo 4 under
Ubuntu, and here's what happens when I try to run the example code:

|db|
db := PqDatabase open: 'comments.db'.
db disableAutoCommit.
db transact: [
Object subclasses do: [:cls | | key |
key := cls asString.
db at: key put: cls comment ]
].
db close.




Any idea what can be happening here?
​
Thanks! :)
Bernat.

-- 
Bernat Romagosa.


Re: [Pharo-users] PUnQLite NB error

2015-04-05 Thread Bernat Romagosa
Ok, forget that! It seems the configuration downloads the unqlite.so
library into the wrong path... just moving it to the image folder did the
trick.

2015-04-05 11:26 GMT+02:00 Bernat Romagosa :

> Hi list,
>
> I'm trying to get Masashi's PUnQLite package to work in Pharo 4 under
> Ubuntu, and here's what happens when I try to run the example code:
>
> |db|
> db := PqDatabase open: 'comments.db'.
> db disableAutoCommit.
> db transact: [
> Object subclasses do: [:cls | | key |
> key := cls asString.
> db at: key put: cls comment ]
> ].
> db close.
>
>
>
>
> Any idea what can be happening here?
> ​
> Thanks! :)
> Bernat.
>
> --
> Bernat Romagosa.
>



-- 
Bernat Romagosa.


[Pharo-users] Association postcopy (Pharo 3)

2015-04-05 Thread Hartmut

Hi,

the Dictionary>>postCopy comment reads:
"Must copy the associations, or later store will affect both the 
original and the copy


However Association(Object)>>copy will neither copy 'key' (thats what I 
expect) nor 'value' (that makes the copy fail).
I checked an older version of Squeak and VisualWorks 7 and found that 
also there Association misses a postCopy.


My workaround for a Dictionary copy reads "...  associationsDo: [ :a | a 
value: a value copy ] ".


Does anybody know why Association does not contain this code in a 
postCopy method ?


Thanks,
Hartmut

--
Hartmut Krasemann

Königsberger Str. 41 c

D 22869 Schenefeld

Tel. 040.8307097

Mobil 0171.6451283

krasem...@acm.org




smime.p7s
Description: S/MIME Cryptographic Signature


Re: [Pharo-users] Association postcopy (Pharo 3)

2015-04-05 Thread Sven Van Caekenberghe

> On 05 Apr 2015, at 12:06, Hartmut  wrote:
> 
> Hi,
> 
> the Dictionary>>postCopy comment reads:
> "Must copy the associations, or later store will affect both the original and 
> the copy

You interpret the comment incorrectly: it talks about the association itself, 
not the value that it holds. Without Dictionary>>#postCopy associations end up 
being shared between the original and the copy; when you overwrite an existing 
entry in the original dictionary, you would also change the copy - which you do 
not want.

You seem to be expecting that the values that you put in should also be copied, 
but that is your responsibility, not that of the data structure. Think about 
it, this copying does not happen in arrays or ordered collections either.

Does that make sense ?

> However Association(Object)>>copy will neither copy 'key' (thats what I 
> expect) nor 'value' (that makes the copy fail).
> I checked an older version of Squeak and VisualWorks 7 and found that also 
> there Association misses a postCopy.
> 
> My workaround for a Dictionary copy reads "...  associationsDo: [ :a | a 
> value: a value copy ] ".
> 
> Does anybody know why Association does not contain this code in a postCopy 
> method ?
> 
> Thanks,
> Hartmut
> 
> -- 
> Hartmut Krasemann
> 
> Königsberger Str. 41 c
> 
> D 22869 Schenefeld
> 
> Tel. 040.8307097
> 
> Mobil 0171.6451283
> 
> krasem...@acm.org
> 
> 




Re: [Pharo-users] How to silently generate and remove code

2015-04-05 Thread Ben Coman
On Sun, Apr 5, 2015 at 12:01 AM, stepharo  wrote:

>
>
> Le 30/3/15 09:10, Marcus Denker a écrit :
>
>  On 29 Mar 2015, at 10:32, stepharo  wrote:
>>>
>>> Before that I would like that the compiler outputs classes definition in
>>> an environment (that can be the default one) but that can be the one
>>> I want and specified from the outside of the compiler.
>>>
>> For installing, it is the ClassInstaller that does that (and yes, it has
>> an environment).
>>
>> What the compiler does not have is to look up references e.g. to symbols
>> regarding to an environment, but that is because we
>> don’t have that concept right now in the system in general. globals/class
>> vars are requested from the class (which defines its environment).
>>
>> So in general, we first need a use case, else it is not clear what to do…
>>
>
> Sc1:
> Imagine that Max wants to load code that if the code is incomplete or
> contains Undefined the code is not loaded at all.
> To do so we need to be able to compile the code in a separate
> namespace. Then on success copy/install to another one.
>
> sd := SystemDictionary new.
> OpalCompiler
> inputEnvironment: Smalltalk globals
> outputEnvironment: sd.
>
> This shows that probably sd should be linked to Smalltalk globals to be
> able to find new added class (that will not be found in sd).
>
> Sc2:
> We should be able to compile Opal beside Opal in a sister environment,
> modify it by compiling method there.
>
> Sc3:
> Guillermo's Tornado Infrastructure.
> Instead of installing, copying manually and hacking, probably that
> guillermo needs a compiling infrastructure were we can say
> - look for literals in this special array or environemtn
> - look for globals in this one
> - put the returns in the other literalas environment and globals.
>
> Stef
>
>
What would be exciting is in a "host-image" being able to generate an empty
special-object Root-Object  (like is held by the VM) as a guest-image
inside the host-image, so you can push core elements into it until the
guest is a running minimal-image, but standard tools can be used to debug
it.  I guess this might be like the simulator (which I haven't used) - but
maybe that just simulates the VM so there are differences.


btw (and just for interest), are there any tutorials for running the
simulator.  A quick google didn't bring up anything useful.

cheers -ben


[Pharo-users] NBSQLite3 on Pharo 4?

2015-04-05 Thread Bernat Romagosa
I've been trying out some simple persistence options on Pharo 4 and I can't
seem to get NBSQLite3 to work.

I have the 32 bits lib present and where it should be, and this is the
error I'm getting when opening a new connection:

NBFFICallout>>loaderForArgNamed:
NBFFICallout>>loaderForArgNamed:indirectIndex:
NBFFICallout>>argName:indirectIndex:type:ptrArity:
NBFnSpecParser>>parseArgument
NBFnSpecParser>>parseArguments
NBFnSpecParser>>parseAnonFunction:
NBFFICallout>>anonSpec:
[ :t3 |
t3
useEmitCall;
callType: conv;
sender: context;
parseOptions: options;
anonSpec: t1;
generate: t2 ] in NBFFICalloutAPI>>function:emit: in Block: [ :t3 | ...
[ t6 := t1 value: (self newForMethod: t3) ] in NBFFICallout
class(NBNativeCodeGen class)>>generateCode:andRetry: in Block: [ t6 := t1
value: (self newForMethod: t3) ]
BlockClosure>>on:do:
NBRecursionDetect class>>in:during:
NBFFICallout class(NBNativeCodeGen class)>>generateCode:andRetry:
NBFFICallout class(NBNativeCodeGen class)>>handleFailureIn:nativeCode:
NBFFICalloutAPI>>function:emit:
NativeBoostLinux32(NativeBoost)>>bootstrapLoadSymbol:ofLength:fromModule:into:
NativeBoostLinux32(NativeBoost)>>loadSymbol:fromModule:
NativeBoostLinux32>>loadSymbol:fromModule:
NativeBoost class>>loadSymbol:fromModule:
NBSQLite3FFI class(Object)>>nbGetSymbolAddress:module:
NBFFICallout>>generateCall:module:
[ :t3 |
t3
callType: conv;
sender: context;
parseOptions: options;
generateCall: t1 module: t2 ] in NBFFICalloutAPI>>function:module: in
Block: [ :t3 | ...
[ t6 := t1 value: (self newForMethod: t3) ] in NBFFICallout
class(NBNativeCodeGen class)>>generateCode:andRetry: in Block: [ t6 := t1
value: (self newForMethod: t3) ]
BlockClosure>>on:do:
NBRecursionDetect class>>in:during:
NBFFICallout class(NBNativeCodeGen class)>>generateCode:andRetry:
NBFFICallout class(NBNativeCodeGen class)>>handleFailureIn:nativeCode:
NBFFICalloutAPI>>function:module:
NBSQLite3FFI(Object)>>nbCall:module:
NBSQLite3FFI>>apiOpen:via:
NBSQLite3FFI>>open:via:

Is it compatible with Pharo 4?

-- 
Bernat Romagosa.


Re: [Pharo-users] NBSQLite3 on Pharo 4?

2015-04-05 Thread Pierce Ng
On Sun, Apr 05, 2015 at 03:08:56PM +0200, Bernat Romagosa wrote:
> I've been trying out some simple persistence options on Pharo 4 and I can't
> seem to get NBSQLite3 to work.
> Is it compatible with Pharo 4?

As I've just written a blog post on Glorp-NBSQLite3 on Pharo 4 this long
weekend, the answer is yes. :-)

I don't think I've encountered the stack trace that you provided too many
times. What is the Smalltalk code you were executing?

Pierce



Re: [Pharo-users] NBSQLite3 on Pharo 4?

2015-04-05 Thread Bernat Romagosa
Hi Pierce!

I was just trying to open a connection as follows:

NBSQLite3Connection openOn: 'test.db'

The top of the stack says Error: Could not find accessor for variable named
"symbolName" in NativeBoost>>#bootstrapLoadSymbol:ofLength:fromModule:into:

Are you using Linux as well?

2015-04-05 15:48 GMT+02:00 Pierce Ng :

> On Sun, Apr 05, 2015 at 03:08:56PM +0200, Bernat Romagosa wrote:
> > I've been trying out some simple persistence options on Pharo 4 and I
> can't
> > seem to get NBSQLite3 to work.
> > Is it compatible with Pharo 4?
>
> As I've just written a blog post on Glorp-NBSQLite3 on Pharo 4 this long
> weekend, the answer is yes. :-)
>
> I don't think I've encountered the stack trace that you provided too many
> times. What is the Smalltalk code you were executing?
>
> Pierce
>
>


-- 
Bernat Romagosa.


Re: [Pharo-users] NBSQLite3 on Pharo 4?

2015-04-05 Thread Bernat Romagosa
Ok, I just figured for some reason it doesn't work when I'm using Pharo via
PharoLauncher...

I just got the latest pharo4 for Linux, image + vm, and NBSQLite3 worked
out of the box.

Hope it helps somebody else!

2015-04-05 16:01 GMT+02:00 Bernat Romagosa :

> Hi Pierce!
>
> I was just trying to open a connection as follows:
>
> NBSQLite3Connection openOn: 'test.db'
>
> The top of the stack says Error: Could not find accessor for variable
> named "symbolName" in
> NativeBoost>>#bootstrapLoadSymbol:ofLength:fromModule:into:
>
> Are you using Linux as well?
>
> 2015-04-05 15:48 GMT+02:00 Pierce Ng :
>
>> On Sun, Apr 05, 2015 at 03:08:56PM +0200, Bernat Romagosa wrote:
>> > I've been trying out some simple persistence options on Pharo 4 and I
>> can't
>> > seem to get NBSQLite3 to work.
>> > Is it compatible with Pharo 4?
>>
>> As I've just written a blog post on Glorp-NBSQLite3 on Pharo 4 this long
>> weekend, the answer is yes. :-)
>>
>> I don't think I've encountered the stack trace that you provided too many
>> times. What is the Smalltalk code you were executing?
>>
>> Pierce
>>
>>
>
>
> --
> Bernat Romagosa.
>



-- 
Bernat Romagosa.


[Pharo-users] Data scrapping in pharo: converting text with dates in Spanish

2015-04-05 Thread Offray Vladimir Luna Cárdenas

Hi all,

I'm making a small data scrapper[1] in pharo to feed some 
visualizations. The data I'm scrapping contains strings with dates in 
Spanish like '16:21 - 15 de jun. de 2011' and I would like to convert 
them to proper dates in Smalltalk. So I started prototyping an Small 
script at [2], but the problem is that monthIndex at: month doesn't work 
because 'jun' is not in the dictionary (please refer to [2] for 
details). This is motivated by month = 'jun' giving false, but when I 
inspect month its content is 'jun', so I think that I'm missing 
something important.


[1] http://smalltalkhub.com/#!/~Offray/Dataviz
[2] http://ws.stfx.eu/IOMTYZ0N9W29

So here come my questions:

a). How to get "monthIndex at: month" working properly so I can get '06' 
as the proper month index for the month 'jun' (junio).?

b) Why month = 'jun' gives false?
c) There is any way to convert strings which has months in different 
languages (for example Spanish) more directly?


Thanks,

Offray



Re: [Pharo-users] Data scrapping in pharo: converting text with dates in Spanish

2015-04-05 Thread Sven Van Caekenberghe
You could have a look at the ZTimestamp package (you can load it using the 
Configuration Browser, the repository is 
http://www.smalltalkhub.com/#!/~SvenVanCaekenberghe/Neo). It has a class 
ZTimestampFormat which currently formats & parses dates/times/timestamps in 4 
languages "by example". You could add Spanish, I guess. Contribution are 
welcome.

For example,

(ZTimestampFormat fromString: '_3 February 2001') 
  french;
  parse: ' 7 Août 1967'.

> On 05 Apr 2015, at 18:18, Offray Vladimir Luna Cárdenas  
> wrote:
> 
> Hi all,
> 
> I'm making a small data scrapper[1] in pharo to feed some visualizations. The 
> data I'm scrapping contains strings with dates in Spanish like '16:21 - 15 de 
> jun. de 2011' and I would like to convert them to proper dates in Smalltalk. 
> So I started prototyping an Small script at [2], but the problem is that 
> monthIndex at: month doesn't work because 'jun' is not in the dictionary 
> (please refer to [2] for details). This is motivated by month = 'jun' giving 
> false, but when I inspect month its content is 'jun', so I think that I'm 
> missing something important.
> 
> [1] http://smalltalkhub.com/#!/~Offray/Dataviz
> [2] http://ws.stfx.eu/IOMTYZ0N9W29
> 
> So here come my questions:
> 
> a). How to get "monthIndex at: month" working properly so I can get '06' as 
> the proper month index for the month 'jun' (junio).?
> b) Why month = 'jun' gives false?
> c) There is any way to convert strings which has months in different 
> languages (for example Spanish) more directly?
> 
> Thanks,
> 
> Offray
> 




Re: [Pharo-users] Data scrapping in pharo: converting text with dates in Spanish

2015-04-05 Thread Ben Coman
On Mon, Apr 6, 2015 at 12:18 AM, Offray Vladimir Luna Cárdenas <
off...@riseup.net> wrote:

> Hi all,
>
> I'm making a small data scrapper[1] in pharo to feed some visualizations.
> The data I'm scrapping contains strings with dates in Spanish like '16:21 -
> 15 de jun. de 2011' and I would like to convert them to proper dates in
> Smalltalk. So I started prototyping an Small script at [2], but the problem
> is that monthIndex at: month doesn't work because 'jun' is not in the
> dictionary (please refer to [2] for details). This is motivated by month =
> 'jun' giving false, but when I inspect month its content is 'jun', so I
> think that I'm missing something important.
>
> [1] http://smalltalkhub.com/#!/~Offray/Dataviz
> [2] http://ws.stfx.eu/IOMTYZ0N9W29
>
> So here come my questions:
>
> a). How to get "monthIndex at: month" working properly so I can get '06'
> as the proper month index for the month 'jun' (junio).?
> b) Why month = 'jun' gives false?
> c) There is any way to convert strings which has months in different
> languages (for example Spanish) more directly?
>
>
>
I don't know the answer, but here is how you might work it out yourself
(its what I just did).
1. World > Tools > Find > Source.
2. Search for text: june
3. Excluding XxxTest test classes, class comments, and a dropList, only a
single method "initialize" looks relevant. That should make it easier.
4. In that method, right-click on 'MonthNames' > Extended search... >
References.
5. In each of those references put a "self haltOnce"
6. World > System > Enable halt/inspect once.
7. Evaluate your expression and see if you hit the halt.

So "maybe" you just edit that initialize method, then evaluate the comment
at the top of the method.

cheers -ben


Re: [Pharo-users] Data scrapping in pharo: converting text with dates in Spanish

2015-04-05 Thread Offray Vladimir Luna Cárdenas

Thanks Ben and Sven,

I will take a look to both of your suggestions.

Cheers,

Offray

El 05/04/15 a las 12:28, Ben Coman escribió:



On Mon, Apr 6, 2015 at 12:18 AM, Offray Vladimir Luna Cárdenas
mailto:off...@riseup.net>> wrote:

 Hi all,

 I'm making a small data scrapper[1] in pharo to feed some visualizations.
 The data I'm scrapping contains strings with dates in Spanish like '16:21 -
 15 de jun. de 2011' and I would like to convert them to proper dates in
 Smalltalk. So I started prototyping an Small script at [2], but the problem
 is that monthIndex at: month doesn't work because 'jun' is not in the
 dictionary (please refer to [2] for details). This is motivated by month =
 'jun' giving false, but when I inspect month its content is 'jun', so I
 think that I'm missing something important.

 [1] http://smalltalkhub.com/#!/~__Offray/Dataviz
 
 [2] http://ws.stfx.eu/IOMTYZ0N9W29

 So here come my questions:

 a). How to get "monthIndex at: month" working properly so I can get '06' as
 the proper month index for the month 'jun' (junio).?
 b) Why month = 'jun' gives false?
 c) There is any way to convert strings which has months in different
 languages (for example Spanish) more directly?



I don't know the answer, but here is how you might work it out yourself (its
what I just did).
1. World > Tools > Find > Source.
2. Search for text: june
3. Excluding XxxTest test classes, class comments, and a dropList, only a single
method "initialize" looks relevant. That should make it easier.
4. In that method, right-click on 'MonthNames' > Extended search... > 
References.
5. In each of those references put a "self haltOnce"
6. World > System > Enable halt/inspect once.
7. Evaluate your expression and see if you hit the halt.

So "maybe" you just edit that initialize method, then evaluate the comment at
the top of the method.

cheers -ben







Re: [Pharo-users] IconFactory - utility for creating icons in Pharo

2015-04-05 Thread Sven Van Caekenberghe
Maybe we are not talking about the same thing ?

You question the fact that the resource is stored as source code in the image 
instead of in a file ?

If so, then the reason to keep them in image has to do with resource 
management, an image is self contained.

I was talking about managing resources as a collection of methods, an example 
would be ZnByteEncoder, where mappings are defined on the class side.

If resources are originally downloaded from somewhere else but cached inside 
the image, it is worth mentioning that, and shipping the necessary code to redo 
it, in the case of the example, #generateByteToUnicodeSpec:

> On 04 Apr 2015, at 17:17, kilon alios  wrote:
> 
> No really I dont get the idea, composition decomposition is the bread and 
> butter of collection types in any language. Unless pharo has a weakness in 
> this area that I am not aware of, in python I had never such problem. 
> actually its a foremost reason to use them in the first place. Browsing is a 
> limitation of the browser which does not provide a special view for variables 
> but not that hard to amend with inspector.  And I find hard to believe you 
> prefer a ton of short methods instead one short one for returning those 
> values.  
> 
> The only reason I can think in this case of icons is that compiling a string 
> as return value of a method to be used statically is easier/ more convenient 
> than defining a huge collection in the initialize method.  
> 
> on the other hand would not make more sense to have all this data that means 
> nothing for the user as separate files and let them load at the startup of 
> the image ? Its not as if anyone would bother editing those huge gibberish 
> strings . 
> 
> Thats the only way I see for avoiding long methods.
> 
> Or am I missing something here ? 
> 
> On Sat, Apr 4, 2015 at 6:01 PM, Sven Van Caekenberghe  wrote:
> Because composition/decomposition is good (among others for re-use), because 
> with separate entries you can browse them more easily, because we don't like 
> long methods, ... You get the idea ;-)
> 
> > On 04 Apr 2015, at 16:45, kilon alios  wrote:
> >
> > once more I really dont like idea of methods returning single values. This 
> > also one of the reasons why Spec annoys me. Why not have Collection / 
> > Dictionary that stores all these strings ? Having 100 methods for 100 icons 
> > seems really ugly .  Instead one collection with 100 entries and a single 
> > method would be more than enough.
> >
> > I know its not just you that do this  and is how icons work in Pharo .Its 
> > basically how many things work like this inside Pharo. But I still dont get 
> > it why ?
> >
> > On Sat, Apr 4, 2015 at 5:15 PM, Peter Uhnák  wrote:
> > Aha, of course.
> > The program makes assumptions about the file name and since it is naming 
> > the method like the file it fails, because you can't have "-" in method 
> > name.
> > I could change it so it removes all non-alphanumeric characters from the 
> > name.
> >
> > Peter
> >
> > On Sat, Apr 4, 2015 at 3:52 PM, kilon alios  wrote:
> > I found the problem
> >
> > "Norse_largeThe '-' prefix works only for literal numbers (use #negated 
> > instead) -> -cpcIconContents
> > "Private - Method generated with the content of the file File @ 
> > /Users/kilon/Downloads/Norse_large-cpc.png""
> >
> > looks like it does not like that i use "-" inside the file name. In the 
> > folder the name of the file is not Norse_large-cpc.png but 
> > Norse-large-cpc.png
> >
> > "-" has some special meaning here ?
> >
> > On Sat, Apr 4, 2015 at 4:12 PM, Peter Uhnák  wrote:
> > create file ? i thought the class only creates methods
> > yeah, I mean method
> >
> > anyway, the method is created , but it does not proceed to next png. 
> > Shouldn create a method for each png it finds in the directory ?
> > yes it should, it operates on a collection, so if
> > dir allFiles select: [ :each | each extension = 'png' ]
> > shows more then one file it should also create a method for each one, not 
> > just the first
> >
> > Peter
> >
> >
> >
> 
> 
> 




[Pharo-users] Object-oriented state-frozen logging

2015-04-05 Thread Peter Uhnák
Hi,

this may be a bit tall order and I am not sure if possible,
however I would like to know the state of objects at certain points.

Currently what I would do is something like
self log: 'anObject someProperty:'; logCr: anObject someProperty.

however this is not very practical.

So I would like something like
self fronzenLog: anObject

and then I could inspect the logger and see the state of the whole objects.

Using debugger and stepping through it is not really practical because I
need to observe several possible objects that are in this function at very
different times.

Is this possible? Is there a better/somewhat better way to do something
like this?

Any pointers appreciated.

Peter


Re: [Pharo-users] IconFactory - utility for creating icons in Pharo

2015-04-05 Thread kilon alios
"Maybe we are not talking about the same thing ?"

We do I just brought an alternative. My initial question is why this data
is not stored inside a Collection and instead individual methods are
preferred.

But now that I thought it through I understand in practice would not make
much difference. And as you said methods are already browsable, Collections
are not.

"If so, then the reason to keep them in image has to do with resource
management, an image is self contained.

I was talking about managing resources as a collection of methods, an
example would be ZnByteEncoder, where mappings are defined on the class
side.

If resources are originally downloaded from somewhere else but cached
inside the image, it is worth mentioning that, and shipping the necessary
code to redo it, in the case of the example, #generateByteToUnicodeSpec:"

Yeah I think I understand that now too, it makes the distribution of the
image much easier not to have to worry about external resources.

Yes I did understood what you were talking about, I just was not clear
about the benefits of this approach over using Collections and instance
variables instead. But I do think that now I understand .

Thank you for trying to help me understand :)

It was important for me to understand this because I want to import a lot
of SVG data into the image and I was not sure if I should use just SVG
files or instead use methods that return SVG strings. I would be using
methods since it will make my distribution much simpler and easier to
version control too.


Re: [Pharo-users] Object-oriented state-frozen logging

2015-04-05 Thread Sven Van Caekenberghe
Hi Peter,

I would call this object logging, plain and simple.

Some of us, myself included, believe this is the way forward.

You could have a look at how Zinc does logging (ZnLogEvent):

 https://www.youtube.com/watch?v=rIBbeMdFCys
 https://www.youtube.com/watch?v=gaUxPNq6_7c

This article might also help:

 https://medium.com/concerning-pharo/lampsort-revisited-visualised-6652055ef858

All in all, it is not too much effort to generate log event objects, and they 
can used in many different ways. Using Announcement makes this quite practical.

HTH,

Sven

> On 05 Apr 2015, at 20:16, Peter Uhnák  wrote:
> 
> Hi,
> 
> this may be a bit tall order and I am not sure if possible,
> however I would like to know the state of objects at certain points.
> 
> Currently what I would do is something like 
> self log: 'anObject someProperty:'; logCr: anObject someProperty.
> 
> however this is not very practical.
> 
> So I would like something like
> self fronzenLog: anObject
> 
> and then I could inspect the logger and see the state of the whole objects.
> 
> Using debugger and stepping through it is not really practical because I need 
> to observe several possible objects that are in this function at very 
> different times.
> 
> Is this possible? Is there a better/somewhat better way to do something like 
> this?
> 
> Any pointers appreciated.
> 
> Peter




Re: [Pharo-users] IconFactory - utility for creating icons in Pharo

2015-04-05 Thread Sven Van Caekenberghe

> On 05 Apr 2015, at 20:16, kilon alios  wrote:
> 
> Thank you for trying to help me understand :) 

You're welcome.

> It was important for me to understand this because I want to import a lot of 
> SVG data into the image and I was not sure if I should use just SVG files or 
> instead use methods that return SVG strings. I would be using methods since 
> it will make my distribution much simpler and easier to version control too.

SVG is human readable (XML based), no ?

If they are not too large, it might even be quite useful to store them as 
strings in the image, although I do agree this is not scalable in the end. (But 
Seaside uses this mechanism to store real images in the image, and that works 
very well during development, in the sense that it is convenient).


Re: [Pharo-users] IconFactory - utility for creating icons in Pharo

2015-04-05 Thread kilon alios
"SVG is human readable (XML based), no ?"

yeap , XML format , nothing special. Athens has an importer for them.

"If they are not too large, it might even be quite useful to store them as
strings in the image, although I do agree this is not scalable in the end.
(But Seaside uses this mechanism to store real images in the image, and
that works very well during development, in the sense that it is
convenient)."

oh yes it suits me to keep them small so they can be more modular so as you
said to compose and decompose them easily . And if it works well for you,
should work well for me ;)


Re: [Pharo-users] IconFactory - utility for creating icons in Pharo

2015-04-05 Thread Ben Coman
On Mon, Apr 6, 2015 at 2:16 AM, kilon alios  wrote:

>
> "Maybe we are not talking about the same thing ?"
>
> We do I just brought an alternative. My initial question is why this data
> is not stored inside a Collection and instead individual methods are
> preferred.
>
> But now that I thought it through I understand in practice would not make
> much difference. And as you said methods are already browsable, Collections
> are not.
>
>
Also methods can be packaged and distributed using Monticello.  Live
Collections can not.
cheers -ben


Re: [Pharo-users] Object-oriented state-frozen logging

2015-04-05 Thread Peter Uhnák
Hi Sven,

thanks for the answers; especially the article was very informative. I
didn't even think of using Announcements, but seeing it in action is really
cool!

Peter

On Sun, Apr 5, 2015 at 8:30 PM, Sven Van Caekenberghe  wrote:

> Hi Peter,
>
> I would call this object logging, plain and simple.
>
> Some of us, myself included, believe this is the way forward.
>
> You could have a look at how Zinc does logging (ZnLogEvent):
>
>  https://www.youtube.com/watch?v=rIBbeMdFCys
>  https://www.youtube.com/watch?v=gaUxPNq6_7c
>
> This article might also help:
>
>
> https://medium.com/concerning-pharo/lampsort-revisited-visualised-6652055ef858
>
> All in all, it is not too much effort to generate log event objects, and
> they can used in many different ways. Using Announcement makes this quite
> practical.
>
> HTH,
>
> Sven
>
> > On 05 Apr 2015, at 20:16, Peter Uhnák  wrote:
> >
> > Hi,
> >
> > this may be a bit tall order and I am not sure if possible,
> > however I would like to know the state of objects at certain points.
> >
> > Currently what I would do is something like
> > self log: 'anObject someProperty:'; logCr: anObject someProperty.
> >
> > however this is not very practical.
> >
> > So I would like something like
> > self fronzenLog: anObject
> >
> > and then I could inspect the logger and see the state of the whole
> objects.
> >
> > Using debugger and stepping through it is not really practical because I
> need to observe several possible objects that are in this function at very
> different times.
> >
> > Is this possible? Is there a better/somewhat better way to do something
> like this?
> >
> > Any pointers appreciated.
> >
> > Peter
>
>
>


[Pharo-users] Data scrapping in pharo: Extracting tweets contents

2015-04-05 Thread Offray Vladimir Luna Cárdenas

Hi,

I'm making a data scrapper from twitter. I know that twitter API is 
there, but I would like to make the scrapped data available to anyone, 
even if the person has not signed an API agreement. Also I think that 
this kind of external data is important for making agile visualization 
less self-referential and could bring some interesting examples with the 
data is common to the usual "netizen".


I have some advances that you can test easily executing the code at [1] 
and I have already scrapped and filled out the data from a twitter 
profile page.


[1] http://ws.stfx.eu/E3LD464QI0GR

Now I'm having problems extracting tweets data. If I execute the code at 
[2] I can get a list of tweets (first 19) and I can explore inside any 
member of the collection, but I can't make sense of the SoupTag data 
inside. How can I extract particularly the tweet contents?


[2] http://ws.stfx.eu/JXYM7W7WL1H9

Any help with this will be greatly appreciated.

Cheers,

Offray



Re: [Pharo-users] Data scrapping in pharo: Extracting tweets contents

2015-04-05 Thread Paul DeBruicker
Is this what you want?


| source anUrl tweet |

anUrl := 'https://twitter.com/offrayLC'.
source := Soup fromString: (ZnEasy get: anUrl ) contents asString.
tweet := (source findAllTagsByClass: 'ProfileTweet-text').
tweet collect:[:ea | ea text].







Offray wrote
> Hi,
> 
> I'm making a data scrapper from twitter. I know that twitter API is 
> there, but I would like to make the scrapped data available to anyone, 
> even if the person has not signed an API agreement. Also I think that 
> this kind of external data is important for making agile visualization 
> less self-referential and could bring some interesting examples with the 
> data is common to the usual "netizen".
> 
> I have some advances that you can test easily executing the code at [1] 
> and I have already scrapped and filled out the data from a twitter 
> profile page.
> 
> [1] http://ws.stfx.eu/E3LD464QI0GR
> 
> Now I'm having problems extracting tweets data. If I execute the code at 
> [2] I can get a list of tweets (first 19) and I can explore inside any 
> member of the collection, but I can't make sense of the SoupTag data 
> inside. How can I extract particularly the tweet contents?
> 
> [2] http://ws.stfx.eu/JXYM7W7WL1H9
> 
> Any help with this will be greatly appreciated.
> 
> Cheers,
> 
> Offray





--
View this message in context: 
http://forum.world.st/Data-scrapping-in-pharo-Extracting-tweets-contents-tp4817746p4817756.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.



Re: [Pharo-users] Data scrapping in pharo: converting text with dates in Spanish

2015-04-05 Thread Paul DeBruicker
copyFrom:14 to: 17 copies 4 characters.  You're testing a 4 character long
string against a 3 character long string.  That's why the test fails. 
Either change it to copyFrom: 15 to:17 or add a trimBoth send to month temp
var.  




You may have an easier time not using temp variables in the workspace as you
can then explore/inspect them more easily to see what they contain after the
calculation has or has not done what you expected.  







Offray wrote
> Hi all,
> 
> I'm making a small data scrapper[1] in pharo to feed some 
> visualizations. The data I'm scrapping contains strings with dates in 
> Spanish like '16:21 - 15 de jun. de 2011' and I would like to convert 
> them to proper dates in Smalltalk. So I started prototyping an Small 
> script at [2], but the problem is that monthIndex at: month doesn't work 
> because 'jun' is not in the dictionary (please refer to [2] for 
> details). This is motivated by month = 'jun' giving false, but when I 
> inspect month its content is 'jun', so I think that I'm missing 
> something important.
> 
> [1] http://smalltalkhub.com/#!/~Offray/Dataviz
> [2] http://ws.stfx.eu/IOMTYZ0N9W29
> 
> So here come my questions:
> 
> a). How to get "monthIndex at: month" working properly so I can get '06' 
> as the proper month index for the month 'jun' (junio).?
> b) Why month = 'jun' gives false?
> c) There is any way to convert strings which has months in different 
> languages (for example Spanish) more directly?
> 
> Thanks,
> 
> Offray





--
View this message in context: 
http://forum.world.st/Data-scrapping-in-pharo-converting-text-with-dates-in-Spanish-tp4817705p4817757.html
Sent from the Pharo Smalltalk Users mailing list archive at Nabble.com.



Re: [Pharo-users] IconFactory - utility for creating icons in Pharo

2015-04-05 Thread kilon alios
yes exactly

On Mon, Apr 6, 2015 at 1:18 AM, Ben Coman  wrote:

>
>
> On Mon, Apr 6, 2015 at 2:16 AM, kilon alios  wrote:
>
>>
>> "Maybe we are not talking about the same thing ?"
>>
>> We do I just brought an alternative. My initial question is why this data
>> is not stored inside a Collection and instead individual methods are
>> preferred.
>>
>> But now that I thought it through I understand in practice would not make
>> much difference. And as you said methods are already browsable, Collections
>> are not.
>>
>>
> Also methods can be packaged and distributed using Monticello.  Live
> Collections can not.
> cheers -ben
>