Re: [Pharo-users] How do I convert a FileTree project to Metadataless GitFileTree project?

2016-07-05 Thread Dale Henrichs

Nicolas,

Over the long July 4th weekend, I realized that the package-cache needs 
to be considered in the package naming scheme ...


As currently implemented, the GitFileTree scheme of sequentially 
numbering version numbers based on the order of git commits is 
problematic when the package-cache is considered, since switching 
branches can lead to a package named XXX-dkh.12 being in the 
package-cache and there is no way to know whether it is the "right 
package" ...


The short sha scheme would guarantee that the package-cache would not 
have improper collisions, so this is an argument in favor of going that 
route ...


When reading a package from a metadataless repository using FileTree as 
opposed to GitFileTree, the package-cache is even more problematic since 
all packages are given the same author-version number: cypress-1 and you 
are virtually guaranteed to have package-cache problems


The scheme that I favor: eliminating both author and version number from 
the name, suffers from the same package-cache problem ...


Now I believe that I should be able to "solve the package-cache problem" 
in Metacello when using the Cypress extension, because Metacello is 
already aware of the package-cache when doing a fetch ...


Unfortunately loads from the Monticello Browser and Gofer will still be 
using the package-cache unless those tools are made aware of 
metadataless repositories or the decisions about whether or not the 
package-cache is used is delegated to the repository instance itself --- 
probably the preferred solution --- and an approach that I also consider 
as I work through the issues for Metacello ...


Anyway, the short-sha may actually be the best solution. I have found 
the short sha very useful when displaying the loaded version of a 
project in the project browser for tODE and echoing the short sha (sans 
author) in the package names, would provide a useful reminder of the 
version that was checked out when the package was loaded ...


Dale

On 06/29/2016 01:24 AM, Nicolas Passerini wrote:
Hi Dale, Therry, I am working on a libgit-based git integration for 
Pharo and I am facing the same problem about version numbers. So maybe 
I can help you if you are working on that.
I had the same idea as Dale, using short SHAs instead of correlative 
numbers, but I didn't have the time yet to got down that path.


Therry, you said that


 you'll have a bunch of stuff expecting version numbers that will
stop working.

Do you already know which stuff will stop working? That would be realy 
helpful.






Re: [Pharo-users] How do I debug: "There was an error while trying to install GitFileTree. Installation was cancelled." from Catalog Browser

2016-07-05 Thread Dale Henrichs
While we're on the subject, when one does get a debugger How is a 
beginner supposed to share the error information with the folks on this 
list?


I have a debugger open on the stack after executing:

  Metacello new
configuration: 'GitFileTree';
version: #stable;
repository: 'http://smalltalkhub.com/mc/Pharo/MetaRepoForPharo50/main';
load

which was my guess for the load expression and I'm getting a walkback 
that I assume is the same as that produced by the Catalog Browser, but 
there is apparently no way of really knowing ...


Anyway, I've got a very nice debugger with a nice stack and nice error 
message in the title bar, but I don't see any way of actually being able 
to share a simple stack trace and error message with the mailing list 
other than to produce a screenshot which will not show the whole stack ..


I happen to know that the PharoDebug.log contains a stack trace (and 
I've attached it to this email), but I don't know how a beginner would 
know to do this, either.


Of course, I think that the stack dump in the PharoDebug.log is 
unreadable, but at least it is a sharable stack.


Finally to summarize, the actual message error is:  'invalid version 
number: normal version component must be integer v0' and this error is 
very likely consequence of a proposed bugfix for a Metacello bug that 
was reported a month or so ago [1], as I'm using a version of Metacello 
with the proposed bugfix present ... so at the end of the day, this is a 
problem with my code ...


But I do think the two questions that came from this exercise are still 
relevant:


  How does a beginner report/debug a Catalog Browser error?
  How does a beginner produce a sharable stack trace?

Dale

[1] https://github.com/dalehenrich/metacello-work/issues/392

On 07/05/2016 11:13 AM, Dale Henrichs wrote:
Using a freshly downloaded Pharo5.0 and the Catalog Browser, I'm 
getting a Notification with the message in the subject line while 
installing GitFileTree, but I get a notification with no indication of 
why or what the error is ... how am I supposed to debug this?


I mean I can guess what load expression is being used, but for a 
beginner, this is not a pleasant introduction ...


There is no Pharo debug log either, so I will have to splash around 
and try to load GitFileTree, in the meantime...


Dale


THERE_BE_DRAGONS_HERE
Error: invalid version number: normal version component must be integer v0
5 July 2016 11:18:06.227447 am

VM: unix - i686 - linux-gnu - CoInterpreter VMMaker.oscog-eem.1855 uuid: d8e4a3c2-a3bf-4adc-b224-8012903a1ef4 May  4 2016
StackToRegisterMappingCogit VMMaker.oscog-eem.1855 uuid: d8e4a3c2-a3bf-4adc-b224-8012903a1ef4 May  4 2016
https://github.com/pharo-project/pharo-vm.git Commit: b8ec25a570d7539653e1d793e97609adb509aaed Date: 2016-05-04 11:14:22 +0200 By: Esteban Lorenzano  Jenkins build #589

Image: Pharo5.0 [Latest update: #50760]

MetacelloSemanticVersionNumber class(Object)>>error:
	Receiver: MetacelloSemanticVersionNumber
	Arguments and temporary variables: 
		aString: 	'invalid version number: normal version component must be integer v0'
	Receiver's instance variables: 
		superclass: 	Magnitude
		methodDict: 	a MethodDictionary(#<->MetacelloSemanticVersionNumber>>#< #=->Metac...etc...
		format: 	65539
		layout: 	a FixedLayout
		instanceVariables: 	nil
		organization: 	a ClassOrganization
		subclasses: 	{MetacelloOldSemanticVersionNumber}
		name: 	#MetacelloSemanticVersionNumber
		classPool: 	a Dictionary()
		sharedPools: 	an OrderedCollection()
		environment: 	a SystemDictionary(lots of globals)
		category: 	#'Metacello-Core-Model'
		traitComposition: 	{}
		localSelectors: 	nil


MetacelloSemanticVersionNumber class>>integerFromString:
	Receiver: MetacelloSemanticVersionNumber
	Arguments and temporary variables: 
		aString: 	'v0'
	Receiver's instance variables: 
		superclass: 	Magnitude
		methodDict: 	a MethodDictionary(#<->MetacelloSemanticVersionNumber>>#< #=->Metac...etc...
		format: 	65539
		layout: 	a FixedLayout
		instanceVariables: 	nil
		organization: 	a ClassOrganization
		subclasses: 	{MetacelloOldSemanticVersionNumber}
		name: 	#MetacelloSemanticVersionNumber
		classPool: 	a Dictionary()
		sharedPools: 	an OrderedCollection()
		environment: 	a SystemDictionary(lots of globals)
		category: 	#'Metacello-Core-Model'
		traitComposition: 	{}
		localSelectors: 	nil


[ :subString | 
| integer |
forPattern
	ifTrue: [ integer := subString ]
	ifFalse: [ integer := self integerFromString: subString.
		integer < 0
			ifTrue: [ self
	error:
		'invalid version number: normal version component must be integer '
			, subString printString ] ].
normalComponents add: integer.
identifierCount := identifierCount + 1 ] in MetacelloSemanticVersionNumber class>>fromString:forPattern:
	Receiver: MetacelloSemanticVersionNumber
	Arguments and temporary variables: 
<
	Receiver's instance variables: 
		superclass: 	Magnitude
		methodDict: 	a 

[Pharo-users] How do I debug: "There was an error while trying to install GitFileTree. Installation was cancelled." from Catalog Browser

2016-07-05 Thread Dale Henrichs
Using a freshly downloaded Pharo5.0 and the Catalog Browser, I'm getting 
a Notification with the message in the subject line while installing 
GitFileTree, but I get a notification with no indication of why or what 
the error is ... how am I supposed to debug this?


I mean I can guess what load expression is being used, but for a 
beginner, this is not a pleasant introduction ...


There is no Pharo debug log either, so I will have to splash around and 
try to load GitFileTree, in the meantime...


Dale



Re: [Pharo-users] NeoNumberParser and localization

2016-07-05 Thread Sven Van Caekenberghe

> On 05 Jul 2016, at 16:40, Peter Uhnák  wrote:
> 
> I know that only NeoCSV uses it — that's how I ran into this problem. I was 
> processing some (czech) CSV files which used the decimal comma separator… 
> however the numbers were silently truncated, which wasn't nice to say the 
> least — I really don't understand why the default behavior is to silently 
> change the value, and not produce an error — this also applies to Pharo's 
> number parser.
> 
> BTW, you not only need to set the thousands separator, but the decimal 
> separator too, I guess.
> 
> depending on the default values, but that's really not the main point
> 
> Now, I can understand where/how your suggestions would make sense. Maybe you 
> can try subclassing and make your own variant (first) ?
> 
> Well I would need a way to configure the CSV parser. Because I am certainly 
> not interested in manually transforming every float field. I want just 
> configure it at one place and use the regular addFloatField — after all the 
> file is going to be consistent in it's format.
> 
> Btw there are other options for improvement, like configuring the default 
> date field and then having addDateField, etc. But maybe that's just 
> overloading the NeoCSV parser… in any case it's a food for thought.

Indeed, I do not want to overload the CSV parser, it is pretty simple right now.

The conversions are all in the convenience protocol for a reason: they just 
save you some typing. You really ought to do your own conversions, when you 
need to.

  parser addFieldConverter: [ :string | MyNumberParser parse: string ]

There are too many formats out there (especially for dates/times).

You are right about truncation and error handling. But parsing and enforcing a 
syntax are two different things. That is why I think the thousands separator 
option is not that simple, consider

  1,000.00
  10,00.00
  1,0,0,0.00
  1,000.00E1000,000

You see ? One quick and dirty solution would be to just remove $, or replace 
one character by another.

> Peter
> 
> 
> On Tue, Jul 5, 2016 at 2:34 PM, Sven Van Caekenberghe  wrote:
> Peter,
> 
> NeoNumberParser is a simple number (integer/float) parser that is part of 
> NeoCSV (it was based on the JSON number parsing code). It was added because I 
> wanted a number parser that makes little demands on the stream it parses from 
> (just 1 character peek ahead, no arbitrary backtracking, limited API). It was 
> not meant to be very powerful.
> 
> If you check the references, you see that where it is used in NeoCSVReader, 
> you could easily substitute another parser.
> 
> Now, I can understand where/how your suggestions would make sense. Maybe you 
> can try subclassing and make your own variant (first) ? BTW, you not only 
> need to set the thousands separator, but the decimal separator too, I guess.
> 
> Sven
> 
> > On 05 Jul 2016, at 14:17, Peter Uhnák  wrote:
> >
> > Hi,
> >
> > is there any plan for NeoNumberParser do add localization support?
> >
> > e.g.
> >
> > NeoNumberParser new
> > thousandsSeparator: $,; "common in us data"
> > parse: '12,230'
> >
> > =>
> >
> > 12230
> >
> > NeoNumberParser new
> > decimalSeparator: $,; "common in eu data"
> > parse: '12,230'
> >
> > =>
> >
> > 12.230
> >
> > Thanks,
> > Peter
> 
> 
> 




Re: [Pharo-users] NeoNumberParser and localization

2016-07-05 Thread Peter Uhnák
I know that only NeoCSV uses it — that's how I ran into this problem. I was
processing some (czech) CSV files which used the decimal comma separator…
however the numbers were silently truncated, which wasn't nice to say the
least — I really don't understand why the default behavior is to silently
change the value, and not produce an error — this also applies to Pharo's
number parser.

BTW, you not only need to set the thousands separator, but the decimal
> separator too, I guess.


depending on the default values, but that's really not the main point

Now, I can understand where/how your suggestions would make sense. Maybe
> you can try subclassing and make your own variant (first) ?


Well I would need a way to configure the CSV parser. Because I am certainly
not interested in manually transforming every float field. I want just
configure it at one place and use the regular addFloatField — after all the
file is going to be consistent in it's format.

Btw there are other options for improvement, like configuring the default
date field and then having addDateField, etc. But maybe that's just
overloading the NeoCSV parser… in any case it's a food for thought.

Peter


On Tue, Jul 5, 2016 at 2:34 PM, Sven Van Caekenberghe  wrote:

> Peter,
>
> NeoNumberParser is a simple number (integer/float) parser that is part of
> NeoCSV (it was based on the JSON number parsing code). It was added because
> I wanted a number parser that makes little demands on the stream it parses
> from (just 1 character peek ahead, no arbitrary backtracking, limited API).
> It was not meant to be very powerful.
>
> If you check the references, you see that where it is used in
> NeoCSVReader, you could easily substitute another parser.
>
> Now, I can understand where/how your suggestions would make sense. Maybe
> you can try subclassing and make your own variant (first) ? BTW, you not
> only need to set the thousands separator, but the decimal separator too, I
> guess.
>
> Sven
>
> > On 05 Jul 2016, at 14:17, Peter Uhnák  wrote:
> >
> > Hi,
> >
> > is there any plan for NeoNumberParser do add localization support?
> >
> > e.g.
> >
> > NeoNumberParser new
> > thousandsSeparator: $,; "common in us data"
> > parse: '12,230'
> >
> > =>
> >
> > 12230
> >
> > NeoNumberParser new
> > decimalSeparator: $,; "common in eu data"
> > parse: '12,230'
> >
> > =>
> >
> > 12.230
> >
> > Thanks,
> > Peter
>
>
>


Re: [Pharo-users] [UFFI] Using a nested structure

2016-07-05 Thread Ronie Salgado
I compiled the DLL using Visual Studio 2015 Community Edition. Later I will
check with mingw.

2016-07-05 14:58 GMT+02:00 Merwan Ouddane :

> Using codeblocks, mine are:
>
> mingw32-g++.exe -m32 -DBUILD_DLL -c main.cpp -o obj\Release\main.o
> mingw32-g++.exe -shared -Wl,--output-def=bin\Release\libTest.def
> -Wl,--out-implib=bin\Release\libTest.a -Wl,--dll  obj\Release\main.o  -o
> bin\Release\Test.dll -s -m32
>
>
> On Tue, Jul 5, 2016 at 2:52 PM, Merwan Ouddane 
> wrote:
>
>> I am not moving from another plateform :/
>>
>> I tried it in pharo 6 and I it didn't work either.
>>
>> It could be my dll. What is your compilation line for the dll ?
>>
>> Thanks you,
>> Merwan
>>
>> On Tue, Jul 5, 2016 at 2:14 PM, Ronie Salgado 
>> wrote:
>>
>>> Hi Merwan,
>>>
>>> I tested this on Pharo 6 and it is working in Windows. However, in 32
>>> bits Window doubles have an 8 byte alignment, unlike Linux where they have
>>> a 4 byte alignment.
>>>
>>> Can you try doing the following before performing the ffi call in
>>> Windows, if you are moving an image from Linux or OS X:
>>>
>>> Vec3 rebuildFieldAccessors.
>>> Position rebuildFieldAccessors.
>>>
>>> Best regards,
>>> Ronie
>>>
>>> 2016-07-05 11:11 GMT+02:00 Merwan Ouddane :
>>>
 Hi,

 I have an issue whith nested structures.

 I made some "dummy" structures in c:


 typedef struct vec3 {
  double data[3];
 } vec3;

 typedef struct position {
  int i;
  vec3 vec;
 } position;
 And a "dummy" function to fill it:
 void fillStruct(position *position)
 {
 position -> i = 19;
 (position -> vec).data[0] = 1;
 (position -> vec).data[1] = 2;
 (position -> vec).data[2] = 3;
 }

 But I can't make the nested structure work.
 The "i" is correctly set to 19 but I have values that doesn't make any
 sense in the vec3 structure.

 In Pharo
 I declared the Double3 type for the array inside Vec3:
 Double3 := FFITypeArray ofType: 'double' size: 3

 Vec3>>fieldsDesc
 ^ #(
 Double3 v;
 )

 And the position:
 Position>>fieldsDesc
 ^ #(
 int i;
 Vec3 vec;
 )

 The ffi call:
 ^ self ffiCall: #(void fillStruct(Position *position)) module:
 'Test.dll'

 Sorry for the long / messy mail :p

 Any clues ?

 Cheers,
 Merwan

>>>
>>>
>>
>


Re: [Pharo-users] [UFFI] Using a nested structure

2016-07-05 Thread Merwan Ouddane
Using codeblocks, mine are:

mingw32-g++.exe -m32 -DBUILD_DLL -c main.cpp -o obj\Release\main.o
mingw32-g++.exe -shared -Wl,--output-def=bin\Release\libTest.def
-Wl,--out-implib=bin\Release\libTest.a -Wl,--dll  obj\Release\main.o  -o
bin\Release\Test.dll -s -m32


On Tue, Jul 5, 2016 at 2:52 PM, Merwan Ouddane 
wrote:

> I am not moving from another plateform :/
>
> I tried it in pharo 6 and I it didn't work either.
>
> It could be my dll. What is your compilation line for the dll ?
>
> Thanks you,
> Merwan
>
> On Tue, Jul 5, 2016 at 2:14 PM, Ronie Salgado  wrote:
>
>> Hi Merwan,
>>
>> I tested this on Pharo 6 and it is working in Windows. However, in 32
>> bits Window doubles have an 8 byte alignment, unlike Linux where they have
>> a 4 byte alignment.
>>
>> Can you try doing the following before performing the ffi call in
>> Windows, if you are moving an image from Linux or OS X:
>>
>> Vec3 rebuildFieldAccessors.
>> Position rebuildFieldAccessors.
>>
>> Best regards,
>> Ronie
>>
>> 2016-07-05 11:11 GMT+02:00 Merwan Ouddane :
>>
>>> Hi,
>>>
>>> I have an issue whith nested structures.
>>>
>>> I made some "dummy" structures in c:
>>>
>>>
>>> typedef struct vec3 {
>>>  double data[3];
>>> } vec3;
>>>
>>> typedef struct position {
>>>  int i;
>>>  vec3 vec;
>>> } position;
>>> And a "dummy" function to fill it:
>>> void fillStruct(position *position)
>>> {
>>> position -> i = 19;
>>> (position -> vec).data[0] = 1;
>>> (position -> vec).data[1] = 2;
>>> (position -> vec).data[2] = 3;
>>> }
>>>
>>> But I can't make the nested structure work.
>>> The "i" is correctly set to 19 but I have values that doesn't make any
>>> sense in the vec3 structure.
>>>
>>> In Pharo
>>> I declared the Double3 type for the array inside Vec3:
>>> Double3 := FFITypeArray ofType: 'double' size: 3
>>>
>>> Vec3>>fieldsDesc
>>> ^ #(
>>> Double3 v;
>>> )
>>>
>>> And the position:
>>> Position>>fieldsDesc
>>> ^ #(
>>> int i;
>>> Vec3 vec;
>>> )
>>>
>>> The ffi call:
>>> ^ self ffiCall: #(void fillStruct(Position *position)) module: 'Test.dll'
>>>
>>> Sorry for the long / messy mail :p
>>>
>>> Any clues ?
>>>
>>> Cheers,
>>> Merwan
>>>
>>
>>
>


