[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
Daily Programming Thread
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 255
Thread images: 24
File: 1422385664777_7.jpg (460 KB, 2500x1000) Image search: [Google]
1422385664777_7.jpg
460 KB, 2500x1000
Old /dpt/ at >>51222231

What are you working on?
>>
first for X#
>>
Improving my skills on StepMania.
>>
shitposts on /g/
>>
>>51222457
Did you write the GUI kit yourself?
>>
>>51230843
What's useful about X#?
>>
>>51230864
All the speed and efficiency of Assembly, with all the usability and compatibility of C#.NET.
>>
I want to work on something but I don't know what..
>>
>>51230875
>with all the usability and compatibility of C#.NET.
huh? How does that work?
>>
>>51230807
any expert c old fart here?
>>
>>51230921
It's essentially Assembly but with Clike syntax.
https://en.wikipedia.org/wiki/X_Sharp
>>
File: trashit.png (406 KB, 570x489) Image search: [Google]
trashit.png
406 KB, 570x489
>>51230937
>X# strings are null terminated.
>>
If you're not in research you're a code monkey
>>
>>51231000
This. CS grad students and researchers UNITE!
>>
>>51230937
Looks cool actually.
>>
>>51231026
No, it looks like a meme clusterfuck.
>>
>>51231056
this
>>
>>51231000
what is that even mean ?
>>
>>51230771

Pointers in C are simple, but not easy. They point to memory addresses.

int x = 5; // regular int 

int *x_pointer; // This type is "pointer to int", (as in, "pointer to where some int lives in memory") but right now it points to some unspecified memory location. The asterix location is convention, but really you can think of this as "int*" instead. In future uses of "x_pointer" you don't need the asterix.

&x; // & is the "address of" operator. This statement does nothing by itself. It returns a pointer to "x"

x_pointer = &x; // Now "x_pointer" actually points to something. It points to the memory location of "x" since we asked for its address.

*x_pointer = 10; // ...wait, we said we don't need the asterix, right? This is called "dereferencing." When you use the asterix like this, it means, "Go get the thing that is pointed to." So here, we're saying, "That address of x we got before? Set the thing at that address to 10."

printf("%d\n", x); // What does this print now?

// Now for some shit that doesn't work.

int *y_pointer;
*y_pointer = 20; // NOPE

// That shit doesn't work because "y_pointer" doesn't point to anything usable.
// It just points to some random area of memory that we don't have access to.

// You can allocate memory and have "y_pointer" point to that instead. Read up on "malloc"
>>
>>51231067

Almost forgot. When you're accessing the field of a struct...

anus->balls;

// is just shorthand for

(*anus).balls;
>>
File: 1265426943001.png (216 KB, 500x468) Image search: [Google]
1265426943001.png
216 KB, 500x468
Hi guys I have little to no programming experience besides an intro to java class I took in high school

What do I do if I want to be a video game code monkey
>>
>>51230927
ye

>>51231000
correct, although research has been murdered
>>
>>51231116
Buy a rope?
>>
>>51231116
You learn C, you read Quake 3.
>>
>>51231122
>although research has been murdered
y?
>>
>>51231122
F
>>
>>51231116
Install Unity and wear a fedora.
>>
>>51231000
>research
so you have no skills in programming and try to leech society by using x algorithm on y and shit a paper about it?
>>
Asking here because /wdg/ is too slow.

I have two jQuery functions, a text input field and a CGI script, and I want the CGI to parse the input and call either foo or bar.
I can parse the input alright, but is there any way to make the script call one of the functions?

I thought about using JSON.
Instead of html, make the CGI script return a JSON object [key, "string"]. On AJAX success I do a switch on the key and call the function with the string as the parameter. This should work, except that I don't know how to work with JSON in jQuery so I'm not sure if it's possible. Technically it should be since all I'm doing is accessing an object, but I may be wrong.

Anyone has any idea?

Obviously if I could just run the code from the CGI that would make it way easier.
>>
>>51231156
Install Xfce and wear a red hat.
>>
>>51231162
web 'development' is not programming.
>>
>>51231162
>jQuery
stopped reading there
>>
>>51231122
would you recommend c as a career ?
>>
>>51231162
>jQuery
>JSON
>he thinks he's a programmer

kljasd mate
>>
File: 1429955062670.jpg (49 KB, 499x826) Image search: [Google]
1429955062670.jpg
49 KB, 499x826
>mfw cabal hell
>>
>>51231197
how do you communicate data structures between languages then fucker
>>
>>51231140
A combination of "good enough" and "everything needs to be marketable" has killed off research.

Pike's talk explains the problem well:
http://herpolhode.com/rob/utah2000.pdf

>>51231195
You will not use just one language in a career.
>>
>>51231181
>>51231185
>>51231197
The backend is done in Haskell, do you think I enjoy working with jQuery? Fucking hell.
>>
>>51231210
with a binary serialization that does not quadruple amount of data.
>>
>>51231000
Research is boring.
>>
>>51231210
If you are sending data structures all the time, maybe you need to reconsider your design.
>>
>>51231220
>haskell
so you don't even work on something useful?

intothetrash.ilbm
>>
>>51231220
>haskell
lel, from one meme language to another. your job is truly... unique
>>
>>51231218
>that formatting
>that medium of communication
>wonders why research sucks
why fund some fuckers who can't even properly communicate what they've done
>>
daily reminder not to help noobs with noobs questions
>>
>>51231233
>gets the job done
>not useful
you have a strange definition of useful

>>51231237
jquery is horrible shit but it's the most widely used scripting library for web, i dont' see how it's a meme
>>
>>51231240
It's the transcript of his talk, with inline slides. "Research sucks" is not the crux of the talk.
>>
>>51231134
this if you're smart and good at math

>>51231156
this tá Žbh fá Žam
>>
>>51231284
>inlining slides
OPTIMIZED
>>
>>51231162
https://www.youtube.com/watch?v=YaG5SAw1n0c
>>
>>51231162

So, rather than troll you, I'll explain something.

There are two separate sides to a web application. There's the server side and the client side. The server side sends shit down. The client side asks for that shit.

The client is the web browser.
The server runs your CGI script.

The web browser eats up all the javascript the server shits down, and then executes it. JQuery is part of that, but it's just a javascript library.

Your CGI scripts run on the server side. Therefore, you can't call those functions from the client.

You're on the right track though. When people are entering input into a field, that's all happening on the client. The server has no idea. You have to tell it.

There are multiple ways you can do this. Your intuition was getting there. You can call back up to the server with jQuery and ask for stuff, and then do some shit with the response.

This is called an XHR or XMLHttpRequest. Most people just call it AJAX. You can do whatever you want with that request, so people started shitting down JSON, XML, CSV and even more HTML.

What you want to do is probably input validation or autocomplete or some shit. When you understand the client server model, you'll understand what shit you want to do in javascript and what you want to do in your CGI stuff.

https://en.wikipedia.org/wiki/Client%E2%80%93server_model
>>
>>51231218
that doesn't look like it's made in roff

what happened to Pike?
>>
>>51231284
im early in it but it's just a bunch of shit arguments

>."But now there are lots of papers in file systems, performance, security, web caching, etc.," you say. Yes, but is anyone outside the research field paying attention?
what does he even want? if there's a a significant devlopment in any of these, they'll be implemented by most big players.
>>
>>51231280
Might as well stop doing /dpt/ all together then
>>
File: ss (2015-11-07 at 02.11.34).png (4 KB, 422x387) Image search: [Google]
ss (2015-11-07 at 02.11.34).png
4 KB, 422x387
New to GUI programming.
I have this python code:
from tkinter import *

master = Tk()

e = Entry(master)
e.pack(expand=1, fill=BOTH)

e.focus_set()

mainloop()

How do I make the cursor start at the top left of the window?
>>
>>51231284
oh nvm the talk is completely old and irrelevant

just like pike
>>
>>51231330
beats having two /sqt/s
>>
>>51231339
read the documentation
>>
>>51231223
There are too many people reinventing the wheel in CS research. A lot of problems we have with systems is 'worse is better', stuff that keeps getting used because everyone else is using it while solutions sit hidden in text books and research papers. Today's grad students need to spend more time standing on the shoulders of giants.
>>
>>51231339
The Entry is for single-line input, use Text.
>>
>>51231380
depends on the field. Machine learning and language processing have been building on the same algorithms and methods/finding new ways to apply them for a while now. Particularly in NLP, it can take so long to develop a system (2-3 years) that will match other systems currently considered state of the art that almost no one goes back and starts from scratch.
>>
>>51231326
research is mostly done by big players and by the programmers in those companies already, 'research' in universities are just a hoax played by professors
>>
How realistically viable it is to work at home?

I hate going to work, i hate those passive agressive pretentious fucking pricks, i hate the whole social bullshit ass game that they play and it really, really, really drains all my energy, i get wolf of wall street levels of stress.

But since i need the money, i can't just quit.
Does anyone here get money from personal projects or something like that? I have one or two ideas that i'm pretty sure i could sell for a good amount, but that amount wouldn't last more than a year..
>>
>>51231396
Thanks anon
>>
>>51231218
it's a little silly to cite a systems talk from 2000 given that most of the interesting advances in distributed computing came after 2000

i've talked to a lot of elder systems researchers and what the pessimal ones pine for are SPECIFICALLY the Wild West of the OS research days. that's how you get quotes like
>The art is gone.
>But art is not science, and that’s part of the point. Systems research cannot be just science; there must be engineering, design, and art.
which is an understandable ~sentiment~, but fairly fucking goofy. i mean you even have the stereotypical bitching about "grandma users," which i just can't respect (go into HPC if you want expert users, there's no shortage of physical scientists with hard problems.) you also have him pulling things out of his ass like GUI design that frankly have very little to do with "systems," you can really tell he came from the early days of all-singing, all-dancing research

