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

I reproduced an error I found in safari. (3)

1 Name: !!nxAAFzeH : 2012-04-20 18:02 ID:bYNH13z5

I recently reproduced an KERN_INVALID_ADDRESS error I found in Safari. Where should I go from here? Could the right person make an exploit out of this?

gdb log is here.

http://paste.pocoo.org/show/584311/

2 Name: !!nxAAFzeH : 2012-04-20 20:50 ID:bYNH13z5

Also, I disassembled all of the functions in Safari.
http://minus.com/mbohY4UH2o/

3 Name: #!/usr/bin/anonymous : 2012-05-17 04:15 ID:oSu5BkGN

Put it in html and then troll Mac users?

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

Google app engine (2)

1 Name: #!/usr/bin/anonymous : 2012-05-06 12:43 ID:EcvP9V7E

I want to make a small webapp and learn Python at the same time - because I might want to do a 2d game later and I figured that I would use python for that as well and this project would be a good chance to do so. The problem is, I would want free hosting. Google app engine is free afaik... any experiences using it? Anything?

2 Name: #!/usr/bin/anonymous : 2012-05-09 14:14 ID:k9eAMYMj

Just get some shared hosting or buy a VPN. It's not expensive and a sensible investment.

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

Is Perl a dead language? (24)

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?

15 Name: #!/usr/bin/anonymous : 2009-10-07 02:28 ID:Heaven

>>13

> free, not gnu

it's on a gnu site. it's licensed under gnu's proprietary anti-free license.

> stable, not buggy

if that's true then it's the first such software those gnu fascists have ever produced.

16 Name: #!/usr/bin/anonymous : 2009-10-07 10:57 ID:Heaven

>>15

> it's on a gnu site. it's licensed under gnu's proprietary anti-free license.

The website is called 'nongnu.org'. What does that tell you? The licence used is BSD.

> if that's true then it's the first such software those gnu fascists have ever produced.

1) It's not written by someone associated with GNU
2) GNU has stable software

What exactly is your problem?

17 Name: #!/usr/bin/anonymous : 2009-10-11 01:16 ID:Heaven

>>16
Should be plain enough to tell what his problem is -- he's an assclown.

And also, GPL is entirely free for all that will ever matter to you, unless you happen to be either a large corporation or a script kiddie, in either case looking to steal other people's code without any requirement on your part. Quit trolling and go back to 4chan.

18 Name: #!/usr/bin/anonymous : 2009-11-20 05:18 ID:iADIUd8O

>>1
Core language development sent many people into hiatus... or into PHP.

Perl6 is now lagging two years after an acceptable release date.

Core syntax updates like named sub patterns and recursive patterns haven't been addressed. (PCRE library addressed those and PHP got the benefits)

And the need for a performant not-typed object oriented language that is also performant (Python WANTS to be slow and PHP WANTS MOAR FEATURES NOMATTERWHAT! gargle) is now so desperate even something weird as go got an incredible amount of publicity.

Perl6 core promises to throw away regexes in favor of an extended concept, a super regex called rule. I'm all in favour of this, but gimme a working executable I don't have to compile in Haskell dammit.

Is this going to end the duke-nukem way?

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

19 Name: #!/usr/bin/anonymous : 2009-11-20 20:30 ID:Heaven

> named sub patterns and recursive patterns

Perl has those: http://perldoc.perl.org/perlreref.html

> not-typed object oriented language that is also performant

Self and (depending on the form of OO) SBCL, Factor and LuaJIT2. V8 is slowly creeping up.

> I'm all in favour of this, but gimme a working executable I don't have to compile in Haskell dammit.

Pugs has been dead for a few years.

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

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

OOP vs functional (4)

1 Name: #!/usr/bin/anonymous : 2011-03-26 13:11 ID:tubYEjxP

in layman's terms what is the difference between the two ?

2 Name: #!/usr/bin/anonymous : 2011-03-26 21:22 ID:fy1QcJq/

Functional programming isn't the direct opposite of OOP, but of imperative programming. Imperative programming operates on the principle that programs have a global 'state' which should be manipulated to produce the desired results, while functional programming attempts to avoid state and treat all data and program flow as interactions between functions. Having no state is often described as being "functionally pure" or "no side effects."

To use an example, consider possible programs in an imperative and functional style:

def x_plus_three(x):
y = 42 # this would be a side effect
# it's poor programming, but the language won't stop you
return x + 3

Algebra, while not technically a programming language, is indeed functional:

f(x) = x + 3

Notice that using algebra, you couldn't change the value of y from within a function that operates only on x. Purely functional languages are subject to the same constraint- in fact, they don't actually 'change' anything at all, they merely produce brand new outputs by performing calculations on their inputs. This prevents errors in case you didn't want y to become 42 or x to permanently increase by three.

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

3 Name: #!/usr/bin/anonymous : 2012-01-26 01:47 ID:auY5imFY

Functional isn't opposite of OO, because there is functional OO.

OO with immutable objects is functional. (States can still be represented by creating new objects based on old ones.)

From a functional point of view, OO is a way of organizing the types into classes which are tuples of properties optionally linked by inheritance relationships, and of dispatching methods based on class-based pattern matching over the argument lists.

Functional OO is "cleaner" than regular OO in some ways. For instance circle-ellipse issues don't arise, because you can't mutate a circle or ellipse once it is constructed.

4 Name: #!/usr/bin/anonymous : 2012-04-11 02:57 ID:x2KjDRnY

>>3

> circle-ellipse issues don't arise, because you can't mutate a circle or ellipse once it is constructed.

I don't believe you here. You can still make a copy of some object A, and call it B. Hell, you can even call it A with a let statement.

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

Interpreted vs. compiled labguages (10)

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 ?

2 Name: #!/usr/bin/anonymous : 2011-03-07 20:49 ID:my34MICF

That's a false dichotomy. You can compile or interpret any language. There are interpreters for C, and compilers for Python. That's just an implementation decision, and on a level that the beginner won't even notice.

I think what you're trying to ask, though, is whether it's easier to learn a language with an interactive prompt, and I think that it's definitely easier to get a grasp on a language if you can "play with it". That's what makes stuff like logo so inviting to beginners, you can type stuff and see immediately what each line of code does. If you have to write a whole file to be processed all at once, there's a disconnect between the program and its evaluation, and it takes an extra mental step to understand the relationship between the input and output.

3 Name: #!/usr/bin/anonymous : 2011-03-10 17:38 ID:wrk12DB5

I am pretty much an advocate of the idea that what really matters when you are trying to pick a first language is how easily you think you might give up if you face trouble and how much time you have to deal with learning how to fix problems with it. If you really want to learn programming and have a reason to stick with it, I don't see why someone can't just start with straight C.

As far as interpreted versus compiled, I would argue that interpreted languages can be less demanding about how you write your code, but the things that they do to be accommodating require some thought on the programmer's part as to what the interpreter will do to accommodate, which may be viewed by some as adding to it's complexity. This is, of course, not a hard-and-fast rule, but it makes the answer to your question more difficult.

4 Name: #!/usr/bin/anonymous : 2011-03-10 22:04 ID:ra5tCMAc

>>2

can I learn C from an interactive prompt ?

5 Name: #!/usr/bin/anonymous : 2012-01-26 01:56 ID:qGoZU+7A

>>1

You can learn programming much better with a high-quality compiled language that has excellent debugging support, compared to an immature toy interpreted language which has poor debugging support (e.g. interpreter just dies with segfault, or a message that you have some error somewhere in the script).

There is a potential for interpreted languages to make better learning environments because they can have better introspection, debugging and interactivity. However, implementing those things takes work, and you may find that many developers of interpreted languages duck out of them, because usually those people are after the primary result (the language interpreter executes correct programs as fast as possible) and neglect those other things, which are more difficult to do (backtraces, breakpoints, single stepping, etc.)

For instance, most Unix shells have no debugging means, even though they are interpreted. (There is a Bash debugger written in bash, but it's too slow to be useful.)

Awk interpreters (GNU gawk and classic ones) are another example. No useful debugging, and no "REPL" (read-eval-print interactive loop). You're better off doing C or C++ where you can use a debugger like gdb to step through the code.

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

6 Name: #!/usr/bin/anonymous : 2012-02-19 20:46 ID:iYY5jLgh

>>5
You are seriously comparing debuggers for C to awk and shell languages??

Try matlab, python, perl, lisp, and so on. Matlab has an excellent debugger. Probably python has one, idk.

And it's ridiculously easy for people to pick up matlab (or octave, I guess), what with the debugger and the REPL and the whole programming environment/desktop thing.

7 Name: #!/usr/bin/anonymous : 2012-02-19 20:52 ID:iYY5jLgh

>>6
While in C, you have to figure out how to compile programs, deal with all the pointers crap, memory management, no easily available datastructures (though C++'s STL has some, thank you STL). There is a shitload of things you have to figure out in C/C++ before you can begin to program actual stuff. While in python or matlab, you can just start using a book or tutorial. It's shit easy and probably Logo is easier, never used it. ...My point being that interpreted languages are on the whole easier. And C/C++ is definitely fucking not easy and no one should ever start programming using them.

8 Post deleted.

9 Name: #!/usr/bin/anonymous : 2012-02-24 22:58 ID:Heaven

>>7

>compile programs
>pointers

Really?

10 Name: #!/usr/bin/anonymous : 2012-04-11 02:54 ID:GfmQ0aq6

>>9
Yes, really. It seems to me you've never programmed anything more complicated than sorting an array. I hate the fucking around with arrays that I have to do in C to do any kind of vector/matrix stuff. Then there is the using libraries and making sure the fucking thing compiles properly. Making sure all of the fucking versions are correct. Yes, compiling is fucking annoying. Pointers suck especially with regard to keeping track of the levels of pointers and free-ing stuff. Then there is the ridiculous fucking shit that is loops instead of function maps/folds. It is absolutely fucking shit.

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

Backup tweets (2)

1 Name: #!/usr/bin/anonymous : 2012-03-28 13:38 ID:DenC9bHu

How would I use wget to backup all a users tweets into a html file? There's 20 tweets per page so you need to iterate { TWEETS/20 } times

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

Spoilers in Wakaba (10)

1 Name: #!/usr/bin/anonymous : 2011-11-15 16:37 ID:vXrur0sV

So I'm trying to add spoiler support in Wakaba, and I'm having a lot of trouble that I think is stemming from regex. I'm new to perl, so this is a bit hard for me. I'm adding the following to sub do_wakabamark($;$$) to accomplish this:

elsif(/^\[spoiler\]/) # spoilers{
if ($lines[0]=~/^\[spoiler\](.*)/){
while !($lines[0]=~/\[\/spoiler\]$/){
push @spoiler,$1; shift @lines;
}
}
$res.="<span class='spoiler'>".(join "<br />",@spoiler)."</span>";
}

Thanks in advance!!

2 Name: #!/usr/bin/anonymous : 2011-11-15 16:37 ID:vXrur0sV

...oh, and anyone know what's wrong?

3 Name: #!/usr/bin/anonymous : 2011-11-15 20:10 ID:vXrur0sV

Made a bunch of changes and got it working for the most part, but now I can't make the spoilers work if post contains any other text before or after the tags. Here's what I have:

        elsif(/.*\[spoiler\].*/) # spoilers
{
my @spoiler;
if ($lines[0]=~/.*\[spoiler\](.*)/){
shift @lines;
while ($lines[0]!~/\[\/spoiler\]$/){
push @spoiler,$lines[0]; shift @lines;
}
shift @lines;
if ($lines[0]=~/\[\/spoiler\]$/){
$lines[0]="";
}
Post too long. Click to view the whole post or the thread page.

4 Name: #!/usr/bin/anonymous : 2011-11-22 02:57 ID:fn49OQZ2

Ohhhh. Hrm.
How would someone go about doing this in Kareha? I've never worked with Perl before but I'd love to have this on one of my Kareha boards.

5 Name: #!/usr/bin/anonymous : 2011-12-01 23:55 ID:HUAkezOC

>>4

it'd be a simple case of a search/replace for [spoiler] tags and an sgml tag balancer

captcha: shit

6 Name: #!/usr/bin/anonymous : 2012-01-07 10:11 ID:lZtWuGxo

below do_wakabamark is do_spans edit that function

7 Name: Mr. Manager!!vBeIv0NZ : 2012-02-03 04:31 ID:rbxt0snr

>>135-141
So I FINALLY got spoilers working properly. I don't remember who told me, but the only way to get this to work without completely rewriting wakabamark was to hold off on the spoiler function until AFTER all wakabamark related things were completed. Anyways, I went ahead and put my code right after:

    # restore >>1 references hidden in code blocks
$comment=~s/&gtgt;/&gt; &gt;/g;

...which was on line 846 in my version of wakaba.pl. Next is the actual spoiler code:

    # new spoiler code (can't put it in 'do_wakabamark' because of 'do_spans' messing with the order of tags
if($comment=~/.*\[spoiler\].*/){
$comment=~s/\[spoiler\]*/\<span class\=\'spoiler\'\>/g;
$comment=~s/\[\/spoiler\]*/\<\/span\>/g;
$comment=~s/\<span class\=\'spoiler\'\>\<br \/\>/\<span class\=\'spoiler\'\>/g;
$comment=~s/\<\/span\>\<br \/\>/\<\/span\>/g;
Post too long. Click to view the whole post or the thread page.

8 Name: #!/usr/bin/anonymous : 2012-02-08 02:56 ID:DZ2UrGTF

>>7
I use Kareha so it is probably not useful to me, but I am thankful that you came back to share the code with other Wakaba users.

9 Name: xenu : 2012-02-19 15:25 ID:/rDAX+RF

Don't fucking parse BBCode with regex!

10 Name: #!/usr/bin/anonymous : 2012-02-28 05:08 ID:7o0JyRUH

I actually wasn't aware that this was doing this until I read this post. After changing some code around (thanks to your example) I have fixed the problem with my bbcodes that I didn't even know was a problem until now.

Thank you!

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

lol (2)

1 Name: dicks : 2012-02-25 17:03 ID:vYRzb1JR

[b][i][u][o]this board is more dead than[/o][/u] [spoiler][sup]/prog/[/sup][/spoiler][/i][/b]

2 Name: #!/usr/bin/anonymous : 2012-02-25 19:11 ID:Heaven

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

Shitpostan (2)

1 Name: #!/usr/bin/anonymous : 2012-02-24 20:39 ID:RfrRcM3F

Check unary dubs.

2 Name: #!/usr/bin/anonymous : 2012-02-24 20:58 ID:Heaven

Bad frog! Don't pee-pee on strangers! Come back home!

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

What is the diff between RSS and Atom feeds? Is one better? (2)

1 Name: #!/usr/bin/anonymous : 2012-02-19 01:29 ID:j4+woF/p

Most news feed programs I have seen say they support both, but I do not see a difference between the two.

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: