Japhs by SMS.

2001-08-07 Thread Abigail

Tonight at the Amsterdam.pm meeting we tried to make a JAPH with 
certain restrictions. The challenge came from Johan Vromans, who
recently tried to SMS a JAPH, but found himself restricted to not
being able to use lowercase letters.

So, the challenge was set to create a JAPH that doesn't use lower-
case letters. And since forking out to external programs (like echo)
makes the task trivial, use of external programs was forbidden too.

It quickly boiled down to finding a way to eval a string, as putting
text into a variable that prints out "Just another Perl Hacker" is
fairly easy. For quite some time, we were stuck on thinking "eval"
and "s///e" are the only ways to eval a string in Perl - and they
both require lowercase characters.

Then someone pointed out that (?{ }) inside a regex evaluates code too. 
But if (?{ }) is inside a variable that is interpolated in a regex, 
you need a "use re 'eval'", which is all lowercase. However, peeking
inside re.pm learned that the same effect can be archieved by setting
$^H - from a BEGIN block, of course.

So Merijn and I came quickly with similar Japhs:

BEGIN{$^H=2097152}$_="(?\173\160\162\151\156\164'\112\165\163\164\040\141\156\157\164\150\145\162\040\120\145\162\154\040H\141\143\153\145\162\012'\175)";/$_/;

This prints out "Just another Perl Hacker", and is 160 characters - exactly
the maximum amount of characters allowed in an SMS message.


Problem solved? Well, yes and no. It's solved if you look at the set
specifications. But, as we found out, none of our SMS capable phones
makes it { or } available.

So, the challenge is to FWP. Write a JAPH, not using more than 160
characters, no lowercase letters, all used characters should be 
available on most cell phones, and no use of external programs.



Abigail



Re: Japhs by SMS.

2001-08-07 Thread Abigail

On Wed, Aug 08, 2001 at 01:26:07AM +0200, Abigail wrote:
> 
> So Merijn and I came quickly with similar Japhs:
> 
> 
>BEGIN{$^H=2097152}$_="(?\173\160\162\151\156\164'\112\165\163\164\040\141\156\157\164\150\145\162\040\120\145\162\154\040H\141\143\153\145\162\012'\175)";/$_/;

And this can be done in less than 80 characters too:

BEGIN{$^H=1<<21}$_="(?{\LPRINT\E'J\LUST ANOTHER\E P\LERL\E H\LACKER\12'})";/$_/



Abigail



Re: Japhs by SMS.

2001-08-07 Thread Jeff 'japhy/Marillion' Pinyan

On Aug 8, Abigail said:

>On Wed, Aug 08, 2001 at 01:26:07AM +0200, Abigail wrote:
>> 
>> So Merijn and I came quickly with similar Japhs:
>> 
>> 
>BEGIN{$^H=2097152}$_="(?\173\160\162\151\156\164'\112\165\163\164\040\141\156\157\164\150\145\162\040\120\145\162\154\040H\141\143\153\145\162\012'\175)";/$_/;
>
>And this can be done in less than 80 characters too:
>
>BEGIN{$^H=1<<21}$_="(?{\LPRINT\E'J\LUST ANOTHER\E P\LERL\E H\LACKER\12'})";/$_/

Why not:

  0=~"(?\173\LPRINT\E'J\LUST ANOTHER\E P\LERL\E H\LACKER\12'\175)";

65 chars.

-- 
Jeff "japhy" Pinyan  [EMAIL PROTECTED]  http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
** Look for "Regular Expressions in Perl" published by Manning, in 2002 **




Re: Japhs by SMS.

2001-08-07 Thread Kye Leslie


>Why not:
>
>   0=~"(?\173\LPRINT\E'J\LUST ANOTHER\E P\LERL\E H\LACKER\12'\175)";
>
>65 chars.

I'm not sure about the official implementation of SMS, but the ~ char
isn't in the symbol table in my nokia phone..
anyone else have this?

Kye.

  Kye Leslie: Helpdesk Officer
  - Need some help? -
  [EMAIL PROTECTED]




Re: Japhs by SMS.

2001-08-08 Thread Juanma Barranquero


On Wed, 08 Aug 2001 13:15:11 +0800, Kye Leslie <[EMAIL PROTECTED]> wrote:

> I'm not sure about the official implementation of SMS, but the ~ char
> isn't in the symbol table in my nokia phone..

According to GSM 03.38, "Digital cellular telecommunications system 
(Phase 2+); Alphabets and language-specific information", section
6.2.1, "Default alphabet", the default 7-bit alphabet available in SMS
messages does not include the following usual characters: ~^\|[]{}

OTOH, it does include lowercase letters, so I suppose the restrictions
in the challenge are arbitrary...

   /L/e/k/t/u




Re: Japhs by SMS.

2001-08-08 Thread Ian Phillipps

On Wed, 08 Aug 2001 at 09:29:35 +0200, Juanma Barranquero wrote:
> 
> On Wed, 08 Aug 2001 13:15:11 +0800, Kye Leslie <[EMAIL PROTECTED]> wrote:

> According to GSM 03.38, "Digital cellular telecommunications system 
> (Phase 2+); Alphabets and language-specific information", section
> 6.2.1, "Default alphabet", the default 7-bit alphabet available in SMS
> messages does not include the following usual characters: ~^\|[]{}

> OTOH, it does include lowercase letters, so I suppose the restrictions
> in the challenge are arbitrary...

I was going to say that apart from one early example, I've not seen a
GSM phone which *doesn't* do lowercase. Sometimes it's not obvious - on
my phone you hold down a letter key for a while and it changes case.

I just sent myself a test message from Genie.co.uk which did, indeed,
fail to send those prohibited characters. It also mapped '_' to '-' BTW,
but this might be an artefact of the Genie site. My phone doesn't have '_'.

So, the real SMS japh is: print 'Just another Perl hacker,'
...although maybe this can be shortened?

Ian



Re: Japhs by SMS.

2001-08-08 Thread Juanma Barranquero


On Wed, 8 Aug 2001 10:49:35 +0100, Ian Phillipps <[EMAIL PROTECTED]> wrote:

> I just sent myself a test message from Genie.co.uk which did, indeed,
> fail to send those prohibited characters. It also mapped '_' to '-' BTW,
> but this might be an artefact of the Genie site. My phone doesn't have '_'.

_ is char 17 (0x11) in GSM 03.38.

But many SMS-sending sites do horrible things to messages. They
usually do some kind of non-standard ISO-8859-1 to GSM translation
where accented chars are lost, etc. They also do things like mapping
[{}] into (()), and  «» to <<>>, for example.

I'm currently programming a SMS sending service for my company
(www.peoplecall.com), so I'm a bit touchy about those issues :-)

   /L/e/k/t/u




Re: Japhs by SMS.

2001-08-08 Thread Bernard El-Hagin

On Wed, 8 Aug 2001, Kye Leslie wrote:

->
->>Why not:
->>
->>   0=~"(?\173\LPRINT\E'J\LUST ANOTHER\E P\LERL\E H\LACKER\12'\175)";
->>
->>65 chars.
->
->I'm not sure about the official implementation of SMS, but the ~ char
->isn't in the symbol table in my nokia phone..
->anyone else have this?

I have a ~ on my Sony CMD-J5.

Cheers,
Bernard




Re: Japhs by SMS.

2001-08-08 Thread Andrew . Savige

In a tribute to John W Backus and his team of
IBM super programmers who developed the first
FORTRAN compiler from scratch in 1954-57,
how about trying for a JAPH consisting
only of valid FORTRAN 0 characters?

AN EXAMPLE FORTRAN 0 PROGRAM

DIMENSION A(11)
READ A
 2  DO 3,8,11 J=1,11
 3  I=11-J
Y=SQRT(ABS(A(I+1)))+5*A(I+1)**3
IF (400>=Y) 8,4
 4  PRINT I,999.
GOTO 2
 8  PRINT I,Y
 11 STOP

Unfortunately, I am not sure of the valid FORTRAN 0
character set, but I hope it does not allow lower
case characters since that is what makes the JAPH
interesting.

Andrew.



Re: Japhs by SMS.

2001-08-08 Thread Abigail

On Thu, Aug 09, 2001 at 03:56:23PM +1000, [EMAIL PROTECTED] wrote:
> In a tribute to John W Backus and his team of
> IBM super programmers who developed the first
> FORTRAN compiler from scratch in 1954-57,
> how about trying for a JAPH consisting
> only of valid FORTRAN 0 characters?
> 
> AN EXAMPLE FORTRAN 0 PROGRAM
> 
> DIMENSION A(11)
> READ A
>  2  DO 3,8,11 J=1,11
>  3  I=11-J
> Y=SQRT(ABS(A(I+1)))+5*A(I+1)**3
> IF (400>=Y) 8,4
>  4  PRINT I,999.
> GOTO 2
>  8  PRINT I,Y
>  11 STOP
> 
> Unfortunately, I am not sure of the valid FORTRAN 0
> character set, but I hope it does not allow lower
> case characters since that is what makes the JAPH
> interesting.


Using the same tricks as with the SMS JAPH, one can construct most,
if not all, Perl programs out at most 12 characters: the digits 0-7,
`=', `~', `\' and `"'.

But I guess that ~ isn't in FORTRAN 0, and perhaps " and \ aren't either.

Abigail



Re: Japhs by SMS.

2001-08-09 Thread Ronald J Kimball

On Thu, Aug 09, 2001 at 04:17:36PM -0500, David L. Nicol wrote:
> Jeff 'japhy/Marillion' Pinyan wrote:
> 
> > Why not:
> > 
> >   0=~"(?\173\LPRINT\E'J\LUST ANOTHER\E P\LERL\E H\LACKER\12'\175)";
> > 
> > 65 chars.
> 
> Wow.  Why does binding this string to 0 cause it to get evald?
> 

It's a regular expression match.  \173 and \175 are curly braces, so the
regex includes the (?{ }) syntax mentioned earlier.

You can use any expression as a regular expression with the binding
operator.  For example:

print "Yay!\n" if 4 =~ 2+2;


Ronald



Re: [NL-PM] Japhs by SMS.

2001-08-08 Thread Redvers Davies

> certain restrictions. The challenge came from Johan Vromans, who
> recently tried to SMS a JAPH, but found himself restricted to not
> being able to use lowercase letters.

Although not as much fun, SMS does allow mixed case.  Your problem is
probably with the interface to your phone.

The way to shift case on my phone is to hold the letter key down for
about 5 seconds and the default case shifts.  After it shifts you can
then press the key as many times ness to get your required letter.

Sod it, japhs in caps are much more interesting :)