part of the issue tbqh is that i've never heard any good, unorthodox ideas for an OS actually pitched. i'm not sure they're out there. you hear talk about message passing or heterogenous cores -- they're not interesting and frankly, not that advanced, the fucking microkernel was just not that brilliant. it was a failed experiment. the barrelfish paper was popular for a while but was it actually THAT innovative or interesting? they got an OS to run on multiple cores. wooooooo
>>
>>51231423

You have to *take* peoples money. You have to take it from them.

Most people can't handle that, so starting their own business doesn't work. Never takes off.

You can work from home though, if you're awesome and have a good work ethic. You have to find a company that allows you to work remotely though. Even then, the pay is usually not as good.
>>
>>51231477
I could change jobs again, but i already did it once, i don't think it's a good idea to keep skipping between jobs, and honestly i don't think the social aspect will ever improve anywhere.
>>
File: processing.png (131 KB, 512x512) Image search: [Google]
processing.png
131 KB, 512x512
Is Processing worth learning?
My first-year programming course covers it, and I'm supposed to make a maze game as my 2nd project.

Other than making some pretty simple games, is it ever really used?
>>
>>51231412
lol
>>
>>51231423
>How realistically viable it is to work at home?
It's a dying trend. You most likely won't find any company worth a shit that allows its teams not to work in person together.
>>
>>51231500

Sounds to me like you've resolved yourself to failure. "I can't do X because of Y. I can't fix Y because I can't do X."

If you hate the social aspect, go do contracting. You'll jump from job to job and won't have time to get tied up in the nonsense.
>>
>>51231056
No, looks cool.
When we moved from assembly to C (and later C++), we lost a fuckload of clarity about what was happening while also losing some speed. Sure, it made development of large programs easier due to the abstraction, but a well-written assembly program can have all the required abstraction while being a fuckload faster and a hell of a lot more readable. X# might close the gap.
>>
File: dog tired from work.jpg (60 KB, 480x486) Image search: [Google]
dog tired from work.jpg
60 KB, 480x486
>>51230807
i just finished writing a program which reads in a weighted graph and returns the shortest distance between two given points

why do things that sound so simple take so long to write
>>
>>51231477
>You have to *take* peoples money. You have to take it from them.

You fucking what?
>>
>>51231596
ummm maybe cause you are a shit programmer?
>>
I have a few beginner questions. I hope it is ok to ask them here.
To learn programming is it necessary to learn about maths/IT as well? I'm a interaction designer and I would like to learn app development while I do my master at university. Should I start with python or swift? I already have 50% of the codeacademy python course but I'm not sure how useful it is going to be if I want to develop iOS apps.
>>
>>51231445
People look at the history of UNIX through rose colored glasses and love to talk about how simple it was and how accessible it was to program on for an ordinary sys admin....and it was. But what people are not aware of is that some really advanced operating systems existed before unix at IBM and DEC that were completely decimated by the proliferation of unix
>>
>>51231641
https://www.youtube.com/watch?v=70Uy7d4b-HY
>>
>>51231645
>masters in interaction design
you can't be serious
>>
>>51231640

TAKE. THEIR. MONEY.
>>
>>51231645
What the fuck is an interaction designer?
>>
>>51231595
> a well-written assembly program can have all the required abstraction while being a fuckload faster and a hell of a lot more readable.
You forgot about unportability.
>>
File: 1385979362770.jpg (27 KB, 256x257) Image search: [Google]
1385979362770.jpg
27 KB, 256x257
>>51231684
>>
>>51231705
There are portable assembly languages like nasm, though.
>>
>>51231645
Depends on the field you're going into. For writing random shitty apps you won't need to know much math at all.
>>
>>51231677
no I have my bachelor in interaction design. My master I do in human factors.

>>51231696
creating concepts, wireframes, UI, UX of interfaces. Not only for apps, software, etc. but also interfaces in the automotive/aero field.
>>
>>51231326
>if there's a a significant devlopment in any of these, they'll be implemented by most big players.
Entrenchment is simply too strong.

>>51231445
>most of the interesting advances in distributed computing came after 2000
Like what? The most interesting advances in distributed computing came in the 1990s.
>>
>>51231728
Can it compile the same program for x64 and any $1 AVR without user having to alter the code?
>>
>>51231728
nasm is only x86.
>>
>>51231283
>jquery is horrible shit but it's the most widely used scripting library for web, i dont' see how it's a meme

>>>/trash/
>>
>>51231747
>creating concepts, wireframes, UI, UX of interfaces.
The fuck? You need a degree to do that? That's not just the job of a UI designer who's going to do every aspect of the design, not just the "wireframe"?
>>
>>51230807
Any embedded programmer around?
I'm trying to figure out how some automatically generated makefile works so I can modify it.

It seems to be using g++ first and then gcc on the output files to generate some .elf file.

make output:
http://pastebin.com/KnLwckqa

makefile:
http://pastebin.com/QXCJ5BUq
>>
>>51231747
>meme degres in my DPT
nope
>>
>>51231650
>operating systems existed before unix at IBM and DEC that were completely decimated by the proliferation of unix
With good reason. The proliferation of Unix is a clear counterexample to my theory that only shitty things can proliferate. But of course now it's entrenched.

Unix WAS simple before Berkeley and MIT started making huge changes and additions without properly understanding the key strengths of Unix's design.
>>
ok this may be a dumb question but how would i go about creating a robots.txt file on all pages of my site?
>>
>>51231595
>but a well-written assembly program can have all the required abstraction while being a fuckload faster and a hell of a lot more readable.
That's only true at small scale. There are companies that fell for that myth and tried to design operating systems written entirely in assembly only to find out in testing that scripting languages can beat it at certain tasks because its impossible for a human to optimize at large scale like a compiler can.
>>
>>51231222
>transmitting and executing binaries from an external source
worse than eval(user_input)
>>
>>51231820
Unix was absolute fucking garbage when it was first released and it never reached even half the capabilities of what it replaced.
>>
>>51231824
it really is a dumb question
>>
>>51231824
fuck off to /sqt/
>>
File: 1421004378744.jpg (94 KB, 750x518) Image search: [Google]
1421004378744.jpg
94 KB, 750x518
>>51231788
UI designer usually don't do the wireframes. Depends on the company though. Interaction designer focus on the 'interaction' between human and machine. Again depends on the company on what he is going to focus. Could be UI design as well.
Personally I focus on things like pic related. That is why I do my master in human factors.
>>
>>51231837
who is talking about executable binaries here? the subject is how to transfer data.
>>
>>51231837
He did not say binaries.

>>51231842
Given that you clearly speak from experience, you can go ahead and list ten.
>>
>>51231860
so hardware design mainly?
>>
>>51231852
>>51231856

nvm ok i got it. So the use of this is only for allowing/disallowing bots to search through your site?
>>
>>51231875
and also how the hardware interacts with the software.
>>
>>51231889
yeah
>>
>>51231595
This is the essential tension in abstraction and why static typing is having a heyday right now. We want to use a high-level language, but then the particulars of our problem are lost in the generic constructs. So then we want static typing to put all that information back in and tell the compiler what we're doing, which is actually why static typing is garbage but whatever, it's all the rage right now. Anyway, then people want typing to be more general and on and on it goes.
>>
>>51231913
reminder that no one actually uses haskell
>>
>>51231913
You sound like a nodejs-hipster who doesn't know fuck about type theory.
>>
>>51231889
allowing/disallowing sounds a bit strong, it's more like a plea.
>>
>>51231595
>When we moved from assembly to C
C wasn't important until after C++ was already widely used.
>>
>>51231966
Take it easy on the kool-aid kid, it's going to give you diabetes.
>>
>>51231997
well meme'd my friend
>>
File: Most JSPythonRuby apps.webm (2 MB, 320x180) Image search: [Google]
Most JSPythonRuby apps.webm
2 MB, 320x180
>>51231972
oh fuck me, >>>/s4s/
>>
>>51231913
>which is actually why static typing is garbage but whatever
Why is static typing garbage exactly?
>>
>>51231972
This is bullshit, prime example is John Carmack used only C to make the original Doom because C++ compilers were to bloated to run on the hardware of the time.
>>
>>51231650
It's true that older OSes were more advanced, but there was also a lot of research that was happening contemporary with Unix. There were OSes with garbage collection, orthogonal persistence, mandatory bounds checking, and so on in the late 70's.
This was mostly research stuff like Barrelfish is today, but there were also commercial products like the IBM System/38 and iAPX 432.
http://homes.cs.washington.edu/~levy/capabook/
>>
>>51232077
>C++ compilers were to bloated to run on the hardware of the time.
How the fuck does this even happen
C++ generates almost exactly the same assembly as C unless you use the more retarded portions of the language. I know a lot of people that write C but use the C++ compiler now
>>
File: ss (2015-11-07 at 03.02.36).png (78 KB, 781x830) Image search: [Google]
ss (2015-11-07 at 03.02.36).png
78 KB, 781x830
>>51231339
Basic text editor here I cum!
It feels so good to make stuff that works.
>>
>>51232077
>C++ compilers were to bloated to run on the hardware of the time
I hate C++ as much as the next totally reasonable person but they were running lisp on shit in the 50s. "Bloat" is such a retarded meme.
>>
>>51231526
not even games, just silly demos
its worth it if you startin of, but there are better languages for beginners (LUA, Python)
processign is essentially java
>>
Are negatives usually handled in the assembler? or do you just output the negative sign as a seperate token and let the parser deal with it?
>>
>>51232095
>C++ generates almost exactly the same assembly as C
It didn't for fucking years. Early C++ compilers were absolutely horrible.
>>
>>51232077
>Doom
Think a decade before that. C was not mentioned until after C++ was popular. The popularity of C++ caused C to become more widely used.
There were probably more people using APL than C.
>>
>>51232195
>assembler
lexer*
>>
>>51232095
>C++ generates almost exactly the same assembly as C unless you use the more retarded portions of the language.
Really? You think all the abstractions of string handling and I/O and OO types and encapsulation all comes for free because it compiles ~exactly~ to the same machine code as C? Nice to see you are drinking up all the C++ memes being shilled here
>>
>>51232119
they were using lisp machines, though.
>>
>>51232096
Meta as fuck
>>
>>51232216
It depends on your language model. If you don't want to use '-' as a unary (or binary) operator, you output a digit and accept negative sign. If you do want to use '-' for other tasks than expressing negative literals, you have to emit it.
>>
>>51229858
Are you using Visual studio? IIRC VS clears the assert macro in release builds.
>>
>>51232246
>If you do want to use '-' for other tasks than expressing negative literals, you have to emit it.
Damn, that just makes my parser a whole lot more complicated.
>>
>try to program in windows
>environment is hell, nothing works properly
>switch to linux
>just werks
>>
>>51232291

learn2read the OS API docs nub
>>
>>51232291
Babyduck
>>
File: fuck_python.jpg (100 KB, 616x600) Image search: [Google]
fuck_python.jpg
100 KB, 616x600
Gas the whitespacefags. LANGUAGE WAR STARTS NOW.

http://c2.com/cgi/wiki?SyntacticallySignificantWhitespaceConsideredHarmful
>>
>>51231758
>Like what? The most interesting advances in distributed computing came in the 1990s.
elastic distributed computing. in the 90s access to large distributed systems was elite and restrictive, which prompted things like planetlab in the 00s. today those things are not needed because basically any researcher or business can purchase a virtual distributed system from amazon for really cheap. so now every business uses distributed computing and every researcher has access to distributed computing (and is expected to run real distributed benchmarks and show things like scaling)
>>
>>51232329
Considered harmful articles considered harmful.
>>
>>51232313
It's quite hard to find required information on the MSDN though.
>>
File: 54.jpg (756 KB, 1920x1200) Image search: [Google]
54.jpg
756 KB, 1920x1200
>>51232096
Oh yes nigger, build your own tools! Hail you! <3

Here have a wallpaper
>>
>>51232313
I'm not talking about programming FOR windows you dipshit
>>
>>51232291
> >try to program in windows
> >environment is hell, nothing works properly

Huh? Like what? Give me a single example.

The Win32 API is pretty great. Perfect? No. And it's certainly of it's time ("it's object-oriented! Because you pass around structures, which are objects!" they literally said this).

.NET is nice. I mean, the code practically writes itself. The biggest hindrance is the fact that nobody specifies modules in e.g. Stackoverflow answers, so you have to dick around for a minute figuring out what they're 'using' in order to actually learn anything.
>>
>>51232203
Unix was C
>>
>>51232348
>I have no other meaningful response so I'll just meme instead

Get bent Pythonista.
>>
File: fioc.png (101 KB, 800x400) Image search: [Google]
fioc.png
101 KB, 800x400
>>51232329
>>
>>51232329
Ifnowhitespaceweresignificantthenhowwouldtokenizationwork?Wouldyouhave[brackets][to][denote][tokens][?]

[At][least][you][can][use][nice][lisp-function-names][this][way][.]
>>
>>51232409
The scary thing is I'm not actually sure whether the bottom line is valid Perl or not. Brace-fags are insane.
>>
>>51232220
"OO types" have no overhead over structs unless they're virtualized

people do the dumbest fucking shit with virtualization, they stick abstract interfaces on everything like Java and then they're surprised when the layer of indirection introduces virtual call overhead. if you don't know the real type of something you will have virtual overhead; this is fucking obvious
>>
>>51232409
> average perlfag
>>
Guys what the fuck is pkg-config?
>>
>>51232220
>all the abstractions of string handling and I/O
these are libraries, not "the C++ language." the primary design goal of the libraries is to be memory and type safe. if you specifically need high performance string parsing or io, then don't use std, because it's not designed for that purpose. <string> is designed for dumb shit like handling filenames and GUI strings
>>
>>51232510
Poor man's import statement.
>>
>>51232460
i should add that the exact same thing happens in C with virtual function pointers, which is literally what you are doing when you introduce a vtable
>>
is java the new cobol?
>>
>>51232545
vtable has more indirection.
>>
>>51232409
Pic just shows that you're a shit programmer who can't properly indent himself so he needs the language to bark at him to make sure it's indented properly, which is unnecessary if you weren't a shit programmer.

Also, TIMTOWTDI.
>>
>>51232572
not yet
>>
>>51232572
No. Literally everyone knows java, and it can be learned in less than a week.
>>
>>51232582
it depends on the implementation. C++ doesn't specify how virtualization should be implemented. there can be an extra layer of indirection if the vtable is pointed-to

it's also possible to be more efficient than C due to type erasure. there's only virtual overhead if the type is virtual
>>
Write a hello world program in your favorite language that accounts all potential errors that could occur, printing "Hello world" before exiting no matter what.

I'll start.
while True:
try:
print("Hello World")
break
except InterruptedError, OSError, IOError, BrokenPipeError, TimeoutError, MemoryError:
continue
>>
>>51232650
Rewind 20 years
>No. Literally everyone knows COBOL, and it can be learned in less than a week.
>>
>>51232572
C is the new Cobol.
>>
>>51232722
Do you consider SIGTERM an error? Because then it's impossible.
>>
>>51232720
>it's also possible to be more efficient than C due to type erasure.
huh ? how so
>>
File: angry_pepe.jpg (39 KB, 900x900) Image search: [Google]
angry_pepe.jpg
39 KB, 900x900
>mfw just found out that my compiler for arm doesn't support -pthread
>fml
>>
>>51232284
Why aren't you using bison/flex?
>>
>>51232572
COBOL was a failed experiment at making syntax so readable that non-programmers could use it. It was designed so business people could use it directly. The experiment failed, they ended up having to use trained programmers to use it, and they hated using it because it was exceedingly verbose.
>>
>>51232572
java is the most popular language in the world and is actively developing new features like streams/scala

/dpt/ has a very unrealistic view of the importance of java and C/C++
>>
>>51232722
    except:
continue
>>
>>51232720
>it depends on the implementation
nice try but you said vtable not virtualization. a vtable is a vtable.-
>>
>>51232378
No matter your side, you have to admit that c2 is the definition of crap. Might as well stand for "crap squared".
>>
desu baka kek senpai
>>
>>51232722
You can get bitchslapped by oom-killer before you can react to it.

>>51232750
The correct signal is SIGKILL btw.
>>
>>51232722
while True:
try:
print('Hello World')
except:
pass
finally:
pass
>>
>>51232722
try {
printf("hello world!\n");
} catch(auto e) {
;
}
>>
>>51232809
SIGKILL and SIGTERM are different signals. The former demands termination whereas the latter merely requires it.
>>
for i in range(1,10001):
s = str(i)
if s==s[::-1]:
print(s)


I'm using this code, however I need to be able to locate all integers that contain the number 3. This code right now can be used to find all the palindromes but I just need the number 3. Help?
>>
>>51232850
That's why I'm telling him this, smartass. You can ignore SIGTERMs.
>>
>>51232804
c2 is great, i had good conversations and reading there. way more than on wikipedia or here.
>>
>>51232601
That doesn't make any sense.
>>
>>51232876
this is python by the way.
>>
>>51232876
for i in range(1, 10001):
i = str(i)
if '3' in i:
print('found 3')


??
>>
>>51232779
>java is the most popular language in the world and is actively developing new features like streams/scala
java is being replaced by universal javascript.
>>
I have code that generates new nodes. Nodes may have children, which themselves are nodes. Some nodes are temporary and at time T, I want to be able to delete them. Moreover, the nodes have a parent node which DOES NOT correspond to the inverse relationship to a child, but rather represents the parent in a merge-find structure.

I keep a list of all nodes that were created. I also keep a partial assoc table between live markers and corresponding live nodes, but this excludes nodes that might be required as children of a live node but is otherwise not referenced.

What is the right way to find dead nodes in this architecture?
>>
>>51232779
>java
>is actively developing new features like
>scala
you wot m8.

also all those "new features" have been in C# for like 10 years.
>>
>>51232908
over 90% of c2 pages are bullshit 'my opinion > your opinion' bullshit where disagreeing by deletion is rampant.
>>
>>51232923
Thank you my friend
>>
>>51232945
start by not being a retard and try to figure when nodes become no longer used delete them
>>
Who notepad++ here?
>>
>>51233003
If you don't know what you're talking about, you're free to not post instead of displaying your ignorance for all to see.
>>
>>51232916
oh thanks, we couldn't figure it by its horrible syntax alone
>>
>>51233007
>windows
baka
>>
>>51232929
It's sad isn't it?
>>
File: 91i+g38v9eL._SL1500_.jpg (229 KB, 1143x1500) Image search: [Google]
91i+g38v9eL._SL1500_.jpg
229 KB, 1143x1500
is there anything like a C++ repl?
>>
>>51232722
two attempts in Lua
local function hw()
xpcall(function() print 'Hello, World' end, function() hw() end)
end
hw()

while true do
if pcall(print, 'Hello World') then
break
end
end
>>
>>51233059
https://root.cern.ch/cint
>>
>>51233059
Shouldn't be too hard thanks to llvm.
>>
>>51232752
arm-none-eabi-g++ add_person.cc addressbook.pb.cc -o add_person.cpp -I/usr/local/include -L/usr/local/lib -lprotobuf -lpthread -pthread

arm-none-eabi-g++: error: unrecognized command line option '-pthread'


Can I somehow fix this?
>>
>>51233059
"learn/use the modern X!"
is this the programming equivalent of "it's 2015, come on!"?
>>
>>51233059
gdb
>>
>>51233059
Go to #C++ on freenode and see the header about geordi, there in channel C++ interpreter
>>
>>51233122
>-lpthread -pthread
Remove the latter.
>>
>>51233154
If it was that obvious I wouldn't have asked.
arm-none-eabi-g++ add_person.cc addressbook.pb.cc -o add_person.cpp -I/usr/local/include -L/usr/local/lib -lprotobuf
/usr/local/lib/libprotobuf.so: file not recognized: File format not recognized
collect2: error: ld returned 1 exit status

The library I'm trying to use apparently doesn't support compiling without threading. The compiler doesn't support it.
>>
>>51233193
Wait, are you actually trying to link x86(or 86_64) library with an arm executable?
>>
>>51233193
I'm not telling you to remove both. I'm telling you to keep -lpthread which tells the compiler to link against pthread and removing the second -pthread entry which isn't a valid g++ option. Also if the library didn't build then how come you're linking against it?
>>
>>51232945
your explanation's a bit poorly worded. Are you able to see a node's children or not? If so, finding dead nodes is as simple as seeing if you can find a node among all the living nodes and their children.

If you can't, you could instead go backwards and for each node trace up the parents trying to find a "live" parent. This would have the added benefit of letting you remove entire branches of the tree if you never find a live parent.
>>
>>51230807
i want to make a particle simulation like https://www.youtube.com/watch?v=XLMU6o7n4E4 in common lisp but i dont know how to do it can someone help me. I asked elsewhere but just get ignored.
>>
i want to make a particle simulation like https://www.youtube.com/watch?v=XLMU6o7n4E4 [Embed] in common lisp but i dont know how to do it can someone help me. I asked elsewhere but just get ignored.
>>
>>51233242
I am not a smart man.

>>51233265
Same result. I compiled the library with standard g++. I realize now that it wasn't the best of ideas.
>>
>>51233281
>>51233304
>common lisp
Are you sure you are up for the task?
>>
>>51232799
yeah but a vtable doesn't have to be indirected by a vpointer, there's no reason you couldn't put a vtable directly in the base class, except for multiple inheritance weirdness. not really sure what the concerns are at the compiler level

>>51232751
if you can deduce the concrete implementation of a base class (e.g. by inlining) then you can call the correct methods directly
>>
>>51233281
>but i dont know how to do it can someone help me

What part do you not know how to do? Graphics? Physics? A loop?
>>
>>51233281
>toroidal space
dropped
>>
>>51233281
I don't know a shit about LISP but you just get https://common-lisp.net/project/cl-opengl/ and play with VBO.
>>
>>51233356
graphics part, i can do the other two.
>>
>>51233446
learn open.gl
>>
>>51233277
The structure is a tree augmented with a merge-find.

-Within the tree structure, nodes can only see their children.
-Within the merge-find, nodes can only see their parent (which is a representative of the set to which they belong).

>go backwards and for each node trace up the parents trying to find a "live" parent.
This doesn't work because the merge-find uses path-compression to achieve amortized O(alpha) complexity.

>seeing if you can find a node among all the living nodes and their children.
I don't know what you mean by this. The obvious solution is to form a set which contains any live node, and then any child of the live nodes, then browsing the list of all nodes and killing anyone not on the list. The problem is that the complexity is O(n_alive^2 + n*n_alive) which is big, I expect there's an O(n) way to do that, or at least an O(nlogn) way.
>>
>>51232945
your problem is a bit underspecified. if "temporary nodes are dead beyond time T and i want to be able to find them," then why not just store a list of temporary nodes sorted by expiration time, and use binary search to find the range before T?

your description seems to imply that a temporary node beyond its expiration time may not be dead if it is somehow topologically relevant. if so, then obviously you need to do a topological check depending on what that property is. if it's connectedness, and the union-find represents connectedness, then isn't it sufficient to check whether the whole cluster has expired?

honestly i don't feel like i'm helping much because i don't understand your scenario (but i should be able to because i code trees of union-finds in basically all of my research). i need to know more
>>
>>51233465
fuck off
>>
struct list { int val; list* next; }; //linked list

struct list *link; //global list

void add(int val) { //add to start of linked list
if (link == NULL) { //if list empty
link = malloc(sizeof(struct list));
link->val = val; //put in front
} else { //if list not empty
link->next = link; //shift to the right
link->val = val; //put in front
}


Someone fucking help me, I don't know what I'm doing.
>>
>>51233265
>>51233242
How does linux deal with the fact that if I try to compile the library itself against ARM while the normal x86 library is still there?
>>
File: box o' help.png (56 KB, 800x815) Image search: [Google]
box o' help.png
56 KB, 800x815
>>51233491
>>
>>51233491
what
>>
>>51233491
gee, you're welcome
>>
File: dissaprovalturtle.png (33 KB, 545x500) Image search: [Google]
dissaprovalturtle.png
33 KB, 545x500
>64-bit python
>>
>>51233506
What's would be the problem? You can store a library in arbitrary place under arbitrary name. You just have to point to it correctly during linking.
>>
>>51233474
Actually O(n_alive^3) I think, perhaps even worse.
>>
>>51233506
Use a different path for storing it.
>>
>>51233474
ok so if i'm getting this right a node is dead if
1. its temporary and we're past its expiration time, and also
2. it's not a child of any live node
and this property is defined recursively, so live -> expired -> expired is all alive. so any subtree of a live node is alive

that sounds way too simple though. if it's just that then all you need to do is walk the forest once and kill anything you see that's not alive by that definition in the walk. so i'm assuming it's more complicated than this, can you clearly define what a dead node is?
>>
>>51233491
this wasnt me
>>
>>51233465
>>51233415
>>51233378
>>51233356
>>51233331
thank you all. this is tons more help than i got in irc :)
>>
>>51233337
>if you can deduce the concrete implementation of a base class (e.g. by inlining) then you can call the correct methods directly
how that has to do with type erasure ? i don't understand
>>
>>51233588
there's multiple things called type erasure floating around in the PL world, unfortunately
>>
>>51233524
Are you one of those Windows memesters who thinks that having all of your software be 32-bit in 2015 is acceptable?
>>
>>51233547
There is no concept of a node's expiration time. Rather, there is a point in time where nodes are made to expire.
At time T, a node is dead if:
1- there is no live marker associated with that node, and
2- that node is not a (tree) child of a node that is referenced by a live marker.

The difficulty is in finding the minimum amount of information required to reduce the complexity of killing those nodes to something reasonable.

>>51233482
>why not just store a list of temporary nodes
It is not clear if a node is temporary until time T is reached and the judgement can be passed. Therefore, one must either keep a list of all nodes or of no nodes.

