Category talk:J: Difference between revisions

Content added Content deleted
(→‎GeSHi Highlighter for J: coordinating lang tag updates for J)
Line 35: Line 35:
I've added all the J vocab as symbols rather than keywords, but don't define styles for them. I've not tried to include any regex sections. I understand that files should be sent to MikeMol when ready but wondered if anyone else wanted to have a look at it and tweak it first?
I've added all the J vocab as symbols rather than keywords, but don't define styles for them. I've not tried to include any regex sections. I understand that files should be sent to MikeMol when ready but wondered if anyone else wanted to have a look at it and tweak it first?
--[[User:Tikkanz|Tikkanz]] 00:07, 10 November 2009 (UTC)
--[[User:Tikkanz|Tikkanz]] 00:07, 10 November 2009 (UTC)

:I don't know J, but what's keeping you from testing your language definition? ——[[User:Underscore|Underscore]] ([[User talk:Underscore|Talk]]) 01:04, 10 November 2009 (UTC)
The template has now been tested and emailed to [[ShortCircuit]]. Hopefully in the near future there will be basic syntax highlighting for J on Rosetta Code. However there are quite a lot of J entries that either don't yet use the <tt>lang</tt> tags, or incorrectly use an uppercase rather than a lowercase J. I've made a start checking through the current J tasks updating the syntax where needed, if you check any please note them below so we can coordinate our efforts. The correct syntax for the <tt>lang</tt> tags is:<br>
::I suspect ignorance more than anything ;-). I imagine that it would probably involve installing and configuring a local PHP server? I've never worked with PHP or installed a PHP server before - not sure that I'm ready to go down that road! --[[User:Tikkanz|Tikkanz]] 05:11, 10 November 2009 (UTC)
<tt><nowiki><lang j></nowiki> one or more lines of code here <nowiki></lang></nowiki></tt>
:::Oh, don't worry, it's easy. I don't know a word of PHP and I was able to test my Perl 6 language definition. You must already have a copy of GeSHi, so all you need is a PHP interpreter; if you're running a flavor of Unix, get it using your package manager, or if you're running Windows, [http://www.php.net/downloads.php get a binary here]. Then change to your GeSHi directory and create a new file there, <code>testgeshi.php</code>, with these contents:

=== Progress updating lang tags ===
J tasks checked and updated so far include:<br>
* All tasks under headings 1, 9, A, B, and C. --[[User:Tikkanz|Tikkanz]] 11:23, 12 November 2009 (UTC)

== Testing a GeSHi template ==
I don't know J, but what's keeping you from testing your language definition? ——[[User:Underscore|Underscore]] ([[User talk:Underscore|Talk]]) 01:04, 10 November 2009 (UTC)
:I suspect ignorance more than anything ;-). I imagine that it would probably involve installing and configuring a local PHP server? I've never worked with PHP or installed a PHP server before - not sure that I'm ready to go down that road! --[[User:Tikkanz|Tikkanz]] 05:11, 10 November 2009 (UTC)
::Oh, don't worry, it's easy. I don't know a word of PHP and I was able to test my Perl 6 language definition. You must already have a copy of GeSHi, so all you need is a PHP interpreter; if you're running a flavor of Unix, get it using your package manager, or if you're running Windows, [http://www.php.net/downloads.php get a binary here]. Then change to your GeSHi directory and create a new file there, <code>testgeshi.php</code>, with these contents:
<blockquote><blockquote><blockquote><lang php><?php
<blockquote><blockquote><blockquote><lang php><?php


Line 55: Line 64:


?></lang></blockquote></blockquote></blockquote>
?></lang></blockquote></blockquote></blockquote>
:::Replace "some test code" with some test J code. (I assume you've named your language definition <code>j.php</code> and put it the directory <code>geshi</code>.) Then say <code>php testgeshi.php</code>, redirect the output to a file, and open the file in your favorite Web browser. —[[User:Underscore|Underscore]] ([[User talk:Underscore|Talk]]) 12:56, 10 November 2009 (UTC)
::Replace "some test code" with some test J code. (I assume you've named your language definition <code>j.php</code> and put it the directory <code>geshi</code>.) Then say <code>php testgeshi.php</code>, redirect the output to a file, and open the file in your favorite Web browser. —[[User:Underscore|Underscore]] ([[User talk:Underscore|Talk]]) 12:56, 10 November 2009 (UTC)
::::Thanks a lot for that - it would be good to make this info available somewhere more prominently. Actually I just downloaded another template from the sourceforge repository, so don't have GeSHi installed yet, but may do so now that the road doesn't look so long and dark!--[[User:Tikkanz|Tikkanz]] 22:43, 10 November 2009 (UTC)
:::Thanks a lot for that - it would be good to make this info available somewhere more prominently. Actually I just downloaded another template from the sourceforge repository, so don't have GeSHi installed yet, but may do so now that the road doesn't look so long and dark!--[[User:Tikkanz|Tikkanz]] 22:43, 10 November 2009 (UTC)
::::: I don't think any of the Rosetta Code: namespace is really protected, so feel free to make any alterations that clarify things; That namespace is mostly guidelines and walkthroughs. If you're really not sure or comfortable making a change, note it in the talk page, give people about '''48 hours''' to respond, and see where things go from there. --[[User:Short Circuit|Michael Mol]] 00:27, 11 November 2009 (UTC)
:::: I don't think any of the Rosetta Code: namespace is really protected, so feel free to make any alterations that clarify things; That namespace is mostly guidelines and walkthroughs. If you're really not sure or comfortable making a change, note it in the talk page, give people about '''48 hours''' to respond, and see where things go from there. --[[User:Short Circuit|Michael Mol]] 00:27, 11 November 2009 (UTC)
:::::: When/if I get it to work I'll give it a shot, however my first try didn't work out. My understanding from the instructions above, was that I should be able to get PHP/GeSHi to process files without necessarily setting it up in conjunction with a web server. I downloaded the Windows binary for PHP, installed it using the default parameters, except I didn't pick any web server to configure it for. I downloaded GeSHi and extracted it to a folder. I created the <code>testgeshi.php</code> file in the same folder as the <code>geshi.php</code> file and copied my <code>j.php</code> file to <code>geshi\j.php</code> with the other language files. I then started a <code>cmd</code> session, made the folder containing <code>testgeshi.php</code> the current directory and then ran <code>php testgeshi.php > mytest.html</code>. The <code>mytest.html</code> is created but it is zero-length. The folder containing the php binaries (exe and dll) was added to the path by the PHP installer. Any suggestions?--[[User:Tikkanz|Tikkanz]] 21:22, 11 November 2009 (UTC)
::::: When/if I get it to work I'll give it a shot, however my first try didn't work out. My understanding from the instructions above, was that I should be able to get PHP/GeSHi to process files without necessarily setting it up in conjunction with a web server. I downloaded the Windows binary for PHP, installed it using the default parameters, except I didn't pick any web server to configure it for. I downloaded GeSHi and extracted it to a folder. I created the <code>testgeshi.php</code> file in the same folder as the <code>geshi.php</code> file and copied my <code>j.php</code> file to <code>geshi\j.php</code> with the other language files. I then started a <code>cmd</code> session, made the folder containing <code>testgeshi.php</code> the current directory and then ran <code>php testgeshi.php > mytest.html</code>. The <code>mytest.html</code> is created but it is zero-length. The folder containing the php binaries (exe and dll) was added to the path by the PHP installer. Any suggestions?--[[User:Tikkanz|Tikkanz]] 21:22, 11 November 2009 (UTC)
::::::: It sounds like you did everything right; in particular, I can verify that you shouldn't need to deal with any Web servers. It's bizarre that you got no output at all, instead of, say, an error message at the very least. Possibly the culprit is that Windows doesn't have a real standard error stream; I really have no idea how <code>cmd.exe</code> works. Try a skeletal PHP script (<code>&lt;?php echo 'Hello, world!'; ?&gt;</code>) to verify that PHP is working; try highlighting a C program (with <code>$language = 'c';</code>) to verify that GeSHi is working; try running <code>php testgeshi.php</code> without redirecting to a file. Sorry if this doesn't help much; it's hard to debug this kind of thing through an asynchronous medium. Worse comes to worse, we could try meeting on IRC this weekend. —[[User:Underscore|Underscore]] ([[User talk:Underscore|Talk]]) 23:09, 11 November 2009 (UTC)
:::::: It sounds like you did everything right; in particular, I can verify that you shouldn't need to deal with any Web servers. It's bizarre that you got no output at all, instead of, say, an error message at the very least. Possibly the culprit is that Windows doesn't have a real standard error stream; I really have no idea how <code>cmd.exe</code> works. Try a skeletal PHP script (<code>&lt;?php echo 'Hello, world!'; ?&gt;</code>) to verify that PHP is working; try highlighting a C program (with <code>$language = 'c';</code>) to verify that GeSHi is working; try running <code>php testgeshi.php</code> without redirecting to a file. Sorry if this doesn't help much; it's hard to debug this kind of thing through an asynchronous medium. Worse comes to worse, we could try meeting on IRC this weekend. —[[User:Underscore|Underscore]] ([[User talk:Underscore|Talk]]) 23:09, 11 November 2009 (UTC)
:::::::: In production PHP setups, error output is supposed to be disabled, to avoid tipping off malicious visitors about the internal organization of a site. I believe current versions of MediaWiki disable error output by default. See [http://www.php.net/manual/en/errorfunc.configuration.php#ini.error-reporting ini.error-reporting]. --[[User:Short Circuit|Michael Mol]] 02:42, 12 November 2009 (UTC)
::::::: In production PHP setups, error output is supposed to be disabled, to avoid tipping off malicious visitors about the internal organization of a site. I believe current versions of MediaWiki disable error output by default. See [http://www.php.net/manual/en/errorfunc.configuration.php#ini.error-reporting ini.error-reporting]. --[[User:Short Circuit|Michael Mol]] 02:42, 12 November 2009 (UTC)
::::::::: Yes it was the error output setting! Thanks for the tips. Have now got a script that seems to work OK for the basics (comments, control words, strings). Will email it on.
:::::::: Yes it was the error output setting! Thanks for the tips. Have now got a script that seems to work OK for the basics (comments, control words, strings). Will email it on.--[[User:Tikkanz|Tikkanz]] 07:22, 12 November 2009 (UTC)