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: HELP Cinemageddon.net (2) 2: What is your definition of "freedom" ? (10) 3: Scala thread (4) 4: [perl] Kareha resources (5) 5: >EXPERT HTML PROGRAMMER (3) 6: Live coding tool (5) 7: [Code Help]General code help?[PHP] (12) 8: Is this board alive? (3) 9: Is Perl a dead language? (29) 10: How to make my own imageboard (6) 11: Interpreted vs. compiled labguages (30) 12: world4ch's /prog/ Emergency Shelter #4 (9) 13: This is the official /prog/riders thread (11) 14: Is Ruby as inefficient as they say (6) 15: Coding Challenge #2! (114) 16: Operating Systems vs Artificial Intelligence (3) 17: 6.034 (6) 18: my own "yet another imageboard-script" (106) 19: Best language for starting out in functional programming? (20) 20: [SICP] LEARNING TIME [PY] (4) 21: HAX MY ANUS (2) 22: OOP vs functional (11) 23: Active (6) 24: Introduction to complexity and the idea od quantum computers (3) 25: Opinions of Codecademy? (8) 26: Programming languages with fast matrix operations (15) 27: [JS] Help me find out the correct speed to sync up with the song 太陽いわく燃えよカオス (5) 28: "4tran"? (52) 29: Spoilers in Wakaba (16) 30: Which one? (4) 31: Backup tweets (4) 32: I reproduced an error I found in safari. (3) 33: Google app engine (2) 34: lol (2) 35: Shitpostan (2) 36: What is the diff between RSS and Atom feeds? Is one better? (2) 37: GameBoy Color emulator in JavaScript (11) 38: Excessive file access in a perl script? (10) 39: Common useful applictions of Perl? (10) 40: How does one put AA art into HTML? (4)

HELP Cinemageddon.net (2)

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.

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

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

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.

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:

[perl] Kareha resources (5)

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.
Name: Link:
Leave these fields empty (spam trap):
More options...
Verification:

>EXPERT HTML PROGRAMMER (3)

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

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:

Is Perl a dead language? (29)

1 Name: #!/usr/bin/anonymous : 2009-07-28 17:56 ID:fC7WlNmb

I have been reading on reddit and digg people are claiming Perl is a dead language. I am a heavy Perl coder and I do not see any of this. What do you think?

20 Name: KnowItAll : 2009-12-13 00:11 ID:CrZLGBMm

Perl is a great scripting language for quick little jobs. All the knobs out there that got such a chubby over this and decided to try and write actual applications in the language and take it on as a way of life R stupid.

21 Name: #!/usr/bin/anonymous : 2009-12-16 00:55 ID:Heaven

Perl is like a tool box. Every family should have one in their home. Owning a tool box doesn't automatically make you a mechanic, but it is liberating to know you can fix things that are quick and easy around the house. And the more you learn to use them, the more you are able to fix.

22 Name: Chris : 2012-01-14 05:32 ID:Sn/rrBhI

Perl was sick, but not dead, in 2009.

However - around mid 2011 - yes - it finally died. Nobody is updating or maintainng any of the major (and already-antique) perl resources anymore.

23 Name: #!/usr/bin/anonymous : 2012-01-17 00:02 ID:Heaven

>>22

┎┰─────────────────────────────────────────────────────────────────────────┐
┃┃ _.-. The neutrality of this post is disputed. │
┃┃ /\|/\ Please see the discussion on the talk page. │
┃┃ --|¯¯ Please do not remove this message until the dispute is resolved. │
┣╋─────────────────────────────────────────────────────────────────────────┤
┃┃ ,_,_ This post does not cite any references or sources. │
┃┃ \ \?\ Please help improve this post by adding citations to reliable │
┃┃ '='=` sources. Unverifiable material may be challenged and removed. │
┖┸─────────────────────────────────────────────────────────────────────────┘

24 Name: #!/usr/bin/anonymous : 2012-04-25 18:15 ID:dQVhDbTe

>>22
you should try perl6/rakudo, seriously

25 Name: #!/usr/bin/anonymous : 2012-06-12 19:09 ID:Heaven

Perl is dead.
Perl6 will not revive Perl.
Perl6 is not a Perl update.
Perl6 is an entirely new language that just happens to be an updated Perl.
New languages are never late, just not yet released.
What I'm trying to say is, Perl is not dead.

Do you understand what I'm saying.

26 Name: #!/usr/bin/anonymous : 2014-04-23 18:31 ID:Qho8HWiq

Perl is the only "big" scripting language in OpenBSD base system. A lot of people still use it for things from quick scripts to full applications. Just a few years ago I was working for a company that managed all DB inventory through Perl and DBI (PostgreSQL and Oracle). I maintained that codebase (something like 20,000 lines of Perl, not counting CPAN modules) and added features as needed, and never ran into the "write once" problem that people often allude to, despite only having met with the original author of that code once. If you simply adopt good practices and write solid code, Perl is a fine choice for many projects. The problem is people who don't know any better run their mouths and others start to believe those lies. But this will come to bite them in the ass, because their favorite language (Python or whatever) will also be subjected to that in time. Anyway, Perl isn't dead any more dead than C. That one also gets a bad rap because of its string handling and buffer overflows, but it's still widely used. Tools that work and are useful will remain...

27 Name: #!/usr/bin/anonymous : 2014-04-26 14:14 ID:u+TFQ6mk

Like >>26 said, OpenBSD uses a lot Perl for everything.
And Perl, is not a dead language, just look the cpan, every day there is a new module.

28 Name: #!/usr/bin/anonymous : 2014-05-04 04:44 ID:Heaven

this thread is almost five years old

29 Name: #!/usr/bin/anonymous : 2014-05-18 22:32 ID:Heaven

>>28
and people still insist that perl was dead five years ago, despite the fact that the latest stable release was only 4 months ago and the latest preview release was last month.

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

How to make my own imageboard (6)

1 Name: #!/usr/bin/anonymous : 2013-12-13 02:52 ID:ivLZN6o0

I am very new to the imageboard setup stuff so I have no clue how to set it up. And I haven't/don't know how to make a table for a DB. If someone could he that would be great.

2 Name: #!/usr/bin/anonymous : 2013-12-13 02:59 ID:ivLZN6o0

Like step by step help.

3 Name: #!/usr/bin/anonymous : 2014-01-03 22:03 ID:+wYIocZK

you need at least a 4 year degree to make an imageboard

4 Name: #!/usr/bin/anonymous : 2014-04-12 09:43 ID:Heaven

>>3
You need at least a 4 inch cock to fuck my anus.

5 Name: #!/usr/bin/anonymous : 2014-04-21 20:10 ID:rqtFFo91

  1. Learn HTML and CSS (or find a cheatsheet)
  2. Learn basic PHP or Perl (one or the other)
  3. Install apache and PHP/Perl and MySQL
  4. Learn SQL commands like SELECT, INSERT, UPDATE, and DROP
  5. ???
  6. PROFIT

Or just do:

[form.html]
``<html><body><h1>Post here:</h1><form name="theform" action="post.php" method="post"><textarea name="comment" placeholder="Post a comment here" rows="8" cols="64"></textarea> <input type="submit" name="submit" value="Reply" /></form></body></html>

[post.php]

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

6 Name: #!/usr/bin/anonymous : 2014-05-03 05:47 ID:Heaven

tl;dr - it takes 4 years 2 weeks 1 second to make an imageboard!
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: