Programming @4-ch

Programming @4-ch

Be it HTML, C++, Java or whatever language you prefer, programming is what we do best around this board.
Markup languages are also fine around here, as with all the "not so real" languages of Shell script, CSS, and other various third party scripting languages.
  • We are sick of language discrimination, more so the PHP/Java bashers. There will be little tolerance of blatant and repetitive insults. You are still welcome to bring forward a sensible, insult-free argument regarding a certain topic at the appropriate time and place for it.
  • Please use WakabaMark or the appropriate HTML tags (with HTML enabled, of course) to format your code.
Rules · 規則
基本的には英語の使用を強く希望します。ただ日本語板の場合は日本語か英語。
Board look: Blue Moon Buun Futaba Headline Mercury Pseud0ch Toothpaste
1: GameBoy Color emulator in JavaScript (13) 2: gaynal sex (1) 3: [perl] Kareha resources (8) 4: >EXPERT HTML PROGRAMMER (4) 5: What is your definition of "freedom" ? (11) 6: HELP Cinemageddon.net (3) 7: Scala thread (4) 8: Live coding tool (5) 9: [Code Help]General code help?[PHP] (12) 10: Is this board alive? (3) 11: Is Perl a dead language? (29) 12: How to make my own imageboard (6) 13: Interpreted vs. compiled labguages (30) 14: world4ch's /prog/ Emergency Shelter #4 (9) 15: This is the official /prog/riders thread (11) 16: Is Ruby as inefficient as they say (6) 17: Coding Challenge #2! (114) 18: Operating Systems vs Artificial Intelligence (3) 19: 6.034 (6) 20: my own "yet another imageboard-script" (106) 21: Best language for starting out in functional programming? (20) 22: [SICP] LEARNING TIME [PY] (4) 23: HAX MY ANUS (2) 24: OOP vs functional (11) 25: Active (6) 26: Introduction to complexity and the idea od quantum computers (3) 27: Opinions of Codecademy? (8) 28: Programming languages with fast matrix operations (15) 29: [JS] Help me find out the correct speed to sync up with the song 太陽いわく燃えよカオス (5) 30: "4tran"? (52) 31: Spoilers in Wakaba (16) 32: Which one? (4) 33: Backup tweets (4) 34: I reproduced an error I found in safari. (3) 35: Google app engine (2) 36: lol (2) 37: Shitpostan (2) 38: What is the diff between RSS and Atom feeds? Is one better? (2) 39: Excessive file access in a perl script? (10) 40: Common useful applictions of Perl? (10)

GameBoy Color emulator in JavaScript (13)

1 Name: #!/usr/bin/anonymous : 2011-08-04 08:17 ID:Qeftnp5w

Someone made a GameBoy Color emulator in JavaScript, now you can play all the classics!
http://www.grantgalitz.org/gamecenter/

4 Name: #!/usr/bin/anonymous : 2011-12-21 21:43 ID:BvKBdNGo

Wow. This is cool.

5 Name: #!/usr/bin/anonymous : 2011-12-23 00:40 ID:uzN0HapF

Wow! God job to whoever made this!! Minecraft, now this! And you guys said Java was dead!

6 Name: #!/usr/bin/anonymous : 2011-12-24 17:25 ID:BvKBdNGo

>>5

wth man

He said JavaScript. NOT JAVA.

7 Name: #!/usr/bin/anonymous : 2011-12-26 23:20 ID:z8oT3Vji

>>6
Just pretend he was trolling.

Is there any sort of easy-to-read guide or manual on the Game Boy and its instruction set (Z80?)?

9 Name: #!/usr/bin/anonymous : 2012-01-04 05:53 ID:PyTm9YAw

10 Name: #!/usr/bin/anonymous : 2012-01-04 09:32 ID:gvG7mhwu

>>7

>(Z80)

Nice ID :o

11 Name: #!/usr/bin/anonymous : 2012-01-17 19:38 ID:wR2Te6ws

This reminds me of the PC emulator someone wrote in javascript:
http://bellard.org/jslinux/
It isn't very fast, but it's still very impressive.

12 Name: #!/usr/bin/anonymous : 2014-09-03 03:58 ID:+P8b84o1

gooby plz

13 Name: #!/usr/bin/anonymous : 2014-09-17 21:04 ID:VjPMwcga

https://www.sendspace.com/file/zagq2q
It is private leaked cracked version! Do not say thanks!!

Name: Link:
Leave these fields empty (spam trap):
More options...
Verification:

gaynal sex (1)

1 Name: #!/usr/bin/anonymous : 2014-08-21 00:04 ID:77in1rtB

gaynal sex

Name: Link:
Leave these fields empty (spam trap):
More options...
Verification:

[perl] Kareha resources (8)

1 Name: #!/usr/bin/anonymous : 2014-05-02 18:55 ID:IpwbeqOT

We like Kareha here. What have you noticed in kareha? Have you made any hacks or otherwise made use of it?

I saw that Storlek used Kareha as a base for his blog in the past. This seems sane to me, and not all too hard to do. When you think about it, Kareha is (in essence) a community blog.

Entering "fusianasan" in the name field or "2ch-sep93" in config.pl's date field do two quite obvious things.

pseud0ch.css, interestingly enough, does not support italics by default.

2 Name: meltingwax!bUNUJnjNcg : 2014-05-03 05:41 ID:XTaTycJ8

Over at sageru.org I use a hacked verson of Kareha that removes dates and makes the rules section user-editable [1]. It also scrambles the thread identifiers (which are normally the thread creation time) so the age of threads cannot be inferred.

It also has a couple custom CSS stylesheets, mainly 7chan, Overchan, and MWN. Feel free to take the first two for your site, if interested.

[1] http://sageru.org/rules

3 Name: #!/usr/bin/anonymous : 2014-05-18 21:40 ID:Heaven

>>2
is the code for that rule changer thing available anywhere?

also, it seems i've found a bug:

> Traceback (most recent call last):
>  File "index.cgi", line 21, in <module>
>   main()
>  File "index.cgi", line 15, in main
>   do_get()
>  File "/home/meltingwax/sageru.org/rules/handlers.py", line 60, in do_get
>   """ % raw
> UnicodeEncodeError: 'ascii' codec can't encode character u'\ufffe' in position 869: ordinal not in range(128)

4 Name: #!/usr/bin/anonymous : 2014-05-18 22:00 ID:Heaven

>>3
i should probably explain how to reproduce that bug...

  1. go to http://sageru.org/rules/ in your browser.
  2. change the page encoding to utf-8 in your browser
  3. paste a unicode character with a value higher than 127 into the textarea
  4. submit the form
  5. go to http://sageru.org/rules/ again.

5 Name: meltingwax!bUNUJnjNcg : 2014-05-28 02:30 ID:XTaTycJ8

>>4
Thanks for reporting that bug. Even when you don't change the page encoding, it doesn't support unicode.

If you want the code to the rules, it's at this link:
http://meltingwax.net/stuph/rules.tar.gz

To install:

  1. Untar that so you have a folder called $KAREHA_ROOT/rules/.
  2. Then, in $KAREHA_ROOT/include/rules.html, put this where you want the rules to appear:
<div id="rules-to-be-loaded" />
<script type="text/javascript">
$.getJSON('/rules/store.json', function(data) {
$('#rules-to-be-loaded').html(data.message);
Post too long. Click to view the whole post or the thread page.

6 Name: #!/usr/bin/anonymous : 2014-08-15 07:10 ID:NKiVyO92

Kareha with PSGI/Plack support: https://github.com/marlencrabapple/kareha-psgi

Surprised it took this long for someone to do this. Its at least 10x faster than vanilla Kareha when run with starman behind nginx.

7 Name: #!/usr/bin/anonymous : 2014-08-18 23:19 ID:Heaven

>>6
So instead of ~2 seconds of cpu time per year, your board uses ~0.2 seconds of cpu time per year?

8 Name: #!/usr/bin/anonymous : 2014-08-20 23:13 ID:mrBSe2Wz

>>7
Its bi-annual on some sites. It might even be monthly here.

Name: Link:
Leave these fields empty (spam trap):
More options...
Verification:

>EXPERT HTML PROGRAMMER (4)

1 Name: >EXPERT HTML PROGRAMMER : 2014-04-21 17:52 ID:lot+OX0a

>EXPERT HTML PROGRAMMER

2 Name: 4-ch.net/code : 2014-05-02 14:42 ID:6E69x8qt

4-ch.net/code

4 Name: #!/usr/bin/anonymous : 2014-08-10 09:32 ID:Fu87NZgk

<?test ><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html><?test ><!-- ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<?test --><?test ?>
<head>
<?test >
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<!-- ?>
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=utf-8" />
<?test --> <?test ?>
<title>HTML or XML?</title>
Post too long. Click to view the whole post or the thread page.
Name: Link:
Leave these fields empty (spam trap):
More options...
Verification:

What is your definition of "freedom" ? (11)

1 Name: #!/usr/bin/anonymous : 2014-04-22 10:49 ID:kQlYfQNM

Discuss.

2 Name: #!/usr/bin/anonymous : 2014-04-22 16:03 ID:dHH6Tobi

>Ability to see code.
>Ability to modify code.
>Ability to distribute modifications (fork).

3 Name: #!/usr/bin/anonymous : 2014-04-24 08:09 ID:M8os6tex

Freedom is the freedom to express 2 + 2 = 4. That granted, all else follows!

4 Name: #!/usr/bin/anonymous : 2014-04-25 01:07 ID:muqlh1bG

When I was young, I heard a song and thought to myself that the lyrics were

>Freedom's just another word for nothing left to do

Later, when I was slightly less young, I realized the lyrics actually were

>Freedom's just another word for nothing left to lose

Those definitions aren't especially useful to me, however, since I'm not a blues singer.

5 Name: #!/usr/bin/anonymous : 2014-05-30 09:49 ID:lW3PjXp1

I don't have one

6 Name: #!/usr/bin/anonymous : 2014-06-13 20:54 ID:4tpzojyy

"Freedom" only really has meaning in context. Freedom to do something, freedom not to have something done to you. On it's own it's an empty ideal.

Seeing as this is a programming board, I assume you mean "freedom" in a free software context, in which case my vote for free license goes to the MIT license. Simple and to the point, and not "copyleft" (which IMO is just trading one master for an arguably more benevolent one.)

7 Name: #!/usr/bin/anonymous : 2014-06-20 13:34 ID:Heaven

>>6
Your opinion is not appreciated. GPLv3 is the only license. We don't need shitty companies. We need transparency. Freedom as in free. The end.

8 Name: #!/usr/bin/anonymous : 2014-06-20 22:18 ID:4tpzojyy

>>7
Hello Stallman.

9 Name: #!/usr/bin/anonymous : 2014-07-02 09:23 ID:5H6su3Ag

But what if I want the freedom to have my work ripped off and exploited for commercial gain by leading companies such as Apple?

10 Name: #!/usr/bin/anonymous : 2014-07-11 13:34 ID:xtFFI2kx

>>9
That happens already on their side since they just ignore licences anyway, but if you really want such freedom, just upload your code on the interbutts without a licence.

11 Name: #!/usr/bin/anonymous : 2014-08-07 23:41 ID:muqlh1bG

>>10
In some countries, that's rather difficult. Luckily, the WTFPL covers such cases.

Name: Link:
Leave these fields empty (spam trap):
More options...
Verification:

HELP Cinemageddon.net (3)

1 Name: #!/usr/bin/anonymous : 2014-07-14 19:28 ID:f5AD22xa

Keep Cinemageddon.net open with new servers, send money to my paypal at donate@beerfund.me

Help us fuck Hollywood and the MPAA in the ass!

2 Name: #!/usr/bin/anonymous : 2014-07-24 09:17 ID:Heaven

Begging for donations on 4-ch of all of the places? Pathetic.

3 Name: gorrillaconvention : 2014-08-03 20:59 ID:Heaven

i dont care who says theyre hot or they arent id still put it in all their holes

Name: Link:
Leave these fields empty (spam trap):
More options...
Verification:

Scala thread (4)

1 Name: #!/usr/bin/anonymous : 2012-02-08 21:38 ID:/YIKnO1d

Hello, Anon. Scala programmer is here. Ask questions.

2 Name: #!/usr/bin/anonymous : 2012-02-10 16:35 ID:Heaven

What's the difference between "null", "Null", "None", and "Nil"?
And why is there any?

3 Name: #!/usr/bin/anonymous : 2014-05-06 01:15 ID:rN/fvWh0

I heard that Scala gives weird backtraces due to the fact that the JVM was built for Java, not a functional language. Any comment on this?

4 Name: #!/usr/bin/anonymous : 2014-06-22 12:04 ID:B2Tt70/Q

>>3
Scala gives weird backtraces because like all ML derivatives, the compiler takes extreme liberties with regard to how its output ends up looking. Much like a segfaulting Haskell program is nigh-impossible to debug with a e.g. gdb, which is oriented towards procedurally-structured compiler outputs.

Name: Link:
Leave these fields empty (spam trap):
More options...
Verification:

Live coding tool (5)

1 Name: #!/usr/bin/anonymous : 2014-04-28 06:26 ID:fjtdgAlQ

Who else likes live coding?

Here is a screenshot of the live coding environment I wrote based on Lua:
http://i.imgur.com/z55ezrV.png

In the past, I've embedded Forth (with FICL Forth), Scheme (s7 scheme) and Lisp (using ECL). If you want a Lisp machine, why not make a live coding environment by embedding a Lisp of your choice?

2 Name: #!/usr/bin/anonymous : 2014-04-28 16:58 ID:Fthhyn5j

thats pretty cool

3 Name: #!/usr/bin/anonymous : 2014-04-29 15:34 ID:skLXpcBj

>>1
How do you save you're work?

4 Name: #!/usr/bin/anonymous : 2014-04-29 16:11 ID:WTvM5cqX

>>3
The buffers are named. Ctrl-S saves the buffer.
Use the setBufferName function to set the name.

The buffers are intended to be used as live REPLs as well as source files. In that way, its similar to a C64.

I haven't directly made it possible to save the state of the world, just the buffers. If you want to save some state, you need to print what you want to save into the buffer.
For example:
print2(inspect(_G)) traverses all variables and tables and inserts their values into the buffer.

I should probably make a video.

5 Name: #!/usr/bin/anonymous : 2014-04-30 22:53 ID:z4vD3Jlv

>>4
neat[i]![/i]

Name: Link:
Leave these fields empty (spam trap):
More options...
Verification:

[Code Help]General code help?[PHP] (12)

1 Name: #!/usr/bin/anonymous : 2014-04-16 17:06 ID:tTTThWto

I was running a textboard that has custom software. It has gone down due to reasons beyond my control (got a new router, AT&T won't let me port forward like I was able to do before). Anyways, in the event I can open ports again, I would like to add something to the script. How could I add an Eternal September post date like on DQN? Would I have to play with date()?

3 Name: #!/usr/bin/anonymous : 2014-04-17 06:10 ID:Heaven

php is shit

4 Name: #!/usr/bin/anonymous : 2014-04-19 21:22 ID:Heaven

Ok, thank you >>2
I know, >>3, I can't be botherd to learn anything else.

5 Name: #!/usr/bin/anonymous : 2014-04-19 22:52 ID:Heaven

>>4
Everything else is shit. But not quite as shit as php. php is a magnificent example of a shitty programming language. However, despite being a total pile of shit you may still achieve satori while using it. As a architectural genius may realize er abilities when stacking blocks of cow dung. After years of toiling with shit, ey will find bricks and concrete, and ey will wounder why the building blocks don't naturally stick together and emit the familiar odor.

6 Name: #!/usr/bin/anonymous : 2014-04-19 23:48 ID:Heaven

>>5
Thank you for that depressing view on languages.

7 Name: #!/usr/bin/anonymous : 2014-04-20 06:44 ID:Heaven

>>6
Don't take it too seriously. Everything is shit in the sense that everything is inadequate at expression in one way or another. But what formal language could possibly compare to the extent of a person's imagination? Nothing.

8 Name: #!/usr/bin/anonymous : 2014-04-21 18:59 ID:07R5RuIa

wouldn't you do?
`$date = Date('2003-09-d')
so that todays date (21st) would say 2003-09-21

9 Name: #!/usr/bin/anonymous : 2014-04-21 19:00 ID:07R5RuIa

*without the backtick. thought that would turn the line into monotype like on ascii boards

10 Name: #!/usr/bin/anonymous : 2014-04-25 19:32 ID:x9BsBbjb

Ok, so based on what >>2-san gave me, this is what I came up with:

$days=21*12*30;//21 because it's been 21 years since 1993
$date = date("1993-09-$days);
echo $date;
Would this be correct? Because every time I check http://www.eternal-september.org/ I'm off by 18 days.

11 Name: #!/usr/bin/anonymous : 2014-04-26 12:57 ID:VhMy9ojj

>>8
Days accumulate. I.e. we're on day 7543 today (september 1993).
>>9
You need to match the opening backtick with a closing backtick. On your post form, click More options..., there is an option box for Formatting:. The default is WakabaMark, see docs here http://wakaba.c3.cx/docs/docs.html#WakabaMark
>>10
$days is a constant and not a variable! I.e. it does not depend on the actual date. How can it possibly update?
You'd first need to retrieve the current date, for example 26/4/2014.
Then you calculate

#        20 years         3 months     current month
$days = (2013-1993)*365 + 3*30 + 26;

But this is a rough calculation that is not correct. The first problem is that not all months have 30 days, and the second is that not all years have 365 days.

Post too long. Click to view the whole post or the thread page.

12 Name: #!/usr/bin/anonymous : 2014-04-26 22:37 ID:gCTBJ7nM

>>11
Thank you! To be honest, I didn't know much about mktime(). But now the function makes sense. Your code works perfectly, thank you. I'm just working on removing everything after the decimal.

Name: Link:
Leave these fields empty (spam trap):
More options...
Verification:

Is this board alive? (3)

1 Name: #!/usr/bin/anonymous : 2014-04-26 08:40 ID:n6Yf9IpJ

Is it sentient?

2 Name: #!/usr/bin/anonymous : 2014-04-26 15:22 ID:zriFw6ue

>>1
Yes [spoiler]no[/spoiler] [spoiler]maybe [/spoiler][spoiler]so[/spoiler]

3 Name: #!/usr/bin/anonymous : 2014-05-04 04:43 ID:Heaven

yawn

Name: Link:
Leave these fields empty (spam trap):
More options...
Verification:

New thread

Title:
Name: Link:
Leave these fields empty (spam trap):
More options...
Verification: