Quantcast
[ 3 / biz / cgl / ck / diy / fa / g / ic / jp / lit / sci / tg / vr / vt ] [ index / top / reports / report a bug ] [ 4plebs / archived.moe / rbt ]

/vt/ is now archived.Become a Patron!

/g/ - Technology


View post   

[ Toggle deleted replies ]
File: 475 KB, 1024x1076, 1334682645405.jpg [View same] [iqdb] [saucenao] [google] [report]
40982743 No.40982743 [Reply] [Original] [archived.moe] [rbt]

old thread at >>40973015

>> No.40982749 [DELETED] 

>o
Not
>O

Thread hidden.

>> No.40982761

Stop the OP faggotry, the old thread is on page three. You even fucked up the post body.

>> No.40982763 [DELETED] 

>>40982749
Sugoi autism onee-chan

>> No.40982779

Why make this thread before the other hits bump limit?

>> No.40982793

>>40982779
It had 303 when I created it. The bump limit is at 300.
Make a post there and see if it bumps the thread.
>Protip: It won't

>> No.40982956
File: 1.48 MB, 2798x3484, 1395677719853.jpg [View same] [iqdb] [saucenao] [google] [report]
40982956

Hard to believe people will sit around for several hours waiting for the thread to reach it's bump limit just so they can upload the picture they want, thinking they should spice things up. At least OP's picture is better than picture's of pic related.

Say what you will, but I prefer the Yuki Nagato image over everything else, it's simple, it fits, and there's no issues.

>> No.40982986

>>40982956
>bumping while complaining
Confirmed for retard or false flag.

>> No.40982998

>>40982986
people need to see it

>> No.40982999

>>40982793
>Protip

>>>horsegenitals.com

>> No.40983000

what book should i read?

>> No.40983013

>>40983000
Yes.

>> No.40983100

>>40982793
bump limit is totally irrelevant since the catalog.

>> No.40983126

i resumed programming a 3D file manager.

i overcame the problems with relative axis rotation by a very simple trick, which saves much RAM and CPU time, still needs some minor optimizing later though.

also i implemented something like a focus cycle, but not using the default java classes, because i didn't want to make a canvas3d a container. it would feel somehow odd, wouldn't it?

i will try to split the file listing wheel, next. so in big directories, the file names won't be unreadable and far away, but distributed over several wheels instead.

>> No.40983131

Imbecile here.
Currently learning C (via cs50), and pointers and data structures are making my head explode.
I understand them conceptually, but I can't into practical logic.

If I have a pointer to a pointer to a pointer, how do I dereference the pointer to alter the pointer the pointer is pointing to?

ex:
a->b->c
How do I, say, change b->c to b->d by going through a?

This roasts my noodle even more when b is an array of pointers.
How the hell do I access just the single member and make it point to something else, via a?
a->b.mem[5]->c ?

Trying to construct a trie from scratch and I've been banging my head against a wall for days.
Let me get the FAQ portion done with:
>google it
>get a book
>find examples
I've googled the fuck out of it, and read through every example I can find, but my question is too stupid for anybody else to have ever asked it in the history of the internet. Books with examples are too complicated for me to understand, or gloss over parts of the implementation that I should apparently just intuit as a person who claims to be sapient.
>holy FUCK you're stupid
I know...but pls...

>> No.40983232

>>40982793
Why is /g/'s bump limit so low?

>> No.40983268

>>40983131
haven't used c in a while, but i think it would be something like
(*a)=&d;
maybe. probably wrong though

>> No.40983300

Im making a website that will keep a log of what my code does. Can anyone recommend an API (not sure what you call it) for HTML/PHP? Gedit is not cutting it.

>> No.40983326

>>40983131
>How do I, say, change b->c to b->d by going through a?
*a++;
Will take the object pointed by a (wich happens to be the pointer b) and increment it.

>How the hell do I access just the single member and make it point to something else, via a?
Can't understand the question, sorry. Care to rephrase it ?

Imho you just haven't understood the theory completely.

>> No.40983349

>>40983268
That's the basic expression of a pointer, yeah, but I'm dealing with a data structure that needs to use a sort of "crawler" struct that points to the current and next nodes in a trie, check whether the next node exists and malloc a new node if not, then alter the current node to point to the new node, then alter itself to make the new node the current node and the next possibly null node the next node.

So I have multiple layers of pointer arithmetic that I can't wrap my head around, and the confusing jumble of arrow (->) dot (.) and star (*) notation isn't making things any easier.

I can handle everything else, and I have the whole thing blocked out in pseudocode, I just can't figure out how to turn the pseudocode into real code because the necessary syntax seems too convoluted to my frail brain.

For those curious, I'm trying to construct a trie that can load 150,000 words from a dictionary into memory. A trie being a tree of linked lists with 26 branches per node down to a maximum list length of 45.

>> No.40983420

>>40982743
Python newfag here,
I'm making a virus scanner, it's my first python project. It's a little harder than I thought, but I am absolutely loving the language so far, I'm picking it up fairly quickly, with my only programming knowledge being a little bit of C++ in HS

>> No.40983464
File: 317 KB, 545x473, ken-thompson-dennis-ritchie.jpg [View same] [iqdb] [saucenao] [google] [report]
40983464

>>40983100
The problem is not finding the thread, the problem is having a conversation, like helping or being helped by someone and then the thread disappears.
The only way to end this holy war, is to make the programming thread a sticky and from time to time the first N posts being deleted so nobody has to load a 1000 posts that nobody cares about anymore.

>> No.40983532

I legit had a dream awhile back I was at a house party and D.R. was there. We were in a bed room and K.T. was walking out of the room, D.R. pulled out a bag of coke and ask if I wanted to do some with him. Then I woke up..

Wonder what that dream ment...

>> No.40983614

>>40983300
sounds like you're looking for an IDE or an editor:

emacs
vim
google for others

>> No.40983666

Can this be the real thread or are people too autistic to make that happen?

>> No.40983723

Back in the good old days-- the "Golden Era" of computers-- it was easy to separate the men from the boys (sometimes called "Real Men" and "Quiche Eaters" in the literature). During this period, the Real Men were the ones who understood computer programming, and the Quiche Eaters were the ones who didn't. A real computer programmer said things like "DO 10 I=1,10" and "ABEND" (they actually talked in capital letters, you understand), and the rest of the world said things like "computers are too complicated for me" and "I can't relate to computers-- they're so impersonal". (A previous work [1] points out that Real Men don't "relate" to anything, and aren't afraid of being impersonal.)

But, as usual, times change. We are faced today with a world in which little old ladies can get computers in their microwave ovens, 12 year old kids can blow Real Men out of the water playing Asteroids and Pac-Man, and anyone can buy and even understand their very own personal Computer. The Real Programmer is in danger of becoming extinct, of being replaced by high school students with TRASH-80s.

There is a clear need to point out the differences between the typical high school junior Pac-Man player and a Real Programmer. If this difference is made clear, it will give these kids something to aspire to-- a role model, a Father Figure. It will also help explain to the employers of Real Programmers why it would be a mistake to replace the Real Programmers on their staff with 12 year old Pac-Man players (at a considerable salary savings).

>> No.40983737

You should probably remove that 'For Dummies' book in the image. That garbage should not be recommended to fucking anyone.

>> No.40983739

The easiest way to tell a Real Programmer from the crowd is by the programming language he (or she) uses. Real Programmers use Fortran. Quiche Eaters use Pascal. Nicklaus Wirth, the designer of Pascal, gave a talk once at which he was asked, "How do you pronounce your name?". He replied, "You can either call me by name, pronouncing it 'Veert', or call me by value, 'Worth'." One can tell immediately by this comment that Nicklaus Wirth is a Quiche Eater. The only parameter passing mechanism endorsed by Real Programmers is call-by-value-return, as implemented in the IBM/370 Fortran G and H compilers. Real Programmers don't need all these abstract concepts to get their jobs done-- they are perfectly happy with a keypunch, a Fortran IV compiler, and a beer.

>Real Programmers do List Processing in Fortran.

>Real Programmers do String Manipulation in Fortran.

>Real Programmers do Accounting (if they do it at all) in Fortran.

>Real Programmers do Artificial Intelligence programs in Fortran.

If you can't do it in Fortran, do it in assembly language. If you can't do it in assembly language, it isn't worth doing.

>> No.40983748

>>40983614
I was hoping for something that would let me see the results of what im doing in semi-real time. Im wasting the majority of my time getting images in the right spots and making everything line up. It feels like im drawing in Paint without being able to see the screen.

Can Vim do something like this or am I asking for to much?

>> No.40983770

The academics in computer science have gotten into the "structured programming" rut over the past several years. They claim that programs are more easily understood if the programmer uses some special language constructs and techniques. They don't all agree on exactly which constructs, of course, and the example they use to show their particular point of view invariably fit on a single page of some obscure journal or another-- clearly not enough of an example to convince anyone. When I got out of school, I thought I was the best programmer in the world. I could write an unbeatable tic-tac-toe program, use five different computer languages, and create 1000 line programs that WORKED (Really!). Then I got out into the Real World. My first task in the Real World was to read and understand a 200,000 line Fortran program, then speed it up by a factor of two. Any Real Programmer will tell you that all the Structured Coding in the world won't help you solve a problem like that-- it takes actual talent. Some quick observations on Real Programmers and Structured Programming:

>Real Programmers aren't afraid to use GOTOs.

>Real Programmers can write five page long DO loops without getting confused.

>Real Programmers like Arithmetic IF statements-- they make the code more interesting.

>Real Programmers write self-modifying code, especially if they can save 20 nanoseconds in the middle of a tight loop.

>Real Programmers don't need comments-- the code is obvious.

>Since Fortran doesn't have a structured IF, REPEAT ... UNTIL, or CASE statement, Real Programmers don't have to worry about not using them. Besides, they can be simulated when necessary using assigned GOTOs.

>> No.40983778

>>40983748
You mean see the results of your HTML and CSS in real time? I think Light Table does something similar. http://www.lighttable.com/

>> No.40983782

Data structures have also gotten a lot of press lately. Abstract Data Types, Structures, Pointers, Lists, and Strings have become popular in certain circles. Wirth (the above mentioned Quiche Eater) actually wrote an entire book [2] contending that you could write a program based on data structures, instead of the other way around. As all Real Programmers know, the only useful data structure is the Array. Strings, Lists, Structures, Sets-- these are all special cases of arrays and can be treated that way just as easily without messing up your programming language with all sorts of complications. The worst thing about fancy data types is that you have to declare them, and Real Programming Languages, as we all know, have implicit typing based on the first letter of the (six character) variable name.

What kind of operating system is used by a Real Programmer? CP/M? God forbid-- CP/M, after all, is basically a toy operating system. Even little old ladies and grade school students can understand and use CP/M.

Unix is a lot more complicated of course-- the typical Unix hacker never can remember what the PRINT command is called this week-- but when it gets right down to it, Unix is a glorified video game. People don't do Serious Work on Unix systems: they send jokes around the world on UUCP-net and write Adventure games and research papers.

No, your Real Programmer uses OS/370. A good programmer can find and understand the description of the IJK305I error he just got in his JCL manual. A great programmer can write JCL without referring to the manual at all. A truly outstanding programmer can find bugs buried in a 6 megabyte core dump without using a hex calculator. (I have actually seen this done.)

OS is a truly remarkable operating system. It's possible to destroy days of work with a single misplaced space, so alertness in the programming staff is encouraged. The best way to approach the system is through a keypunch.

>> No.40983795

What kind of tools does a Real Programmer use? In theory, a Real Programmer could run his programs by keying them into the front panel of the computer. Back in the days when computers had front panels, this was actually done occasionally. Your typical Real Programmer knew the entire bootstrap loader by memory in hex, and toggled it in whenever it got destroyed by his program. (Back then, memory was memory-- it didn't go away when the power went off. Today, memory either forgets things when you don't want it to, or remembers things long after they're better forgotten.) Legend has it that Seymore Cray, inventor of the Cray I supercomputer and most of Control Data's computers, actually toggled the first operating system for the CDC7600 in on the front panel from memory when it was first powered on. Seymore, needless to say, is a Real Programmer.

One of my favorite Real Programmers was a systems programmer for Texas Instruments. One day, he got a long distance call from a user whose system had crashed in the middle of saving some important work. Jim was able to repair the damage over the phone, getting the user to toggle in disk I/O instructions at the front panel, repairing system tables in hex, reading register contents back over the phone. The moral of this story: while a Real Programmer usually includes a keypunch and line printer in his toolkit, he can get along with just a front panel and a telephone in emergencies.

>> No.40983804
File: 34 KB, 640x800, 1384459612425.png [View same] [iqdb] [saucenao] [google] [report]
40983804

>>40983739
>People who only use my favorite programming langue are "REAL" programmers.
>Everyone else who understands that programming languages are tools, and different tools are better for different jobs are COWARDS.

>> No.40983819

Anyone here good with WPF/C#/.NET? I'm trying to do some stuff in WPF where I need to get mouseMove events even if the mouse is outside my main window. I've tried capturing the mouse in a few different places (mostly on getting a mouseLeave event) but I just can't get it to raise mouseMove events if the mouse isn't above the window no matter what I do. Stackoverflow et al. all say to capture the mouse and that's all I can find on the topic apart from doing some hacked together shit with global hooks which I don't wanna get into.

>> No.40983822

In some companies, text editing no longer consists of ten engineers standing in line to use an 029 keypunch. In fact, the building I work in doesn't contain a single keypunch. The Real Programmer in this situation has to do his work with a "text editor" program. Most systems supply several text editors to select from, and the Real Programmer must be careful to pick one that reflects his personal style. Many people believe that the best text editors in the world were written at Xerox Palo Alto Research Center for use on their Alto and Dorado computers[3]. Unfortunately, no Real Programmer would ever use a computer whose operating system is called SmallTalk, and would certainly not talk to the computer with a mouse.

Some of the concepts in these Xerox editors have been incorporated into editors running on more reasonably named operating systems-- EMACS and VI being two. The problem with these editors is that Real Programmers consider "what you see is what you get" to be just as bad a concept in Text Editors as it is in Women. No, the Real Programmer wants a "you asked for it, you got it" text editor-- complicated, cryptic, powerful, unforgiving, dangerous. TECO, to be precise.

It has been observed that a TECO command sequence more closely resembles transmission line noise than readable text[4]. One of the more entertaining games to play with TECO is to type your name in as a command line and try to guess what it does. Just about any possible typing error while talking with TECO will probably destroy your program, or even worse-- introduce subtle and mysterious bugs in a once working subroutine.

For this reason, Real Programmers are reluctant to actually edit a program that is close to working. They find it much easier to just patch the binary object code directly, using a wonderful program called SUPERZAP (or its equivalent on non-IBM machines). This works so well that many working programs on IBM systems bear no relation to the original Fortran code.

>> No.40983823

I ALREADY TOLD YOU ONCE!
>>40983623

>> No.40983824

>>40982743
I have learned several languages, but never seen to do anything with them beyond simple calculators and shit. What intermediate projects do you think I should try?

>> No.40983836

>>40983804
how do you not recognize what he's posting?

>> No.40983860

Some programming tools NOT used by Real Programmers:

>Fortran preprocessors like MORTRAN and RATFOR. The Cuisinarts of programming-- great for making Quiche. See comments above on structured programming.

>Source language debuggers. Real Programmers can read core dumps.

>Compilers with array bounds checking. They stifle creativity, destroy most of the interesting uses for EQUIVALENCE, and make it impossible to modify the operating system code with negative subscripts. Worst of all, bounds checking is inefficient.

>Source code maintenance systems. A Real Programmer keeps his code locked up in a card file, because it implies that its owner cannot leave his important programs unguarded [5].

Where does the typical Real Programmer work? What kind of programs are worthy of the efforts of so talented an individual? You can be sure that no Real Programmer would be caught dead writing accounts-receivable programs in COBOL, or sorting mailing lists for People magazine. A Real Programmer wants tasks of earth-shaking importance (literally!).

>Real Programmers work for Los Alamos National Laboratory, writing atomic bomb simulations to run on Cray I supercomputers.

>Real Programmers work for the National Security Agency, decoding Russian

>It was largely due to the efforts of thousands of Real Programmers working for NASA that our boys got to the moon and back before the Russkies.

>The computers in the Space Shuttle were programmed by Real Programmers.

>Real Programmers are at work for Boeing designing the operation systems for cruise missiles.

>> No.40983866
File: 11 KB, 243x208, 12123131.jpg [View same] [iqdb] [saucenao] [google] [report]
40983866

>>40983778
Thank you anon this is exactly what I was looking for.

>> No.40983886
File: 2.84 MB, 4961x3508, 136624089945.png [View same] [iqdb] [saucenao] [google] [report]
40983886

[- Python -]
> http://www.python.org/

Friendly reminder that python is the top notch programming language
and has been heavily adopted by the industry and the academics.

Python has events and conferences all around the world:
> http://www.pycon.org/

Python even has a video repository!!
> http://pyvideo.org/

Find your local pythonistas group
> http://wiki.python.org/moin/LocalUserGroups

Join python and become a true computer scientist

>> No.40983903

>>40983824
A program that simulates a restaurant, with dishes, menus, ingredients, requests etc
A chess game
Stock market simulator
Is there some task that you feel that there isn't any software that can solve it properly? If so implement it.

>> No.40983914

The Real Programmer might compromise his principles and work on something slightly more trivial than the destruction of life as we know it. Providing there's enough money in it. There are several Real Programmers building video games at Atari, for example. (But not playing them-- a Real Programmer knows how to beat the machine every time: no challenge in that.) Everyone working at LucasFilm is a Real Programmer. (It would be crazy to turn down the money of fifty million Star Trek fans.) The proportion of Real Programmers in Computer Graphics is somewhat lower than the norm, mostly because nobody has found a use for Computer Graphics yet. On the other hand, all Computer Graphics is done in Fortran, so there are a fair number of people doing Graphics in order to avoid having to write COBOL programs.

Generally, the Real Programmer plays the same way he works-- with computers. He is constantly amazed that his employer actually pays him to do what he would be doing for fun anyway (although he is careful not to express this opinion out loud). Occasionally, the Real Programmer does step out of the office for a breath of fresh air and a beer or two. Some tips on recognizing Real Programmers away from the computer room:

>At a party, the Real Programmers are the ones in the corner talking about operating system security and how to get around it.

>At a football game, the Real Programmer is the one comparing the plays against his simulations printed on 11 by 14 fanfold paper.

>At the beach, the Real Programmer is the one drawing flowcharts in the sand.

>At a funeral, the Real Programmer is the one saying "Poor George. And he almost had the sort routine working before the coronary."

In a grocery store, the Real Programmer is the one who insists on running the cans past the laser checkout scanner himself, because he never could trust keypunch operators to get it right the first time.

>> No.40983939

The Real Programmer is capable of working 30, 40, even 50 hours at a stretch, under intense pressure. In fact, he prefers it that way. Bad response time doesn't bother the Real Programmer-- it gives him a chance to catch a little sleep between compiles. If there is not enough schedule pressure on the Real Programmer, he tends to make things more challenging by working on some small but interesting part of the problem for the first nine weeks, then finishing the rest in the last week, in two or three 50-hour marathons. This not only impresses the hell out of his manager, who was despairing of ever getting the project done on time, but creates a convenient excuse for not doing the documentation. In general:

>No Real Programmer works 9 to 5. (Unless it's the ones at night.)

>Real Programmers don't wear neckties.

>Real Programmers don't wear high heeled shoes.

>Real Programmers arrive at work in time for lunch.

>A Real Programmer might or might not know his wife's name. He does, however, know the entire ASCII (or EBCDIC) code table.

>Real Programmers don't know how to cook. Grocery stores aren't open at three in the morning. Real Programmers survive on Twinkies and coffee.

>> No.40983961

What of the future? It is a matter of some concern to Real Programmers that the latest generation of computer programmers are not being brought up with the same outlook on life as their elders. Many of them have never seen a computer with a front panel. Hardly anyone graduating from school these days can do hex arithmetic without a calculator. College graduates these days are soft-- protected from the realities of programming by source level debuggers, text editors that count parentheses, and "user friendly" operating systems. Worst of all, some of these alleged "computer scientists" manage to get degrees without ever learning Fortran! Are we destined to become an industry of Unix hackers and Pascal programmers?

From my experience, I can only report that the future is bright for Real Programmers everywhere. Neither OS/370 nor Fortran show any signs of dying out, despite all the efforts of Pas- cal programmers the world over. Even more subtle tricks, like adding structured coding constructs to Fortran, have failed. Oh sure, some computer vendors have come out with Fortran 77 compilers, but every one of them has a way of converting itself back into a Fortran 66 compiler at the drop of an option card-- to compile DO loops like God meant them to be.

Even Unix might not be as bad on Real Programmers as it once was. The latest release of Unix has the potential of an operating system worthy of any Real Programmer-- two different and subtly incompatible user interfaces, an arcane and complicated teletype driver, virtual memory. If you ignore the fact that it's "structured", even 'C' programming can be appreciated by the Real Programmer: after all, there's no type checking, variable names are seven (ten? eight?) characters long, and the added bonus of the Pointer data type is thrown in-- like having the best parts of Fortran and assembly language in one place. (Not to mention some of the more creative uses for #define.)

>> No.40983981

No, the future isn't all that bad. Why, in the past few years, the popular press has even commented on the bright new crop of computer nerds and hackers ([7] and [8]) leaving places like Stanford and MIT for the Real World. From all evidence, the spirit of Real Programming lives on in these young men and women. As long as there are ill-defined goals, bizarre bugs, and unrealistic schedules, there will be Real Programmers willing to jump in and Solve The Problem, saving the documentation for later. Long live Fortran!

>> No.40983999

ITT: Spambots

>> No.40984020

>>40983981
That was beautiful, I remember reading this, The Story of Mel and OS and JEDGAR years ago on some BBS somewhere in cyberspace and just being bewildered. Made me want to get into programming.

>> No.40984034

>>40984020
It really is a great story.

>>40983999
No I'm real, I'm just waiting for my coffee to brew. You can read the whole story here: http://www.pbm.com/~lindahl/real.programmers.html

>> No.40984126

That essay's really dated, there's no reason in this day and age to write in assembler language. Modern compilers do a pretty good job. Sure if you want you could modify the output of those compilers and you might be able make it run faster, but there's no longer a reason to.

>> No.40984133

>>40984126
Embedded systems programming.

>> No.40984155

>>40984126
> there's no reason in this day and age to write in assembler language.
Go tell that to virus/bootloaders/OS/time-critical software/embedded software writters

>> No.40984159

>>40984126
Since when do you have to have a reason to do anything?

>> No.40984168

>>40984159
Since your time is limited.

>> No.40984174

>>40984126
It would've been more right to have said there's no reason to write in Fortran anymore, but you still would've been wrong.

>> No.40984199

>>40984174
why do people write in fortran? serious question

>> No.40984223

>>40984199
It has lots of research applications, in science and engineering, especially theoretical stuff. Same with LISP, how ever LISP is really only AI and fundamental programming theory

>> No.40984243

>>40984223
>how ever LISP is really only AI and fundamental programming theory
if you keep telling that to yourself and it might turned true in your head

- http://jlongster.com/Open-Sourcing-My-Gambit-Scheme-iOS-Game-from-2010
- http://www.naughtydog.com/docs/Naughty-Dog-GDC08-Adventures-In-Data-Compilation.pdf
- http://www.siscog.eu/upload/GESTAO-DE-LISTAS/News/PDF/eclm-2013-siscog-a-story-written-in-lisp-20130602.pdf

>> No.40984265

>>40984243
Oh wow, a whole 3 examples of other uses.

>> No.40984285

>>40984243
You can use a lot of programming languages for a lot of things, I was just talking about what the languages are renowned for. I love LISP and I know you can do lots of stuff with it.

>> No.40984298
File: 8 KB, 274x184, showers.jpg [View same] [iqdb] [saucenao] [google] [report]
40984298

Hey, using python, I'm having trouble with something.

How do I take a function as an argument in another function, rather than simple the result of the first function?

I'm trying to create a function to manipulate data for many different function types, but I'm getting a type error because my function is calling the results of the other functions rather than the functions and arguments themselves.

What do.

>> No.40984315

>>40984298
stop trying to be so pro

>> No.40984355
File: 84 KB, 400x159, 0008swqe.png [View same] [iqdb] [saucenao] [google] [report]
40984355

>>40984315

Impossible, any other ideas?

>> No.40984372

>>40984265
Which are more than enough to demonstrate that Lisp is not restricted to research in some university.
If the average code monkey can't work with anything that is more complex than java that's his problem, not the language.
If all companies are using the same languages just for the sake of using whatever the other company is using it's their loss.
But perpectuating that ignorant myth about lisp being close to useless is not acceptable.

>> No.40984377

>>40984355
first result for "python using functions as parameters" in google

>> No.40984449
File: 24 KB, 538x218, shower2.jpg [View same] [iqdb] [saucenao] [google] [report]
40984449

>>40984377
>python using functions as parameters

Yeah I googled that, but I thought it might be wrong since that's what I did and I'm still getting error type as though it's using result as argument rather than function...

Maybe my problem is elsewhere then, darnit.

>> No.40984745

>>40983300
Aptana is pretty ok.

>> No.40984762

/g/, how do you deal with spaghetti code beyond saving?

>> No.40984793

>>40984762
Patience and time. Rewrite the whole thing be using some pieces of the old code.

>> No.40984805

>>40984762
delete it all and do a %100 rewrite.

>> No.40984810

>>40984762

Spaghetti code is best code, elegance is for women and pederasts.

>> No.40984811

>>40984449

<code>
def test(fn, *args, **kwargs):
return fn(args, kwargs)

def echo (name, *args, **kwargs):
print(name)

test(echo, "pleb")
</code>

>> No.40984825

>>40984811

well that failed

>> No.40984839

and [ /code] without the space between the [ and /

>> No.40984854

>>40984839

ah ty

>> No.40984866

How do I hack programming code and see into other peoples computers without the person knowing? I already know HTML and hiragana btw

>> No.40984878

>>40984449

fixed and added a correction

def test(fn, *args, **kwargs):
return fn(*args, **kwargs)

def echo (name, *args, **kwargs):
print(name)

test(echo, "pleb")
[/bode]

>> No.40984940

>>40984762
Redesign the interface is necessary, hotfix spaghetti code to use this interface, then begin to rewrite every part.

>> No.40984947

Fuck my life guys.

Taking 2 compsci classes over the summer
>CSCI 211 = Continuation of Csci 112 with emphasis on advanced data structures, algorithm design analysis, advanced programming techniques, and user interfaces.
>CSCI 223 = Introduction to the architecture of computer systems. The topics include processor and external device structures and operation, machine operation, machine operations and instructions, assembly language concepts, and assembly language programming.

Then during the fall:
>CSCI 311 = Introduction to the theoretical foundations of computer science, including automata and formal languages.

>CSCI 323 = Study of a contemporary operating system and its set of tools from the perspective of software professionals and system administrators. The course analyzes the system components and their interactions, the tool environment, and system administration issues such as configuration, installation, networking, security, and performance tuning.

>CSCI 450 = History and concepts of programming languages; run-time behavior; formal aspects; language definition; data types and structures; control; and data flow, compilation, and interpretation.

>CSCI 423 = Study of the basic concepts of operating systems, including user interfaces, process management, state saving, interprocess communication, input/output, device drivers, timing services, memory management, file management, and system abstractions.

What the fuck do these even mean??

>> No.40984956

Any recommendations on materials to learn data structures, and when/how to use them?

Preferably C++/Python

>> No.40984977

>>40984947
That doesn't sound too bad, and could even be interesting. What's the worry, you just don't understand it? Just read a few books.

>> No.40985000

post your fibonacci programs

int fib(int n) {
return (n == 1) ? 1 :
(n == 0) ? 0 :
fib(n - 1) + fib(n - 2);
} //End fib()

>> No.40985011
File: 21 KB, 411x450, shower3.jpg [View same] [iqdb] [saucenao] [google] [report]
40985011

>>40984878
I think that's a slightly different problem.

def fixedPoint(f, epsilon):

guess = 1.0
for i in range(100):
if f(guess) - guess < epsilon:
return guess
else:
guess = f(guess)
return guess

def sqrt(a):
def tryit(x):
return 0.5 * (a/x + x)
return fixedPoint(tryit(a), 0.0001)

print sqrt(2)


Returns a TypeError at "if f(guess)" because f is not a function here it's the result of "tryit(a)"

>> No.40985019

>>40984947
I don't see anything in there that wasn't in my vocabulary before I even became a programmer... I think you might end up dropping out if you don't get in some serious reading now

>> No.40985053

>>40985011
Sometimes I have a hard time understanding why certain pics are sometims posted.

>> No.40985066
File: 122 KB, 1175x777, project4.png [View same] [iqdb] [saucenao] [google] [report]
40985066

>>40984977
I'm worried because I was forced to skip CSCI 111 (java 1) and go straight to CSCI 112 (java 2). I'm doing alright in the class (I should have an A), but I feel like it takes me too long to do the projects. For example, the project I'm working on now (pic related) will probably take me 4-6 hours or so, and I'll probably have to go to the tutor for help. I feel like thats way too long. I don't know how I will take harder classes if I cant ace this class. I do find my classes interesting so its not that I dont want to take them, i'm just worried

>> No.40985087

>>40985019
dropping isn't an option, I'm on scholarship so its either buck up and face it head on or pay back 50k. I had no programming experience at all until this semester, so its been a little tough

>> No.40985105

>>40985087
Just make as many programs as you can... It doesn't really matter what. Exercises are available anywhere

>> No.40985107

>>40985066
btw I'm not asking for help or anything, just providing an example as a time reference

>> No.40985139

>>40985011
what's he trying to do though? he's obviously returning an int, why would he expect it to work as a function?

with my example he can call tryit and pass in both a and 0.0001 without calling it.

>> No.40985153
File: 25 KB, 302x318, Pretty Pattern.png [View same] [iqdb] [saucenao] [google] [report]
40985153

I am attempting to make this pretty pattern in Python

>> No.40985179

>>40985153
Remove the scroll bars, they're disgusting.

>> No.40985182

>>40985139

He seems to be trying to remove the other gentleman's trousers.

>> No.40985200

>>40985000
(define (fib n)(if (< n 2) n (+ (fib (- n 1)) (fib (- n 2))))) (fib 9)

>> No.40985202
File: 37 KB, 336x226, 36423780.jpg [View same] [iqdb] [saucenao] [google] [report]
40985202

>>40985182

>> No.40985205

>>40985153
What's the degree offset, 18?

>> No.40985208

>>40985202
Epic meme, upvote.

No seriously, what was that post for?

>> No.40985225

>>40985200
I don't know lisp but this is the most beautiful thing I've ever seen

>> No.40985236

>>40985139

fixedPoint(f, epsilon) is the function I'm working with, sqrt() and tryit() are just examples. I want to be able to place any function that returns a float into fixedPoint()'s 'f' argument, then be able to work with that function within fixedPoint.

>> No.40985237

>>40985205
I have no idea. In the interactive programming textbook for python for functions chapter. This is the exercise it just states to draw that pattern after all the learning about functions.

>> No.40985242

>>40984947
>>CSCI 211 = Continuation of Csci 112 with emphasis on advanced data structures, algorithm design analysis, advanced programming techniques, and user interfaces.
Why are user interfaces in there? Human-machine interaction should have course for itself.

Can someone even explain to me why americans number thoses classes like that?

>>40985066
I don't see anything overly complicated in there it is pretty simple. If don't know any concept or word such as "polymorphic" or "overriden" in there just google it or search the index of your favourite introductory book

>> No.40985247

What text editors do you guys use? No flame wars, just opinions.

>> No.40985257

>>40985205
Let me figure it out and I will tell you and post it in here.

>> No.40985270

>>40985247
For .NET, VS2010.
For Lisp, Emacs.
Vim for everything else.

>> No.40985271

>>40985247
I use vim. The next guy will use vim too, and then some emacs user will appear.
The ides users may reply too.
What is the point of this?

>> No.40985281

>>40985247
Nano
Honestly, it just gets the job done and all the other text editors are harmful

>> No.40985293

>>40985200
I have revised my code according to yours. well played
int fib(int n) {
return (n < 2) ? n : fib(n - 1) + fib(n - 2);
} //End fib()

>> No.40985294

>>40985281
>Honestly,
Ok, now I believe you.

>> No.40985296 [DELETED] 

>>40985153
foldMap (rotateBy ?? unitSquare) [0, 0.1 .. 1]

I'm not sure what your code looks like, but I'm sure as heck it's verbose.

>> No.40985300

TECO

Emacs when I want to multitask, by which I mean be distracted

>> No.40985305

>>40985236

so just use
fixedPoint(tryit, 0.0001)

instead of
fixedPoint(tryit(a), 0.0001)

You need to have to function in scope for it to work though

>> No.40985322

>>40985305

err i'm off today. the function is in scope. that last bit was not meant to be posted.>>40985236

>> No.40985328

>>40985300
What's wrong with single-tasking in Emacs?

>> No.40985330

>>40985300
>TECO

Of all the shit not to use in this day and age... Fucking "real programmer" types are cancer. How are you even on 4chan with your PDP-8?

>> No.40985346

>>40985208

no idea heh

>> No.40985347

>>40985328
The temptation to multi-task

>>40985330
There are a plethora of reasons to use TECO, even today. Would I recommend anyone learn TECO nowadays? Probably not, but I started with TECO and I'll end with TECO, so long as it's still maintained.

>> No.40985365

>>40985305

That's great! No no that was my error, thanks!!

>> No.40985368

>>40984811
[You must be registered to post in this forum.]

>> No.40985371

>>40985247
vim, for developing Haskell

>> No.40985391

>>40985347
Is there a program still in regular use today that's older than TECO? A bit off topic but I'm curious.

>> No.40985397
File: 5 KB, 284x177, images.jpg [View same] [iqdb] [saucenao] [google] [report]
40985397

>>40985368

i fixed my mistake

>> No.40985401

>>40985247
VS and sublime

>> No.40985404
File: 18 KB, 300x300, pretty.png [View same] [iqdb] [saucenao] [google] [report]
40985404

>>40985153
foldMap (rotateBy ?? unitSquare) [0,0.1..0.4]

I'm not sure what your code looks like, but I'm pretty sure it's verbose.

>> No.40985443
File: 26 KB, 300x300, pretty.png [View same] [iqdb] [saucenao] [google] [report]
40985443

>>40985404
Oops, forgot the center lines

foldMap (rotateBy ?? square 1 <> hrule 1 <> vrule 1) [0,0.1..0.4]

>> No.40985470

>>40985443
Imports?

>> No.40985530

>>40982743
anyone wants an atom.io invite?

>> No.40985544

>>40985470
import Control.Lens ((??))
import Data.Foldable (foldMap)
import Diagrams.Prelude


If you actually want to output anything, you probably want to add something like:

import Diagrams.Backend.Cairo
main = renderCairo "output.png" (Width 300) $ ...


Or use the diagrams pastebin thing.

>> No.40985560

>>40985443

what language is this?

>> No.40985572

>>40985560
Haskell, obviously

No other language could result in code this concise and beautiful

>> No.40985584

>>40985530
me!

>> No.40985656

>>40984762
You start by giving us Phanck source code

>> No.40985717

>>40985656
That's what I'm worried about.
It's shit, and I don't want to give shit code.
How about, I improve it until the end of April and I release the code then? I'll keep you guys updated and hell, I might even create a web-based demo.
Currently, it pulls data only from Wikipedia, and it isn't really that accurate.

>> No.40985785

Trying to make a game in XNA C#, I want to make a popup window that you can write a name but I'm not exactly sure how to do it. I've looked into Windows Form but I was wondering if there was another way to do it.

>> No.40985805

>>40984762
>beyond saving
Clearly the only solution is to delete and rewrite (in Haskell).

>> No.40985840

>>40985717
Sure.

Could you be more specific on how it does it?

>> No.40985871

Has anyone worked with the youtube api after the g+ update? I've been trying for the last 3 days to retrieve the full list of comments for a video. The v3 api still doesn't support this function, and the v2 is buggy as hell and it can only fetch a maximum number of 100 comments.

I've been trying to scrape the comments directly from the page, but that's the first time I have seen such spaghetti code. After the update, comments are no longer kept on the same page as the video, but are loaded instead using the google api, in an iframe. Try looking yourselves into the source, and see how deorganised it is. Furthermore, it doesn't even load all the comments and you need to send everytime a POST request to retrieve the next 100 comments. You also need to keep the token from the previous page, the author's channel and user id, so the request would be valid.

It wouldn't be such a big problem, if I didn't need the users' ids(or their usernames). After the update, there's no other data than the user's g+ id in the commtens(while scraping directly), and I can't afford to send a get request to each of their channels just to get their channel ids.

Is there any other way?

>> No.40985890

>>40985544
>Or use the diagrams pastebin thing.
Cool!

>> No.40985912

>>40985572
>No other language could result in code this concise and beautiful
Because importing some code is now concise. Show the implementation of functions you call and let's see how concise it is.

>> No.40985924

>>40985840
Trade secret :^)

>> No.40985962

>>40985924
But you're releasing it anyways. So why not?

>> No.40985972
File: 14 KB, 814x364, Two Spirals.png [View same] [iqdb] [saucenao] [google] [report]
40985972

The two spirals in this picture differ only by the turn angle. Draw both in Python language.


import turtle

def drawSpiral(t, angle):
''' takes a turtle, t, and an angle in degrees '''
length = 1
for i in range(84):
t.forward(length)
t.right(angle)
length = length + 2


wn = turtle.Screen() # Set up the window and its attributes
wn.bgcolor("lightgreen")

guido = turtle.Turtle() # create guido
guido.color('blue')

## draw the first spiral ##
# position guido
guido.penup()
guido.backward(110)
guido.pendown()

# draw the spiral using a 90 degree turn angle
drawSpiral(guido, 90)


## draw the second spiral ##
# position guido
guido.home()
guido.penup()
guido.forward(90)
guido.pendown()

drawSpiral(guido, 89)

>> No.40985996

>>40985391
TTY is technically teletypewriter and the name directly goes back to the first teletypewriter back in 1876. Not a program sure, but it's the result of a bit more than just a nod to past technology. On UNIX or UNIX-likes it traces it's roots directly back to the computers of the 40's 50's and early 60's, which used actual teletypewriters. There was a period of time primarily in the 60's where physical teletypewriters were used in conjunction with similarly named virtual teletypewriters. By the 70's and 80's, there was a slow trend that did away with the physical machines. You still could find them every once in a while back in the 90's. Now they're all but gone, how ever the name stuck.

>> No.40986005

>>40983886
Fuck that, I don't want to become an academic. Going to learn me some Real Programmer languages instead. Ones that aren't afraid of GOTO or otherwise religigiously enforce whitespace and fuck you up and make you all mental and shit like those scientologists who are always trying to find converts.

>> No.40986093

>>40985391
COBOL programs (running on PDP11s) are still used in many nuclear power plants.

>> No.40986100

>>40985912
>Because importing some code is now concise.
Yes, it is. What's the problem, does your favorite language not have the reusable tools and combinators available? Maybe you should think about why that is and be enlightened by the power of Haskell's abstraction.

>Show the implementation of functions you call and let's see how concise it is.
foldMap f = foldr (mappend . f) mempty

rotateBy = transform . rotation . review turn

fab ?? a = fmap ($ a) fab

square d = rect d d

hrule d = trailLike $ trailFromSegments [straight $ r2 (d, 0)] `at` (p2 (-d/2,0))
vrule d = trailLike $ trailFromSegments [straight $ r2 (0, (-d))] `at` (p2 (0,d/2))

(QD d1) <> (QD d2) = QD (d2 <> d1)

>> No.40986150

>>40985972
>Python
Why is doing this even an achievement?
Python does all the work for you.
Do it in C/C++/C#/Java.

>> No.40986228

>>40986100
>fab ?? a = fmap ($ a) fab
What's the point? This thing is literally fab <*> pure a

>> No.40986232

>>40986150

ur dum

>> No.40986255

>>40986100
Why is haskell so useless?

>> No.40986260

>>40986228
Not him but you just restricted yourself to Applicative instead of Functor. It's a useful helper.

>> No.40986310

>>40985972
>import turtle

just use Logo man

>> No.40986406

I'm having trouble figuring out how to generate a clean looking summary report in my output file. It needs to give a total amount of each paint used. Pretty new to this.

<script src="http://pastebin.com/embed_js.php?i=HUW70B5N"></script>

>> No.40986411
File: 124 KB, 1000x494, spiral.png [View same] [iqdb] [saucenao] [google] [report]
40986411

>>40985972
let spiral d = fromSegments . zipWith scale [1,0.99..0.01] $
iterate (rotate $ d @@ deg) (straight unit_Y)
in spiral 90 ||| strutX 0.2 ||| spiral 89


Hasklel

>> No.40986430

>>40986406
and I fucked that up hard... How do I embed my code?

>> No.40986461

>>40986430
Copy-paste and use code tags.

>> No.40986473

>>40986430
Read the rules.

>> No.40986490

>>40986406

use std::endl, and look at this example on formatting

https://stackoverflow.com/questions/275484/cout-formatting

>> No.40986506

>>40986093
That's terrifying, although I guess the alternative is upgrading it and risking nuclear failure

>> No.40986532
File: 38 KB, 847x329, Untitled-1.png [View same] [iqdb] [saucenao] [google] [report]
40986532

Why the fuck is my printf not working?

>> No.40986560

>>40986461
>>40986473
Ahhh thanks guys, it wont accept it because its too long I guess.

>> No.40986564

>>40986532
When you use printf it's expected that you actually add some formatting

Else just use print or println

>> No.40986572

>>40986532
because you're using java

>> No.40986581

>>40986490
Will read, thanks anon.

>> No.40986583

What are some commands that are not used by emacs? I need to bind my tmux commands to something

>> No.40986597

>>40985584
>93
I don't want to get banned

>> No.40986605

>>40986564
I know but it still should just print what I told it to. It was working before.
Anyway I fixed it this way:
http://stackoverflow.com/questions/7774428/why-am-i-getting-a-compilation-errors-with-a-simple-printf

I guess I got this error because I updated my java to ver 8.

>> No.40986647

>>40985530
So basically... it's EMACS, but with none of the functionality, huge community, and history of stability? It basically no redeeming features aside from a modern interface?

>> No.40986648

>>40986605

you're using a function that requires a second parameter Object[] and then complaining because it won't just print a string? It's not what it's used for.

>> No.40986664

>>40986648
I opened my old project that used to work and it was fucked because of printf. I wrote this shit just to show it to /g/. I got it fixed now anyway. see >>40986605

>> No.40986705

>>40986664

oh i see

>> No.40986730

>>40986647
No. Its ST, but with none of the functionality, huge community, and history of stability. Its not like ST itself had history or sth though lol

>> No.40986760

>>40986730
Oh well alright. I closed the tab after I saw "hackable" next to a picture of some sublime-like interface

>> No.40986765
File: 5 KB, 406x155, ss (2014-03-24 at 10.48.03).png [View same] [iqdb] [saucenao] [google] [report]
40986765

What do you mean, refactor?

>> No.40986816

https://www.youtube.com/watch?v=FGiMarNz96c

So this is what Dan Murphy gets up to these days...

>> No.40986842

I've never programmed C++ for performance, could some expert rate my brainfuck compiler/toy vm? Specially execution speed and possible optimizations

https://anonfiles [spam a shit] .com/file/0b94160412449ee915da2d1ec2111795

compile with your-c++-compiler -std=c++11 *.cpp

>> No.40986859
File: 165 KB, 1000x968, spiral.png [View same] [iqdb] [saucenao] [google] [report]
40986859

>>40986411
Oops, fixed my padding issue.

Included also 72 and 45 for good measure.

>> No.40986949

>>40986816
He sure plays a mean harmonica

>> No.40986969
File: 5 KB, 504x355, 1395694991674.png [View same] [iqdb] [saucenao] [google] [report]
40986969

>inb4 hurr lel atomic weight is not a verb xD

>> No.40986990

>>40986969
atomic weight is not a verb xD

>> No.40986996

>>40986990
You forgot the "hurr lel".

>> No.40987000

>>40985066
Shouldn't take that long. Maybe 2-3 hours

>> No.40987031

>>40986969
Will 2400 AD be a leap year?

>> No.40987180

>>40986969
If my father's name was John, what was the name of my paternal grandmother's only son?

>> No.40987217

>>40986969
Your "thing" is called "subject"
https://en.wikipedia.org/wiki/Subject_(grammar)

>> No.40987255
File: 4 KB, 504x355, 1395696150478.png [View same] [iqdb] [saucenao] [google] [report]
40987255

H-hold me /g/.
It's my creation.

>>40987031
>>40987180
Not that advanced.
It's kind of dumb, because it pulls information from Wikipedia and parses that.

>>40987217
I never realized that.

>> No.40987351

>>40985871
Please notice me.

>> No.40987382

>>40987255
It's a beautiful creation regardless.
Can you share some background?
How did you implement the parsing?
And what resources did you use?

>> No.40987390

I started learning how to program last week. Started with Python from recommendations on /g/.
It's pretty daunting so far. My friend claims that as soon as you get the logic it becomes easy. Is that true because im getting a bit discouraged.

>> No.40987438

>Be senior in HS
>Talking with a couple friends, one of whom is currently taking Intro to Comp Sci, the other took it a couple years ago
>The one in Intro mentions something about the mysterious syntax of Java (public static private etc)
>Other explains what each means, and explains the String[] args bit as being a "throwback to command line days"
>throwback
>as in, not modern
I died a little. This is what our students are learning.

>> No.40987444
File: 4 KB, 504x355, 1395696921292.png [View same] [iqdb] [saucenao] [google] [report]
40987444

>>40987382
No background at all, I was shitting one day and this idea came to me.
The parsing is really basic at the moment and only supports a few sentence types, but it is sufficient enough.
I didn't use any resource other than the MediaWiki API for getting wiki text.

>> No.40987512

>>40987444
Implement Wolfram Alpha into it.

>> No.40987541

>>40987512
I feel like that would be cheating, since WolframAlpha is already something similar to this.

>> No.40987551

>>40987541
Thought about that afterwards.

>> No.40987557
File: 49 KB, 818x548, 1395697314627.png [View same] [iqdb] [saucenao] [google] [report]
40987557

>>40987541
HOLY TOPPEST LELS
SUCK MY DICK, WOLFRAMALPHA
WOOOOOO

>> No.40987562

Hello Gentlemen

May someone post the learning Programming by example Pic

much thanks

>> No.40987563

>>40987541
Ask it how many Jews died in the holocaust

>muh 6 trillion

>> No.40987564

>>40987444
What is the meaning behind
>3
>11

>> No.40987571

I've started work on an automatic VM shitter. Since I just started work on it, it only changes the theme to High Contrast and opens the Bonzi Buddy install.
Any ideas on what else to add?

>> No.40987580

>>40987564
You'll never know.
:^)

>> No.40987595
File: 83 KB, 466x365, ...jpg [View same] [iqdb] [saucenao] [google] [report]
40987595

>>40987580

>> No.40987736
File: 46 KB, 676x642, 1395697900028.png [View same] [iqdb] [saucenao] [google] [report]
40987736

>>40987557
DOBGEG :^))))))))))
Wolfram|Alpha™ a shit

>> No.40987750

>>40987736
tell them you'll send the code for money

>> No.40987772

>>40987351
>youtube comments
the only valid thing to do with them is to hide them completely.

>> No.40987813

>>40987736
>>40987736
I'm sure you realise this but WA does much more than just trivia questions which is why it's domain in trivia is a lot more limited.

It'd be kind of like feeding some maths into both programs and pointing and laughing and yours because it can't do it.

>> No.40987818

>>40987772
It doesn't matter what I want to with them. I have the comments disabled most of the time, but I need to complete a project where fetching them is needed and I can't continue without it.

>> No.40987824

For linked lists in C, you apparently have to constantly make new nodes via some loop, but in every example I see, it's making several dozen nodes all named new_node.

Why do nodes not require unique variable names in this case? If I tried to initialize thirty different int variables all called num, the compiler would throw a fit.

For that matter, is there no way to algorithmically or procedurally name new variables as they're created, for example declaring "int s" where s is a string containing the name you want to be given to the new int?

>> No.40987841

>>40987255
how did you learn to do things like this?
I mean, what are the technologies and the disciplines behind it?

It looks like magic to me.

>> No.40987869

>>40987813
Difference being WA is praised by some as being the end-all be-all omnicient program.

>> No.40987900
File: 3 KB, 504x355, 1395698469015.png [View same] [iqdb] [saucenao] [google] [report]
40987900

>>40987813
B-but it can!

>> No.40987924

>>40987841
I bet 10 bucks that you don't want to see the code behind it.
You really don't want to.

>> No.40987940

>>40987900
3x^2-2xy+y^2=1

>> No.40987947

>>40987824
Take a closer look at the scope of those node names.

>> No.40988003
File: 19 KB, 183x232, 4ch.png [View same] [iqdb] [saucenao] [google] [report]
40988003

>>40987940
>3x^2-2xy+y^2=1
O-oy vey goy! W-why would you want to solve such complex equations? A-are you going to kill 6 trillion innocent people again?

>> No.40988017

>>40987924
Boo hoo, you did some hacky thing and didn't put any effort into making your code readable or explicit. It's not like we don't have to deal with that all the time anyways or we can't handle it, it's just annoying to see in code that's meant to be worked on by multiple people. In this case of a personal project, nobody minds, and e're more interested in the generalizations of how it works rather than the exact ways you phrased them within the code. As long as it's remotely decipherable, I can assure you that I do in fact want to see the code.

>> No.40988024

>>40987900
"what is the atomic weight of baron?" and "what atomic weight of baron" would work the same, Right?

>> No.40988078
File: 9 KB, 504x355, 1395699115553.png [View same] [iqdb] [saucenao] [google] [report]
40988078

>>40988024
Maybe.

>> No.40988091

>>40987390
Anyone?

>> No.40988093
File: 38 KB, 521x531, 1395699178885.png [View same] [iqdb] [saucenao] [google] [report]
40988093

>>40988017
Here's a snippet.

>> No.40988105

>>40988091
Yes, just practice. Like everything, you need to get used to this way of thinking

>> No.40988115

>>40988093
Spaghetti code ahoy!

I sincerely think you'll be a great programmer in 5-10 years.

>> No.40988122

>>40988078
Is the confidence always just 100/(number of results)?

>> No.40988131
File: 27 KB, 945x266, 1395699295324.png [View same] [iqdb] [saucenao] [google] [report]
40988131

>>40988115
Y-you too!

>> No.40988160

>>40988131
Also have you started learning Haskell yet?

>> No.40988171

>>40988160
Fuck Haskell, read your SICP instead.

>> No.40988172

>>40988131
Can't you put a newline before/after those ORs?

>> No.40988194

>>40987947
Rank amateur here, obviously, but I've only heard of "scope" referencing how deeply nested a part of code is. So variables inside brackets aren't seen outside of them or something to that effect.

But in this case, isn't each declaration of new_node getting dropped on the stack, so that the stack becomes littered with struct variables all with the same name?
I suppose since they're all only accessible via pointers it doesn't matter that much, but I feel like if I typed "free(new_node)" every single one would get wiped out.

I'm guessing this isn't the case, but I'm just having trouble with the theory. I can draw a diagram of a linked list just fine, but it feels like it goes against everything I've been taught up to this point.

>> No.40988214
File: 58 KB, 808x375, 1395699585865.png [View same] [iqdb] [saucenao] [google] [report]
40988214

>>40988122
No.

>>40988160
I tried to begin, but it seemed too unnecessary.

>>40988172
I'm done fine-tuning that function so it's unnecessary. It is usually hidden away like so.

>> No.40988232

>>40988131
That kind of thing makes me like python, where you can just do if words[offset] in ["which","that","who","in"]

>> No.40988280

>>40988131
>words[offset]
>words [offset]
Two things wrong with that
1) Inconsistent style
2) NEVER use that second way

>> No.40988284

>>40988171
But Haskell is actually a good programming language, unlike all other languages.

>> No.40988309

>>40988131
>goto
Oh for the love of god why
Haven't you been bitched at by everyone about using gotos in languages that came after Cobol yet?

>> No.40988311
File: 34 KB, 553x192, muh autism.png [View same] [iqdb] [saucenao] [google] [report]
40988311

>>40988232
I wish C# had that kind of syntactic sugar.

>>40988280
Blame MonoDevelop.

>> No.40988342

>>40988284
That's because Lisp is a level above conventional programming languages.

>> No.40988347

>>40988311
I will continue blaming you because you're responsible for your code's style and chose your own tools.
Modify your IDE not to do that, use a different one, or fix each one yourself.

>> No.40988348
File: 63 KB, 480x640, 1363924202438.jpg [View same] [iqdb] [saucenao] [google] [report]
40988348

gud nite erry1

>> No.40988369

>>40988347
MonoDevelop randomly stops inserting whitespace before brackets because of IntelliSense "crashing".

>> No.40988372

>>40988214
>I tried to begin, but it seemed too unnecessary.
Give it a few more years I guess.

You remind me a lot of myself in the past.

>> No.40988383

>>40988369
That changes nothing that I've said.

>> No.40988485

>>40988194
The new_node inside that constructor function is a pointer. It just points to some location in memory, probably in the heap. Each time that constructor is called to make a new node, that variable will get put on the stack and point somewhere new in memory and then passed back out from the constructor. You have some other variable pointing to the head of the list which gets assigned that location in the main body of your code. new_node only ever even exists in that constructor. free(new_node); wouldn't be valid since new_node doesn't exist.
To delete the whole list list you'd have to do something like
/* list is a pointer to head of linked list, node structure has a next field which is a pointer to next element in list */
for (node *temp_node = list->next; temp_node != NULL; temp_node = list->next)
free(temp_node);

You need to traverse the list because you only have a pointer to the head of the list, that's all you know about. If you just call free(list); then you'll end up with everything but the first element sitting in memory.

>> No.40988770
File: 160 KB, 1920x1080, voronoi.jpg [View same] [iqdb] [saucenao] [google] [report]
40988770

look i made tits

>> No.40988791
File: 212 KB, 1920x1080, voronoi_waves.jpg [View same] [iqdb] [saucenao] [google] [report]
40988791

>>40988770
smooth minimum applied to get rid of tits, then inverted for waves

>> No.40988799

>>40988485
Oh, so what's actually happening, is that it's creating a bunch of nodes without names, and because each one ostensibly is kept track of via a linked list or other pointer arrangement, that doesn't matter?

I think I'm sort of getting it. I've been using pointers off and on for a few weeks now, and I swear every time I look at them , I see something different. It's gotta be the syntax or something messing with my head.

For example:
node* new_node = malloc(sizeof(node));

That creates a pointer to a place in memory, and gives that place in memory a number of bytes equal to the amount needed by the struct. But when I look at it, I can't help but wonder why it's not giving the pointer itself (a four byte variable) the allocated memory instead.
In pseudocode, the line would read "The think pointing at new_node gets allocated the memory needed by struct node", wouldn't it?

>> No.40988822
File: 162 KB, 1920x1080, voronoi2d.jpg [View same] [iqdb] [saucenao] [google] [report]
40988822

>>40988791
mapped from this 2d function:
vec4 smoothvoronoi2d(vec2 p,float t){
float v=0.0;
vec2 f=floor(p)+vec2(0.5);
for(float i=-3.0;i<3.0;i++)
for(float j=-3.0;j<3.0;j++){
srand(f+vec2(i,j));
vec2 o;
o.x=rand();
o.y=rand();
o*=rot2d(t*(rand()-0.5));
float r=distance(p,f+vec2(i,j)+o);
v+=exp(-8.0*r);
}
return vec4(-(1.0/8.0)*log(v));
}

>> No.40988850

>>40987571
Here's what I have so far: http://a.pomf.se/kxxuzy.zip
If nothing's happening, don't panic, Bonzi Buddy is downloading.
DON'T RUN THIS ON ANY COMPUTER THAT YOU LIKE, RUN IT ON A VM OR SOMETHING
Code is in break.ahk or below:
; Config AutoHotkey
SetTitleMatchMode, 2

; Set Theme to High Contrast 2 with Koala
Run rundll32.exe Shell32.dll`,Control_RunDLL desk.cpl desk`,@Themes /Action:OpenThemePack /File:"theme.themepack"
Sleep 4000
WinClose Personalization

; Install Bonzi Buddy
UrlDownloadToFile http://storagecow.eu/Downloads/BonziBuddy432.exe, files/BonziBuddy432.exe
Run files/BonziBuddy432.exe
Sleep 500
Send {Enter}
Send {Enter}
Send {Enter}
Sleep 7000
WinWait TTS
ControlClick Yes, TTS
Sleep 500
ControlFocus Finish, Bonzi
Send {Enter}
Sleep 500
IfWinExist, Agent 2.0
{
ControlClick, Yes
}

>> No.40988868
File: 238 KB, 1920x1080, color_voronoi.jpg [View same] [iqdb] [saucenao] [google] [report]
40988868

>>40988822
without smoothing and with color to differentiate cells:
vec4 voronoi2d(vec2 p,float t){
float v=8.0;
vec4 c;
vec2 f=floor(p)+vec2(0.5);
for(float i=-3.0;i<3.0;i++)
for(float j=-3.0;j<3.0;j++){
srand(f+vec2(i,j));
vec2 o;
o.x=rand();
o.y=rand();
o*=rot2d(t*(rand()-0.5));
float d=distance(p,f+vec2(i,j)+o);
if(d<v){
v=d;
c.r=rand();
c.g=rand();
c.b=rand();
}
}
return vec4(c*(1.0-v));
}

>> No.40988942

>>40988868
runs in real-time on webgl, needs powerful GPU, click and drag to move camera:
https://www.shadertoy.com/view/lsXXRn

>> No.40989013
File: 158 KB, 1365x767, ss (2014-03-24 at 11.02.10).png [View same] [iqdb] [saucenao] [google] [report]
40989013

who said you can't code on windows :^)

>> No.40989033

>>40989013
no-one i think

>> No.40989035

this shit
#!/usr/bin/env python
# raw_text: strips all html and coding tags from block of text


def strip_body(txt,s,e):
x = 0
body_start=txt.find(s,x)

bracket_rt=txt.find('>',body_start+1)

if body_start > -1 and bracket_rt > -1:

body_end=txt.find(e,bracket_rt+1)

return txt[bracket_rt+1:body_end]
else:

return txt


def strip_scope(txt,l,r):
x = 0
clean_string=""
while x < len(txt):
start_tag=txt.find(l,x)
bracket_rt=txt.find(">",start_tag+1)
end_tag=txt.find(r,bracket_rt+1)
if start_tag > -1 and bracket_rt > -1 and end_tag > -1:
clean_string+=txt[x:start_tag]

x = end_tag+len(r)

else:
return clean_string
return clean_string



def strip_tags(txt,l,r):
x = 0
clean_string=""
while x < len(txt):
bracket_lt=txt.find("<",x)
bracket_rt=txt.find(">",bracket_lt+1)
end_tag=txt.find(r,bracket_rt+1)
if bracket_lt > -1 and bracket_rt > -1:
clean_string+=txt[x:bracket_lt]

x = bracket_rt+1

else:
return clean_string
return clean_string



fp=open("/home/winston/test3.html",'r')
pop = strip_body(fp.read(),"<body","</body>")
fp.close()
pop = strip_scope(pop,"<script","</script>")
pop = strip_scope(pop,"<style","</style>")
pop = strip_tags(pop,"<",">")
print pop

>> No.40989041

>>40989013
Nobody did. People say that doing so is gimping yourself.

>> No.40989087

>>40989013
Looks ugly though

>> No.40989093

>>40989035
babby's first insecure as shit “sanitizer”

>> No.40989096

Any C++ friends know how to get the iterator to the beginning of a set of newly inserted elements in a vector?

ie

std::vector<int> hi;
std::vectpr<int> hello;
hello.push_back(1);
hello.push_back(2);
hello.push_back(3);

std::vector<int>::iterator woah;
hi.insert(hi.end(),hello.begin(),hello.end());

// STL doesnt return anything when you insert a range, so how do I get woah to be the iterator of the first newly inserted element?

>> No.40989169

>>40988799
>I can't help but wonder why it's not giving the pointer itself (a four byte variable) the allocated memory instead.
Because the pointer holds no data except for an address. All malloc is doing (at least all you need to worry about it doing) is finding a space in memory big enough to store whatever data you want to store, marking it as being in use, and returning you a pointer to the start of that block of memory.
"new_node gets the address of memory allocated for struct node"

>> No.40989179

>>40989096

wouldn't it be hi.begin()?

>> No.40989198

>>40989096
>vectpr

>> No.40989201

>>40989041
LOL

>> No.40989247

>>40989198
it was just an example

>>40989179
in this case yes but only because hi was initially empty

>> No.40989260

>>40989093
not a sanitize brosphe(at least not in the sense of using it make safe pages) Mainly to be used to strip emails and convert to plain text. They'll be viewed as text anyway so there is no insecurity only aesthetic concerns if some code breaks through and offends my eyes

>> No.40989392

>>40989247

i'm assuming since you have the iterator pos, you just increment that for the newly inserted value.

>> No.40989428

>>40989169
That almost makes too much sense. Thanks, anon, I think I'll be okay now.

>> No.40989459

>>40989392
? No... inserting things into a vector can invalidate the iterators.

>> No.40989487

Can you create programs with guile or is it only mean for scripting and being an extension language?

>> No.40989499

>>40989459

oh yeah good point

>> No.40989581

So I've mainly been using Java, C, and C++ for a little while, but I want to get into web development as something to learn. I was never too sure about which technologies would be best to learn. Obviously some HTML and CSS would be needed, but I was never to sure about additional technologies I should use. Any tips? I want to create some kind of calendar app (just as a project).

>> No.40989611
File: 185 KB, 1366x767, ss (2014-03-24 at 11.36.14).png [View same] [iqdb] [saucenao] [google] [report]
40989611

>>40989013
my god

>> No.40989618

>>40989581
Javascript or something that compiles to javascript.
For a web back-end you can use almost any language.

>> No.40989661

>>40989487
Guile has I/O and can interface with C, you can use it like any other language. It was just originally designed to be an extension language.

>> No.40989733

>>40989611

i want to laugh, but i'm not surprised.

>> No.40989810

What are some fun simulator things to code for someone with ~5 years of programming experience?

I'd like to avoid needing to do graphics since my current setup isn't really good for that, so no Mandelbrot set suggestions pls

>> No.40989864

>>40989611
>winblows
>multiple instances of vim instead of using buffers

>> No.40989881

>>40989810
stock market simulator?

>> No.40989883

Best way to learn C?

>> No.40989895
File: 141 KB, 1920x1080, 1395705419250.jpg [View same] [iqdb] [saucenao] [google] [report]
40989895

>>40989810
strange attractors? they aren't really real-time animated so don't need a good gpu.

>> No.40989896

>>40989864
>i'm using buffers but i need different workspaces for :bufdo, and it's not like vim can tell between buffers from different tabs or allows to group them in any way

>> No.40989907

>>40989883
The C Programming Language

>> No.40989932

>>40989883
I started learning C recently, I looked at the The C Programming Language book, but after a bit I just decided to actually try and make something.

I made a reverse.c that can take inputs from stdin, then wrote linked lists - and at this point I feel really confident with pointers.

It depends on what sort of person you are - reading The C Programming Language might be right up your alley (I've heard only good things), but if you're more of a do person, make something and fix your silly bugs on the way.

>> No.40989937

>>40989896
>i don't know why i greentexted that

>> No.40989997

>>40989932
As a general comment - only do stuff without reading the book if you have a good grasp of another language, it probably helps if it's also imperative/low level.

>> No.40990038
File: 85 KB, 1375x817, 1395705958545.png [View same] [iqdb] [saucenao] [google] [report]
40990038

I just finished implementing a GUI-driven graph theory networking tool which can find shortest paths using Dijkstra's Shortest Path algorithm.

>> No.40990131

>>40990038
What's the shortest path from Me to You? :D

>> No.40990139

>>40990038

i'm jealous of you highly motivated /g/entoos

;_;

>> No.40990169

>tfw my current project is about 20 lines of code and 150 lines of comments

>> No.40990187

>>40990169
Stop embedding mathematical proofs.

>> No.40990230

so, what do when too tired to program because of having spent many hours programming.

chug some coffee and press on like a real man?

listen to some new age advice and like, go take a walk or some other gay shit?

watch tv or browse 4chan and try again in half an hour?

whatch an episode of some pedo-tier anime like K-ON or the one about J-POP idols?

>> No.40990245

>>40990230
Definitely [email protected]

>> No.40990278

>>40990230
Meditate about the meaning of life while you attempt to prove the Riemann hypothesis.

After thirty minutes return to programming.

>> No.40990281

Which is the best practice for your .gitignore?

>commit it
>add it to itself

>> No.40990295

>>40983126
got website/bins? would love to try

> l

>> No.40990310

>>40989096
Just keep track of the size before and after the insert.

>> No.40990361

>>40990230
>so, what do when too tired to program because of having spent many hours programming.
I rest, go to sleep or simply do any thing that isn't programming related.

>> No.40990363

>>40990281
I always commit it, but that's rather because I never thought about adding it to itself.

>> No.40990393

>>40990363
It works fine, so I'm assuming there's no downside. Just wanted to hear some experiences.

>> No.40990400

>>40990230
>get drunk
>get high
>rev up those feels

>> No.40990408 [DELETED] 

>>40990139
What do you mean?

This took me 2 days. It really wasn't as hard as it seems :)

Also, I'm 16 years old and self-taught.

>> No.40990435

>>40990408
Underaged b& detected.

>> No.40990445

>>40990408
>16 years old

>inb4 b&

>> No.40990451

>>40990408
MODSMODSMODS

>> No.40990464

>>40990408
>:)
>self-taught
>underage
No wonder these threads have gone to utter shit in the last year.

>> No.40990513
File: 37 KB, 388x388, d.jpg [View same] [iqdb] [saucenao] [google] [report]
40990513

Adding more fixes and features for my 4chan personal archive program.

https://github.com/diantahoc/chan-archiver

Latest news:
- Added the ability to stop file download.
- Fixed 2 bugs.
- Added save/load functions for manually added threads.

Did I mention that this can run on the raspberry pi? Yep, and pretty fast too. using mono

>> No.40990523
File: 70 KB, 625x626, 1375489311894.png [View same] [iqdb] [saucenao] [google] [report]
40990523

>>40990435
>>40990445
>>40990451

>> No.40990554

>>40990445
>>40990451
>>40990464

damn whistleblowers, the kid seemed cool.

>> No.40990563

>>40988770
This is now my new desktoppaper

>> No.40990579

>>40990554
He is cool, but no one forced him to say that.

>> No.40990584

>>40990554
The kid outed himself like a retard. Cool and smart kids wouldn't do that.

Also, inb4 faggot OP shits up DPT with his image autism again.

>> No.40990587

>>40990169
Comments are good if:
1) They're well made
2) You can bring yourself to actively maintain them
3) They're well made

It's always good to be able to remind yourself what the fuck you were doing several months ago on a Project

>> No.40990640

>>40988348
bonne nuit

>> No.40991321

>>40989810
Sports, like the Football Manager series. There's a lot of scope for high detail.

>> No.40991774

Why isn't this serializing my HashMap? System.print right before it shows the HashMap is full of values but the output never prints "Outputed"

try (
OutputStream file = new FileOutputStream("hashmap.ser");
OutputStream buffer = new BufferedOutputStream(file);
ObjectOutput output = new ObjectOutputStream(buffer);
){
output.writeObject(Index);
System.out.println("Outputed");
}

>> No.40991844

>>40991774
>try(assignments) { code }
Which language has such ass-backwards try-statements?

>> No.40991861

>>40991844
Java, probably should have said that.

>> No.40991905

>>40991861
You are doing something horribly wrong then. I'm surprised this actually compiles.

try {
code here
} catch(ExceptionYouNeedToCatch e) {
cleanup here
}

>> No.40991947

>>40991905
So somthing like this? There's nothing to catch here, there'll always be an Index.
OutputStream file = new FileOutputStream("hashmap.ser");
OutputStream buffer = new BufferedOutputStream(file);
ObjectOutput output = new ObjectOutputStream(buffer);
try {
(output.writeObject(Index));
}

>> No.40992165

>>40991905
Here's the current version and the catch is triggering, any idea why?
try
{
FileOutputStream fileOut = new FileOutputStream("hashmap.ser");
ObjectOutputStream out = new ObjectOutputStream(fileOut);
out.writeObject(Index);
out.close();
fileOut.close();
System.out.printf("Serialized data is saved in hashmap.ser");
}catch(IOException i)
{
i.printStackTrace();
}


Here's the stack trace if that helps.
http://pastebin.com/T4G8iDFZ

>> No.40992637

>>40992165
>out.writeObject(Index);
>NotSerializableException
>Thrown when an instance is required to have a Serializable interface.

>> No.40992651

Turns out my problem was the objects inside the HashMap values weren't set up for serialization.

>>40992637
This, thanks.

>>
Name (leave empty)
Comment (leave empty)
Name
E-mail
Subject
Comment
Password [?]Password used for file deletion.
Captcha
Action