Bill Lam

Your suggestion works.
I inserted the two lines into jfilesrc.ijs :

elseif. '.png'-:_4{.y do.
 htmlresponse d,~gsrchead rplc '<TYPE>';'image/png';'<LENGTH>';":#d

Thanks 

Bill Szuch

-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of
[email protected]
Sent: Tuesday, 26 July 2011 5:13 AM
To: [email protected]
Subject: Programming Digest, Vol 70, Issue 38

Send Programming mailing list submissions to
        [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
        http://jsoftware.com/cgi-bin/mailman/listinfo/programming
or, via email, send a message with subject or body 'help' to
        [email protected]

You can reach the person managing the list at
        [email protected]

When replying, please edit your Subject line so it is more specific than
"Re: Contents of Programming digest..."


Today's Topics:

   1. (no subject) (J J)
   2. Inserting png files (William Szuch)
   3. Re: Inserting png files (bill lam)
   4. Re: definition of +. (Devon McCormick)
   5. Re: definition of +. (Boyko Bantchev)
   6. Creating GTK Grids on Request (Justin Tirrell)
   7. Re: Creating GTK Grids on Request (L.Tomei)
   8. Re: Creating GTK Grids on Request (Raul Miller)
   9. Re: Creating GTK Grids on Request (Justin Tirrell)


----------------------------------------------------------------------

Message: 1
Date: Mon, 25 Jul 2011 03:01:55 -0700 (PDT)
From: J J <[email protected]>
Subject: [Jprogramming] (no subject)
To: [email protected], [email protected],
        [email protected],    [email protected],
        [email protected]
Message-ID:
        <[email protected]>
Content-Type: text/plain; charset=us-ascii

I thought I had everything all figured out despite the circumstances I
stayed optimistic theres nothing else that compares with this...
http://millovia.cba.pl/DarrenWallace22.html now im recognized everywhere you
should try it too thank me later


------------------------------

Message: 2
Date: Mon, 25 Jul 2011 21:26:27 +1000
From: "William Szuch" <[email protected]>
Subject: [Jprogramming] Inserting png files
To: "J Programming Forum" <[email protected]>
Message-ID: <[email protected]>
Content-Type: text/plain;       charset="us-ascii"

I have tried to insert the png file "formula.png" into a web page using the
following file: " test3.ijs". 

This did not work.

However when I simply changed the extension to "formula.jpg" it worked. 

Am I doing something wrong with the png file ?.

I would like to be able to insert the png files.

 

NB.  File : test3.ijs

coclass 'test3'

coinsert 'jhs'

 

HBS=:  0  :  0

'<img alt="png Not Found"
src="~Projects/finexec/calculators/formula.png"></img>'

jhhr

'<img alt="png Not Found"
src="~Projects/finexec/calculators/formula.jpg"></img>'

jhhr

)

 

jev_get=: create 

 

create=:  3  :  0

'test3'jhr''

)

 

 

Regards

 

Bill Szuch

 

 

 



------------------------------

Message: 3
Date: Mon, 25 Jul 2011 21:55:06 +0800
From: bill lam <[email protected]>
Subject: Re: [Jprogramming] Inserting png files
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=utf-8

Perhaps it is a bug, please try the file jfilesrc.ijs inside ide/jhs addons
to make it allow png. (untested)

???, 25 ??? 2011, William Szuch ?????(?):
> I have tried to insert the png file "formula.png" into a web page 
> using the following file: " test3.ijs".
> 
> This did not work.
> 
> However when I simply changed the extension to "formula.jpg" it worked. 
> 
> Am I doing something wrong with the png file ?.
> 
> I would like to be able to insert the png files.
> 
>  
> 
> NB.  File : test3.ijs
> 
> coclass 'test3'
> 
> coinsert 'jhs'
> 
>  
> 
> HBS=:  0  :  0
> 
> '<img alt="png Not Found"
> src="~Projects/finexec/calculators/formula.png"></img>'
> 
> jhhr
> 
> '<img alt="png Not Found"
> src="~Projects/finexec/calculators/formula.jpg"></img>'
> 
> jhhr
> 
> )
> 
>  
> 
> jev_get=: create
> 
>  
> 
> create=:  3  :  0
> 
> 'test3'jhr''
> 
> )
> 
>  
> 
>  
> 
> Regards
> 
>  
> 
> Bill Szuch
> 
>  
> 
>  
> 
>  
> 
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm

--
regards,
====================================================
GPG key 1024D/4434BAB3 2008-08-24
gpg --keyserver subkeys.pgp.net --recv-keys 4434BAB3


------------------------------

Message: 4
Date: Mon, 25 Jul 2011 09:57:51 -0400
From: Devon McCormick <[email protected]>
Subject: Re: [Jprogramming] definition of +.
To: Programming forum <[email protected]>
Message-ID:
        <CAGdEmpE7DeRKbawMcmwj-Xp8Xgq=ty-roo0jmvbt7psxvox...@mail.gmail.com>
Content-Type: text/plain; charset=UTF-8

Based on a quick test, it looks like it gives a result consistent with the
integer definition of GCD: if you divide both terms by the answer, you get
integer results:

   3 4 5 +.~ 12
3 4 1
   3 4 5 +. 12.5
0.5 0.5 2.5

   gcdDivBy=: 4 : '(x;y)%&><x +. y'

   3 4 5 gcdDivBy 12
1 1  5
4 3 12
   3 4 5 gcdDivBy 12.5
 6  8 2
25 25 5
   3 4 5 gcdDivBy 12.25
12 16 20
49 49 49



On Sun, Jul 24, 2011 at 6:27 PM, Boyko Bantchev <[email protected]> wrote:

> The +. verb computes the `GCD' of all kinds of numbers known to
> J, but the corresponding page of the DoJ does not say what exactly
> +.  produces.  As there is no standard definition of GCD for
> floating-point or complex numbers in mathematics, +. seems to be
> underspecified.  Moreover, the text
>
>    `The greatest common divisor divides both of its arguments x
>    and y to produce results that have no common factor, that is,
>    the GCD of the quotients is 1.  Moreover, these quotients
>    represent the fraction x%y in lowest form.'
>
> seems to suggest only integer arguments.  For example,
>    `the GCD of the quotients is 1'
> apparently does not hold for many reals.
>
> So, what does +. compute?
> (I can imagine several definitions, but I am curious what the actual one
> is.)
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>



-- 
Devon McCormick, CFA
^me^ at acm.
org is my
preferred e-mail


------------------------------

Message: 5
Date: Mon, 25 Jul 2011 18:59:34 +0300
From: Boyko Bantchev <[email protected]>
Subject: Re: [Jprogramming] definition of +.
To: Programming forum <[email protected]>
Message-ID:
        <caldozqkd3gmqa5xz9rjj_a-uldbqnlxzmjmzaakmppcukz0...@mail.gmail.com>
Content-Type: text/plain; charset=UTF-8

On 25 July 2011 16:57, Devon McCormick <[email protected]> wrote:
> Based on a quick test, it looks like it gives a result consistent with the
> integer definition of GCD: if you divide both terms by the answer, you get
> integer results:
> ................
> ? gcdDivBy=: 4 : '(x;y)%&><x +. y'
> ................
> ? 3 4 5 gcdDivBy 12.25
> 12 16 20
> 49 49 49

However, with `more real' real numbers:

   1p1 gcdDivBy 1p2
4.92635e11 1.54766e12

   x: 1p1 gcdDivBy 1p2
8867428937083r18 7738291556936r5


------------------------------

Message: 6
Date: Mon, 25 Jul 2011 13:50:13 -0400
From: Justin Tirrell <[email protected]>
Subject: [Jprogramming] Creating GTK Grids on Request
To: [email protected]
Message-ID:
        <CAGOuK7se=v1kRyo0SoO_6EA-okniazJ=siigstrdj00azjd...@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

I just started using J and GTK, so apologies if this is too vague:

I am writing a script that will take input data from a GTK frontend, use it
to do a query into a jdb database, and output the data in a new gtkgrid
contained in a new window. I would like the user to be able to make
(hypothetically) an infinite number of queries and keep all windows open.

Currently, I have written it with a variable that I can use in my grid
locale and increment after each query. For example:

".('mygrid',(":currgrid),' =:conew ''jgtkgrid''')
NB. currgrid is an integer that is incremented after each query
".('create__mygrid',":currgrid)
".('handler__mygrid',(":currgrid),' =: 3 : handlerdef')

I seem to be having a lot of issues with this method, and it results in
messy code. Is there a better/correct method? I can clean up my code and
post more if anyone wants to see it.

Thanks,
Justin Tirrell


------------------------------

Message: 7
Date: Mon, 25 Jul 2011 11:20:23 -0700 (PDT)
From: "L.Tomei" <[email protected]>
Subject: Re: [Jprogramming] Creating GTK Grids on Request
To: [email protected]
Message-ID: <[email protected]>
Content-Type: text/plain; charset=us-ascii


In your code:

".('create__mygrid',":currgrid)

I don't see any argument passed to create verb, so it's not easy to
undertand which type of issues occur.

Lorenzo



Justin Tirrell wrote:
> 
> I just started using J and GTK, so apologies if this is too vague:
> 
> I am writing a script that will take input data from a GTK frontend, use
> it
> to do a query into a jdb database, and output the data in a new gtkgrid
> contained in a new window. I would like the user to be able to make
> (hypothetically) an infinite number of queries and keep all windows open.
> 
> Currently, I have written it with a variable that I can use in my grid
> locale and increment after each query. For example:
> 
> ".('mygrid',(":currgrid),' =:conew ''jgtkgrid''')
> NB. currgrid is an integer that is incremented after each query
> ".('create__mygrid',":currgrid)
> ".('handler__mygrid',(":currgrid),' =: 3 : handlerdef')
> 
> I seem to be having a lot of issues with this method, and it results in
> messy code. Is there a better/correct method? I can clean up my code and
> post more if anyone wants to see it.
> 
> Thanks,
> Justin Tirrell
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
> 
> 

-- 
View this message in context:
http://old.nabble.com/Creating-GTK-Grids-on-Request-tp32133920s24193p3213414
1.html
Sent from the J Programming mailing list archive at Nabble.com.



------------------------------

Message: 8
Date: Mon, 25 Jul 2011 14:21:03 -0400
From: Raul Miller <[email protected]>
Subject: Re: [Jprogramming] Creating GTK Grids on Request
To: Programming forum <[email protected]>
Message-ID:
        <CAD2jOU8x1Jp=wtv16n40jjzks5w0oyu-jkaz1-p2bg9rxwo...@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

On Mon, Jul 25, 2011 at 1:50 PM, Justin Tirrell <[email protected]>
> Currently, I have written it with a variable that I can use in my
grid
> locale and increment after each query. For example:
>
> ".('mygrid',(":currgrid),' =:conew ''jgtkgrid''')
> NB. currgrid is an integer that is incremented after each query
> ".('create__mygrid',":currgrid)
> ".('handler__mygrid',(":currgrid),' =: 3 : handlerdef')

I do not know what problem you are trying to solve by using
auto-increment names to hold your locales.  So I cannot suggest an
alternative there.

That said, I can suggest a cleaner way of doing what you are currently
doing.

First, you can define a wrapper for getting at the names you are using:

mygrid=:3 :0
  'mygrid',":y
:
  x,'__mygrid',":y
)

Then, you can rephrase the above sentences like this:

   (mygrid currgrid) =:conew 'jgtkgrid'
   NB. currgrid is an integer that is incremented after each query
   ('create' mygrid currgrid)~ ''
   ('handler' mygrid currgrid)=: 3 :handlerdef

The key insights here are:

1. You can use a string to refer to a variable being assigned.
2. You can use a string to refer to a verb to be consumed.

For assignment, when using an expression to compute the name you are
assigning to, you should put that expression in parenthesis.

The operator which lets you use a string to refer to a verb name is ~

That said,
   ('handler' mygrid currgrid)=: 3 :handlerdef

would probably be better handled by creating a definition for handler
in a class that inherits from jgtkgrid.  In otherwords:

coclass'mygtkgrid'
  coinsert'jgtkgrid'
  handler=: handlerdef_base_ f.

Though it would be clearer, I think, to use the literal definition of
handlerdef_base_ instead of putting it where you do not need it and
referring to it indirectly.

Also note that you need to end your class definition.  This will
either be the end of file, or the begining of a new class definition
or a cocurrent'base' statement.

Also, the sequence
   (mygrid currgrid) =:conew 'jgtkgrid'
   NB. currgrid is an integer that is incremented after each query
   ('create' mygrid currgrid)~ ''

would be better implemented as:
   (mygrid currgrid) =: '' conew 'jgtkgrid'

This works because when conew is given a left argument, the create
method in your class is run with that as its argument.

And if you only need that one line, you could even do without the
'mygrid' verb, leaving you with:

   ('mygrid',":currgrid) =: '' conew 'jgtkgrid'


I hope this helps,

-- 
Raul


------------------------------

Message: 9
Date: Mon, 25 Jul 2011 15:12:28 -0400
From: Justin Tirrell <[email protected]>
Subject: Re: [Jprogramming] Creating GTK Grids on Request
To: Programming forum <[email protected]>
Message-ID:
        <cagouk7so4pvs4zpqkxmgdzlv486dgkztj0egu-3n_wjyspw...@mail.gmail.com>
Content-Type: text/plain; charset=ISO-8859-1

Thanks for the quick responses.

Lorenzo, I had intended to pass an empty string to that verb, I must have
somehow missed it when copy-pasted my code, sorry about that.

Raul, I started to clean up my code in the ways you suggested and it seems
to have resolved the errors I was getting. Now that portion of my code is
working perfectly. Must have been my messy code causing issues.

Thanks to both of you.

Justin


On Mon, Jul 25, 2011 at 2:21 PM, Raul Miller <[email protected]> wrote:

> On Mon, Jul 25, 2011 at 1:50 PM, Justin Tirrell <[email protected]>
> > Currently, I have written it with a variable that I can use in my
> grid
> > locale and increment after each query. For example:
> >
> > ".('mygrid',(":currgrid),' =:conew ''jgtkgrid''')
> > NB. currgrid is an integer that is incremented after each query
> > ".('create__mygrid',":currgrid)
> > ".('handler__mygrid',(":currgrid),' =: 3 : handlerdef')
>
> I do not know what problem you are trying to solve by using
> auto-increment names to hold your locales.  So I cannot suggest an
> alternative there.
>
> That said, I can suggest a cleaner way of doing what you are currently
> doing.
>
> First, you can define a wrapper for getting at the names you are using:
>
> mygrid=:3 :0
>  'mygrid',":y
> :
>  x,'__mygrid',":y
> )
>
> Then, you can rephrase the above sentences like this:
>
>   (mygrid currgrid) =:conew 'jgtkgrid'
>   NB. currgrid is an integer that is incremented after each query
>   ('create' mygrid currgrid)~ ''
>   ('handler' mygrid currgrid)=: 3 :handlerdef
>
> The key insights here are:
>
> 1. You can use a string to refer to a variable being assigned.
> 2. You can use a string to refer to a verb to be consumed.
>
> For assignment, when using an expression to compute the name you are
> assigning to, you should put that expression in parenthesis.
>
> The operator which lets you use a string to refer to a verb name is ~
>
> That said,
>    ('handler' mygrid currgrid)=: 3 :handlerdef
>
> would probably be better handled by creating a definition for handler
> in a class that inherits from jgtkgrid.  In otherwords:
>
> coclass'mygtkgrid'
>  coinsert'jgtkgrid'
>  handler=: handlerdef_base_ f.
>
> Though it would be clearer, I think, to use the literal definition of
> handlerdef_base_ instead of putting it where you do not need it and
> referring to it indirectly.
>
> Also note that you need to end your class definition.  This will
> either be the end of file, or the begining of a new class definition
> or a cocurrent'base' statement.
>
> Also, the sequence
>    (mygrid currgrid) =:conew 'jgtkgrid'
>   NB. currgrid is an integer that is incremented after each query
>    ('create' mygrid currgrid)~ ''
>
> would be better implemented as:
>   (mygrid currgrid) =: '' conew 'jgtkgrid'
>
> This works because when conew is given a left argument, the create
> method in your class is run with that as its argument.
>
> And if you only need that one line, you could even do without the
> 'mygrid' verb, leaving you with:
>
>   ('mygrid',":currgrid) =: '' conew 'jgtkgrid'
>
>
> I hope this helps,
>
> --
> Raul
> ----------------------------------------------------------------------
> For information about J forums see http://www.jsoftware.com/forums.htm
>


------------------------------

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

End of Programming Digest, Vol 70, Issue 38
*******************************************


----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to