> then isn't it sufficient to check whether the whole cluster has expired?
Union-find cannot give you clusters outright. A cluster is any set of nodes x for which find(x) returns the same value. Moreover, a node which is part of a cluster can expire without the rest of the tree expiring. However, the example returned by find(x) may not expire until it is the only node in that cluster. Forming the clusters is O(n) for C1, O(n - #C1) for C2, etc. (so something like O(n^n_clusters)), where clusters are on an order similar to n in this case.
>>
>>51233620
then explain what you do mean by type erasure because i have read a lot about PL and type erasure always meant that types are only available in the static environment. there no other definition.
>>
Can someone help me. I have a popup calendar script that I'm trying to use with a form that has a button to add another form of the same type (form #1, *click button* form #2, etc) The inputs are arrays which work but I cant get my script to work after the first form. Any tips? Thank you


<code>
<input type=text name='doc_date[]' size=9 required> <A HREF="#" onClick="cal.select(document.forms['mortgages'].elements['doc_date[]'],'anchor1','MM/dd/yyyy'); return false;" NAME="anchor1" ID="anchor1"><img src="calendar.gif" border="0"></A>
</code>
>>
>>51233743
>>>/g/wdg
>>
>>51233743
r u havin a giggle m8
>>
>>51231772
holy shit that place actually exists
>>
Where do I find the mount points for USB sticks and harddisks under windows?
Like the /dev/sd{a,b,c} "files" on linux for raw data access before any mounting.

I wrote a small, pure userspace fs and would like to test on real hardware and multiple plattforms.
>>
File: 1391008087806.jpg (16 KB, 300x303) Image search: [Google]
1391008087806.jpg
16 KB, 300x303
>mfw C++ is making a comeback now processing power is hardly increasing anymore
>>
>>51233704
>At time T, a node is dead if:
>1- there is no live marker associated with that node, and
>2- that node is not a (tree) child of a node that is referenced by a live marker.
if your live markers are a constant-time set structure (e.g. a hash set) then it's O(|#nodes|) to just:
1. initialize a queue of root nodes
2. until the queue is empty, get a node
3. if that node is not in the live set (constant-time check), delete it and push its children into the queue
4. else, do nothing

the only question is if your data structures let you get the roots efficiently. a shitty, but O(|nodes|) way to do it is to make a hash set of non-roots, insert the child of every node into the non-root set (every node is a child at most once, so O(|nodes|), and then check for nodes that aren't children (also O(nodes))

1. finding non-roots: O(n)
2. inverting to roots: O(n)
3. walking the forest: O(n)
so O(n) algorithm
>>
got a question.
Since c# is regarded as a beefed up java.
And I want to learn java first, should I actually consider c# as a starting point, or the successor of the languages I want to learn?

If this question confuses you, please tell me so, then I will try to be more concise.
Thank you in advance
>>
>>51233281
http://eudoxia.me/article/common-lisp-sotu-2015/#graphics
and just a heads up, the Lisp General has moved to lainchan a couple of months ago
>>
>>51233704
>However, the example returned by find(x) may not expire until it is the only node in that cluster.
i'm a little confused by this part because, assuming the UF uses path compression, and represents the same topology as the tree (does it?), then the set representative will always drift to the root of the tree, which means the whole tree cannot expire

basically how does the UF correspond with the tree structure, if at all, and how does the UF play into life/death? because the UF was not mentioned at all in the definition of a dead node you gave
>>
>>51233498
>
        link->next = link; //shift to the right

this is wrong, it should be link = link->next

and you should store your head in another global. rename link to tail, and add another one named 'head'. tail moves forward as you insert new elements and if you want to check list, start with head and iterate using nexts
>>
>>51233885
>http://eudoxia.me/article/common-lisp-sotu-2015/#graphics
wow this is acutally very help full thanks
>>
I'm getting an error when I try to go to myserver.com/audio with this Node.JS code. Anyone able to help?

http://pastebin.com/raw.php?i=VnD4mUMA
>>
>>51233825
>>51233891
also if the union-find DOES respect the tree topology then a node is a root iff it's union-find parent is itself. so there's a fast way to find roots, potentially
>>
File: 1409516325049.gif (3 MB, 480x270) Image search: [Google]
1409516325049.gif
3 MB, 480x270
>>51233931
you're welcome
>>
>>51233942
go to other general, the one for web 'developers'
>>
>>51233533
>>51233544
libprotobuf.a: error adding symbols: File format not recognized


Fucking hell I'm about to give up
>>
>>51233825
>check for nodes that aren't children
One would have to check each node (n) against each child (n_children), so that's O(n * n_children). You can't simplify to O(n) because n_children can be O(n - c) for some constant c (indeed, it is typically this case).

In the first case, one would end up with multiple copies of the same node. To prevent that, one needs to browse the set of nodes collected so far (i.e. O(n_alive^2)) and then take into account the dead nodes' children (which may appear several times themselves, requiring another O(n) structure to avoid a stack overflow).

>>51233891
>(does it?),
Not at all, that's kinda the whole point of UF. The UF doesn't have a correspondence with the tree in general. It's easily possible that it represent the same tree, differently rooted (but it's unlikely).
>>
>>51233989
>.a
Isn't it the extension used for Windows libraries? What the fuck man.
>>
How do you call a function that's within a page that's mmap'd with the PROT_EXEC flag?
Does it involve a significant amount of sys/mman tomfoolery, or can you just call an address if you already know its offset within the page?
Thread replies: 255
Thread images: 24

banner
banner
[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y] [Home]

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.