Re: [Pharo-users] [UFFI] Using a nested structure

2016-07-05 Thread Merwan Ouddane
I am not moving from another plateform :/

I tried it in pharo 6 and I it didn't work either.

It could be my dll. What is your compilation line for the dll ?

Thanks you,
Merwan

On Tue, Jul 5, 2016 at 2:14 PM, Ronie Salgado  wrote:

> Hi Merwan,
>
> I tested this on Pharo 6 and it is working in Windows. However, in 32 bits
> Window doubles have an 8 byte alignment, unlike Linux where they have a 4
> byte alignment.
>
> Can you try doing the following before performing the ffi call in Windows,
> if you are moving an image from Linux or OS X:
>
> Vec3 rebuildFieldAccessors.
> Position rebuildFieldAccessors.
>
> Best regards,
> Ronie
>
> 2016-07-05 11:11 GMT+02:00 Merwan Ouddane :
>
>> Hi,
>>
>> I have an issue whith nested structures.
>>
>> I made some "dummy" structures in c:
>>
>>
>> typedef struct vec3 {
>>  double data[3];
>> } vec3;
>>
>> typedef struct position {
>>  int i;
>>  vec3 vec;
>> } position;
>> And a "dummy" function to fill it:
>> void fillStruct(position *position)
>> {
>> position -> i = 19;
>> (position -> vec).data[0] = 1;
>> (position -> vec).data[1] = 2;
>> (position -> vec).data[2] = 3;
>> }
>>
>> But I can't make the nested structure work.
>> The "i" is correctly set to 19 but I have values that doesn't make any
>> sense in the vec3 structure.
>>
>> In Pharo
>> I declared the Double3 type for the array inside Vec3:
>> Double3 := FFITypeArray ofType: 'double' size: 3
>>
>> Vec3>>fieldsDesc
>> ^ #(
>> Double3 v;
>> )
>>
>> And the position:
>> Position>>fieldsDesc
>> ^ #(
>> int i;
>> Vec3 vec;
>> )
>>
>> The ffi call:
>> ^ self ffiCall: #(void fillStruct(Position *position)) module: 'Test.dll'
>>
>> Sorry for the long / messy mail :p
>>
>> Any clues ?
>>
>> Cheers,
>> Merwan
>>
>
>


Re: [Pharo-users] NeoNumberParser and localization

2016-07-05 Thread Sven Van Caekenberghe
Peter,

NeoNumberParser is a simple number (integer/float) parser that is part of 
NeoCSV (it was based on the JSON number parsing code). It was added because I 
wanted a number parser that makes little demands on the stream it parses from 
(just 1 character peek ahead, no arbitrary backtracking, limited API). It was 
not meant to be very powerful.

If you check the references, you see that where it is used in NeoCSVReader, you 
could easily substitute another parser.

Now, I can understand where/how your suggestions would make sense. Maybe you 
can try subclassing and make your own variant (first) ? BTW, you not only need 
to set the thousands separator, but the decimal separator too, I guess.

Sven

> On 05 Jul 2016, at 14:17, Peter Uhnák  wrote:
> 
> Hi,
> 
> is there any plan for NeoNumberParser do add localization support?
> 
> e.g.
> 
> NeoNumberParser new
> thousandsSeparator: $,; "common in us data"
> parse: '12,230'
> 
> => 
> 
> 12230
> 
> NeoNumberParser new
> decimalSeparator: $,; "common in eu data"
> parse: '12,230'
> 
> => 
> 
> 12.230
> 
> Thanks,
> Peter




[Pharo-users] NeoNumberParser and localization

2016-07-05 Thread Peter Uhnák
Hi,

is there any plan for NeoNumberParser do add localization support?

e.g.

NeoNumberParser new
thousandsSeparator: $,; "common in us data"
parse: '12,230'

=>

12230

NeoNumberParser new
decimalSeparator: $,; "common in eu data"
parse: '12,230'

=>

12.230

Thanks,
Peter


Re: [Pharo-users] [UFFI] Using a nested structure

2016-07-05 Thread Ronie Salgado
Hi Merwan,

I tested this on Pharo 6 and it is working in Windows. However, in 32 bits
Window doubles have an 8 byte alignment, unlike Linux where they have a 4
byte alignment.

Can you try doing the following before performing the ffi call in Windows,
if you are moving an image from Linux or OS X:

Vec3 rebuildFieldAccessors.
Position rebuildFieldAccessors.

Best regards,
Ronie

2016-07-05 11:11 GMT+02:00 Merwan Ouddane :

> Hi,
>
> I have an issue whith nested structures.
>
> I made some "dummy" structures in c:
>
>
> typedef struct vec3 {
>  double data[3];
> } vec3;
>
> typedef struct position {
>  int i;
>  vec3 vec;
> } position;
> And a "dummy" function to fill it:
> void fillStruct(position *position)
> {
> position -> i = 19;
> (position -> vec).data[0] = 1;
> (position -> vec).data[1] = 2;
> (position -> vec).data[2] = 3;
> }
>
> But I can't make the nested structure work.
> The "i" is correctly set to 19 but I have values that doesn't make any
> sense in the vec3 structure.
>
> In Pharo
> I declared the Double3 type for the array inside Vec3:
> Double3 := FFITypeArray ofType: 'double' size: 3
>
> Vec3>>fieldsDesc
> ^ #(
> Double3 v;
> )
>
> And the position:
> Position>>fieldsDesc
> ^ #(
> int i;
> Vec3 vec;
> )
>
> The ffi call:
> ^ self ffiCall: #(void fillStruct(Position *position)) module: 'Test.dll'
>
> Sorry for the long / messy mail :p
>
> Any clues ?
>
> Cheers,
> Merwan
>


Re: [Pharo-users] can pharo change encoding of a file?

2016-07-05 Thread Peter Uhnák
Perfect! Thank you both.

Peter

On Tue, Jul 5, 2016 at 12:49 PM, Sven Van Caekenberghe  wrote:

> Yes,
>
>   ZnCharacterEncoder newForEncoding: #cp1250
>
> gives you all you need.
>
> You can use the stream classes Guile mentioned. Just make sure you do your
> underlying, basic file IO binary.
>
> > On 05 Jul 2016, at 12:21, Guillermo Polito 
> wrote:
> >
> > You can, check the ZnCharacterReadStream and ZnCharacterWriteStream
> classes. You can configure them with an encoding and voilá.
> >
> > Guille
> >
> > On Tue, Jul 5, 2016 at 12:14 PM, Peter Uhnák  wrote:
> > Hi,
> >
> > is there a way to reencode a file from within Pharo?
> >
> > e.g. I have a file in CP1250 encoding and I want to change it to UTF-8.
> >
> > In linux I would do something like "recode cp1250..utf8 file.txt".
> >
> > But can Pharo do that natively, or do I need to defer to the system with
> FFI/OSSubprocess?
> >
> > Thanks,
> > Peter
> >
>
>
>


Re: [Pharo-users] can pharo change encoding of a file?

2016-07-05 Thread Sven Van Caekenberghe
Yes, 

  ZnCharacterEncoder newForEncoding: #cp1250

gives you all you need.

You can use the stream classes Guile mentioned. Just make sure you do your 
underlying, basic file IO binary.

> On 05 Jul 2016, at 12:21, Guillermo Polito  wrote:
> 
> You can, check the ZnCharacterReadStream and ZnCharacterWriteStream classes. 
> You can configure them with an encoding and voilá.
> 
> Guille
> 
> On Tue, Jul 5, 2016 at 12:14 PM, Peter Uhnák  wrote:
> Hi,
> 
> is there a way to reencode a file from within Pharo?
> 
> e.g. I have a file in CP1250 encoding and I want to change it to UTF-8.
> 
> In linux I would do something like "recode cp1250..utf8 file.txt".
> 
> But can Pharo do that natively, or do I need to defer to the system with 
> FFI/OSSubprocess?
> 
> Thanks,
> Peter
> 




Re: [Pharo-users] can pharo change encoding of a file?

2016-07-05 Thread Guillermo Polito
You can, check the ZnCharacterReadStream and ZnCharacterWriteStream
classes. You can configure them with an encoding and voilá.

Guille

On Tue, Jul 5, 2016 at 12:14 PM, Peter Uhnák  wrote:

> Hi,
>
> is there a way to reencode a file from within Pharo?
>
> e.g. I have a file in CP1250 encoding and I want to change it to UTF-8.
>
> In linux I would do something like "recode cp1250..utf8 file.txt".
>
> But can Pharo do that natively, or do I need to defer to the system with
> FFI/OSSubprocess?
>
> Thanks,
> Peter
>


[Pharo-users] can pharo change encoding of a file?

2016-07-05 Thread Peter Uhnák
Hi,

is there a way to reencode a file from within Pharo?

e.g. I have a file in CP1250 encoding and I want to change it to UTF-8.

In linux I would do something like "recode cp1250..utf8 file.txt".

But can Pharo do that natively, or do I need to defer to the system with
FFI/OSSubprocess?

Thanks,
Peter


[Pharo-users] [UFFI] Using a nested structure

2016-07-05 Thread Merwan Ouddane
Hi,

I have an issue whith nested structures.

I made some "dummy" structures in c:


typedef struct vec3 {
 double data[3];
} vec3;

typedef struct position {
 int i;
 vec3 vec;
} position;
And a "dummy" function to fill it:
void fillStruct(position *position)
{
position -> i = 19;
(position -> vec).data[0] = 1;
(position -> vec).data[1] = 2;
(position -> vec).data[2] = 3;
}

But I can't make the nested structure work.
The "i" is correctly set to 19 but I have values that doesn't make any
sense in the vec3 structure.

In Pharo
I declared the Double3 type for the array inside Vec3:
Double3 := FFITypeArray ofType: 'double' size: 3

Vec3>>fieldsDesc
^ #(
Double3 v;
)

And the position:
Position>>fieldsDesc
^ #(
int i;
Vec3 vec;
)

The ffi call:
^ self ffiCall: #(void fillStruct(Position *position)) module: 'Test.dll'

Sorry for the long / messy mail :p

Any clues ?

Cheers,
Merwan