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

RIP /prog/rider (24)

1 Name: #!/usr/bin/anonymous : 2017-03-04 20:05 ID:QUE518++

progrider finally kicked the bucket.. shame. there's news about a new one at goatfinger.ga

15 Name: goatfinger.ga : 2017-03-16 17:11 ID:QUE518++

http://goatfinger.ga/ stallman bircthday celebration

16 Name: #!/usr/bin/anonymous : 2017-03-20 21:59 ID:YZ5lJIdx

>>15
I dislike that 24bit color background remake, can't post there

17 Name: #!/usr/bin/anonymous : 2017-03-21 11:43 ID:QUE518++

>>16
there's a poll running on goat/lounge/ whether to change the bg or not

18 Name: #!/usr/bin/anonymous : 2017-03-25 16:31 ID:kQxOG84M

All the replacements suck.
I am glad progrider is gone though, it had become rank stale and mouldy.

19 Name: #!/usr/bin/anonymous : 2017-03-26 01:46 ID:QUE518++

>>18
what don't you like about them?

20 Name: #!/usr/bin/anonymous : 2017-03-28 01:32 ID:YwvXmZA9

Goatfinger is basically textboard /g/

21 Name: #!/usr/bin/anonymous : 2017-03-28 19:15 ID:kQxOG84M

It's worse than /g/

22 Name: #!/usr/bin/anonymous : 2017-03-29 12:57 ID:QUE518++

how is it like /g/? there's no desktop threads, there's no consumer hardware threads? I think this is just a slander..

23 Name: #!/usr/bin/anonymous : 2017-03-29 13:26 ID:QUE518++

new meem up on the g***f****r frontpage!

24 Name: #!/usr/bin/anonymous : 2017-03-29 13:46 ID:z+P64Enn

>>22
It's worse than /g/ because it's a bunch of internet archaeologists doing a cat -v gettysburg. Progrider had become unreadable trash long long ago and anyone who ends up at the afterparty is a dumb tagalong who didn't realize the punch was piss before they arrived.

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

Befunge, Brainfuck, Obfuscated Crap (45)

1 Name: #!usr/bin/anon 2005-12-05 00:45 ID:PXVSoaQm

This thread is for my fellow brothers (and sisters?) who have embraced useless, obfuscated languages like Brainfuck.

++++++++[>+++++++++<-]>.<++++[>+++++++<-]>+.<++[>+++<-]>+..+++.++++[>++++++++<-]>.<+++++[>++++++++++<-]>+++++.<<.+++.------.<+++[>---<-]>+.

(^.^)/~

36 Name: 36 BITS FOREVER : 2007-02-15 03:59 ID:Heaven

TECO called and said to tell you copycats to go suck eggs.

37 Name: #!/usr/bin/anonymous : 2007-02-15 13:29 ID:Heaven

>>36 bits

Turning called and &c &c.

38 Name: #!/usr/bin/anonymous : 2007-02-15 16:19 ID:Heaven

Or rather, Turing. I spel gud.

39 Name: #!/usr/bin/anonymous : 2007-02-21 08:16 ID:Heaven

How should I do to make a loop in unlambda?

40 Name: #!/usr/bin/anonymous : 2007-03-10 04:13 ID:ATMDVxRe

I found a cool blog site with nice accessible introductions to esolangs:

http://scienceblogs.com/goodmath/goodmath/programming/pathological_programming/

41 Name: #!/usr/bin/anonymous : 2007-03-10 12:28 ID:Heaven

> nice accessible introductions to esolangs

That seems inappropriate!

42 Name: #!/usr/bin/anonymous : 2007-03-10 14:51 ID:ATMDVxRe

Well, esolangs have this "image" that they're about pain and masochism, but I rather prefer the mind-stretching quality of them. You're exposed to things you would never think of.

43 Name: #!/usr/bin/anonymous : 2017-03-07 17:56 ID:ry9qaaLI

dicks out for Harambe

44 Name: SHILLER : 2017-03-14 12:33 ID:d6KkahGl

.....::::;;;;;/⌒)
..::;;;⊆.==卍|_
...:::;;;; ・∀・)
∬;;__つ/ ̄ ̄ ̄/__ I made a /prog/. http://42chan.org
旦 \/Win2000/

SHILLING SHILLING SHILLING SHILLING SHILLING

45 Name: #!/usr/bin/anonymous : 2017-03-18 10:48 ID:AgKmTw9h

>>44
5 shillings! I'm rich!

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

Reading rar-content into memory using Java (5)

1 Name: #!/usr/bin/anonymous : 2008-06-26 12:25 ID:LdvOIobC

I've already done it for zip in my Java program which was pretty straight forward and thought I'd expand it to cover the other most common format rar as well. But I can't find any information about reading the content of rar files to memory.

