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

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

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

How to make my own imageboard (5)

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

Interpreted vs. compiled labguages (30)

1 Name: #!/usr/bin/anonymous : 2011-03-07 12:48 ID:Aep/pjix

Would you say it's easier for a newbie to pick up programming by learning an interpreted language ?

21 Name: #!/usr/bin/anonymous : 2012-10-20 13:39 ID:77BK0eUh

>>19

I dare to object. Every self-respecting C compiler should spill warnings about UB, until you bend over. To top it off for a bit, stronger typing of C++ treats some UB as hard errors (while creating plethora of new ones in it's wild-west approach to OO).

22 Name: #!/usr/bin/anonymous : 2012-11-24 14:31 ID:/vjq3rnG

>>20
Please don't start with PHP, for the love of God. That is the worst thing anyone could do.

23 Name: #!/usr/bin/anonymous : 2012-11-24 22:29 ID:Heaven

>>22
I mean, feel free to learn it at some point as I fully understand it is necessary to know in some lines of work, but to learn it as a first language will give you bad habits that are hard to drop if they're the first things you learnt.

I recommend learning Scheme while reading SICP. It will start you off with a nice, high standard. Python is okay too if you would rather.

24 Name: #!/usr/bin/anonymous : 2012-11-29 18:32 ID:7Bu9YmDM

>>20
No, oh my god no. PHP is no. Just no.
Is you want to pick up an actual language that is easy, go with Python or Ruby.

25 Name: #!/usr/bin/anonymous : 2012-12-06 19:55 ID:Rm+oYDsT

PHP is an actual programming language. It is, however, not a general-purpose programming language.

26 Name: #!/usr/bin/anonymous : 2013-07-11 19:01 ID:seY6nZns

>>21
Okay then, is there a static code checker that is programmed to detect [b]every[/b] possible UB there is?

27 Name: #!/usr/bin/anonymous : 2013-08-03 10:45 ID:2RNh0GIN

>>20

PHP is a bad language for a beginner. It is far too difficult to find mistakes and the semantics are confusing. A beginner should take a language, which is clean and strict, so he will learn some discipline he needs for more loosely defined languages.

Look for strongly typed languages. Check if they don't have erratic behaviors like:

0 == "0" && 0 == "" && "0" != ""

Look how errors are handled. If these things look sane, it is useful as first language.

Paradigm doesn't matter. You can choose whatever style you want.

28 Name: #!/usr/bin/anonymous : 2013-10-16 12:49 ID:GkO8z4RU

Sure, interpreted languages may seem easier at first, but if you want to get into advanced computer programming and computer science, you'll probably be using compiled languages.

29 Name: #!/usr/bin/anonymous : 2014-04-12 09:46 ID:4xxaYzhl

Sure, interpreted ani may seem easier at first, but if you want to get into advanced anus penetration and penetration science, you'll probably be using compiled ani.

30 Name: #!/usr/bin/anonymous : 2014-04-21 19:17 ID:N/YH8931

>>27
Had this issue when using empty() to check if a set of radio-button options had been filled in, but ticking the option with value 0 failed at validation. found out that empty() uses == rather than ===.

0 !== "0" && 0 !== "".

When you're more experienced, PHP teaches you to assume nothing... so why does (int) "" === 0 ?

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

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

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()?

2 Name: #!/usr/bin/anonymous : 2014-04-17 00:53 ID:Heaven

You probably would have to write your own date function based on PHP's date(). For example if you wanted to stay on 2000 and we have 2014 then you'd have to add (2014-2000)*12 months to your month count. But since you want an eternal september you'd have to calculate 14*12*30 days instead. It's actually really easy.

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

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

>EXPERT HTML PROGRAMMER (1)

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

>EXPERT HTML PROGRAMMER
Name: Link:
Leave these fields empty (spam trap):
More options...
Verification:

world4ch's /prog/ Emergency Shelter #4 (9)

1 Name: Shrine Maiden of Hakurei : 2013-07-06 00:00 ID:BeoV+edZ

This shelter has been designated by the local government for the purposes of temporary protection from the spam storm.

Links of interest:

Please sign the petition!

Kabbalah and other Jewish spells

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

2 Name: #!/usr/bin/anonymous : 2013-08-26 20:29 ID:xQcaql+m

don't sign the petition!!!!!

3 Name: sage : 2013-08-27 04:28 ID:Fgop11xL

we back, without the ability to report threads, like here.

4 Name: #!/usr/bin/anonymous : 2013-08-29 19:22 ID:BeoV+edZ

I thought this had been deleted!

Also, goddamn captchas.

5 Name: #!/usr/bin/anonymous : 2013-09-02 01:52 ID:Fgop11xL

Waiting on a response:
https://boards.4chan.org/q/res/757463#p757464
If some can, please bump to catch the mods attention.

6 Name: #!/usr/bin/anonymous : 2013-09-02 02:17 ID:BeoV+edZ

>>5
What? No.

7 Name: #!/usr/bin/anonymous : 2014-04-08 14:13 ID:Heaven

rest in peaches

8 Name: lol jk : 2014-04-09 07:22 ID:Heaven

>>7
;_;

9 Name: #!/usr/bin/anonymous : 2014-04-13 15:41 ID:eyFmI2A5

bumperu

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

This is the official /prog/riders thread (9)

1 Name: #!/usr/bin/anonymous : 2014-04-12 16:34 ID:YCpP//24

2 Name: #!/usr/bin/anonymous : 2014-04-12 17:45 ID:slOHyfc7

Hey >>1-san, in case you're unaware, we're waiting for you over at http://bbs.progrider.org/prog/ !

3 Name: #!/usr/bin/anonymous : 2014-04-12 18:19 ID:YCpP//24

>>2
thank you

4 Name: #!/usr/bin/anonymous : 2014-04-13 15:51 ID:Heaven

>>2
I get the feeling that he was the ``go back to /g/'' guy

5 Name: #!/usr/bin/anonymous : 2014-04-13 16:43 ID:Heaven

>>4
I too noticed a suspicious increase in shitposting since yesterday. I sort of feel bad for letting him know about /prog/riders now.

6 Name: #!/usr/bin/anonymous : 2014-04-14 13:29 ID:Heaven

>>2,4
I've seen you posting on DQN and other boards. Shut the fuck up, I've known you for years now. You don't feel bad for telling a friend where the new /prog/ is, surely?

7 Name: #!/usr/bin/anonymous : 2014-04-14 18:24 ID:Heaven

>>6
This is my first time posting on 4-ch [i]faggot[/i]

8 Name: #!/usr/bin/anonymous : 2014-04-14 20:33 ID:Heaven

>>7
TEH BAIT

9 Name: #!/usr/bin/anonymous : 2014-04-15 08:25 ID:Heaven

redundancy is fault tolerance.

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

Is Ruby as inefficient as they say (6)

1 Name: #!/usr/bin/anonymous : 2013-05-04 05:49 ID:pe6UtPea

I'm looking into mobile development, and Ruby looks really nice, but I heard it's fairly slow. Is it really as bad as they say? If I don't use Ruby, and I absolutely hate Java, what's a good language for developing software for Android?

2 Name: #!/usr/bin/anonymous : 2013-05-09 22:49 ID:Heaven

Ruby is fairly slow, but much of what you see on the internet about it is exaggerated.

> If I don't use Ruby, and I absolutely hate Java, what's a good language for developing software for Android?

Clojure or C.

3 Name: #!/usr/bin/anonymous : 2013-10-17 22:02 ID:4C81U/b9

SCALA!

4 Name: #!/usr/bin/anonymous : 2013-11-10 00:59 ID:bqCiCcd7

これはアメリカのゲームです。1度やってみてください。
これは、たった3分でできるゲームです。試してみてください。
驚く結果をご覧いただけます。
このゲームを考えた本人は、メールを読んでからたった10分で願い事が
かなったそうです。このゲームは、おもしろく、かつ、あっと驚く結果を貴方にもたらすでしょう。
約束してください。絶対に先を読まず、1行ずつ進む事。
たった3分ですから、ためす価値ありです。
まず、ペンと、紙をご用意下さい。
先を読むと、願い事が叶わなくなります。
①まず、1番から、11番まで、縦に数字を書いてください。②1番と2番の横に好きな3~7の数字をそれぞれお書き下さい。
③3番と7番の横に知っている人の名前をお書き下さい。(必ず、興味の
ある性別名前を書く事。男なら女の人、女なら男の人、ゲイなら同姓の名
前をかく)

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

5 Name: #!/usr/bin/anonymous : 2014-03-10 02:10 ID:9nctplly

No, it's worse

6 Name: #!/usr/bin/anonymous : 2014-04-12 09:42 ID:VIwy/2Tw

2 bad wuby es sloww as fukkk!!! XDDDDDD

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

Coding Challenge #2! (114)

1 Name: Yaranaika Daddy!K./5Izeg0I 05/01/08(Sat)11:21 ID:Heaven

Alright people who know how to tell there computer what to do and how to get there... I bring you a challenge from the interweb.

THE 4K CODE CHALLENGE

Objective: To create the most productive/useful code that as source code is no larger than 4 kilobytes (4096 bytes). There is no restrictions as to what your code does, or what language it is used in.

Rules:

  • The code must be yours, and you must be willing to give your code out to the public domain.
  • You must state EXACTLY what your code does. If it is malicious you must state what it does/exploit.
  • There is no restriction on what language, however markup languages are not allowed. Javascript/VBScript are, and any HTML required to perform the task is not counted towards the byte tally however objects calling to Javascript/VBScript do.
  • Common standard libraries (.h files, javabeans, perl modules etc) are allowed and dont count towards the byte tally.
Post too long. Click to view the whole post or the thread page.

105 Name: #!/usr/bin/anonymous : 2008-04-23 18:26 ID:6rn5Nb8P

reposting this from /prog/ (hi guys!) to compete in the 4K challenge:

<html><head><title>CBC using Mersenne Twister</title><style>body { color: white; background-color: black; }</style><script type="text/javascript">
N = 624;
M = 397;
MATRIX_A = 0x9908b0df;
UPPER_MASK = 0x80000000;
LOWER_MASK = 0x7fffffff;
var mt = new Array(N);
var mti = N+1;
function unsigned32 (n1) { return n1 < 0 ? (n1 ^ UPPER_MASK) + UPPER_MASK : n1; }
function subtraction32 (n1, n2) { return n1 < n2 ? unsigned32((0x100000000 - (n2 - n1)) & 0xffffffff) : n1 - n2; }
function addition32 (n1, n2) { return unsigned32((n1 + n2) & 0xffffffff) }
function multiplication32 (n1, n2) {var sum = 0;for (var i = 0; i < 32; ++i){if ((n1 >>> i) & 0x1){sum = addition32(sum, unsigned32(n2 << i));}}return sum;}
Post too long. Click to view the whole post or the thread page.

106 Name: #!/usr/bin/anonymous : 2008-04-23 18:45 ID:Hnry8iXO

> what does anon think?
Unlike Blum Blum Shub, the algorithm in its native form is not suitable for cryptography.

PS: "anon" lives at 4chan. Here we are anonymous, not Anonymous.

107 Name: #!/usr/bin/anonymous : 2008-04-27 05:20 ID:xxFWOzRb

Monads in Javascript

// Monad stuff
function bindM(m ,k)
{
return function (s) {
tmp = m(s);
a = tmp[0]; s_ = tmp[1];
return k(a)(s_);
}
}
function thenM(m,k) { return bindM(m,function(_){return k;}); }
function returnM(v) { return function (s) { return [v,s]; } }
function evalS(m,s) { return m(s)[0]; }
function getS(s) { return [s,s]; }
Post too long. Click to view the whole post or the thread page.

108 Name: #!/usr/bin/anonymous : 2008-04-27 05:20 ID:Heaven

>>107

// Example parsers
// Parse some parentheses
function parens(s) {
return choice_( doM( char_('(')
, thenM
, parens
, thenM
, char_(')')
, thenM
, parens
)
, returnM(null)
)(s);
Post too long. Click to view the whole post or the thread page.

109 Name: #!/usr/bin/anonymous : 2008-04-27 05:22 ID:Heaven

>>108
Usage: var nestcount = run(nesting,"((()))");

110 Name: #!/usr/bin/anonymous : 2008-05-01 05:38 ID:ohi6hRRc

//Coded by drwho
// Knight's Tour program where moves are base on on horizontal and vertical
// arrays and are accessed by a random number generator. This does only 64
// moves but can be increased. the 0 on the board is the night
// I didn't know how to get C to print out both characters and integers
// or else I would have made the knight k (%c didn't work and just displays
// weird shit). Question? I idle in #4-ch on synirc so come by
// http://en.wikipedia.org/wiki/Knight's_tour

#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <windows.h>

int main(int argc, char *argv[])

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

111 Name: #!/usr/bin/anonymous : 2008-05-01 07:56 ID:ohi6hRRc

//Coded by drwho
// Update: Thanks to a friend from 2600 I was able to shorten the code for the
// chess board. Now that is real hacking!
// Knight's Tour program where moves are base on on horizontal and vertical
// arrays and are accessed by a random number generator. This does only 64
// moves but can be increased. the 0 on the board is the night
// I didn't know how to get C to print out both characters and integers
// or else I would have made the knight k (%c didn't work and just displays
// weird shit). Question? I idle in #4-ch on synirc so come by
// http://en.wikipedia.org/wiki/Knight's_tour

#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <windows.h>

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

112 Name: #!/usr/bin/anonymous : 2008-05-02 16:51 ID:Heaven

113 Name: #!/usr/bin/anonymous : 2014-04-10 20:19 ID:mTcepw93

>>1
Why not just implement an interpreter for lisp or something. That's as useful as you can get because you can implement any other program in that.

114 Name: #!/usr/bin/anonymous : 2014-04-12 08:58 ID:OPaAx9vm

ok I hav it giv me a sec XDD

[code]
mysqld > /dev/usr/in > out.py
out.py < in.tt > ee.ttt
dc -e "5 6 * + +" > ff.rrrr
cat ee.ttt ff.rrrr > src.c
gcc -Wall -O3 src.c -o exe
[/code]

ders my code XDD u need the /devusr/in file tho XDDD

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

Operating Systems vs Artificial Intelligence (3)

1 Name: #!/usr/bin/anonymous : 2014-03-12 19:25 ID:DMEIp9HR

I want to choose the area of specialization - operating systems or artificial intelligence.
On the one hand, I'm interested in operating systems and low-level programming. But this area seems to me to stop. It seems to me that nothing new happens here, "all have been invented". This article (though written long ago) confirmed my thoughts:
http://doc.cat-v.org/bell_labs/utah2000/
On the other hand, artificial intelligence seems to be something very interesting and even exciting. There are many interesting areas - machine learning, machine vision, pattern recognition. Artificial intelligence is associated with robotics. I heard "Around 2025, being a robot programmer will be in demand as much as being an app programmer is today. Study lots of A.I. Start early". But I have friends who say that artificial intelligence - the area is quite boring, mainly related to the meticulous study of algorithms or "primitive selection of parameters for algorithms and preparation of input data for them."

2 Name: #!/usr/bin/anonymous : 2014-04-09 02:53 ID:/uI4LNgY

yall dumb

3 Name: #!/usr/bin/anonymous : 2014-04-12 08:52 ID:o2YMg15H

lel my name is #!/usr/bin/anonymous I'm such a hacker XDDDD

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: