[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
/dpt/ - 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: 35
File: NSA.jpg (89 KB, 1366x768) Image search: [Google]
NSA.jpg
89 KB, 1366x768
old thread: >>54600081

What are you working on, /g/?
>>
>>54605498
you suck at life
>>
>C programmers will never admit that other languages have SOME good features
>>
>>54605550
I do
javascript has closures
PHP has traits
C++ has lambdas
java and python suck though
>>
>>54605550
C is PERFECT there is literally NOTHING wrong with C. C++ and Go are literally just bloat, I don't see why anyone would in their right mind program in slow as fuck languages like Python or Lisp. The unix way is the right way. C is the best language.
>>
>>54605550
I don't think that's the case usually. It's about tradeoff.

There's rarely good tradeoffs.
>>
>>54605475
If these are the most important features of C++ to you then I suggest using Rust.
>>
oh shit i can actually make dynamic web pages in C

Is there anything C can't do?
>>
>>54605584
java has lambdas
python has lambdas
>>
>>54605604
Probably the wrong post to reply to:
>>54605443
>>54605526
>>
I have a file and a compressed version of it (some flavor of gzip without encryption that i cannot replicate with gzip) how can i determine what the encryption is and how to replicate it with other files?

Anyone have experience with this kind of stuff?
>>
File: 1430338552076.jpg (154 KB, 633x558) Image search: [Google]
1430338552076.jpg
154 KB, 633x558
>>54605600
>C is PERFECT there is literally NOTHING wrong with C.

i like ur bait
>>
>>54605603
depends on what you're using it for

C is really bad for a lot of purposes
>>
>>54605639
Run file on it:

$ file kek
kek: gzip compressed data, from FAT filesystem (MS-DOS, OS/2, NT)

$ file rofl
rofl: compress'd data 16 bits
>>
>>54605603
I would argue that using C is a negative trade off for most applications.

>>54605604
I used to think so, but the compiler is restrictive to a point in Rust where you are forced to program around the compiler instead of being able to focus on the actual problem at hand. I don't think it could be any other way and I greatly appreciate Rust but it can be a pain in the ass for writing a lot of things you'd need a "systems programming language" for.
>>
>>54605621
> java has lambdas

functional interfaces. you need to declare an interface to use a lambda. it beats the purpose.

> python has lambdas
but it needed closures. ruby and lua have them.
>>
>>54605673
If you're having to "program around the compiler" you're probably doing something wrong. What do you mean exactly?
>>
File: Screenshot (85).png (60 KB, 1743x405) Image search: [Google]
Screenshot (85).png
60 KB, 1743x405
I want to print my str and mpg all on one line...
how do?
>>
>>54605600
>the unix way is the right way
>C
Nigga the Unix way is flat files and scripting together small utilties. Ergo Bash and Lisp.
>>
>>54605711
>how do?
Use C++
>>
>>54605660
>C is really bad for a lot of purposes
What's C bad for? Seems like that's worth metioning.
>>54605673
>I would argue
Please, go ahead and argue. Aside from functional programming I don't know of any programming paradigms (in isolation, ignoring where they're contained currently) which really help you in development to a significant extent.
>>
any reason to use REASON? https://facebook.github.io/reason/
>>
>>54605730
but were using python

plz no bully.... :__:
>>
>>54605741
carlos!
>>
>>54605684
>you need to declare an interface to use a lambda.
No you don't

>it beats the purpose.
And here I thought the purpose was higher order programming

>but it needed closures
It has fucking closures
>>
>>54605619
Average 2 ints
>>
File: img.png (118 KB, 1185x790) Image search: [Google]
img.png
118 KB, 1185x790
Playing around with Electron.js and Three.js. Currently making a key input controller.
>>
>>54605711
https://www.google.com/search?q=print+one+line+python
>>
>>54605464
>kek
Explain.

If you think there's something in your brain worth having, I will take it.
>>
>>54605498
what is this show called XD?
>>
>>54605800
return ((float) (a / 2.0) + (b / 2.0))
>>
File: 1372868480524.jpg (359 KB, 1280x1811) Image search: [Google]
1372868480524.jpg
359 KB, 1280x1811
>>54605619
> Is there anything C can't do?
Make its users to shut the fuck up about it
>>
>>54605852
Why not (a + b) / 2.0
>>
>>54605870
overflow
>>
>>54605877
So use a different variable type.
>>
>>54605735
>What's C bad for?

It'd probably be more appropriate to talk about what C is good for, which is systems programming.
>>
>>54605823
a trailing comma! Thanks!
>>
>>54605800
http://www.google.com/patents/US6007232?dq=6007232
>>
>>54605830
There's no point you will never understand. Language games and all.

It would be pointless anyway.
>>
File: 2016-05-17-042111_766x422_scrot.png (245 KB, 766x422) Image search: [Google]
2016-05-17-042111_766x422_scrot.png
245 KB, 766x422
Remember to poo in gnoo kids
>>
>>54605619

Congrats on getting set up with CGI, by the way.
>>
>>54605870
Overflow and it rounds down when it shouldn't, i.e. The average of 6 and 15 is 10.5, correctly rounded 11. Calculating ( 6 + 15 ) / 2 in C returns 10 though.

I haven't seen a good solution to this posted yet.
>>
>>54605672
that really helped
what was i even thinking...
>>
>>54605550
Often it is easier to implement a small lisp or basic in C and write your application in it than write it directly in C, lol.
>>54605600
C is a 1970s relic designed to run in 128kb of RAM, truly a "worse is better" of programming languages.
>>
>>54605967
The integer average is usually defined with truncation, not rounding.
>>
Where do I go to learn OpenGL. I just don't get it. I try to set up my VBO's (which I don't understand) and my VBA's (which I also don't understand) and call my glUseProgram(); anywhere it wouldn't matter (like just after I've swapped the buffer) and shit just stops drawing.
>>
>>54605967
I don't know about C, but in C++ define the variables a and b as double

int main()
{
double a, b, avg;
a = 6;
b = 15;

avg = (6 + 15) / 2.0;
cout << avg;
cin >> a;
}
>>
>>54605992
Not sure if sarcasm
>>
>>54605937
Okay.
>>
>Recently DeepMind said that they switched from Torch to Tensorflow
>That means they still used Torch before, for AlphaGo vs Lee Sedol match
>Torch is built on Lua, to be specific - on LuaJit

The Human vs AI match of the century has been using Lua at its core. How does that make you feel?
>>
>>54605940
thanks

What's the best way to make a dynamic webpage?
I've never done this before, but I'm thinking I should be printing out premade headers and footers and then my dynamic data in between?
>>
>>54605967
Actually when rounding .5 the "correct" way is to round even. Still, integer average on a computer is accepted to be truncated.
>>
>>54606020
https://open.gl
>>
>>54606051
Be a cool kid and implement the whole webserver in C.
>>
File: Jason Lee Demo 1.gif (2 MB, 1032x750) Image search: [Google]
Jason Lee Demo 1.gif
2 MB, 1032x750
Got some more features done and renamed the project to something less serious. Im so proud of it so far :)
JSON Level Editor > JSON LeE > Jason Lee
>>
File: Capture.png (37 KB, 683x738) Image search: [Google]
Capture.png
37 KB, 683x738
getting lazier
>>
>>54606077
JSON is overkill and wasteful for this.
>>
>>54606050
LuaJIT is some of the fastest shit there is around, even faster than V8.
>>
>>54606094
Title commands don't need an "=".
>>
>>54606051
What are you using? I've been interesting in doing web-backend stuff but all those ugly scripting languages just scares me.
>>
>>54606077
lel one of my old programming professors was named jason lee
>>
File: 1434835617551.jpg (45 KB, 409x409) Image search: [Google]
1434835617551.jpg
45 KB, 409x409
>>54606115
>>
>>54606051
Yes. Read about the HTTP protocol particularly gets and posts and session cookies.
>>
>>54606110
Actually torch offloads the real computation to CUDA, but all the high level stuff is still luajit.

Also note that @ 2016 v8 is already faster.
>>
>>54606127
>session cookies
don't forget the annoying as shit EjUw-mandated disclaimer
>>
>>54606095
Its made and intended to be used with GameMaker:Studio which only has (albeit shitty) support for JSON. Didnt feel like making my own parser for something else. The level file will store a list of all the instances and their properties as well as any other data for the level like music etc.
Im thinking about also storing all of the levels in a single file so that people could make a bunch of extra levels and you just have to send 1 file.

Its far too late but Im just curious, what would you prefer instead of JSON?
>>
>>54606158
Well it seems to me like everything has the same properties, so a simple binary format would be enough. JSON (and co.) is useful when you need to encode the structure alongside the data.
>>
>>54606152
>eu mandated disclaimer?
What is the EU making y'all do?
>>
>>54606114
C

Really, all i'm doing is printing shit.
    char *header = create_buffer("assets/header.html");
char *footer = create_buffer("assets/footer.html");
printf("Content-type: text/html\n\n");
/* header */
printf("%s", header);
/* body */
printf("current time: %zu, %s\n", t, messages[rand() % 3]);
/* footer */
printf("%s", footer);
>>
When will a non-bloat modern direct replacement of C come?
>>
>>54606050
>using Lua at its core

>>54606110
>LuaJIT is some of the fastest shit there is around

I looked at the source code and have determined you are both full of shit. Lua is delegated to a glue language, all the relevant parts are implemented in C:

https://github.com/torch/torch7/blob/master/TensorMath.lua

Claiming Torch is Lua is like claiming Tensorflow is Python.
>>
>>54606221
it already has.
http://fsharp.org/
>>
>>54606221
https://www.youtube.com/watch?v=TH9VCN6UkyQ&list=PLmV5I2fxaiCKfxMBrNsU1kgKJXD3PkyxO
>>
>>54606158

This editor is built in GM?
>>
>>54605967
int avg ( const int a, const int b )
{
return a / 2 + b / 2 + ( ( ( a < 0 ) ^ ( b > 0 ) ) & ( ( a % 2 ) | ( b % 2 ) ) );
}
>>
File: Jason Lee save format v0.2.png (19 KB, 364x690) Image search: [Google]
Jason Lee save format v0.2.png
19 KB, 364x690
>>54606187
They do all have the same properties but their values are all different. Pic related is a simplified version of the save structure (older save format is missing a few variables but overall structure is the same).
>>
>>54606065
>>54606020
To elaborate: I think http://learnopengl.com/ is like an updated version of this. I started with open.gl and was still pretty confused when I finished, mostly because it has a very "Just copy paste this code and look at the result!" kind of approach. I'd recommend once you finish that you just throw all the code out, start over and try to think yourself about how you want to abstract the stuff in it. You obviously don't want your main event loop to be a bunch of glDraw this, glBind that, etc. so find a way to break it all out into smaller chunks and it'll become much easier to think about.

The way I think about it (admittedly I'm still very much a beginner) VBOs are basically arrays and VAOs (what I'm guessing you mean by VBAs) are collections of glVertexAttrib calls (but not glBindBuffer calls, which I used to forget a lot). Depending on how many shader programs you have you shouldn't need to call glUseProgram much. If you only have one shader program you should only need to call it once.
>>
>>54606308
Exactly. JSON is completely overkill for this kind of scenario.

You don't need to encode any structure in your level file, so you can literally just have a binary stream of integers where each 8 in a row (IDs are just integers) will produce an object.
>>
>>54606299
Sure is! Been working on it for about a week. It also can save and load the level files both in the editor and in game.
Its my pride and joy right now
>>
what does /dpt/ think of
dat boi
?
>>
>>54606190
If your website has cookies you need to put a popup about it on the page. I've seen it on a lot of pages but it's also missing on a lot of pages so I doubt you're gonna get taken to court over it.
>>
>>54606332

Breddy neat. I've used GM to build a few small platformers before, but nothing serious.

Not into gamedev, desu.

Slick editor, though. Looks gud.
>>
>>54606302
Why is avg an int, why would you define them as int.
>>
File: AP PHYSICS 1 ESSENTIALS. pg 179.jpg (169 KB, 1024x1365) Image search: [Google]
AP PHYSICS 1 ESSENTIALS. pg 179.jpg
169 KB, 1024x1365
>>54606333
o shit waddup
>>
>>54606323
Thanks for elaborating. I'l go through both.

Basically right now I have one program that renders an entire scene through a fragment shader (raymarcher, signed distance field). I just wanted to see how I could start using that scene in interesting ways. I've been guessing I'd manage that by using a depth buffer (because that's something I can use to decide on a pixel by pixel basis what's infront or not).

But I can't get the point I was gonna test with to render for what I don't see as any real reason. But I'm gonna have to sleep now. It's clear I need open.gl or learnopengl.com.
>>
Who is better Kanye or Drake?
>>
>>54605715
>Unix way
>Lisp
>I don't know what the fuck I'm talking about
>>
>>54606416
both shit but kanye
>>
>>54606325
That would be a good idea but the object names are unpredictable because the game I am making it for isnt complete yet. Also I plan on making it compatible with anyone's projects and selling it on the marketplace. Ill be supplying the source scripts to save and load but the compiled version of the editor. It will soon have the ability to add custom variables to objects then the dev would just have to modify the save and load scripts in their game to make use of them.

>>54606346
Thanks :) Its been a pain in the ass so far but Im happy with it. I want it to outperform the built in one with features.

>>54606416
Kanye for sure. His newer music is a joke but the old shit is dope.
Drake is too much of a cry baby.
>>
>>54606350
Because that was the original problem: How do you mathematically average two integers (meaning without truncation and overflow). This is how you do it (or at least I hope it is).
>>
>>54606242
> Lua is delegated to a glue language, all the relevant parts are implemented in C:

The actual architecture of the neural network and training algorithms are specified in Lua, while low level vector algebra ops are implemented in C and CUDA. Without lua code the AlphaGO wouldn't be AlphaGO.
>>
>>54606006
>C
>designed to run in 128kb of RAM
sounds efficient
>>
>>54606432
>object names are unpredictable
Doesn't matter, you should save them as IDs and not names.
>>
>>54606468
GM:S determines and hides asset ids from the user. I only see them as names and can only control the ids with object_get_name(index) and asset_get_index("name"). The ids of the game and the editor are unpredictable. What one calls 15 the other could call 34. The name is the only way I could think to transfer them.
>>
>>54606540
I'm pretty sure they're fixed when you create the thing in question in practice.
>>
trying to come up with ideas of how to showcase my telegram lib/use for a tutorial
why is it so hard to come up with things once i do have time for them?
>>
Which programming language is most likely to get me laid when I tell her?
>>
>>54605550
It's called the Blub Paradox, you should look it up.
>>
>>54606626
>C2 uses garbage collection as an example
>>
File: coq.png (16 KB, 112x180) Image search: [Google]
coq.png
16 KB, 112x180
>>54606614
Coq
>>
>>54605917
Are compilers considered systems programming? Any* language can read in some text and spit out assembly, right?
>>
>>54606708
Nope. A VM would be, though.
>>
File: Game maker object file.png (61 KB, 1022x897) Image search: [Google]
Game maker object file.png
61 KB, 1022x897
>>54606556
The studio doesnt give you anywhere to change or even see ids. When it saved the project the object file looks like pic related. It doesnt store ids because it automatically determines them at compile. GM:S isnt the best for programming in general but its good for (2D) games.
>>
>>54606708
>Any* language can read in some text and spit out assembly, right?

Yeah, considering a lot of compilers are written in something like ML, then later self-hosting.
>>
Is there a way to write all commands executed in console to file from a sub-process?

Tough to explain but for example if you typed 'execute todo.bat or todo.py' write all the outputs and inputs to file somehow without editing the source code of those files?
>>
>>54606708
>Are compilers considered systems programming?
Technically yes, from the standpoint that they form a fundamental part of the system because they're basically at the bottom of the stack. But in terms of complexity/high-level vs. low-level, modern compilers are extremely high-level and it's not unusual for them to rely on lots of high-level libraries, either. Because of the nature of cross-compilation, compilers are something that are able to work at a low-level of the software stack but be created at a very high-level. So most people (myself included) wouldn't consider them to be systems programming. However, since the output can be particularly low-level, if you're judging based on involvement with assembly/low-level code then yes, they can be systems programming.
>>
I learning a computer language.

HOW DO I REMEMBER ALL THIS SHIT?!
>>
>>54606849
As for me when I look the same thing up over and over enough it sticks.
>>
>>54606838
easily, unless you're on windows
>>
>>54606849
How do you remember all the words in English that you know?
>>
>>54607014

It just hit me that we use a lot of words that we couldn't otherwise describe. That is to say, if someone asked you for the definition of word, you might not be able to provide it, but you still use these words every day.

I promise I am not high.
>>
is rust still being destroyed by ruby cucks?
>>
>>54607113
rust is a ghetto
>>
File: 1450029505213.gif (2 MB, 261x199) Image search: [Google]
1450029505213.gif
2 MB, 261x199
>>54607113
>>54607122
they had a meetup near me that used the geekfeminism code of conduct, I was going to attend to see what it was about until I saw that.
>>
>>54606077
Use OBS to record
Then use imagemagick to make a gif
Or use ffmpeg to make a webm
>>
>>54607107
You would probably be able to give a very general definition of the word
>>
>>54607107
In the end language is taught not by definitions but by reinforcement.

>>54607166
If that person then asks you what the meaning of the words you used to define the initial word, you would eventually be pushed into circular definitions.
>>
>>54607187
Because a lot of words are synonymous
>>
>>54607113
Of course
It is lead by SJWs and funded by them (Mozilla)
>>
/dpt/, a coworker and I recently had a disagreement about a piece of code I wrote.

My code deals with hundreds of pieces of data identified by 2-byte identifiers. These identifiers range from 0x0000-0xFFFE, and are spread pretty randomly across that range. I needed a way to associate a one-byte unsigned "size" for each 2-byte identifier, which needs to be stored for extremely fast lookup later. Because we develop on an old as shit platform, we have no hash tables, and no time to reinvent the wheel with any fancy algorithms. We really only have std::map and std::vector for searchable lists, so I defined my searchable list as such:

unsigned char list[65535];

He sperged because there is less than 2000 of these identifiers, and my list holds 65,535 of them. However, my thought process was, is 64k of memory really that big a deal when the speed payoff is so great?

Anyway, was he right?
>>
File: 1442409407329.jpg (1 MB, 2836x2244) Image search: [Google]
1442409407329.jpg
1 MB, 2836x2244
Is it possible to learn C and system embedded programming together? I don't want to beat around the bush. (I have very minimal programming experience)
>>
>>54607316
How old of a platform are we talking? And what'd be its specs?

My opinion is that if you have waaaaay more than enough RAM to spare, just go with what's faster. And simpler to understand and maintain.
>>
>>54607316
If this is really such a big issue, you should do something like
#define from 0x8282 /* smallest value */
#define offset 0xFFAA /* largest value */
unsigned char list[offset - from]; /* or something */
>>
>>54607316
Just benchmark it and decide based on that you cuck
>>
>>54607316
How much memory does your target system have? Is memory really a concern? You could mark it as a place to improve later if you need the memory.

It sounds like he's spergin' though.
>>
>>54607373
Platform is Windows CE 7 (I'm so fucking sorry), 1 GB RAM, 2 ghz (give or take), single core ARM processor.
>>
>>54605790
You do need an interface to use them lmao. Foh
>>
>>54607391
64K sounds like a drop in the bucket man. I think your coworker just wants to feel smart.
>>
If there aren't fully supported language bindings of OpenGL, CUDA, or OpenCL for a programming language, it's an objectively useless language.
>>
>>54607573
FUCK

looks like vhdl is useless.
>>
I'm almost certainly getting a job as software engineer in test at a company that writes language-processing AI.

How do I prove to them I'm good enough to work on the AI itself?
>>
>>54606849
write code obvs
shit becomes muscle memory
do every single example and exercise
do side projects
fuck around with stuff
write more code
>>
>>54606666
quads ch-ch-ch-checked
>>
>>54606708
>Any* language can read in some text and spit out assembly, right?
yes, but lots of languages compile to C, LLVM, or JVM anyways so in the end those languages are the final step.
>>
>>54607621
Do you own a pair of knee pads?
>>
>>54607621
git gud at test, start fucking with the code on your own, show them a feature you wrote, make a pull request
>>
File: leredditderp.jpg (189 KB, 717x880) Image search: [Google]
leredditderp.jpg
189 KB, 717x880
>>54606416
DAE else celebrity culture
>>
>>54605856
underrated kek
>>
Let me stretch your brains with a problem I devised earlier to stave off the boredom:

You want to cut a circular cake, diameter d, into x pieces of equal area.
The traditional way of doing this would be to cut normal slices every 360/x deg around the circle.
However you are an autist from /g/ and need each slice to have the exact same area - you also only have a ruler to hand.
Therefore devise an equation/ set of equations to cut the cake in parallel slices into slices of exactly equal area simply in terms of x and d.

Good luck!
>>
>>54608135

This is number 7 on the homework, right? Mr. Maxwell is gonna be so pissed if I don't finish it for tomorrow!
>>
>>54608159
If you even slightly understood this question you would know that it is most certainly not of a level where you get "homework"
>>
>>54608159

>Mr.
>Not Professor or Dr.

>>54607355

Typically, system/embedded programming is done with C. I suppose you could learn them together.
>>
>>54608159
This will result in a transcendental equation I think but beyond that not sure.. deceptively complex
>>
>>54607391
Your coworker's an idiot.
>>
Im dumb as fuck with assembly.

So im within 40F000-42FFF0 base address range but this move tries to copy stuff from outside this range:
movzx r10d,byte ptr ds:[r9+rdx]

rdx is 00000000133E8420 (this is outside the base address range but it can still pull data from somewhere, but where?)
r9 is 0 to F

How do i get to the address where the move copies data from?
>>
>>54608135
You want an equation but the answer is a procedure.

>>54608230
>Dr.
>Not Herr Doktor
>>
>>54608230
>>Mr.
>>Not Professor or Dr.

It was a joke, lad.

>>54608182
>>54608232

I read it quickly at first, and it sort of had the relative shape of a homework question. I pressed post and it was already too late.
>>
>>54608262
It's almost certainly a homework question for some remedial summertime calculus course.
>>
>>54608135
integrals mate

for a cake of radius r you need to calculate f(x) = ∫2√(r-(x-r)^2) dx, then starting at x_0 = 0 find a second value x_1 such that f(x_1) - f(x_0) = (πr^2)/n where n is the number of slices. once you find that, let x_0 = x_1 and find a new x_1 until x_0 == 2r
>>
>>54608232
Yep it does. A solution for a particular n involves n definite integrals of sqrt(d^2 - x^2); and those involve arcsin.
>>
File: 1458729939031.png (767 KB, 1920x1080) Image search: [Google]
1458729939031.png
767 KB, 1920x1080
If I wanted to create a messageboard site purely with CGI, should I treat the program like one monolithic program that displays what you want depending on the GET url string?

That way I could maintain state between calls, or something.
I have no idea what i'm doing.
>>
>>54608409
Yes.
>>
>>54608409

>State between calls
What sort of state? Have you heard of these newfangled things called databases?
>>
>>54608704
Yeah, I should probably learn about those.
What's good in databases these days?
I've only ever heard of mysql.
>>
>>54608732
>I've only ever heard of mysql.

Yup, that'll do it. Let us know when you get your imageboard working.
>>
On the topic of relational databases
mysql vs postgresql?
>>
>>54608862
postgres is more webscale
>>
What's a good, easy architecture to write an assembler and vm for? Bigger than LMC but smaller than MIPS is what I'm going for
>>
>>54605741
Shit tier
Just use F# ffs
>>
>>54608939
Make your own. Make it as complex as you would like.
>>
>>54608862
>>54608886
Is there any reason why I shouldn't implement a messageboard using SQLite?
>>
>>54607355
if you want to learn embedded programming you can't get away from learning c, so its not only possible, but necessary
>>
>>54608939
Just implement an architecture that consists entirely of x86 mov.
https://www.cl.cam.ac.uk/~sd601/papers/mov.pdf
>>
>>54608986
Fucked it up.

>>54608135
This is a transcendental equation.

You can find the area of the unit circle to the right of the line x=w[/code] by the equation acos(w)-w*sqrt(1-w^2), (found by applying multivar) but you can't solve for the area generally. You can pretty easily scale this by r.

The internet seems to agree with me. https://answers.yahoo.com/question/index?qid=20080510090813AAezUCC
>>
Okay, this is barely programming related, but this question has been fucking with me.

I want to install windows 98, with UEFI (no MBR).
Can I load UEFI GRUB, then load windows 98 with it, or is it just impossible?
>>
>>54605741
> functions must be specified with a keyword
>semicolons
Did they just shit on Ocaml
>>
>>54609010
Anything 32 bit Windows isn't even compatible with uefi
>>
>>54609010
>this is barely programming related
It's not programming related at all. >>>/g/sqt
>>
>>54608135
>The traditional way of doing this would be to cut normal slices every 360/x deg around the circle.
>However you are an autist from /g/ and need each slice to have the exact same area - you also only have a ruler to hand.
Wouldn't doing it the traditional way solve the problem
>>
>>54609039
There wasn't a SQT last time I checked, they're used to more retarded questions so my hopes are low anyway.
>>
>>54609054
Nah he only has a ruler no protractor and he somehow is able to draw a perfect diameter and a perfect right angle.
>>
>>54609022
yes, it looks pretty awful. they just made ocaml bad so that web devs would like it more
also bad:
>switch instead of match
>C-style if (statements) {}
>let { } instead of let in
>no more (=) and (<>) operator
>? : instead of if then else as an expression
>>54605741
nah it's useless, just use normal OCaml syntax. using Reason is pointless cause you lose out on docs, stack overflow shit, code examples, libraries, etc. in exchange for some syntax that will save you 15 minutes of learning
>>
>assembler exam in 1 week
>haven't studied shit

what to do
>>
>>54609133
It's so stupid
>>
>>54609140
Just get a head start in life and apply to Mc Donalds early on.
>>
>>54609173
kek'd
time to flip burgers faggot
>>
>>54609140
How are you supposed to learn assembly by studying?
>>
>>54608973
None. SQLite is pleasant to work with.
>>
>>54609036
any workarounds?

(without changing to legacy mode from BIOS settings, or VMing)
>>
>>54608973

Do you need to handle shit tons of simultaneous writes? Use something else. Otherwise, SQLite is pretty nice.
>>
>>54609140
study shit, rtfm
>>
File: qIIPq.gif (2 MB, 500x285) Image search: [Google]
qIIPq.gif
2 MB, 500x285
hey /dpt/, post yfw compiler error
>>
File: mad.png (204 KB, 500x281) Image search: [Google]
mad.png
204 KB, 500x281
>>54605673
>>54605708
Yeah, I would like to know what he means by this as well. I don't know Rust but it doesn't appear to me to be more "restrictive" than C for most purposes.

>>54609140
You fucked up. Your only choice now is to wear a skirt in the exam room
>>
>>54609442
>it doesn't appear to me to be more "restrictive" than C for most purposes.

But literally the point of the language is to be more restrictive than C.
>>
>>54609140

Tell your prof that C is basically Assembler++ and to let you use it.
>>
>>54609140

A week is plenty of time to study. What all will the exam cover?
>>
File: dashboard.png (4 KB, 208x125) Image search: [Google]
dashboard.png
4 KB, 208x125
Started building a library to auto-generate a web dashboard for bots when I make them so that you'll eventually be able to configure the bot settings like what commands are enabled/disabled, who has admin/op for the bot, as well as seeing status info (ping, chats it's in, incoming requests, etc.)
pic related is generated from:
open Telegram
open Dashboard
open Opium.Std

module Bot = MkDashboard (struct
include BotDefaults

let token = [%blob "../bot.token"]

let commands =
let open Api.Command in
[{name="test"; description="Test command"; enabled=false; run = fun _ -> print_endline "testing"; Nothing}]
end)

let () = Bot.run ()
>>
>>54609456

It is incredibly easy to write C in Rust. It is also easy to write safe, fast code.
>>
File: cover.jpg (51 KB, 400x579) Image search: [Google]
cover.jpg
51 KB, 400x579
Hi /dpt/

I am working on pic related
I have just got far enough that the exercises require a Scheme implementation.

Should I use MIT-GNU Scheme or Racket?
I would prefer something with bracket matching and code highlighting. If there are other alternatives (for Windows), that would be fine too.
>>
>>54609481
>What all will the exam cover?

Writing programs using only mov.
>>
File: 1448130919991.jpg (19 KB, 363x263) Image search: [Google]
1448130919991.jpg
19 KB, 363x263
>>54609410
>Segmentation fault
I hate this shit
>>
>>54609498

Maybe I'm not smart enough for Rust, but I'll be damned if it doesn't complain about everything under the fucking sun.

Maybe I should actually carefully read the docs.
>>
>>54609535

It complains of you try to write Rust like Rust. If you use raw pointers and declare everything as unsafe, it'll be relatively quiet, and even play nice with code written in C.
>>
>>54609494
lmao which turbomemelang is this?

also if you're anonymous why are you using a tripcode?
>>
>>54609553
>If you use raw pointers and declare everything as unsafe, it'll be relatively quiet

Oh.. but that's cheating isn't it?
>>
>>54609564
>lmao wigh turbomaymaylank iz dis?
OCaml
>alzo if you're anonymouz wy are you uzign a dripgode?
i haven't had the time to generate a real trip code yet, was gonna try and get nv!dia.corp at some point in the future
>>
>>54609456
It makes memory safety guarantees, yes, but it doesn't seem to me like Rust's mutability/ownership system would interfere with algorithms involving indirection that much.

>>54609534
Use valgrind.

>>54609494
That's neat, anon.

>>54609564
My guess is it's like an approximation of IDs on some boards
>>
>>54609580

It's literally the first thing I tried when I decided I wanted to try out the language. In its capacity to act like C, it's actually not bad.

And to be quite honest, if you want to do anything interesting with the language, a portion of the program has to be unsafe code anyways.
>>
>>54609637
>And to be quite honest, if you want to do anything interesting with the language, a portion of the program has to be unsafe code anyways.
no
>>
>>54609643

Most Rust libraries of worth are wrappers around C libraries. As it turns out, you need an unsafe block to make a Rust function call some external C function.
>>
>>54609691
literally every language needs extern at some level
>>
>>54609725
chinese
>>
>>54609510
You can use DrRacket and either import #lang sicp or download and compile MIT/Gnu Scheme and run it in emacs https://docs.racket-lang.org/sicp-manual/index.html
>>
namegame = raw_input('What is your name? ') , raw_input('What is your last name, ') +

Fucking around with early Python concepts. How would I go about referencing an earlier raw_input in the same line as another? Would I need to somehow assign it to a variable?

In case it isn't clear what I'm trying to do, I want to tell Python to output the first and last name of a user in a two lines of code. If I could surmount this stump then all that'd be left to do is to write print (namegame)
>>
>>54609938
Nevermind, there's no need to "reference" the other assigned value as Python reads it anyways
namegame = raw_input('What is your name? ') + ' ' + raw_input('What is your last name? ')
print 'Hello, ' + namegame + '!'
>>
>>54609938
>>> print(raw_input('one: ') + raw_input('two: ')
one: i1
two: i2
i1i2
>>
>>54609691
You can write contracts/asserts for the C libraries you wrap in Rust but it's incredibly tedious and almost 90% likely you'll find so many bugs in that C libary while doing it you'll end up tossing the library and rewriting it from scratch in Go
>>
>>54609978
woops, forgot a paren
I honestly don't know why I didn't just copy/paste
>>
File: 1452403462016.png (79 KB, 307x400) Image search: [Google]
1452403462016.png
79 KB, 307x400
>>54609979
>Go
Don't kid yourself.
>>
Trying to run through K&R for C right now, but afterwards I'd really like to try some basic graphics programming. What library should I use that's straightforward?
>>
>>54610049
SDL?
>>
>>54610049
>graphics programming
Depends what you exactly mean by that.

A window and some 2D drawing stuff: SDL2 or some shit
Just rendering to a 2D image: Cairo
3D and/or hardware accelerated stuff: OpenGL/Vulkan and a windowing library (SDL2, GLFW, etc.)
>>
>>54610049
>C

If you do anything in C you should take this course
http://www.cs.cmu.edu/~rjsimmon/15122-s16/schedule.html

It's trivial to hang yourself with exploitable/broken/slow C data structures.
>>
>>54610095
That class isn't even about C. Did you even take it?
>>
>>54610086
Just 2D since 3D would be way over my head. Thank you for the information.

>>54610095
Might look at this, likely won't. If I do finish K&R I will probably try to move onto C: A Modern Approach. I'm not learning C to do anything meaningful in it (I likely will never be good enough in it to do so) so I'm not that concerned. I just want to branch out from Java/Python so I feel less confined.
>>
>>54610115
But shitposting aside, it's a good course to actually write code that does what it says it does.
>>
>>54610115
You write in C0 and then transfer to C midway through

The entire course is about how you will fuck yourself in C by thinking "operationally" vs thinking logically about what you're doing.
>>
You guys know about sorting, how many passes will an array{26 13 22 23 18 11 19 9} have with insertion sort? I say 7 but i think im wrong
>>
>>54610147
Yup, you're right.
>>
File: yeehaw.jpg (84 KB, 1300x953) Image search: [Google]
yeehaw.jpg
84 KB, 1300x953
>>54609410
I'm not a dumbass using C++.
>>
>>54610095

This material looks pretty good, even for non-beginners.
>>
>>54610233
nice hat!
>>
>>54610240
It's the course they give freshmen. You take it the first semester if you have programming experience, or second semester after they teach you the basics of programming. It does have discrete math as a corequisite because there are some simple proofs.
>>
>>54610240
There's filmed lectures too
https://scs.hosted.panopto.com/Panopto/Pages/Sessions/List.aspx#folderSets=15&folderID=%22632b424b-8526-4314-b82f-0428c1c68e39%22
>>
>>54610275
>It's the course they give freshmen.

Better material than I had, for sure. I think they know what they're doing at CMU.
>>
>>54610157
You can count it yourself by inserting a print procedure in your insertion sort code.

Or you can do it on pen and paper and find out.
>>
>>54610275
The "basics of programming" course isn't exactly basic either https://www.cs.cmu.edu/~112/schedule.html where you measure the O(n) of simple prime/sqrt programs and write assert statements/tests for everything you do.

Well compared to every other university intro course I've seen it's not 'basic, like MIT just glosses over all of this now same with Harvard CS50 there's no code checking/tests until you get to second year.
>>
Hey nerds, how do i send an email without the date? I want to hide the time i sent it.
>>
>>54610332
Well, I never had to take it, but that's good to know. I knew a few people who had trouble with it.
>>
>>54610318
CMU has a recurring theme of proving correct code. CM-112 assert tests for everything, CM-122 contracts for everything, CM-150 is functional programming w/coq proofs, and in 15-440 which I'm doing right now it's entirely done in Go with a focus on careful error handling/yet more tests.

You can walk out of CMU and work writing mission critical NASA code
>>
>>54610332
>Week 3
>Top Down Design

Shit, nigger. Talk about fast paced.
>>
Is it possible (practical) to write a garbage collector of any kind (for an interpreter) in Rust without using any unsafe blocks?
>>
>>54610375

A bunch of the stuff in their first year coursework are things I hadn't seen until second or beginning of third year. Shit, there's plenty of stuff in there that we never got introduced to in the classroom.

I should've gone to CMU.
>>
>>54610390
Everything there is pretty fast paced. Having dropped out, everything else seems to be too slow or not demanding enough and I always end up regretting it.
>>
>>54610397
should be, you can always just use a big array/vector to represent the memory and implement your own allocation mechanism within that
>>
>>54610390
>Top down design
http://www.kosbie.net/cmu/fall-14/15-112/notes/notes-top-down-design.html

Lol, Polya's How to Solve It is recommended reading. I read that for an analysis class but not an intro to programming class
>>
>>54610390
CMU is insane. One of my friends who went there had to implement malloc as one of his introductory programming course projects.
>>
>>54610461
Malloc is a project in Intro to Systems Programming, which you can take after 15-122.
>>
>>54610461

Jesus H. I guess it's a blessing and a curse. I mean, they're doing general 2nd/3rd year material in their 1st year, which means they can later drill down into the real meat of CS theory. Still, seems a bit hectic.
>>
>>54610375
cmu ? the school who introduce programming with ruby and doesn't want to teach oop anymore ? lel
>>
>>54610537
3/10
>>
File: reason.png (64 KB, 1196x1228) Image search: [Google]
reason.png
64 KB, 1196x1228
Why haven't you learned Reason yet, anon ?

https://facebook.github.io/reason/
>>
>>54610652
Because it's not Elixir.
>>
>>54610652
>horrific love child between javascript and OCaml
>>
If I call wait(), is it necessary/good practice to do it like
wait(&status);

Or should I always do it like this
pid = wait(&status);

Basically, is there a reason to call it as a variable assignment? Is there a benefit or safety associated with this? My program works without the assignment, so just wondering
>>
>>54610652
lel, they ruined it
>>
>>54610694
Read manual pages
>http://linux.die.net/man/2/wait
It returns -1 if there's an error. Unless you intend on adding code to handle that error don't worry about it.
>>
So /dpt/ in my program I have to set every element in a couple ~300 long bool arrays to false quite frequently. I don't give a fuck about memory consumption. Is it faster to iterate through with a for loop or to memcpy a blank slate onto them? Or maybe there's a faster way I didn't know about?

And if I memcpy I probably want to expand those arrays so that their sizeof is a multiple of 4 right?
>>
>>54610916
Is your program running to slow, or are you optimizing prematurely. If it's premature, a loop is fine. I bet optimizing for this isn't going to affect your run time by much.
>>
>>54610957
Well I'm more curious than anything else. I just read up on memset so I'll use that.
>>
>>54610980
memeset will likely be the fastest, if not just as fast as a for loop.
>>
>>54609510
Racket.
>>
File: ss+(2016-05-17+at+11.41.58).jpg (318 KB, 1707x851) Image search: [Google]
ss+(2016-05-17+at+11.41.58).jpg
318 KB, 1707x851
>>
File: 1463010176888.jpg (43 KB, 372x372) Image search: [Google]
1463010176888.jpg
43 KB, 372x372
>>54605498
Given a simple if else conditional, where there are two conditions being checked, with the four combinations of values being

True and False
True and True
False and True
False and False

what would the else evaluation explicitly look like given only one if check of:

if(True and True)

Would it be:
else (False and False) or how can you tell?

I can post code if needed.
>>
>>54611201
It doesn't matter what you're trying to do, I can guarantee you're doing it wrong.
>>
>>54610694
> wait(&status);
What would be the point of this? It waits for some unspecified child process to terminate and returns its status. But given that you don't know which child the status corresponds to, the status isn't really much use.

> pid = wait(&status);
So what are you going to do if pid isn't what you expected it to be?

> My program works without the assignment
For small values of "works". IOW, any problems don't show up for a trivial test case.

You should probably be using waitpid().
Thread replies: 255
Thread images: 35

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.