Re: system call, passing multiple files to an app

2015-01-14 Thread marmorine
this works perfectly (sorry for the delay in the answer!).

here is the code where I use it for any interested. its in a small
flash-card like program which uses feh in the pc terminal and fbi in
the framebuffer console (pics or slideshows).

(de show_pic (L)
   (show_txt pic)
   (if (= (gopt 'hst) pc)
  (apply call L feh -D (gopt 'dia) --cycle-once)
  (apply call L fbi -t (gopt 'dia) -1 -noverbose) )
   (prin Dsp) )

the -1 in fbi is its cycle once.

for mplayer the program only needed it called on a single file:

(de show_vid (X)
   (show_txt vid)
   (call mplayer X -really-quiet)
   (prin Dsp) )




-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: A Minimal PicoLisp DB/GUI Application, Telephone field

2015-01-14 Thread Rowan Thorpe
On 2015/01/14-14:37, Luis P. Mendes wrote:
 Hi,
 
 2015-01-14 12:09 GMT+00:00 Alexander Burger a...@software-lab.de:
 
  I see. So Norway has different systematics with telephone numbers.
 
  I don't understand them, though. In Germany we have the rule that both
  0049 123 456 and +49 123 456 are the same as 0123 456.
 The 00 to + conversion is of no problem, but the 0 leading local or
 domestic numbers seems to be a feature of some countries, but not of
 others.

There are even more variations though, including for international calling
code:

 from Australia: 0011 + country code + area code + ...
 from USA: 011 + country code + area code + ...

-- 
Rowan Thorpe
PGP fingerprint:
 BB0A 0787 C0EE BDD8 7F97  3D30 49F2 13A5 265D CCBD

There is a great difference between worry and concern. A worried person sees
a problem, and a concerned person solves a problem.
 - Harold Stephens
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: A Minimal PicoLisp DB/GUI Application, Importing

2015-01-14 Thread Jon Kleiser
Hi Alex,

On 13. Jan, 2015, at 15:37, Alexander Burger a...@software-lab.de wrote:

. . .
 How difficult would it be to create export and import functions, e.g.
 to and from tab-separated files? This could be separate utilities, i.e.
 not a part of the GUI.
 
 That's very easy. There is a report mechanism in PicoLisp. You find
 examples for that in the demo application in the app/ directory. The
 'csv' function is called there, e.g. in sales.l and inventory.l.
 
 Same with import. You can import CSV or XML (an example for the latter
 is in http://picolisp.com/wiki/?osmgeodata). But each case is different,
 depending on the specialities of the format at hand.
 
 
 If you just want an import/export, you could use 'dump'.
 
   (load @lib/too.l)
   (out adrDump.l
  (dump (db nm +Prs @@)) )
 
 You can then do (load adrDump.l) to read the data back.
. . .
 ♪♫ Alex

I’ve got the dump and load working, but I have not yet figured out how to use 
the 'csv’ function for import from a file (I took a look at sales.l and 
“inventory.l”). Maybe it would be just as easy to generate an adrDump.l file 
from a CSV file? The only thing that I don’t understand about the adrDump.l 
file, is the dotted pair after the (+Prs), as here: (obj (+Prs) (1 . 27)
Can that dotted pair be generated according to some simple rule?

/Jon

Re: A Minimal PicoLisp DB/GUI Application, Telephone field

2015-01-14 Thread Luis P. Mendes
Hi,

2015-01-14 12:09 GMT+00:00 Alexander Burger a...@software-lab.de:

 I see. So Norway has different systematics with telephone numbers.

 I don't understand them, though. In Germany we have the rule that both
 0049 123 456 and +49 123 456 are the same as 0123 456.
The 00 to + conversion is of no problem, but the 0 leading local or
domestic numbers seems to be a feature of some countries, but not of
others.


Luis
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: A Minimal PicoLisp DB/GUI Application, Telephone field

2015-01-14 Thread Jon Kleiser
Hi Alex,

On 14. Jan, 2015, at 13:09, Alexander Burger a...@software-lab.de wrote:

 Hi Jon,
 
 I don’t quite get this. I have done as you suggested, (locale NO
 no) and leading 0, so I can now enter a phone number as 099887766. You
 say it will be stored internally with leading 47 instead of that 0, but
 
 Right. You see that if you look directly into the DB.
 
 
 when I put the mouse over that phone-pencil icon, it seems that
 tel:099887766 is what will be used (and that’s also the href I see in
 the inspector).
 ...
 If I try to dial 022852804 from my mobile, I get number not in use.
 
 I see. So Norway has different systematics with telephone numbers.
 
 I don't understand them, though. In Germany we have the rule that both
 0049 123 456 and +49 123 456 are the same as 0123 456.
 
 A number without a leading zero is a local number (within the same city,
 but that's almost obsolete these days as you can take your number with
 you when you move or change your provider, so you can't rely on that).
 
 The '+TelField' (based on the functions 'telStr' and 'expTel') handles
 this. What are the exact rules for Norway? And how can we handle this
 flexibly?
 
 ♪♫ Alex
 — 

I think this page describes Norwegian telephone numbers quite well:
http://en.wikipedia.org/wiki/Telephone_numbers_in_Norway

It also seems that the Danish numbers are somewhat similar:
http://en.wikipedia.org/wiki/Telephone_numbers_in_Denmark

I may not be the right person to say how we can handle this flexibly. ;-)
I don’t know if it can be of any help, but here is Google’s common Java, C++ 
and JavaScript library for parsing, formatting, storing and validating 
international phone numbers:
https://github.com/googlei18n/libphonenumber

/Jon

Re: A Minimal PicoLisp DB/GUI Application, Importing

2015-01-14 Thread Alexander Burger
On Wed, Jan 14, 2015 at 05:54:17PM +0100, Alexander Burger wrote:
 A simple example would be
 
(in myAdrDB.csv
   (while (split (line) ^I)
  (dbSync)
  (let Obj (request '(+Prs) 'nm (pack (car L)))
 (put Obj 'adr (pack (cadr L)))
 (put Obj ...)
 ... )
  (commit 'upd) ) )

Not correct of course. Better:

   (use L
  (in myAdrDB.csv
 (while (setq L (split (line) ^I))
(dbSync)
... L ...
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: A Minimal PicoLisp DB/GUI Application, Telephone field

2015-01-14 Thread Alexander Burger
Hi Jon, Luis, Rowan,

thanks!

I see that this problem is non-trivial. We need to extend the
localization files loc/??.l

Probably some functional expression or pattern needs to be stored there,
in addition to (or as a replacement of) the country code '*CtryCode'.

Perhaps the Google library gives the necessary information. I'll take a
look asap. Any further input welcome!

♪♫ Alex
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: A Minimal PicoLisp DB/GUI Application, Importing

2015-01-14 Thread Alexander Burger
Hi Jon,

 I’ve got the dump and load working, but I have not yet figured out how
 to use the 'csv’ function for import from a file (I took a look at

The 'csv' function can only generate the CSV file (TAB-separated data).
It is not suitable for import.


To import a CSV file, you need to write proper code depending on the
data and the given situation. There are thousand possibilities of
input formats, character sets, type and order of data.

A simple example would be

   (in myAdrDB.csv
  (while (split (line) ^I)
 (dbSync)
 (let Obj (request '(+Prs) 'nm (pack (car L)))
(put Obj 'adr (pack (cadr L)))
(put Obj ...)
... )
 (commit 'upd) ) )


 understand about the adrDump.l file, is the dotted pair after the
 (+Prs), as here: (obj (+Prs) (1 . 27)

This is the object ID encoded as a dotted pair (see the 'id' function).
'dump' is actually overkill for this simple address DB. It tries to find
a unique key for each object it dumps, so that references to this object
from other objects can be properly resolved.

The +Prs objects in the address DB don't have a unique key. And even the
object ID is not needed, because there are no references (+Link or
+Joint) from other objects.

So for this simple case, you can simply ignore the dotted pair.

♪♫ Alex
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: A Minimal PicoLisp DB/GUI Application, Telephone field

2015-01-14 Thread Henrik Sarvell
Isn't this a non-issue, simply enter and store all numbers regardless
of location with country code + number without leading zero, eg
4912345678?

Will work for all countries everywhere, I never store numbers without
the country code in my mobile nowadays and always works regardless if
I'm in said country or not.



On Wed, Jan 14, 2015 at 5:23 PM, Alexander Burger a...@software-lab.de wrote:
 Hi Jon, Luis, Rowan,

 thanks!

 I see that this problem is non-trivial. We need to extend the
 localization files loc/??.l

 Probably some functional expression or pattern needs to be stored there,
 in addition to (or as a replacement of) the country code '*CtryCode'.

 Perhaps the Google library gives the necessary information. I'll take a
 look asap. Any further input welcome!

 ♪♫ Alex
 --
 UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe
--
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: A Minimal PicoLisp DB/GUI Application, Telephone field

2015-01-14 Thread Alexander Burger
On Wed, Jan 14, 2015 at 05:52:02PM +0100, Henrik Sarvell wrote:
 Isn't this a non-issue, simply enter and store all numbers regardless
 of location with country code + number without leading zero, eg
 4912345678?

Yes, as I said, simply use +TextField instead of +TelField.

However, local customers will complain if they have to handle such
unwieldy numbers :)

♪♫ Alex
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: A Minimal PicoLisp DB/GUI Application, Telephone field

2015-01-14 Thread Alexander Burger
Hi Jon,

 I don’t quite get this. I have done as you suggested, (locale NO
 no) and leading 0, so I can now enter a phone number as 099887766. You
 say it will be stored internally with leading 47 instead of that 0, but

Right. You see that if you look directly into the DB.


 when I put the mouse over that phone-pencil icon, it seems that
 tel:099887766 is what will be used (and that’s also the href I see in
 the inspector).
 ...
 If I try to dial 022852804 from my mobile, I get number not in use.

I see. So Norway has different systematics with telephone numbers.

I don't understand them, though. In Germany we have the rule that both
0049 123 456 and +49 123 456 are the same as 0123 456.

A number without a leading zero is a local number (within the same city,
but that's almost obsolete these days as you can take your number with
you when you move or change your provider, so you can't rely on that).

The '+TelField' (based on the functions 'telStr' and 'expTel') handles
this. What are the exact rules for Norway? And how can we handle this
flexibly?

♪♫ Alex
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe


Re: A Minimal PicoLisp DB/GUI Application, Telephone field

2015-01-14 Thread Alexander Burger
On Wed, Jan 14, 2015 at 01:09:12PM +0100, Alexander Burger wrote:
 The '+TelField' (based on the functions 'telStr' and 'expTel') handles
 this. What are the exact rules for Norway? And how can we handle this
 flexibly?

Alternatively, of course, you could replace '+TelField' with
'+TextField'. Then the GUI won't do anything with the telephone numbers.

♪♫ Alex
-- 
UNSUBSCRIBE: mailto:picolisp@software-lab.de?subject=Unsubscribe