http://forum.java.sun.com/thread.jspa?threadID=5193691

It is the best example I've found of extracting to disc. I'm no code guru so I might be missing some obvious change you could do to that code to write to memory instead disc.

So if someone could tell me how to change it to reading into a BufferedImage or so instead of to a File, or have some good links to other ways of reading/unpacking rar-content to memory it would be a real help.

2 Name: #!/usr/bin/anonymous : 2008-06-26 13:21 ID:ELkTrT2v

Your best bet is using unrar.dll and writing a JNI wrapper. It's possible to do this without going via disk.

3 Name: #!/usr/bin/anonymous : 2008-06-26 13:22 ID:Heaven

Or I guess you could try using JNA to access the DLL directly.

4 Name: #!/usr/bin/anonymous : 2008-06-27 01:09 ID:Heaven

http://www.koders.com/c/fid0B01FB69E652B633384A49891D6082E2852657DD.aspx

JNI is for pussies, and dear god why do you want to read RAR files?

5 Name: #!/usr/bin/anonymous : 2017-03-14 16:19 ID:wALzs4rq

dicks out for Harambe

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

website without protection (5)

1 Name: anyone : 2016-03-24 15:17 ID:zj0nyDOS

found a website without protection

user & pass: admin

how to fix this bug ?

http://www.sinovator.org/

admin link : http://www.sinovator.org/admin

2 Name: #!/usr/bin/anonymous : 2016-03-24 17:31 ID:Heaven

Send them a condom in the mail

3 Name: #!/usr/bin/anonymous : 2016-03-29 04:18 ID:VsZwb3MW

>>2
Use it first before sending

4 Name: #!/usr/bin/anonymous : 2016-04-03 10:27 ID:Heaven

>>2,3
On its way.

5 Name: #!/usr/bin/anonymous : 2017-03-14 14:25 ID:fpS98v60

dicks out for Harambe

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

Will progrider ever come back? (6)

1 Name: #!/usr/bin/anonymous : 2017-03-12 22:22 ID:q8qpTuoU

Where am I going to JACKSON FIVE GET now?

2 Name: #!/usr/bin/anonymous : 2017-03-13 00:20 ID:OHcqBjKG

In three more posts.

3 Name: #!/usr/bin/anonymous : 2017-03-13 01:46 ID:XwJ3X5Rv

You can find the new location here: http://tinyurl.com/cr45pyp

4 Name: #!/usr/bin/anonymous : 2017-03-13 02:43 ID:KDmHLMPG

5 Name: goatfinger.ga : 2017-03-13 19:43 ID:GgFUxWWL

goatfinger.ga

6 Name: #!/usr/bin/anonymous : 2017-03-14 06:24 ID:thAMDmsW

/prog/ culture is shit now. Just look at the top thread of this board.

http://4-ch.net/code/kareha.pl/1489357359/

In 2006 there was a discussion, in 2017 it's just some retard spamming a /pol/ meme.

I stopped posting here ages ago. I'm only here now because it's still in my feed reader.

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

Harga Lantai Kayu, Lantai Parket vs Lantai Vinyl (3)

1 Post deleted.

2 Post deleted.

3 Name: #!/usr/bin/anonymous : 2017-03-13 21:42 ID:ACjGSKQT

dicks out for Harambe

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

Brainfart: GCC and templates (11)

1 Name: #!/usr/bin/anonymous : 2006-10-25 16:04 ID:yRl1iPbl

Trying to get back into C++ after only using python for almost a year. I ran into this one while trying out partial template specialization, narrowed it down to this simple test case...

#include <iostream>
using namespace std;
template <class T>
struct wtf {
T member;
wtf():member() {}
void message() {
cout << "this is wtf " << member << " ." << endl;
}
};
template <class T>
struct wtf2 : public wtf<T> {
Post too long. Click to view the whole post or the thread page.

2 Name: #!/usr/bin/anonymous : 2006-10-25 21:01 ID:WQDDjra2

structs can have functions?

3 Name: #!/usr/bin/anonymous : 2006-10-25 21:55 ID:cRCqb5aI

>>2
Yes. In C++, the only difference between a struct and a function is that a struct's members are public by default, if I recall right.

4 Name: #!/usr/bin/anonymous : 2006-10-26 07:45 ID:GufioEP4

...ugh, should've googled more first. Apparently it's two-phase name lookup that makes it barf.

Templates and accessing inherited members
http://groups.google.com/group/comp.lang.c++/browse_thread/thread/7b1863222072b340/b75b5b2de84a0a1a

5 Name: #!/usr/bin/anonymous : 2006-10-29 08:39 ID:cMRxjRN8

Isn't partial specialization the sort of thing that you should only whip out if your execution time and/or cache profilers tell you that yeah, maybe using a 32-bit integer for a boolean value wasn't that smart after all?

6 Name: #!/usr/bin/anonymous : 2006-10-29 08:55 ID:cMRxjRN8

>>3
Plus, structs have different alignment rules. I seem to recall that classes' members may be even reordered to get better packing in the presence of alignment constraints, whereas structs need to appear in memory as they are declared.

Where the vtable pointer appears in the struct, I have no idea. It would sound like a rather bad idea to rely on the in-memory format of a structure that has virtual methods.

7 Name: #!/usr/bin/anonymous : 2006-11-10 00:40 ID:6aGbySab

>>6

>>Plus, structs have different alignment rules. I seem to recall that classes' members may be even reordered

blinks

looks at his Vector3D class

looks at use of Vector3D for position (pos) member in a skeletal Joint class

sweats

looks at Joint::draw() function that has the line:

glVertex3fv ((float*)&jointarray[i].pos);

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

8 Name: #!/usr/bin/anonymous : 2006-11-10 05:01 ID:yRl1iPbl

>>7
don't sweat it, your code is fine. heck, if you define operator float* in your vector class, you can ditch the explicit typecast for every function call, too.
9.2.12 Nonstatic data members of a (non-union) class declared without an intervening access-specifier are allocated so that
later members have higher addresses within a class object. The order of allocation of non-static data members separated
by an access-specifier is unspecified (11.1). Implementation alignment requirements might cause two adjacent members not to be allocated immediately after each other; so might requirements for space for managing virtual functions (10.3)
and virtual base classes (10.1).

9 Name: #!/usr/bin/anonymous : 2006-11-10 07:33 ID:6aGbySab

>>8

I thought operator overloading could only overload... operators. Can you really overload typecasts as if they're operators? I've never heard or seen that. If it's true, then I've said it before and I've said it again -- it's pretty much guaranteed I learn something new about C++ every week, for almost like 7 years now. Just last year I found out C++ has try/catch/throw style exceptions... I don't use them (I can only take so much visual clutter), but they're there if I want to.

Actually I did overload the array subscript operator for my Vector classes... so I could've really done, just out of semantic nitpickery (depends on the mood I'm in... sometimes I'm picky, sometimes I'm not):

glVertex3fv (&jointarray[i].pos[0]);

10 Name: #!/usr/bin/anonymous : 2006-11-11 08:09 ID:yRl1iPbl

>>9
Heh, yeah, C++ always has some new stuff, especially the obscure template magic you only tend to see in things like boost.
I have this in my vector class:

operator float*()
{
return (float*)this;
}

11 Name: #!/usr/bin/anonymous : 2017-03-13 21:42 ID:X+RmD5B1

dicks out for Harambe

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

Corporate corner-cutting (5)

1 Name: #!/usr/bin/anonymous : 2007-05-12 01:23 ID:nKnFBqhT

I just bought a new Linksys router. If I surf to http://192.168.1.1/ and enter the administration password, and then go to View Source, here's the first thing I see -- draw your own conclusions:

<!--
*********************************************************
* Copyright 2003, CyberTAN Inc. All Rights Reserved *
*********************************************************

This is UNPUBLISHED PROPRIETARY SOURCE CODE of CyberTAN Inc.
the contents of this file may not be disclosed to third parties,
copied or duplicated in any form without the prior written
permission of CyberTAN Inc.

This software should be used as a reference only, and it not
intended for production use!
Post too long. Click to view the whole post or the thread page.

2 Name: #!/usr/bin/anonymous : 2007-05-12 02:49 ID:Heaven

You're looking for http://4-ch.net/tech/ .

3 Name: #!/usr/bin/anonymous : 2007-05-12 08:45 ID:Heaven

Interesting

4 Name: #!/usr/bin/anonymous : 2007-05-12 09:10 ID:Heaven

Is anyone surprised?

5 Name: #!/usr/bin/anonymous : 2017-03-13 15:19 ID:pi00HQOD

dicks out for Harambe

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

OUTSOURCED TO INDIA (4)

1 Name: #!/usr/bin/anonymous : 2007-04-24 20:10 ID:/WLkuYOq

(lol)

2 Name: #!/usr/bin/anonymous : 2007-04-27 17:51 ID:Heaven

i bet they only let members of the same caste work on the same subpackage class

3 Name: #!/usr/bin/anonymous : 2007-04-29 18:08 ID:Heaven

>>2 ba-dum-tish! Tip your waiters, folks.

4 Post deleted.

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

Unreadable scripts that print cool things (19)

1 Name: #!/usr/bin/anonymous : 2006-07-27 04:35 ID:eKs6qOaU

daniel@navi ~ $ cat bin/win.pl
#!/usr/bin/perl

$_="P;=N?;MA:LB:M\@;N><HA?3RC4RBFB\@EE>C?5CB>9A?>K;CJ7HI4?69J3<:9J39<9K39<9K3::;J49;?E59<AA59A>?76G8\@";$o='.';
s/(.)/for($i=0;$i<ord($1)-50;$i++){print$o;$l++;}if($o eq'.'){$o='x'}else{$o='.'}if($l>=50){print"\n"; $l=0;$o='.'}/ge;

daniel@navi ~ $ bin/win.pl
..............................xxxxxxxxx...........
............................xxxxxxxxxxxxx.........
...........................xxxxxxxxxxxxxxx........
..........................xxxxxxxxxxxxxxxx........
...........................xxxxxxxxxxxxxx.........
............................xxxxxxxxxxxx..........

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

10 Name: #!/usr/bin/anonymous : 2006-11-07 10:56 ID:Heaven

>>8
At a guess, this would be a difference between a BSD sh and bash. On Linux and Mac OS X, the sh and bash executables are the same thing. On the various BSDs and Solaris, bash is GNU bash and sh is an older bourne shell of their own implementation which predates bash.

11 Name: #!/usr/bin/anonymous : 2006-11-10 00:53 ID:njtA+MjN

C code I wrote to print some kind of carpet design with a diagonal symmetry axis:
[code]
putch();z(x){return((x&16)>0)+((x&8)>0)+((x&4)>0)+((x&2)>0)+((x&1)>0);}main(){for(int i=0;i<1024;i&31?0:putch(10),putch(z(i&31)^z((i++&992)>>5)?6:0));}
[/code]

12 Name: #!/usr/bin/anonymous : 2006-12-24 22:30 ID:MW/+zJRM

>>11

test.c:6: warning: data definition has no type or storage class
test.c: In function 'main':
test.c:6: error: 'for' loop initial declaration used outside C99 mode

13 Name: #!/usr/bin/anonymous : 2006-12-26 21:20 ID:Heaven

>>12

gcc -std=c99 ...

14 Name: #!/usr/bin/anonymous : 2006-12-26 23:45 ID:Heaven

>>13

test.c:1: warning: data definition has no type or storage class
test.c:1: warning: type defaults to 'int' in declaration of 'putch'
test.c:1: warning: return type defaults to 'int'
test.c: In function 'z':
test.c:1: warning: type of 'x' defaults to 'int'
test.c: At top level:
test.c:1: warning: return type defaults to 'int'
/tmp/ccmrPvLe.o: In function `main':
test.c:(.text+0x81): undefined reference to `putch'
test.c:(.text+0xc6): undefined reference to `putch'
collect2: ld returned 1 exit status

15 Name: #!/usr/bin/anonymous : 2006-12-27 01:54 ID:Heaven

>>14
s/putch\(\)/putch\(c\)\{return putw\(c,stdout\);\}/

16 Name: #!/usr/bin/anonymous : 2006-12-29 14:40 ID:EUz9Yh2d

>>15
I don't mean to be a grouch, but you're really putch-ering the language there.

17 Name: #!/usr/bin/anonymous : 2007-01-11 02:08 ID:s37EMaVh

#include "stdio.h"
#define e 3
#define g (e/e)
#define h ((g+e)/2)
#define f (e-g-h)
#define j (e*e-g)
#define k (j-h)
#define l(x) tab2[x]/h
#define m(n,a) ((n&(a))==(a))

long tab1[]={ 989L,5L,26L,0L,88319L,123L,0L,9367L };
int tab2[]={ 4,6,10,14,22,26,34,38,46,58,62,74,82,86 };

main(m1,s) char *s; {
int a,b,c,d,o[k],n=(int)s;
Post too long. Click to view the whole post or the thread page.

18 Name: #!/usr/bin/anonymous : 2007-01-12 02:05 ID:Heaven

Not mine, but funny:

#!/usr/bin/perl
for(;print"\e[2J";$d--){for$i(0..31){for(0..7){$|=1;$c=cos$d/($P=4*atan2(1,1));
$s=sin$d/$P;(1,2,4,8,16,32,64,128)[$_]&(63,127,63,1,65,1,65,1,65,1,65,1,65,1,65
,1,63,31,63,1,1,1,65,1,1,1,65,1,1,127,65,127)[$i]&&print"\e[",25+int$c*($Y=-4+
int$i/4)-$s*($X=($i%4-2)*9+$_),";",40+int$s*$Y+$c*$X,"H*"}}select('','','',.1)}

19 Name: #!/usr/bin/anonymous : 2017-03-12 15:34 ID:c/LVWKzS

dicks out for Harambe

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: