[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: 37
File: 09-16-26-Hackers-With-An-Agenda.jpg (809 KB, 1000x749) Image search: [Google]
09-16-26-Hackers-With-An-Agenda.jpg
809 KB, 1000x749
Fuck weaboos
Previous -
>>55092415

What are you working on, /g/?
>>
C
>>
why was last thread deleted
>>
File: 1465700695183.jpg (80 KB, 482x424) Image search: [Google]
1465700695183.jpg
80 KB, 482x424
What's the best programming language and why is it Excel Formulas?
>>
Don't know why that thread got deleted, but what is it that makes Linux better for programming? I use both Linux and windows so I don't mind going either way.
>>
>>55100864
>>55100870
Because they were posted before the bump limit.
>>
>>55100882
Oh. Well it's past bump limit now so it's fine.
>>
Why were all the other threads deleted?
>>
>>55100846
Learning rails for the backend of an app I am creating, learning http stuff for the front end, learning js for the web app
>>
>>55100867
Can you use Excel formulas to implement a universal Turing machine?
>>
>>55100867
It's not OOP
>>
File: himegoto (3).jpg (407 KB, 600x800) Image search: [Google]
himegoto (3).jpg
407 KB, 600x800
>>55100846
Let's get this thread back on track!
>>
>>55100870
vim, gcc, bash in general, etc
>>
>>55100902
Please stop posting your forced memes.
>>
>>55100904
So you mean terminal?
I use atom though, not vim. Been learning java on my laptop, running Fedora.

>>55100902
Fuck off.
>>
>>55100904
Windows has that
>>
>>55100870
I don't know about other languages, but practically every single aspect of C programming is better on some sort of *nix.
>>
>>55100870
sudo apt-get install libwhatevah
>>
File: 1435341712903.png (593 KB, 950x1335) Image search: [Google]
1435341712903.png
593 KB, 950x1335
>>55100846
>Fuck weaboos
I would so love to drop you normalfags into 2007 /g/ & watch you get triggered at "/g/ - Techloli/g/y". Why are you so butthurt about anime being on the majority of boards on an anime imageboard?

>>55100870
Linux is better because:
>gcc/g++/gdb out of the box ; Windows requires the installation of a bloated, laggy substitute called MinGW
>100's, possibly 1000's of programming-related packages in the repositories
>better, more functional, more aesthetic text editors & IDEs

>>55100902
I'll help.

>>55100915
>memes

>>55100926
>Fuck off.
Make us. I'll bet you were the jock in high school that laughed at the kid who always raved about how sexy hentai is. Leave.
>>
>>55100939
Lets not forget
pkg-config --cflags --libs whatevah
>>
Good ideas for side projects?
>>
>>55100894
Yes, of course you can
>>
>>55100870
there are many things. Command line compiling for C or C++ is much better on linux (Windows either requires installing 4 gigabytes visual studio, or using mingw/cygwin which don't perform very well). Other langauges on windows require using the command line for invoking compiler/interpreter, and not even the fact that the windows command line is so severely limited, adding shit to windows environment PATH is just a big chore. On GNU/Linux systems all you have to do is export PATH=$PATH: or edit .bashrc or something like that. Even then, most of the times installing languages through package managers streamlines that stuff anyway and drops the executables somewhere that's already on the path like /usr/bin. Bash scripting is actually useful unlike batch scripts.

But none of those are true complete reasons. You could still live on windows without that stuff. What Unix operating systems have that is such a huge advantage over windows is grep. That's all I've gotta say about that.
>>
>>55100975
Fair enough. I'll probably just stick to Fedora then, it's more convenient on a laptop.
>>
File: 1462390618956.gif (1000 KB, 500x210) Image search: [Google]
1462390618956.gif
1000 KB, 500x210
Reading a book on abstract algebra
Anyone got any books they'd recommend on pretty much anything related to programming and mathematics?
>inb4 SICP

>>55101009
Did you get lost on your way to reddit?
>>
Probably an autistic question, but can you program in C# on Linux, I know you can C++ and C, but for whatever reason I'm under the impression you can't use C#.
>>
anyone with a lack of respect for academic integrity want to help me pass a college C course over the next two weeks for 1 BTC?

im not joking, im too stupid to even understand pointers, i should probably kill myself.
>>
>>55100870
Well, Linux is way faster and uses less resources. Also, installing dbs and packages and such is much easier.
>>
>>55101080
£oneãr ælgëßrå äñđ grë₱h thèôr¥

Âl$© çombïñàtōrìč§
>>
>>55101106
I'll do it for 1BTC, but you also have to buy a skirt and crossdress for me over skype.
>>
>>55101106
i gotchu senpai
>>
>>55101106
Have you ever tried to actually understand pointers?
>>
how do i build a better ftp?
i want it to go fast
>>
>>55101156
Didn't know the robot was in effect on /g/ too. Thank goodness. Keeping Twittertrashspeak out.
>>
>>55101086
You can, look into monodevelop for now. Microsoft is also pushing towards making .NET work well on linux.
>>
>>55101194
Have as little protocol overhead and round-trips as possible.
It really depends on what you want it to do though.
>>
>>55101203
I've been hearing this for over 10 years now.
Miguel de Icaza is a hack.
>>
>>55101194
>>55101221

i should mention, i have a specific type of network
as least 40 ms ping time
at least 10 Gbps
>>
>>55101203
Ah ok so I was right that it's not really supported. That's unfortunate I was thinking of working with it to try it out. Maybe I'll look into monodevelop but if it's not that supported yet there's not point to not stick with Java or C++
>>
>>55101217
>>55101232
I didn't say you should develop .NET on linux, only that you kind of can. Given the choice you should use windows or a different framework, in my opinion.
>>
who /VHDL/ here?
>>
File: 1464902262758.jpg (176 KB, 971x688) Image search: [Google]
1464902262758.jpg
176 KB, 971x688
>>55101263
Are there any incompatibilities or shit, on Linux?
>>
File: g.png (302 KB, 1920x1080) Image search: [Google]
g.png
302 KB, 1920x1080
Would an employer laugh at my github if it had a BMI calculator, or temp converter on it?
>>
>>55101273
i did verilog in college
it was the hardest "programming language" i ever had to learn
>>
>>55101312
Yep.
It's really no better than having a hello world on your github.
>>
>>55101255
Tanned != brown

>>55101251
I don't know a huge amount about designing networking protocols. I was thinking that you would just push all of the data as numbered UDP packets over the network, and having the receiver acknowledge the packets they have received (possible doing several at the same time), but then I realised that would just be poorly re-implementing TCP and other application-level protocols.
>>
>>55101312
not if you made it as an android/ios app
>>
>>55101284
The core part of .NET should work fine, so if you're just making console applications that don't use too much of the extended library you'll be fine. There are plenty of incompatibilities when it comes to graphical/UI libraries and things like that. Some of them have worse alternatives that you can use on linux, but othres don't.
Honestly if you're wanting to play around with it for fun you should go for it.
>>
>tfw writing a binary format for text-based animations
Shit's hard, m8.
>>
>>55101316
what did you learn first? Software or Hardware?
>>
>>55101331
>but then I realised that would just be poorly re-implementing TCP and other application-level protocols

actually, you guessed on the correct answer
i have to constantly fight with TCP to get the best performance on long fat networks
getting the best performance requires using multiple connections in parallel, vastly increasing the tcp window size, and changing the congestion control algorithm

i'm of the opinion that it would be better to use a different protocol altogether
>>
OP pic is not kawaii. Redo the thread nao
>>
>>55101357
both
in the class we learned about the software and programming language side
but in the laboratory we had to synthesize everything onto FGPAs
it was a major headache for me trying to separate the two
>>
>>55101331
TCP is a lot heavier than just having sequence numbers. UDP with sequence numbers and a basic ACK/re-send mechanism should work well. There are several tricks you can do, like having ACK(10) mean the receiver has received packets 0-10 instead of having to ACK each packet. Other than that you can mess with packet sizes and things like that to get marginal better performance as well, especially if you know what kind of a connection you're sending over.
You're probably splitting hairs at that point for a file sharing program though, unless you are planning on sending terabytes of data.
>>
>>55101389
>unless you are planning on sending terabytes of data
actually that's exactly what i'm doing
minimum 1 TB
normal dataset size is 11 TB
>>
>>55101106
Sent. :^)
>>
>>55101402
http://tsunami-udp.sourceforge.net/
I can't vouch for this but it looks like what you want, maybe take a look at their code if you're interested in implementing it yourself.
>>
>>55101450
thanks, i remember reading about tsunami years ago but it had fallen off my radar
i'll check it out again

one problem we keep running into is that the techniques required to reach 1 Gbps speeds (like in tsunami) are different than the techniques required to reach 10 Gbps speeds
in the lab we've been able to transfer at close to 100 Gbps but it requires several dirty tricks and is very fragile
>>
>>55101487
Are you running into issues processing the data fast enough at those volumes? Maybe even little things like flipping the bytes to/from network order need to be parallelized on both sides or completely avoided when you're working with that much data.
>>
>>55101379
In order to have it more clear you should understand what parts form a program.

Essentially understanding the difference of control flow statements from regular statements and instructions.

In hardware you have both of those things, the difference being that individual assigments, statements logic evaluations and what not are always there, they are not executed.

if you have something like the following assignment in C for instance

if ( x == 3)
{
Y = A + B
}
else
Y = A - B


in software you do a conditional branch, one which would load the addition or the substraction instructions depending on what value does the X variable have, each of those instructions would load the result in the memory address of Y.

In hardware you essentially have the same thing. Only Y is synthetized as a register and the + and the - get synthetized as two harware blocks whose inputs are always A and B, the == logical operator could get synthetized as a designware who tests register X against the constant 3. They function at all times. BUT you get to decide when their outputs are saved in register Y with the aid of multiplexers and enablers. (if y.en == 1 at that particular time the input value of Y gets stored)

You can implement something like C's control flow in hardware with the aid of a FSM whose inputs would be, in this case the logical test X ==3 output and its outputs would be the multiplexor control signals who put either A-B or A+B at register's Y input and the enable signal that orders register Y to update its value.

In the end Harware itself consist in nothing but a Data Path and a FSM to control it. Pretty much like any other declarative programming language.
>>
Noob question coming through. Can you install linux in your computer but still keep windows? What I mean, can you install linux on windows and use it without double booting? I want to start learning/coding in linux.
>>
>>55101531
what is a virtual machine?
>>
>>55101514
we don't change the endianness of the data payload

at very high speeds we run into issues with non-uniform memory access and contention on PCI express bus
our dirty tricks involve taking a diagram of the hardware and manually mapping the threads of our file transfer program to run on specific cores
>>
>>55101531
if you want to learn some linux, what helped me a bit is having a raspberry pi to mess around with and automate some stuff on, you'll earn to ssh into stuff and connect through the network with it, write some startup scripts, etc etc

or yeah just use a virtual machine >>55101546
>>
>>55101531
vmware or virtualbox.
>>
>>55101525

Y = A + (((2*(x == 3)) - 1)*B)
>>
>>55101546
>>55101567
>>55101574
Thanks for the response guys. I am pretty new to programming.But I feel like learning how to code in linux(especially because its command line(terminal) its superior to windows) will take my coding skills to the next level. Any advice from you experience programmers on how to become a GREAT programmer instead of just one more in the herd?
>>
How do I gently convince my girlfriend that she's not smart enough to learn C++?
>>
File: AMD spontaneous fires explained.png (358 KB, 575x592) Image search: [Google]
AMD spontaneous fires explained.png
358 KB, 575x592
>>55101643
You don't.
>>
Should I learn Idris?
>>
>>55101662
Yes, you should. It will be a learning experience.
>>
>>55101659
But listening to her complaints is driving me crazy. She's been studying out of a book all summer and can't even understand pointers.
>>
>>55101685
Just tell her they're literally just memory addresses and that she shouldn't worry about anything else.
>>
>>55101659
Ironic, given that Nvidia is the leading cause of explosions and loss of limb.
>>
>>55101681
OK but is it worth using in a project or is it a meme
>>
>>55101603
This is going to be my own personal opinion and highly subjective.

You're on the right track with linux, I'd recommend you start out learning with C. It'll be really tough at first, you'll struggle to make even the most basic programs... but you'll learn how to help yourself and find the information you need when you get stuck, which is invaluable.

Secondly, learning from the "ground up", and starting with a so-called low-level programming language (as opposed to scripting languages like python/LUA/javascript that a lot of people recommend), is going to give you a better understanding of the fundamentals of programming.
Breaking your problem into its smallest parts, a good representation of your data and functions to transform that data into your desired result, will become second nature to you.

I could probably ramble on but this sounds autistic already.
>>
>>55101701
It really depends what you want
>>
>>55101368
>>55101389
Speaking about the performance characteristics of networking protocols, how well does SCTP perform?
>>
>>55101643
Try teaching her java instead
>>
>>55101592
>>55101592
you can apply the same method there, only there's no control statement so you would only get combinational logic, the only control statement would be needed to store that operation in Y. but that would be just a datapath with a Y/N switch for register Y. let me draw a diagram.
>>
>>55101714
lmfao, I don't certainly don't mind you rambling. I appreciate listening(or in this case reading) to people who are more knowledgeable than me on a subject ramble. So ramble away my friend, I am reading. lol
>>
>>55101747
i haven't considered sctp, but i will now!
thanks
>>
>>55101721
The project would be entirely written in a functional language anyway, I just wonder if its improvements over Haskell outweigh the library support at this point and such things
>>
>>55101331
Reinventing most of TCP is standard practice you code monkeying Pajeet
>>
>>55100846
Is the weab shit finally gone?
Thank fuck.

What's a good beginner language? Java? That's what we're learning in uni.
>>
File: 1452635429762.jpg (67 KB, 416x508) Image search: [Google]
1452635429762.jpg
67 KB, 416x508
>>55101824
Anti-anime fags confirmed for being non-programmers.
>>
>>55101824
Python
>>
the complexity/repetition in this codebase is getting insane. i may just make a tool to generate the code for me and start over from scratch :^)
>>
File: 39431.png (306 KB, 593x540) Image search: [Google]
39431.png
306 KB, 593x540
>>55101781
It really depends on the project

>>55101824
>Java
>good beginner language
pic related
>>
>>55101845
>Using a language that doesn't have macros
>>
>>55101836
Anime fags confirmed fucking retards.

>>55101824
Python or Java are great, depends on what you want to do.
>>
>>55101824
Depends on your approach, you can learn about shit like algorithms using a higher level language but if you want to understand the hardware you are probably going to need to use C some
>>
>>55101845
You forgot to forget your trip
>>
>>55101858
>Python or Java are great
Are you fucking serious? And you even have the gall to try and call somebody else a retard.
>>
>>55101854
yep, starting to regret it at this point. although i was just gonna use AST mappers to achieve most of the same thing, it would only be like 20-40 more lines than writing Scheme macros for everything im doing
>>
File: file.png (27 KB, 1368x472) Image search: [Google]
file.png
27 KB, 1368x472
>>55101592
>>55101768

something like this
>>
>>55101846
I thought you were being facetious but was replying anyway, at this point fuck off though memekid
>>
>>55101871
Yes. There's a reason most colleges start with java and OOP.
>>
>>55101876
It does depend on the project
>>
>>55100846
A music player app for my Android course. Give me a good name for it, /g/.
>>
>>55101881
Nice appeal to authority, mate.
OOP is a fucking awful meme that leads to shared-state.
>>
>>55100846
Drawing a triangle using Vulkan

I have most of the calls in place but need more barriers or some shit like that

>>55101902
Not to mention memory fragmentation, and also bullshit like

public class Mesh {
...
public void draw() {
for(Triangle t : this.triangles) {
t.draw()
}
}
}


For more rants about how OOP is shit, read just about anything by Mike Acton
>>
>>55101824
>>55101824
>What's a good beginner language?
C
then go to C++ for OOP.

Then jump to whatever the fuck you want. and think is the best.
>>
>>55101937
>>55101902
It's great for beginners, who will then move on to c, or c++.
>>
>>55101937
even better when you're doing a virtual call on every triangle
>>
File: vhdl.png (73 KB, 747x791) Image search: [Google]
vhdl.png
73 KB, 747x791
>>55101273
I gotta learn that in college. Am in first semester.
Right now we have to read pretty basic VHDL code, analyze it and draw it as the corresponding FPGA hardware.

Pic is an easy example.
>>
>>55101982 here, I forgot
>>55101873
>>55101273
Is there some simple, free IDE I can practice VHDL in? Right now we only ever turned code into circuit networks, but we never wrote any code on our own. I think writing some on my own for a day would help me a lot more at this point.
>>
>>55101982
>FPGA hardware.

You mean RTL, also I put that post as bait so I could tell undergrads to tell their professors to stop using that bullshit prehistoric meme language called Verbose Hardware Description Language
>>
>>55100846
Currently finishing up Js on the part of DOM apis, i must say its a bit annoying from the application im learning from, they literally slap 20 terms on one page and expect you to know it the following page. Its not too hard to grasp, but should you really remember all those terms, its quite a bit. And how important is this really, like yes the basic stuff of it i see is pretty important like
document.getElementById("demo")
but what about the others like converting something into an array or know the childNodes
>>
>>55102014
>>55102022
If you would like to get more into harwarde design I strongly recommend verilog, I don't think there's open sofware for hardware design sadly. since it's always tied to some Hardware you'll use to load your hadware (haps, fpga's etc) and tohse usually come with IDE's and licenses. but I might be wrong.
>>
File: 1451916068305.jpg (120 KB, 1012x675) Image search: [Google]
1451916068305.jpg
120 KB, 1012x675
>>55101356
I take that back, I was being retarded.

My 46MB raw animation is now compressed losslessly into a 2.7MB file, and I haven't even started implementing the crazy interframe-like idea I have for much better compression.
>>
File: 1444460772879.jpg (37 KB, 329x399) Image search: [Google]
1444460772879.jpg
37 KB, 329x399
>>55100946
>an anime imageboard
Fuck right off to /anime/ you autistic manchild
>>
>>55100902
Stop, please post content that has relevancy to programming.
>>
How important is it really to know your dom apis in Js

>>55102097
>>55102077
I dont think theyll ever get it through their heads, too incompetent.
>>
>>55101982
Also to compare and contrast the verbose code in your picture would be something like this in verilog


module k1_del_ws2004_2005 (
input wire a,
input wire b,
input wire c,
input wire clk,
input wire [2:0] d,
output reg u,
output reg v,
output reg w,
output reg y
);

wire s1;
wire s2;

always_comb y = (d[2] | d[1] | d[0])&( ~d[2] | ~d[1] | d[0]) ; //pretty sure you don't need a case statement here, and besides you can reduce my combinational statement.

always_comb v = ~(b | u);
always (posedgeclk) begin
w <= s2 & w;
s2 <= s1 | w;
s1 <= c;
end


endmodule



no need for all that horseshit
>>
Idea for a potential project: a bytecode standard of my own for functional languages. Essentially, would be a runtime environment like the JVM or CLR, with less of a focus on object oriented features, and more on making implementations of functional languages easier.
>>
>>55102403
Don't forget GADTs
>>
>>55102403
Don't forget fucking your mom
>>
>>55102403
I didn't think you used functional programming
>>
>>55102403
>>55102456

what do you guys have against OOP and I mean against the paradigm itself, not implementation related issues like memory fragmentation and whatnot.?
>>
>>55101312
>>>55101255
why is binary search 93?
>>
>>55102493
it's hard to sum up but a lot of things including verbosity, lack of composability, inconsistency, lack of abstraction, etc
>>
>>55102456

I don't really do functional programming much, but I think it's a bit odd that functional languages like F#, Clojure, and Scala, are mainly used in environments designed to accommodate object oriented styles, rather than functional styles.
>>
>>55102589
>lack of abstraction
but OOP itself IS about abstraction

besides, really pro people at structured programming end up emulating classes/objects anyway.
>>
>>55102616
It's because it's unmistakenly superior


>>55102629
No, ALL programming is about abstraction
>>
Something I just finished recently:

Spent 8 months from late september to about the end of may working on an expression parser in C# that be taught formulas and learn them sort of like an AI system, also lets you add variables at will. Has full access to all math functions with endless additional variables to solve with or for. Also has memory like a calculator, a converter for DEG/RAD/GRAD, a programming calculator, and a built in console to load a formula by its name rather than searching for it in the list.
>>
>>55102639
Well, I guess not ALL but most
>>
>>55102493

I don't hate OOP. My favorite languages are Ruby and C++. I'm just thinking it might be a cool idea for a more functional-oriented runtime environment. For instance, why not let an export library able to export top level functions, rather than simply types with static methods?
>>
>>55102642
Looks pretty nice, which UI framework did you use?
>>
>>55100870
It's only good if you use C, C++, or languages which require C libraries

this is because the libraries are easily there and this also makes building C, C++ applications/libraries easier. Along with C being built with Unix which has the typical build system (make files)

Go for example doesn't have this problem due to not requiring any C libraries and people are encouraged to write in pure Go and not using bindings. (and also coming with its own build system)
>>
>>55102676
Everything was made in .NET with compatibility for 4.5+. Considering doing some redesigning for the colors to make it dark themed instead.
>>
>>55102681

>or languages which require C libraries
So basically everything.
>>
>>55102705
Go doesn't require C libraries
>>
>>55102493
It encourages "implementation related issues like memory fragmentation and whatnot.".

Although I can point out one thing that is definitely a problem in Java and I'm not sure if it's all that avoidable in C++ without resorting to structs:

Triangle[] triangles = new Triangle[tri_count];

// ... init triangles ...

for(int i = 0; i < tri_count; i++) {
// these are eventually inlined to triangles[i].x and y
float x = triangles[i].getX();
float y = triangles[i].getY();
add_point(x, y);
}


Which, when translated to C:

Triangle **triangles = malloc(sizeof(Triangle *)*tri_count);

// ... init triangles ...

for(int i = 0; i < tri_count; i++) {
// unless you forgot to enable optimisation, this is ultimately 3 lookups per entry:
// 1. find the triangle reference from the array
// 2. get x from the triangle
// 3. get y from the triangle
// lookup #1 is the problem as there's no guarantees that each triangle is in a completely separate page
float x = ( *( *(triangles + i) ) ).x;
float y = ( *( *(triangles + i) ) ).y;
add_point(x, y);
}


Whereas if we were just doing it in C the normal way (or C++ using structs):

Triangle *triangles = malloc(sizeof(Triangle)*tri_count);

// ... init triangles ...

add_linear_block_of_triangles( triangles, tri_count );


If you can't see the problem: The Java example has to do N pointer lookups, one lookup per triangle, to even find the damn triangle in the first place. Each non-primitive array is an array of pointers, and this indirection is unavoiable.

The "C the normal way" example avoids this indirection.
>>
Is it recommended to try and learn two languages (C++ and Python) at the same time or should I learn one and then start on the other?
>>
>>55102714
Right, but does anybody in industry even use Go?
>>
>>55102745
of course
https://gophercon.com/sponsors/
https://github.com/golang/go/wiki/GoUsers
>>
>>55102403
I suggest reading up on OCaml's bytecode uif you want to see how other people have approached this problem before. there's a chapter in Real World OCaml (available online/PDF in gentoomen library). the bytecode isn't really used anywhere else, but there have been some talks of Idris switching over to it
>>
>>55101961
You can write OOP in C
>>
>>55102745
http://jimplush.com/talk/2015/12/19/moving-a-team-from-scala-to-golang/
>>
>>55102744

Start with one, then the other. I recommend starting with C though if you haven't programmed before. The syntax behind C++ can be a bit bewildering for many beginner programmers, especially if you consider that it's literally undecidable (it is impossible to compute in finite time if a given C++ program is correct). Moreover, the reference interpreter for Python is written in C, so knowing C may make understanding the internals of Python easier.

>>55102772

Might be worth a read.
>>
File: junko wrapped.png (703 KB, 745x573) Image search: [Google]
junko wrapped.png
703 KB, 745x573
>>55102795
program a 2d AI wife

>>55102790
realworldocaml.org
>>
>>55102795
just try to be nice to girls around you, get their numbers/snapchats. know how to read the signs about if she's into you and if you think she is ask her out
>>
>>55102790
I've done a bit of Java before and have been flicking through a C++ book over the past few days, but I'll have a look at some C stuff too now.

Ta
>>
>>55102616
>"The visional design of the .NET platform was very much expected to be a multilanguage platform from the start. Right back in 1998, just in fact as our research group in programming languages started at Microsoft and I joined the team and then other 10 of us joined the team, we were approached by a guy called James Plamondon, who started the project called Project 7, which was about getting 7 academic and 7 industrial programming languages on each side to target the .NET common language runtime and really check out if it was good enough, to see if design changes could be made early on in the design process of .NET to make sure it was good enough for a range of programming languages."

>"I took what I learned from .NET Generics and saw that there was a chance to do a ML like language fitted very closely with .NET. During this time we had a go doing Haskell for .NET, we actually got a long way in doing that, but in the end there is quite a lot of dissonance between Haskell and .NET."

www.infoq.com/interviews/F-Sharp-Don-Syme
>>
File: nervous_twiddling.gif (208 KB, 354x534) Image search: [Google]
nervous_twiddling.gif
208 KB, 354x534
>>55102820
B-but how do I get girls around me in the first place?
>>
>>55102744
Depends. Do you know any languages already?

If you have a few under your belt it should be fine.

>>55102745
TIOBE index ranks it 48th, probably not a big indicator but at least it's still in the "ranked in order" section

>>55102786
You definitely can, it looks a bit like this:

// Point.h
struct Point;

struct Point *new_Point(double x, double y);
void destroy_Point(struct Point *p);
double Point_getX(struct Point *p);
double Point_getY(struct Point *p);

// Point.c
#include <stdlib.h>

#include "Point.h"

struct Point {
double x, y;
};

struct Point *new_Point(double x, double y) {
struct Point *p = malloc(sizeof(Point));
p->x = x;
p->y = y;
return p;
}

void destroy_Point(struct Point *p) {
free(p);
}

double Point_getX(struct Point *p) {
return p->x;
}

double Point_getY(struct Point *p) {
return p->y;
}


The compiler will inline most of that shit for you if you use link-time optimisation and don't cross a library boundary

If you use Clang it may even optimise out the malloc/free and just give you a Point on the stack
>>
>>55102845
try to hang around some guys who are more normie than you, meet girls through them. or just talk to random girls from work/uni some more
>>
I'm 22 years old with a full time job. I matched with an 18 year old. It feels weird. Like I don't see myself attracted to her. Am I becoming gay or just mature?
>>
>>55102879
>Am I becoming gay
Do you use functional programming?
>>
Why is Google's API such a pain in the ass to use? If I want to access my own private data, not someone elses, I either have to jump through all of the OAuth2 hoops, or set up a service account and manually give it permission to access certain data. Fuck. I'm sure there's some good reason for it, but shit, I hate auth.
>>
File: sharku.jpg (414 KB, 1060x1600) Image search: [Google]
sharku.jpg
414 KB, 1060x1600
>>55102878
But I don't know any normies and I'm too diffident to talk to random girls.
>>
>>55102904
I'm familiar with it. But never worked with it. Just school and personal exploration.
>>
>>55102860
That's not oop, that's an abstract data type. you have now lost all the little credibility you had.
>>
>>55102879
you need to smell her pheromones, it doesn't work on a screen
>>
Daily reminder you shouldn't use JSON in 2016

http://blog.codeclimate.com/blog/2014/06/05/choose-protocol-buffers/

https://developers.google.com/protocol-buffers/docs/overview
>>
File: Grace_Kelly_MGM_photo.jpg (319 KB, 1096x1349) Image search: [Google]
Grace_Kelly_MGM_photo.jpg
319 KB, 1096x1349
>>55102795
>hepburn
>not princess grace of monaco
kek
>>
>>55102879
Definitely gay.
>>
>>55102921
He's using what are effectively member methods, as well as having getters and setters

You don't know what you're talking about.
If he had ONLY said

struct Point { double x, y; }
then you'd be right
>>
>>55102916
i dont mean people who are 100% normies, just someone who talks to girls more than you. talking to random girls can be hard but you just have to realize that if you fuck it up you can always try with someone else.
>>
>>55102950
Where do I talk to random girls?
>>
>>55102921
Nor is this by your standard:

public class Point {
private double x, y;
public Point(double x, double y) {
this.x = x;
this.y = y;
}

double getX() {
return this.x;
}

double getY() {
return this.y;
}
}


But immutable objects are good OO practice
>>
>>55102944
>He's using what are effectively member methods

1. those are not method
2. those are not even members of the said "object" which is one of the main difference between ADTs and objects.

you don't know what you are talking about. get lost.
>>
>>55102952
The new place called outside?
>>
File: popup_3.jpg (185 KB, 643x557) Image search: [Google]
popup_3.jpg
185 KB, 643x557
>>55102933
Speaking of pheromones, ant colony optimization is pretty cool
>>
>>55102962
But where outside?
>>
>>55102943
I better go to Orlando.

>>55102936
Only bad thing is that 99% of data is already in JSON
>>
>>55101824
fuck literally everyone else here. Go pick up a copy of K&R C (The C Programming language K and R are the authors) and fucking learn to code kid. That shit is the alcohol of languages. It's a staple and it will never not be good to know
>>
>>55102959
no, this is an object because both the data and the implementation of the procedural interface are both abstracted.
>>
>>55102961

>i-it's not exactly the same syntax so it's completely different!
>>
>>55102936
protobufs don't support my language of choice
>>
The "correct" answer is that it doesn't matter. That's pretty much true, but I personally vouch for Java because I think it shows the important software structures more concretely than python/ruby/js, but isn't nearly as easy to fuck up as C. Also if you're already learning it in class then it's probably good to keep at it for now, don't want to spread yourself to thin.
>>
>>55102969
idk, at the mall or something... just go up to some random girl and ask for her number. if she says no you'll probably never see her again so it doesnt really matter
>>
>>55102989
real some plt someday maybe ?

here a concrete example of how adts and objects are different in use.

object
sort(object o)
{
o.sort();
}


adt
sort(data d)
{
switch (type(d))
{
intarray:
intarray_sort(d);
floatarray:
floatarray_sort(d);
...
}
}


it's like you guys never read anything on abstraction techniques.
>>
>even TypeScript has discriminated unions
kek
https://github.com/Microsoft/TypeScript/pull/9163
>>
>>55102980
Let's just copy-paste the not-abstracted public interface w/o the private implementation:
// Point.h
struct Point;

struct Point *new_Point(double x, double y);
void destroy_Point(struct Point *p);
double Point_getX(struct Point *p);
double Point_getY(struct Point *p);


>OOP == syntactic sugar and what you did lacks sugar

>>55102936
Shit, I better use XML instead

Thank you anon
>>
>>55103031
I apologise for your stupidity
>>
File: i-love-xml.png (4 KB, 130x139) Image search: [Google]
i-love-xml.png
4 KB, 130x139
>>55103051
You're welcome
>>
Hi there, I spend most of my time on /mu/ but it seems nice over here. Much less shit bitching. Anyway, I'm going into my senior year of college and have spent the past year and a half becoming fairly proficient at web development, mostly SPAs but a little Node as well. All of my personal projects are in JS, so I would really like to add something to my resume to show that I'm not just a "web" guy. I was considering picking up one of the newer languages like Rust or Crystal or Kotlin, and writing something decently significant in it, but I'm sure they aren't nearly as useful to have as a significant project in Python or Java. Any thoughts or advice? Also, any suggestions for a substantial project to work on in my new language? Something strictly back-end.
>>
File: 1958201258.png (147 KB, 815x627) Image search: [Google]
1958201258.png
147 KB, 815x627
>>55103036
>unions
>necessary
>>
>>55103008
What hipster language do you use?
>>
Decided to play around with libarchive after discovering that zlib apparently cannot work with zip archives -- it only supplies functions for using the compression/decompression algorithms used in zip files.

>>55102837
Interdasting.

>>55102811
Site not loading for me for some reason.
>>
>>55103051
>OOP == syntactic sugar
Never. You can't have oop in C without adding new semantics to the language.

>>55103060
https://www.cs.utexas.edu/users/wcook/papers/OOPvsADT/CookOOPvsADT90.pdf
>>
>>55103083
C
>>
>>55103103
Not loading for me either, look it up on archive

>>55103105
You are literally saying that it's not the same because syntax
>>
>https://www.cs.utexas.edu/users/wcook/papers/OOPvsADT/CookOOPvsADT90.pdf

Hey that guy was my professor last year. That paper went straight over my head though.
>>
>>55103072
Rust is hella fun to write, so +1 to that option. maybe try reimplementing some coreutils with it for a starting project.
>>
>>55103105
You can implement all the good parts of OOP in C natively.
You can even go full autistic and add member functions if you're so inclined, but since C forces you to pass in the pointer you want to work on, it beats the point altogether.
Though, you could probably use this as a really autistic form of "namespaces".
ptr->set_data(ptr, data);
>>
>>55102989
In OOP, an object is a black box that you send messages into. The object itself determines how to handle the message. When you invoke a function directly which fiddles with the contents of the box, you've broken the abstraction.

To implement OOP in C, just add a vtable to your struct. E.g.

struct my_object;

struct my_object_operations {
int (*do_thing)(struct my_object*);
int (*do_stuff)(struct my_object*);
};

struct my_object {
int data;
struct my_object_operations *op;
};
>>
>>55103072
If you really, really want something that screams "I don't just do web stuff", learn C.

If you want to be able to end up on pretty much any web job ever, the langs for that tend to be Java, Python, C#, Ruby, and PHP.

>>55103105
void Object_sort(union Object *o) {
switch (o->typ) {
case OTYP_IntArray:
IntArray_sort(&o->IntArray);
break;
case OTYP_FloatArray:
FloatArray_sort(&o->FloatArray);
break;
}
}

void sort(union Object *o) {
Object_sort(o);
}


Have fun
>>
>>55103180
The intent of the example was that the accessors would be used. Any language with enough control could bypass accessors.
>>
>>55102795
just keep talking to girls and try to be funny/somewhat interesting, not a total bore
>but i dont have any girls to talk to
go outside more, talk to them at the mall, bus, library etc etc
>im too anxious to go outside
get your fat ass into therapy
>>
File: comfy.png (167 KB, 376x328) Image search: [Google]
comfy.png
167 KB, 376x328
Someone give me a project to do in C.
I haven't programmed in weeks.
>>
>>55103105
>You can't have oop in C without adding new semantics to the language.
but thats wrong
the C interface of directx even has vtables
>>
Creating a distributed system in GoLang
>>
>>55103244
Write a compiler for your own language
>>
>>55103244

program some low level teledildonics software so you can fuck and cum in your computer
>>
>>55103193
In the example, there is no way to invoke the accessors except directly. The caller shouldn't event know about the concrete implementation of an accessor. All the caller should know about is the interface, i.e. that there are methods called getX and getY which can be invoked through an instance of a Point object.
>>
>>55103180
That's only one aspect of OOP (subclassing), but yes that can be done too.

>>55103216
Keep chipping away at C and you'll eventually discover wonders like this

glDrawArrays(GL_TRIANGLES, 0, sizeof(player_mesh_data)/sizeof(player_mesh_data[0]));


>>55103244
Write a software 3D renderer

Alternatively, write a raymarcher

>>55103279
Unless the caller is deliberately breaking the universe or some shit like that, in which case if you try really hard to defend against it you're just going to ruin performance

Heck, Java has reflection just in case you *really* need to break the interface
>>
>>55103279
>except directly
What would be a non direct invocation of an accessor?

Clearly not p.getX() because this is no more explicit than getX(p) - in many ways (including literally in C++) "." just acts as an operator to pass the object on the left to the function on the right

Would you seriously say that only a language with implicit accessors, such as C#'s property functions, is OOP?
>>
>>55100846
what's the best way to get user inputs for polynomials in a program? Like should I parse an input of x^n for a value of x raised to n or is there a better way of doing it? I know there's a mathtex or something but i've never put much effort into looking at it. Thanks in advance /g/ois.
>>
>>55103321
scanf

>>55103318
Direct access would be p->x, but nobody outside of Point.c is supposed to know the contents of the Point struct
>>
>>55103321
Either use a parser or just use a text interface to build the AST
>>
>>55103234
This. Even if you're really cheesy it'll work.
>>
>>55103334
And nobody does given that you use the API as intended. In the most OOP C++, Java, C#, etc etc you can still get your way around and figure out the implementation details. You can do this (with much greater difficulty) without even knowing the source code, people do this all the time.
>>
>>55103337
By a text interface I mean like a one by one thing where it's like

Enter input:
+: add a term
*: multiply by a term
^: raise to a term
(: begin subexpression
): end subexpression
f: finish
>>
>>55103131
>>55103187

Any opinions on learning Scala? I picked up a little Haskell for class last semester, but it just seems a little too...academic for my liking. I really don't know a ton about Scala, but it seems interesting.
>>
>>55103313
>That's only one aspect of OOP (subclassing)
Message passing is the core of OOP.

>>55103318
>What would be a non direct invocation of an accessor?
p->getX(p)

>Clearly not p.getX() because this is no more explicit than getX(p)
The difference here is that p determines the meaning of getX, rather than the caller.
>>
>>55103374
The caller doesn't determine the meaning of getX in the other example - this is C, there is no scoping
>>
>>55103394
C has block scoping tho.
>>
>>55100870

UNIX in general was designed as a development platform from the beginning. The tools and conventions it has have evolved over decades. C was invented for UNIX, and the C standard is based on what was available on UNIX. POSIX can be considered an extended standard library.

Linux reaps the benefits of all that because it's a POSIX environment.

Windows was designed as a general purpose end-user operating system. Development tools tend to be monolithic or plugin-based and sit on top of the system instead of being an integral part of it. It's a different mentality, but some people prefer it.

I don't care for Windows development myself, but I'll be the first to admit I have little experience with it.
>>
>>55103337
>>55103334
so basically just tell user how to input text and handle it on my end? thanks anons.
>>
>>55103420
That's not remotely similar
>>
>>55103394
>getX(p)
The caller is invoking a function called getX which has a fixed implementation.
>p->getX(p)
The caller is asking p for the function called getX, the implementation of which is unknown to the caller, and then invoking it.
>>
>>55103443
Yes, once you're more experienced you could perhaps do actual expression parsing

>>55103456
double getX(Point* p);
Point q;
int main(int,char**) {
getX(q);
return 0;
}

...
implementation
>>
File: r6 gadget esp.png (679 KB, 652x573) Image search: [Google]
r6 gadget esp.png
679 KB, 652x573
>>
>>55101252

The Second Life server and many of its clients are written in C# and run fine on UNIX with Mono. I had a server up on FreeBSD and used a couple different clients on Linux back in the day.

So yeah, it works. I've never written a line of C# in my life, though, so take it for what it's worth.
>>
>>55103107
>2016
>using C
That's worse than using JSON in 2016
>>
Why is OOP so boilerplatey?
>>
>>55101603

Program. A lot.

Choose projects that challenge you.

Learn one mainstream language really well, but write the occasional project in something different. Write a couple things in an esoteric language. Forth, LISP, Haskell, etc. are good choices for the esoteric language.

Also, program with other people on large projects. In the real world, you'll be dealing with codebases large enough that no one understands the entire system. Learning to work with others on a huge project is invaluable.
>>
>>55103521
It's the only thing which reliably works on all machines in my house and can fairly easily be ported to new OSes and architectures.
>>
>>55101714
>LUA

that was totally bait

for everyone else, it's called Lua because it's BR for "moon"

>>55103521
enjoy your long compile times then faggot
>>
Are there any frameworks for other languages that have Node.js style non-blocking IO?
>>
File: 1464632537832.png (152 KB, 1948x858) Image search: [Google]
1464632537832.png
152 KB, 1948x858
>>55103543
Whoops, your car diagram loops a bit broken to me. Here are some patterns you can use to improve your design
>>
>>55102403

Look into the design of Clojure for reasons to avoid a stack-based VM like the JVM.

You want to natively support tail calls if you're going functional.
>>
>>55103543
You can fix that pretty easily, watch:

// properties.h
#define PROP_RO(type, name) \
private type name; \
public type get_##name() { \
return this.name; \
}

#define PROP_RW(type, name) \
PROP_RO(type, name) \
public void set_##name(type name) { \
this.name = name; \
}

// MutablePoint.java.pre
#include "properties.h"

public class MutablePoint {
PROP_RW(double, x);
PROP_RW(double, y);
PROP_RO(int, instance_id);
private static volatile int instance_id_counter = 0;
public MutablePoint(double x, double y) {
this.x = x;
this.y = y;
this.instance_id = instance_id_counter++;
}
}
>>
>>55103680
This sort of shit is why I do a half-assed OOP design.
>>
>>55101603
using a terminal in linux isn't going to take your "coding skills to the next level." there's a command prompt in windows that does the same thing you're going to use the terminal for in linux. writing good programs is what will make you a better programmer, and messing with all that linux stuff is just going to slow you down in the beginning when you're trying to figure out basic concepts about programming. good luck
>>
>>55103244

Got a server?

Write an SNMP responder to monitor its health.
>>
>>55103771
But once you get a reasonably thick skin you can pick up VIM which is the greatest shit ever
>>
>>55102077
>>55100846
>>55101824
kys
>>
How do you hack people? Do you do it through the command line? Do you download special programs? I am watching Mr. Robot, and he did it through the linux terminal, is that realistic?
>>
>>55103543
What's wrong? It's perfectly alright. For instance the setSpeed() wouldn't only modify the current speed but also check if you're not trying to set speed to like 100 km/h while being on first gear and such.
>>
>>55103931
Yes, you "hack" stuff by exploiting it and navigating through command line eases the process thanks to all the CLI tools available.
>>
>>55103931
The best way to hack people is by e.g. pretending to be them and asking their friends what their password is

Also google I am sick of your fucking store fronts
>>
>>55103931
By hacking people do you mean psychoengineering or disassembly?
>>
>>55103956
So let's say I want to access my sister's laptop through my command line, how would I be able to do it? I don't particularly want to do it since I can access it easily. But I want to practice my command line skills.
>>
>>55103981
You start by getting off /dpt/ because it's wrong thread for that kind of discussion.
>>
>>55103978
Disassembly, or more specific, just be able to access their personal files. I just got curious after watching Mr. Robot's tv show.
>>
>>55104003
Well hacking people / disassembling them is neither legal nor moral and I shan't help you
>>
Looking for Python learners interested in collab-study sessions. Currently doing code wars stuff and working through John Zelle's Python Programming.

Looking for people with high motivation, willing to learn with me.

Don't be timid. Hit me up at

[email protected]
>>
>>55104076
Global rule 11
>>
File: racket.png (15 KB, 502x126) Image search: [Google]
racket.png
15 KB, 502x126
>Trusting FP in production.
>>
>>55104155
>blaming FP for a Lisp problem
>>
>>55104155
>trusting anything in production
my years as a sysadmin has made me a paranoid wreck
>>
>>55103180
>>55103248
This is not OOP, you are doing the usual cs101 student mistake. OOP is total abstraction of data behind a procedural interface but in your code, the operations are just pointers and pointers are also data that you are leaking. This is why you can't implement OOP in C: You can't "bind" a procedural interface to an object without that interface being (leaking) data.
>>
>>55103947
See
>>55103680
>>
File: cunt.png (632 KB, 802x632) Image search: [Google]
cunt.png
632 KB, 802x632
I'm working on a 3D-engine. I started a few days ago so I haven't gotten very far.

I'm trying to do it like an entity-component-system but there's some shit that just doesn't work that well. Take for example a pointlight, among its other properties it has a position, however the transform component is supposed to keep track of this. So either I store the same data in two places and let the transform system update both OR I assemble the pointlights in the scenemanager by going through all entities and collecting the ones with a light component and transform component before sending it to the renderer.

Also if anyone knows of any good resources regarding 3D-engine design they would be very welcome.
>>
>>55104309
you have to be pragmatic anon
some things work better through composition, others through inheritence
unreal solves this problem by having "scene components"
a scene component is basically a component that has an actual representation within a scene (for example a mesh, a light or a rigid body etc), and thus alwyas contain a transform
you can then attach additional scene components to the root scene component, and calculate positions that way

when in doubt, just peek at unreal
>>
>>55104328
That sounds like a neat idea. I'll look into it.
>>
/* Standard C Headers */
#include <stdio.h>
#include <stdlib.h>
#include <inttypes.h>

/* libarchive headers */
#include <archive.h>
#include <archive_entry.h>

/* Unix syscall headers. These should work with MinGW*/
#include <unistd.h>
#include <sys/stat.h>

#define BUF_LEN 8192

static void
print_entry(struct archive *ar, struct archive_entry *entry)
{
mode_t mode = archive_entry_mode(entry);
if (S_ISDIR(mode)) return;

int64_t size = archive_entry_size(entry);
printf("filename: %s\n", archive_entry_pathname(entry));
if (size <= 0) {
printf("contents: empty\n");
return;
}

printf("contents:\n");

char buf[BUF_LEN];
int64_t offset = 0;
ssize_t c;

while ((c = archive_read_data(ar, buf, BUF_LEN)) > 0) {
for (ssize_t count = 0; count < c; count += 16, offset += 16) {
ssize_t diff = c - count;
ssize_t incr = ((diff >= 16) ? 16 : diff);
printf("0x%016llX: ", (unsigned long long) offset);

for (ssize_t i = count; i < count + incr; i++) {
printf("%02hhX ", buf[i]);
}

for (ssize_t i = incr; i < 16; i++) {
printf(" ");
}

for (ssize_t i = count; i < count + incr; i++) {
char b = buf[i];
if ((b >= ' ') && (b <= '~')) putchar(b);
else putchar('.');
}
putchar('\n');
}
}

printf("0x%016llX\n", (unsigned long long) size);
}

static void
usage(void)
{
printf("usage: archive_dump file\n");
exit(EXIT_SUCCESS);
}

int main(int argc, char *argv[])
{
if (argc < 2) usage();

struct archive *ar;
struct archive_entry *entry;

printf("Value of PRIi64: " PRIi64 "\n");

ar = archive_read_new();
archive_read_support_filter_all(ar);
archive_read_support_format_all(ar);

int r = archive_read_open_filename(ar, argv[1], BUF_LEN);
if (r != ARCHIVE_OK) {
fprintf(stderr, "could not open archive\n");
exit(EXIT_FAILURE);
}

while (archive_read_next_header(ar, &entry) == ARCHIVE_OK) {
print_entry(ar, entry);
archive_read_data_skip(ar);
}

archive_read_free(ar);
return EXIT_SUCCESS;
}
>>
>tfw coding at an airport
>tfw people think I'm a terrorist
>>
Fit in just around 2k characters. It's a program I just hacked up out of boredom using libarchive to open up a .zip file (or maybe a .tar file, doesn't really matter), list the non-directory files in it, and hexdump them. Strange casts are to avoid compiler warnings regarding printf.
>>
>>55101312
Pretty much, the same can be said about all of the programs on the list in the picture, they're all basically useless and not worth posting on github.
>>
File: ninja.gif (2 MB, 249x238) Image search: [Google]
ninja.gif
2 MB, 249x238
>>55103815
Weabs getting mad
>>
>>55104437
This language is deprecated
Thread replies: 255
Thread images: 37

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.