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

/dpt/ - Daily Programming Thread

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 320
Thread images: 32

File: DPT.png (389KB, 934x1000px) Image search: [Google]
DPT.png
389KB, 934x1000px
What are you working on, /g/?

>>57722586
>>
>>57727976
I want to lick your bum OP
>>
File: Calculus of Maki Constructions.png (312KB, 452x355px) Image search: [Google]
Calculus of Maki Constructions.png
312KB, 452x355px
>>
>>57727976
newfags don't know the bump limit
>>
File: jjj.jpg (42KB, 500x281px) Image search: [Google]
jjj.jpg
42KB, 500x281px
>>57727986
>>
math is a social construct
>>
Death to JavaScript
>>
there's a problem i'm trying to get the most efficient solution for, and it's removing duplicates from a linked list. it's easy enough to get to n log n by sorting and then doing an iteration, but is it possible to get it this efficient while maintaining the original order of occurrence?

e.g. 3 1 2 3 becomes 1 2 3 my way, but i'm wondering about how it coule become 3 1 2
>>
>>57728003
I do, just wanted to make sure some cunt doesn't advertise his Discord chat in the OP.
>>
>>57728027
Convert it to a TreeSet and back?
>>
>>57727976
>What are you working on, /g/?
I'm making an Artificial Intelligence with Caffe on weeding out anime pictures on /g/
>>
I almost never use private, only public when I'm programming. When will I run into a problem for not privatizing things?
>>
>>57728063
>meme language
trash.jpg
>>
>>57728057
haskell has the set datatype which uses binary search. would adding things to the set as i go along the list and checking if they're in it be equivalent in efficiency to that?
>>
>>57728077
If you don't privatize things you will ruin your economy.
>>
>>57728063
>not using tensorflow

what a complete faggot
>>
>>57728089
he wants to keep the same order
>>
strawpoll.me/11751033

New poll
>>
>>57728089
I think so.

Max cost of checking existence of/inserting an element into the set = log(N)
Number of times you need to do that = N
Total cost = N log(N)
>>
>>57728078
>>meme language
Caffe is a deep learning framework written for both C++ and Python.

It's not a language

>this is the intelligence of the average anime poster

>>57728099
>using the jewgle botnet
>>
>>57728118
>python
>unironically shit language
trash.jpg
>>
>>57728089
>interpreted (see common use) language
>concerned about efficiency
Why?
>>
>>57728141
>haskell
>interpreted
kys
>>
>>57728156
>kysfag
go kiss your mother so can clean out your mouth
>>
>>57728077
see >>57728090
>>
>>57728165
your mother, bro
>>
Why aren't you watching Terry program TempleOS?
https://www.youtube.com/watch?v=xBslSVgcf1I
>>
>>57728197
I have my own OS.
>>
>>57728107
>>57728115
i'm the original poster, i believe my solution is optimal now. it has a set of things that have been seen, and the input list. thanks guys
>>
"if you scale a project up, you use longer labels. if you scale a project down, you use shorter labels. that's how you be a good programmer."

t. erry a davis
>>
File: SCR_1480309480.png (222KB, 1047x540px) Image search: [Google]
SCR_1480309480.png
222KB, 1047x540px
Picrelated is a small slice of a graph I'm drawing using Pygraphviz. It outputs clunky svg or png files (from ~9500 lines of DOT language), that are a bitch to even open, let alone navigate and use.
I need some way to draw graphs like that in a non-static way. Sort of like radare2 or IDA Pro draw their disassemblies. So that I could move around in a graph easily, maybe interact with it.

Is this possible to achieve with Python without too much effort (i.e., writing something with OpenGL)?
If not, what would be a relatively simple solution, preferably without changing the graph itself? (of course I can break the graph up, i just don't wanna)
>>
C++ is simple

template <bool B, typename T = void> struct EnableIf;
template <typename T> struct EnableIf<true, T> { typedef T Type; };

template <bool B, typename T, typename F> struct Conditional { typedef T Type; };
template <typename T, typename F> struct Conditional<false, T, F> { typedef F Type; };
>>
>>57728261
in Haskell this is just

type family EnableIf (b :: Bool) (t :: k) :: k where
EnableIf True t = t
>>
>>57728275
But do you get an error if you use EnableIf (False) ?
>>
Fucking opengl is unusable without a wrapper, fuck all that cruft and depreciated functionality that is constantly referenced in every opengl book and tutorial.
>>
>>57728312
I though GLNext would be a simpler cleaned up OpenGL and I was waiting for that to learn it.

Of course we got Vulkan, and you need a thousand lines to get a triangle...
>>
>>57728290
if you try to assign something other than bottom, e.g.

x :: EnableIf True Bool
x = True
-- good
y :: EnableIf False Bool
y = True
-- bad
>>
>>57728312
Well you're finding bad tutorials.
Find something which limits itself to modern (check the dates) opengl
>>
>>57728275
In the real world, I'd get a paycheck
>>
niggerlicious
>>
File: meme loving fuck.jpg (276KB, 1239x922px) Image search: [Google]
meme loving fuck.jpg
276KB, 1239x922px
>>57727976
So I am going into an Aps Development program at my college, and they say I have to use Slack to communicate with students, faculty, and update my assignments. I don't like slack, any tips for tolerating this meme?
>>
>>57728333
In the real world, I get your paycheck
>>
>>57728340
Write an IRC bot that syncs with slack and use IRC
>>
>>57728349
>haskell programmers admit that they can't get a job in programming so they resort to working countergirl at a bank
>>
>>57728378
>>haskell programmer admits to getting my money
>>
>>57728399
Your money, maybe. But I challenge someone to make anything more complex than a fizzbuzz program in Haskell
>>
File: wire defusal problem.png (277KB, 2780x860px) Image search: [Google]
wire defusal problem.png
277KB, 2780x860px
>>57728416
>>
>>57728424
I bet you can't even boot a computer with deprechaskell.
>>
>>57728424
>Compare input to something else
>print when you're done
It's literally a fizzbuzz program
>>
>>57728424
>programming exercises
case in point
>>
>terry writes braces like {
proof that terry is better than 90% of /dpt/
}
>>
>>57728485
>listening to that controlled op CIA nigger
>>
>>57728485
>90% of /dpt/
I think 90% do the same.
>>
>>57728485
Most of dpt I've seen use that style too. Only really newer programmers taking courses tend to write with a brace on the newline from what I see.
>>
>>57728424
>Colour

also

>defusing bombs by cutting wires
What is this, the fucking 80 where they dont teach you basic chemistry? Do one of the following:
1)Remove power supply
2)Remove Det-Cap
3)Soak in water and Sodium Bisulfite
4)Blow it up early with a bot

Fucking google hr, making shit complicated.
>>
Wait. Even if I'm rendering in software mode, doesn't the graphics data still pass through the GPU because that's where my DVI cable comes out of and into the monitor?
How does that work?
>>
>>57728543
Software render:
Do all the drawing in math on the CPU.
Move the pixel buffer to the GPU
Move to monitor
Hardware:
Do first step on the GPU, skip second do third.
>>
>>57728538
>1)Remove power supply
The battery is inside the casing, opening, perforating or damaging the casing triggers the bomb.

>2)Remove Det-Cap
Not externally visible.

>3)Soak in water and Sodium Bisulfite
Moving the device will nudge the accelerometer, triggering an explosion.
Dumping liquid on the device will be largely ineffective due to the waterproof shell.

>4)Blow it up early with a bot
Yes. Although you won't save the building it's in, if any.
>>
>>57728555
I wish there wasn't so much fucking abstraction in modern computing. It confuses me.

I think I'm going to order a FPGA and make my own computer and stop dealing with all this crap.
>>
>>57728197

Watching other people program can quite honestly be rather boring most of the time. I'll make an exception for the youtuber Bisqwit though, as he does not show himself programming live, but instead, shows a sped up programming video that he will occasionally comment on to explain more difficult concepts. It's a lot easier to follow, if you consider that 80% of programming is
>>
>>57728596
Buy a RISC-V if you're going to start clean, x86 is a mess.
>>
>>57728596
Maybe you care for handmadehero.org then
Aims to deal with that stuff as little as possible.
>>
>>57728591
>opening the bomb tiggers the bomb
Then how would we get to the wires? Are they sticking out of the case? If so, then the case can be opened.

>cap not visible
It is if there are wires going to it

>Moving the bomb triggers an explosion
then how did they get it in place to begin with MIT? Do bombers bring their own lab with them where ever they go?

>blows up the building
Fuck it, its only trump tower
>>
>>57728669
I'm not the anon you were replying to, there are no wires on my bomb.
I'm just fucking with you.

>then how did they get it in place to begin with MIT?
Only once you active it does it start to defend itself. There's a button, push it once to activate the countdown, push it again and it blows up now.
>>
File: 1479181284085.jpg (78KB, 500x682px) Image search: [Google]
1479181284085.jpg
78KB, 500x682px
>>57728669
>Fuck it, its only trump tower
Take that back, fucker
>>
>>57728669
the bomb is biological and the wires are its veins
>>
>>57728696
That sounds fucking cool, good way to die
>>
>>57728513
and 80 year old archmages
>>
>>57728719
you have to cut it in such a fashion that it isn't at any point aware of its death and capable of detonating
>>
>>57728752
*wields katana*
*tips fedora*
>>
Java decided one of it's libraries for handling formatted binary files didn't exist, so I decided I'd just convert the data to CSV instead. Wrote a small Ruby script to do it.

#!/usr/bin/env ruby

def read_uint8 file
file.read(1).ord
end

def read_uint32_big_endian file
file.read(4).unpack('N')[0]
end

ARGV.each do |filename|
File.open(filename, 'rb') do |file|
# Get type of file (array of scalars vs array of matrices)
magic = read_uint32_big_endian file
ndims = magic - 0x800

# Compute the number of rows and columns per generated CSV file
rows = read_uint32_big_endian file
columns = 1
(ndims - 1).times do
columns *= read_uint32_big_endian file
end

# Generate new CSV file and write the vector/matrix data to it
File.open("#{filename}.csv", 'w') do |csvfile|
rows.times do
columns.times do
value = "#{read_uint8 file},"
csvfile.write value
end
csvfile.seek -1, :CUR
csvfile.write "\n"
end
end
end
end
>>
>>57728890
>Java
Found you're issue there
>>
Super new to Haskell but just finished my first big-ish project in it. Are list comprehensions slow as shit or am I doing something wrong?

I made the same thing in java years back and it runs way fucking faster in java. Even compiled with O2 but I'm guessing I'm overlooking some basic optimizations.
>>
>>57728907
here's a (You) for you're predicted response
>>
FREE PASCAL REPRESENT
>>
>>57728911
If you want performance, don't use the default lists
>>
>>57728985
I gotcha bro.

Who /BCPL/ here?
>>
File: BisqwitRules.jpg (108KB, 902x450px) Image search: [Google]
BisqwitRules.jpg
108KB, 902x450px
>>57728907

I don't really have a choice, mate.
>>
I don't know if this is the place for this but would anyone happen to know how to install directx through a batch file while not having administrator rights? I have access to notepad and I've been tried using this - cmd /min /C "set __COMPAT_LAYER=RUNASINVOKER && start "" "%1"" - to install but it still says I need admin access.
>>
We draw together, autism edition:
http://korbo.ga:82/
>>
>>57729232
You can't install DirectX without being admin.
>>
Is there such a thing as an embedded GPU? Mobile phones use something like that, right?
>>
>>57729269
Yeah. NVidia's Tegra is pretty popular
>>
>>57729063
This guy is as autismal as they come. After having to deal with the code of one of his acolytes (who misunderstood half the shit he wrote) I'm a little irked.
>>
>>57729284
Whoa, those are pretty pricey chips individually
>>
>>57729304
Well yeah, they're on the high-end and pack a lot of power in something much more constrained than a desktop GPU
>>
>>57729063
Why are fimns always so autistic?
>>
What languages to learn, friends? What languages will help me excel in the industry? Or bitterly regret my existence?
>>
>>57729331
C++ will do both.
>>
>>57729315
I was hoping to find something cost effective for doing fancy visual effects on a 640x480 display for an embedded project. Guess I'll have to research and see if there's something lower end than that. Could always dedicate a second CPU as a graphics co-processor, but that might struggle with some stuff.
>>
>>57729348
I'm taking it this semester just to add to my languages and I absolutely hate the professor. Probably should've avoided the intro programming class. I'm learning how it parallels to other languages on my own anyways
>>
>>57729370
I recommend learning things on your own and ignoring the prof. You'll have more fun and learn more deeply that way.
>>
>>57729375
Its pretty much what I did, only two weeks of class left. Just went to class as a formality and tried tuning out her rambling. Couldn't even use computers during lecture so I just ended up working on algorithms and shit from my other class.
>>
File: pwh.gif (84KB, 1000x750px) Image search: [Google]
pwh.gif
84KB, 1000x750px
it's a pretty simple deterministic password manager, passwords aren't stored. it's just an SHA-256 hash function with settings stored per domain. what do you think?
>>
>>57729504
Deterministic password managers are a very misguided idea. You should realize this.
>>
Programming a CLI monopoly game in java for my CS course

Currently stuck on getting my array of players to talk to the array of BoardPositions using a for/while loop
>>
>>57729546
i hear a lot of theory about this but no practical examples of them ever failing. most just do a poor job of saving settings
>>
>>57729565
>java
stopped reading right their buddy
>>
>>57729595
The whole point of deterministic password managers is that you don't have to store settings and sync your passwords database between devices.

But that fundamentally means that you can't change your password more than a couple times if you need to, because otherwise the user would have to remember the exact settings used for each website, defeating the whole point.

Furthermore, if someone finds your algorithm, all of your passwords are instantly compromised.
Instead of the password database being secret, the algorithm is secret. This is security by obscurity.

Now especially if your algorithm is just one round of SHA-256, you might as well consider all your accounts hacked already.
>>
>>57729645
+bOu]imT~MG<y+"6C=3.Ee/ntApvw]Y:
hack away. just because the algorithm is public doesn't mean you have my master or the number of iterations
>>
Refactoring by subclassing. Ugh. I love the idea of subclassing, if only it came before I wrote a ton of logic.
>>
File: aaa.png (266KB, 765x1045px) Image search: [Google]
aaa.png
266KB, 765x1045px
How do I learn JS senpai?
>>
>>57729859
https://developer.mozilla.org/en-US/docs/Web/JavaScript

now fuck off
>>
>>57729880
Wow rude.
>>
Is it possible to learn basic programming in a year and get a job as novice or some starting shit?
What language do you guys recommend for starting, maybe java or python?
Im completely new to this.
>>
File: 9.jpg (48KB, 492x492px) Image search: [Google]
9.jpg
48KB, 492x492px
Why haven't you embraced functional programming, lads?
>>
How do I convert all my programming knowledge into drawing skill?
>>
>>57730069
at least mix it up with different frogs, the clown frog is too obvious that it's bait
>>
>>57730231
what do you need to draw for? do 3d rendering instead
>>
>>57729979
it depends on how retarded you are (in terms of learning programming) and on what social skills you have (in terms of getting a job) but it's possible to do. learn java and spend at least a few hours every day on learning java and programming-related concepts and working on personal projects

https://docs.oracle.com/javase/tutorial/
>>
>>57730069
is asm functional?
>>
>>57730283
No 3D suck. 2D is all we need
>>
>>57730324
>make 3d hentai games
>use profits to higher professional 2d artists
???
>>
>>57730367
>higher
hire
>>
>>57730069
my life is a dysfunctional mess on the verge of caving in over my head and I'll certainly just fuck up FP too.
>>
>>57730311
no
>>
>>57729044
BCPL is ANSI C with the only machine word type available.
>>
>>57730069
Because no one still told properly what does it have better over OOP.
>>
how do I tell a Makefile to use -export-dynamic?
>>
>>57728027
one random idea
if the values are integers and in a small range, you can use something similar to bucket sort to get O(n+k) time, and O(k) storage.

just use a bitset of size k initialized to 0. as you iterate over the list, do:

if(bitset[i] == 0){ aux[i] = 1} else { set.remove(i); }


of course its a bad idea if the range k is much larger than 1k in size
>>
File: 5.png (395KB, 680x665px) Image search: [Google]
5.png
395KB, 680x665px
>>57730069
>tfw I don't even know what the difference between functional and non-functional programming is

If I were to guess, functional programming means using higher-order functions and pure functions. Is that right?
>>
Drawthreads are getting deleted on /a/, apparently mods don't like general threads.
How long til the end of /dpt/?
>>
I'm working on a VB project, but pulling my hair out. Can't find a way to read from a binary file in Random mode into a structure without using BinaryReader, only FileOpen and such.
>>
File: ccc.jpg (30KB, 499x499px) Image search: [Google]
ccc.jpg
30KB, 499x499px
>>57731132
First desktop threads, then draw threads.

What next? Brit/pol/? I can't live without Brit/pol/.
>>
>>57728424
Haskell's puzzle-oriented programming prowess on display once again
>>
>>57731132
i wish djt and dpt were deleted instead
why even delete other generals when literally the shittiest ones are still around
>>
>>57731119
>If I were to guess, functional programming means using higher-order functions and pure functions. Is that right?
you also need to adopt a smug sense of superiority when talking to non-functional programmers. bonus points for acting like a special snowflake.

make sure you occasionally lecture people on the merits of lambda calculus
>>
>>57728077
It's fine. You really should default to public. If you need getter/setter methods you change to that when you need it.
That's the tldr of this video https://youtu.be/_xLgr6Ng4qQ
>>
>>57730303
thanks buddy
>>
Guys, I got an (student) internship.

I told them I am proficient in the following things: SQL, MS Powershell, MS Power BI.

The problem is: I know little about these things (yet). I only can do basic SQL queries.

The interview is on Friday.
How fucked am I? What should I look at in the meanwhile?
>>
>>57728027
Issues you never have if you're a good programmer.
See >>57724599
>>
>>57731372
http://blog.sqlauthority.com/2009/02/02/sql-server-t-sql-script-for-fizzbuzz-logic/
>>
Mask then shift or shift then mask?
>>
>>57731647
Depends on the result you want.
>>
>>57731647
Just find a SIMD instruction with a name like MVSMASKSHIFTQQBA that does both at the same time.
>>
This may seem like a stupid question, but what exactly is a 'plugin'?
Is there some formal or semiformal definition for what counts as a plugin, or what a program must do to be able to be said to support plugins?
>>
>>57730069
I did years ago. And it's amazing.
>>
Can anyone fucking help me.

This fucking stupid fucking jQuery fucking bullshit fucking shit keeps saying "Uncaught SyntaxError: missing ) after argument list" for all of them except the first one

WHERE IS THE MISSING FUCKING ) I'M GOING TO KILL MYSELF.

    <script>
$(document).ready(function(){
$( "thead" ).css({"background-color": "black", "color": "white"});
});
</script>
<script>
$(document).ready(function(){
$( "tfoot" ).css({"background-color": "black", "color": "white"});
};
</script>
<script>
$(document).ready(function(){
$( "tr:odd" ).css("background-color": "light-grey");
};
</script>
<script>
$(document).ready(function(){
$( "tr:even" ).css("background-color": "light-green");
};
</script>


I keep fucking with stupid shit trying to make it work BUT NOTHING FUCKING DOES SHOOT ME
>>
>>57732254
A plugin is a dynamically loaded library that can be loaded at runtime and interfaces with the program.

In general you provide people with a header interface that they compile against, and they create a .so for their plugin.
>>
>>57732319
Are you legally fucking blind of what?

>});

> };

> };

> };
>>
>>57732319
Anon, you're blind.
>};
>};
>};
>>
>>57732341
I just saw that shit and I FUCKING FIXED IT AND IT'S STILL THROWING THE FUCKING ERROR
>>
>>57732319
dude...
    <script>
$(document).ready(function(){
$( "thead" ).css({"background-color": "black", "color": "white"});
$( "tfoot" ).css({"background-color": "black", "color": "white"});
$( "tr:odd" ).css("background-color": "light-grey");
$( "tr:even" ).css("background-color": "light-green");
});
</script>
>>
<script>
$(document).ready(function(){
$( "thead" ).css({"background-color": "black", "color": "white"});
});
</script>
<script>
$(document).ready(function(){
$( "tfoot" ).css({"background-color": "black", "color": "white"});
});
</script>
<script>
$(document).ready(function(){
$( "tr:odd" ).css("background-color": "light-grey");
});
</script>
<script>
$(document).ready(function(){
$( "tr:even" ).css("background-color": "light-green");
});
</script>
>>
>>57732346
I hope you put the parenthesis after the bracket
>>
>>57732346
post code again, you almost certainly didn't fix it right. The compiler should tell you the exact line you fucked up on.
>>
>>57732357
Bro I swear to god I already did that. Watch I'll put it in and it won't work. Unless I'm having alcohol withdrawals and it's 5AM>>57732362
><script>
> $(document).ready(function(){
> $( "thead" ).css({"background-color": "black", "color": "white"});
> $( "tfoot" ).css({"background-color": "black", "color": "white"});
> $( "tr:odd" ).css("background-color": "light-grey");
> $( "tr:even" ).css("background-color": "light-green");
> });
> </script>
>>
>>57732380
Jesus fuck bear with me I'm losing it.

    <script>
$(document).ready(function(){
$( "thead" ).css({"background-color": "black", "color": "white"});
$( "tfoot" ).css({"background-color": "black", "color": "white"});
$( "tr:odd" ).css("background-color": "light-grey");
$( "tr:even" ).css("background-color": "light-green");
});
</script>

Says tr:odd is missing a parenthesis.
>>
>>57732392
does these lines not need to be like this?
            $( "tr:odd" ).css({"background-color": "light-grey"});
$( "tr:even" ).css({"background-color": "light-green"});
>>
>>57732423
Holy shit the stupid fuckin : needs to be a comma fuck this jQuery bullshit. I'm blaming it on that instead of me being retarded.
>>
>>57732433
Lmao all that work at the table rows haven't even changed colors fuck this web development bullshit.
>>
>>57732456
why are you so angry
stop being a shitter, take a step back, process the code and documentation carefully, and fix whatever the problem is
>>
File: webui-graph.png (89KB, 848x806px) Image search: [Google]
webui-graph.png
89KB, 848x806px
>>57728254
bump, pic somewhat related: this is how radare2 does what I want to achieve
>>
>>57732319
it's exactly as the error message says. use a fucking IDE so you can see mismatched parentheses more easily.
>>
>>57732572
idk probably the alcohol withdrawals and it's 5:30 in the morning.

And that's the thing, I've been looking for the problem yet I see none. No errors, just shit doesn't do anything.
>>
>>57732600
>radare2
That just looks like a messier IDA with a minimalist GUI and no features.
Is there more to it?

>>57728254
There's probably libraries for that, but if you're uber lazy you could just make a glorified image viewer that starts zoomed in on a root node.

Most of the time you don't actually need to move things around.
>>
>>57732665
are the tables loaded dynamically? If so then it won't work
>>
>>57732694
I'm not sure what you mean. The table is just in the code.
>>
>>57732704
is the table above the jquery code chunk or below?
if it's the former then try moving it below
>>
File: SCR_1480339597.png (237KB, 557x698px) Image search: [Google]
SCR_1480339597.png
237KB, 557x698px
>>57732678
>Is there more to it?
yes, it draws graphs. I don't care/know about anything else.

>There's probably libraries for that
That's why I asked. What language and what library do I need.
I assume I'd have most luck with something web-based. I hear those wacky web devs like drawing pretty things on the screen.

>you could just make a glorified image viewer that starts zoomed in on a root node.
Aside from this being dumb, it's also incredibly complicated for no gain at all, relative to a proper solution.

>Most of the time you don't actually need to move things around.
I don't need to move things around, I want to be able to move around quickly: jumping to specific nodes and traversing long-ass edges, etc.
Neither PNG nor SVG allow me to do any of that at a bare minimum level of comfort.
>>
>>57732786
Okay, but you say some pretty conflicting things.

You want to do it in JS, or with Python and OpenGL? Because OpenGL is *not* easy to make a graphing library with from scratch, and running this in the browser is a completely different thing.

You can probably write your custom GUI with pyGraphViz, but maybe decide what you want first and then google it.
>>
>>57732786
Sounds like you want a good 2D graphics library.

I would reckon Cairo has python bindings... Which is a 2D graphics library with OpenGL acceleration.

There's also Skia, which I beleive added support for python bindings lately. Skia is like Cairo, and it used to render most of the UI on Android and everything in Google Chrome (web wegine and the UI). Skia is faster than Cairo, though I hear it's a little harder to use.
>>
How the fuck do I into Java I/O?
There are so many classes. All I want to do is save the state of my text based quiz and load it and I have no idea where to start.
>>
File: SCR_1480341608.png (110KB, 375x735px) Image search: [Google]
SCR_1480341608.png
110KB, 375x735px
>>57732839
>You want to do it in JS, or with Python and OpenGL?
I meant OpenGL being the "too much effort" way, but phrased it weirdly. So OpenGL is probably the very last resort.

JS is a simpler way. But it has a billion libraries for everything, so whenever I start a web thing I get confused.

Ideally I want an interactive Graphviz-like thing. I would just set nodes and edges, and it would draw a pretty thing and let me explore it easily and without performance penalties.

>>57732893
Nah man, I just realized that graphics isn't the way. The clever part of any graphing library is putting nodes in places where they make sense. I can't replicate that. I'd rather use a constraining graphing library than write my own from scratch.
>>
>>57733078
>JS
>without performance penalties.
Pick one
>>
>>57733087
That's not what I meant.
Right now I can't even open the SVG file Graphviz gave me: Chrome loads it half way to the bottom, and Inkscape needs ~10GB of RAM to open it. radare2 and IDA don't have this problem with graphs that are more complicated, so that's what I want.
>>
>>57733126
That's because Radare2 and IDA aren't written in Python or JS.

And even then IDA refuses to open graphs with more than 1000 nodes unless you insist.
>>
segmentation fault (core dumped)
>>
>>57733148
12        if (!item->ground) {
(gdb) p item
$1 = std::shared_ptr (empty) 0x0


DUH
>>
I have a program that constantly writes to stdout
can i direct stdout to a file (bash) whilst having it write out to screen?
>>
>>57733148
THIS fucking error message right here is just completely fucking wrong and it's triggering me.

The current year is 1992+24 and "segmentation" is still part of the vocabulary even though this abomination stopped being relevant ages ago and firmly died with 64bit CPUs.

100% of the time when you get a SIGSEGV, it's due to a PAGE FAULT, not a SEGMENTATION FAULT.

For fuck's sake.
>>
>>57733196
use tee
>>
>>57733196
man tee
>>
while(1) {
blocking_function();
do_something();
}


Should I sleep in this loop if the blocking function only blocks for a certain amount? It is the recv() from socket in linux
>>
>>57733246
no you should almost never use sleep directly
>>
>>57733202
What's the difference?
>>
>>57733332
The difference is page fault just means you tried to access a page of memory you didn't have access to.
If you had an actual segmentation fault, it means you were probably writing some sketchy assembly code by hand and did something very wrong, because otherwise it's just a page fault.

Those are two very different bugs, calling it a segfault when it's almost always a page fault is plain legacy bullshit.
>>
Do I have to specify which arguments a function takes when prototyping it in C?
>>
>>57733431
yes
>>
>>57733431
there's an obsolete syntax which will allow you to do so, but you SHOULD always specify the arguments. Otherwise the compiler may not be able to give errors/warnings for certain improper usages of those functions.

void foo();
means foo takes an unknown number of parameters of unknown type
>>
File: 1472558694762.png (54KB, 1344x770px) Image search: [Google]
1472558694762.png
54KB, 1344x770px
You have literally 5 seconds to tell me why you're not using Java
>>
File: 1362609748403.png (405KB, 553x369px) Image search: [Google]
1362609748403.png
405KB, 553x369px
Disgusting hack of the day:

The following is a C minimal program that will compile and run correctly on x86 machines.

main const main = '\''*5;


C is a beautiful language. Can you understand what the short example code above does?
>>
>>57733731
its shite
>>
>>57733736
Typo, this should be:
const main = '\''*5;
>>
>>57733731
but I am
how do I avoid drowning in money?
>>
>>57733731
Because Go doesn't have poo in loo IAbstractFactoryFactoryBeanImpl
>>
There was this great Python book for beginners, the author I think was Italian. Does anyone know what book I'm talking about?
>>
>>57733804
I saw a book once. There were words in it.
>>
File: 1457985137929.png (2KB, 456x71px) Image search: [Google]
1457985137929.png
2KB, 456x71px
>>57733736
>>57733744
Is it a hack to waste my time?
>>
>>57733885
>main.cpp

either save as .c or use gcc -x=c main.cpp
>>
>>57733885
>src/main.cpp
>.cpp
Learning to read would be a good use of your time, anon!

Sepples doesn't allow all the legacy bullshit that C does.
>>
Finally managed to track down and fix a tricksy bug.

In a somewhat unrelated (but allocated near the same time) section of the code there was a:

*union_ind[union_ind_num++] = i;


instead of a

(*union_ind)[union_ind_num++] = i;


Now those were four hours well spent haha.
>>
File: fff.png (17KB, 900x900px) Image search: [Google]
fff.png
17KB, 900x900px
Post your neocities site, lads.
>>
>>57733965
http://jessica.neocities.org/
>>
>>57733731
Because Java has been disgusting to me ever since i learned C++.
>>
>>57733956
Just do
[union_ind_num++]*union_ind = i;
instead and you avoid the parentheses!
>>
>>57734013
jesus christ
>>
File: DDX-10 - Nonholomorphic - cover.png (213KB, 1000x1000px) Image search: [Google]
DDX-10 - Nonholomorphic - cover.png
213KB, 1000x1000px
Currently making music in MATLAB:
https://www.youtube.com/watch?v=dqeM0x6AWgg&t=39s
You can check out the rest of myprojects here:
https://ddx-10.bandcamp.com
>>
>>57734034
// I'll admit readability suffers slightly... 
>>
>>57733744
>>57733736
Looks entirely syntactically wrong. Care to explain?
>>
>>57733736
\' * 5 = 159 = 0xC3 = ret opcode
>>
>>57733731
>anything faster than asm
by definition not possible unless the benchmark code is deliberately biased.
>>
>>57734085
Sure.

In C if you declare a variable without a type, the type is assumed to be int.
So th code is equivalent to:

const int main = '\''*5;


Which is really just:

const main = 0xC3;


Due to the way the C linker works, the binary will be compiled as if this variable where a function.
When you start the program, it will execute the instruction "0xC3", which is a return is x86 assembly.

>>57734087
Bingo.
>>
>>57734110
Its all about how optimizing the compiler is and how much overhead is incurred. The JVM unrolls the the loop and will do SIMD for the current system at runtime, which I highly doubt the asm programmed did. Its a really shitty test, just for showing java is fast.
>>
>>57733202
>even though this abomination stopped being relevant ages ago and firmly died with 64bit CPUs.
Except it didn't.
Windows, BSD and Linux all use fs and gs segments on x64 for things like thread locals.
>>
>>57734148
It's the only exception, otherwise in long mode the CPU pretty much just ignores segments.
>>
Daily reminder that if you don't know what big-Θ is, you don't know what big-O is.
>>
>>57734114
Is it possible to extend that? Maybe make a hello world in C with opcodes?
>>
>>57734176
That's literally and figuratively wrong.
>>
>>57734178
Sure. You'd make main a char array and put your machine code inside.

That's called a shellcode, and this is essentially how you exploit buffer overflows and other memory corruptions, you inject raw machine code and point the CPU at it.
>>
>>57731380
literally was too long so i didn't read
>>
>>57734114
pretty cool
>>
You have 6 millenniums and 57 seconds to tell me exactly why you aren't releasing Free and Open Source Software under the unlicense license

This is free and unencumbered software released into the public domain.

Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.

In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
of the public at large and to the detriment of our heirs and
successors. We intend this dedication to be an overt act of
relinquishment in perpetuity of all present and future rights to this
software under copyright law.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR
OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

For more information, please refer to <http://unlicense.org>
>>
>>57734290
Because this license is standing on shaky grounds.

The 0-clause BSD license is automatically better, because if 2-clause BSD is valid, then 0-clause BSD holds up too.

Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted.

It's also shorter.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
>>
>>57734290
Because i'm too insecure in my sexuality.
>>
>>57734334
http://www.youtube.com/watch?v=3j4t185wl-0
>>
just programming in assembly for Comp Sci course
>>
>>57734330
up to 80 columns per line please
>>
>>57733246
Sleep is not the right tool to synchronize your program.
>>
>>57731119
So, basically Lisp?
>>
>>57734330
>Because this license is standing on shaky grounds.
How so?
>>
>>57731119
H.O.F.s are definitely functional
there's a lot of other stuff normally associated with functional programming
>>
File: Nazi license.png (108KB, 1341x628px) Image search: [Google]
Nazi license.png
108KB, 1341x628px
>>57734367
I would, but the license text probably forbids that too.
>>
>>57734409
It's never been tested in court
>>
>>57734427
>You may not time-share the software
the what?
>>
>>57734501
Install it on a single mainframe and divide usage time between people like it's 1980 again.
>>
>>57734501
it doesn't time-share the software or else it gets the hose again
>>
>>57734427
I think just installing the software is a violation of the license (you may not copy)..
>>
>>57734511
what do you think """""the Cloud""""" is
>>
>>57734468
>I don't want to sue anyone for using my code
>nobody can use me because it comes with no warranty
How is it on shaky ground?
>>
>>57734531
Obscenely overpriced bandwith and hardware?
>>
>>57734427
>You may not read this license.
>>
Are there any services anybody knows of that allow you to rent a server and program a phone system menu (press 1 for spanish, press 2 for english, press 3 to hear your account balance, etc.)
>>
>>57734539
Don't underestimate lawyers
>>
Pajeet-tier programming novice here.

Is it good practice or pure autism to try and rid my functions of as many side effects as possible? I really like it when my functions do just one thing, it makes it easier on me to organize my code. (since I'm retarded and can't properly plan out my programs beforehand) The only problem is all my programs have like 80 functions.
>>
>>57734571
code in assembly
>>
>>57734571
It's not bad practice as long as you don't overdo it.

If you have to bend your code out of shape for some misguided sense of purity, you're doing more harm than good.

Purity is a nice property, but there's no silver bullet, it won't solve all your problems.
>>
>>57734571
It's good design.

https://en.wikipedia.org/wiki/Single_responsibility_principle

But, as with all programming principles, do not take it as a law. Be willing to think outside of these paradigms but take them into account as well
>>
>>57734571
get rid of all hidden side effects
>>
>>57730069

Because i want a job.
>>
>>57734703
>>>>>>>>>>>>>>>>>>>>>>implying
>>
File: 1479920929764.jpg (65KB, 570x796px) Image search: [Google]
1479920929764.jpg
65KB, 570x796px
How does /g/ keep warm while programming?
>>
>>57734913
I have a hueg woolen sweater if I'm cold.
Or if for some reason it's actually freezing I just go warm up in front of the oven.

Why?
>>
>>57734630
*get rid of all state
>>
>>57734913
those aren't girl hands those are boy hands
>>
>>57734571
>Is it good practice or pure autism to try and rid my functions of as many side effects as possible?
Yes. Just don't over do it. If your function causes side effects, make sure there's a good reason for it.
>>
>>57734571
As long as your int average function works correctly
>>
>>57735084
First you have to define integers
>>
>>57734571
Anyone who tells you to never have side effects or state is an idiot. You should try to minimize *observable* side effects, which means it's easier to reason about functions as transformations from input to output. Make sure any observable side effects are well-documented.
>>
File: 1461894996998.png (46KB, 881x685px) Image search: [Google]
1461894996998.png
46KB, 881x685px
>>57735192
:^)
>>
i made a program to get cancer from your favorite twitch streamer w/o having to watch them

https://github.com/wrvc/misc/blob/master/twitch.c
>>
>>57735238
Wow slow down did you just assume the existence of natural numbers?

Back to Whitehead & Russel with you.
>>
>>57731153
t. scheme & ocaml fag
>>
>>57735269
define existence
>>
>>57735269
>Whitehead & Russel with you.
Deprecated.
>>
>>57735282
Existence: Said of anything defined and self-consistent
>>
File: 1450157454693.png (43KB, 906x625px) Image search: [Google]
1450157454693.png
43KB, 906x625px
>>57735269
:^)
>>
>>57735299
>possibility implies existence
slow down anselm
>>
>>57735192
Nat : U
0 : Nat

data Int : U where
pos : Nat => Int
neg : Nat => Int
neut : pos 0 = neg 0


>>57735238
Nat : U
_+_ : Nat => Nat => Nat

data Int : U where
_-_ : Nat => Nat => Int
quot : (x_1 y_1 x_2 y_2 : Nat) => (x_1 + y_2 = x_2 + y_1) => (x_1 - y_1 = x_2 - y_2)


>>57735269
data Nat : U where
0 : Nat
s : Nat => Nat

_+_ : Nat => Nat => Nat
m + 0 = m
m + s n = s (m + n)
>>
>>57735299
define of
>>
File: nukeProof.png (7KB, 635x63px) Image search: [Google]
nukeProof.png
7KB, 635x63px
ITT
>>
Post screenshot of you're *last* written code.
No cheating.
>>
File: quality.png (92KB, 1365x767px) Image search: [Google]
quality.png
92KB, 1365x767px
>>57735429
It was some shit code for /dpt/, incidentally.
>>
>>57735429
print(hello world)

It gave me an error. I quit programming after that
>>
>>57735429
>>57728424
>>
>>57735323
>In the first chapter, Anselm begins with a statement that anyone should be able to convince themselves of the existence of God through reason alone "if he is even moderately intelligent".[152] He argues that many different things are known as "good", in many varying kinds and degrees. These must be understood as being judged relative to a single attribute of goodness.[153] He then argues that goodness is itself very good and, further, is good through itself. As such, it must be the highest good and, further, "that which is supremely good is also supremely great. There is, therefore, some one thing that is supremely good and supremely great—in other words, supreme among all existing things."[154] Chapter 2 follows a similar argument, while Chapter 3 argues that the "best and greatest and supreme among all existing things" must be responsible for the existence of all other things.[154] Chapter 4 argues that there must be a highest level of dignity among existing things and that highest level must have a single member. "Therefore, there is a certain nature or substance or essence who through himself is good and great and through himself is what he is; through whom exists whatever truly is good or great or anything at all; and who is the supreme good, the supreme great thing, the supreme being or subsistent, that is, supreme among all existing things."[154]
wat
>>
>>57735476
You've been posting that picture for at least a week.

Did you not start on a new project yet? Typical Haskell programmer
>>
#(- 3 (+ 1 2) 4 7)
expression(['-', '3', ['+', '1', '2'], '4', '7'])
#generates this assembly
.section .data
.section .text
.globl _start
_start:
pushl $7
pushl $4
pushl $2
pushl $1
popl %eax
addl (%esp), %eax
addl $4, %esp
pushl %eax
pushl $3
popl %eax
subl (%esp), %eax
addl $4, %esp
subl (%esp), %eax
addl $4, %esp
subl (%esp), %eax
addl $4, %esp
pushl %eax
movl %eax, %ebx
movl $1, %eax
int $0x80


Thoughts?
>>
>>57735575
It's just defining "God" as the entity that is maximally good and then reasoning that if there are finitely many entities then "God" must exist.
>>
>>57735581
a day, actually
i've been doing things other than programming
>>
>>57728424
it's literally fizzbuzz tier and you're not even following the instructions properly, you could do the same in any OOP language easily
>>
>>57735697
>lierally
>fizzbuzz
>*-tier
are you literally twelve-year-old-tier?
>>
>>57735718
you can't even make a proper program, it shouldn't fail to compile, it should print out whether or not the bomb was defused
>>
>>57735718
he rode it write

go a way
>>
>>57735774
Hehe
>>
>>57735633
That's incredibly bad. You couldn't have worse codegen if you tried.

First there's the obvious gratuitous spilling of registers onto the stack, the use of the stack instead of immediates to find operands, and just the fact that you don't seem to have any constant folding at all
>>
Doing easy code challenges in Rust.
>>
General question, but for a beginner who's just going through textbooks, I hear, and feel, that I should just jump into a project.

How would I go about this? Is Github really that open?
>>
File: Rusts code of conduct.png (71KB, 811x618px) Image search: [Google]
Rusts code of conduct.png
71KB, 811x618px
>>57735919
>using a meme language for sjws
shiggy
>>
What's the point of having programming languages other than asm? Why do faggots need those retarded abstractions and software engineering design principles? Why can't they work with a plain old RISC instruction set?
>>
>>57735971
>getting butthurt over a CoC
You're just as bad.
>>
>>57735985
He just wants his safe space from being told not to call everyone he doesn't like a nigger
>>
>>57735971
>Not allowed to call someone a filthy nigger in your commit messages
>"This is fucking bullshit!"
>>
>>57735985
>>57735996
>Respect that people have differences of opinion and that every design or implementation choice carries a trade-off and numerous costs. There is seldom a right answer.

>you can't say that bubblesort sucks because it hurts someones feelings
>>
>>57736075
Why would anyone want to say "bubblesort sucks"?
>>
>>57735919
>>57735971
Rust is the new Nodejs
https://twitter.com/SimonSapin/status/802975701636972544
>>
>>57733184
do you know about "tui enable" for gdb?
>>
>>57736086
Why would anyone want to correct shitty code?

Man. It's no wonder Firefox is going down the drain in terms of performance
>>
>>57736094
KEK

Left-pad when?
>>
>>57736075
So? If you don't like the community, don't participate in it.
https://www.reddit.com/r/dailyprogrammer/comments/54lu54/20160926_challenge_285_easy_cross/
use std::env;

const LIMIT: u32 = 255;

fn main() {
for arg in env::args().skip(1) {
let val = arg.parse::<u32>().unwrap();
let remainder = val % LIMIT;
let mut count = (val - remainder) / LIMIT;
while count > 0 {
print!("{} ", LIMIT);
count -= 1;
}
print!("{} ", remainder);
}
println!("");
}
>>
I'm trying to learn compilers and shit but I keep getting this error

/usr/lib/gcc/x86_64-pc-linux-gnu/6.2.1/../../../../lib/libfl.so: undefined reference to `yylex'


here's my routine
$ flex tiny.l
$ bison -d tiny.y
$ gcc -c *.c
$ gcc -o tiny *.o -ly -lfl


am I missing some library or what
>>
File: 1342041910896.jpg (35KB, 239x257px) Image search: [Google]
1342041910896.jpg
35KB, 239x257px
>>57736094
THREE HUNDRED fucking external dependencies
>>
>>57736129
>relatively short solution to a simple problem
Is Rust just like Haskell but less thought out?
>>
>>57736141
Rust is C++ with functional meming added to it.
>>
>>57736141
It's more like Haskell if it left the university and got a real job.
>>
>>57736165
>Rust
>Real job
>>
>>57735950
Also interested in this.
>>
>>57736176
Call me back when Mozilla hires you to make a browser in fucking >haskell
>>
>>57736195
>Mozilla
>Real job
>>
>>57736176
It can handle mutable state without disappearing up its own abstract algebraic asshole.
>>
>>57736205
Says the academic
>>
>>57735886
you are very right it's as inefficient as it can get, i was thinking of using registers more, but decided to opt out for a simpler option and just have it be correct

the folding is there btw, it just pushes the temporary values on the stack, which can't be slower than 5 times slower than using a register, since the stack will be in L1 anyway
>>
Rate my blog post, /g/

http://collinoswalt.com/11
>>
>>57736207
>real job
>>
why are haskell programmers so annoying
>>
>>57736207
>Already John Smith, we need someone to develop a php file which will get the posts in a blog from a MySQL database and display them. Think you can do that?

>Well, no, but let me tell you about mutable states

none of you are getting fucking jobs
>>
>>57736284
cuz they dont have a job
>>
>>57736284
They worked really hard to be unemployable.
>>
https://github.com/Gabriel439/post-rfc/blob/master/sotu.md
>>
>>57736248
Is that javascript?
I think I just puked in my mouth a little
>>
>>57736331
https://www.youtube.com/watch?v=iSmkqocn0oQ
>>
>>57736291
What kind of code-monkey jobs do you people have? That kind of shit is what me and my friends did in the first year of high-school. lol
>>
>>57736291
>Rust isn't PHP
Damn.
>>
NEW THREAD - >>57736371
NEW THREAD - >>57736371
NEW THREAD - >>57736371
NEW THREAD - >>57736371
>>
>>57736333
It's partially javascript, but not really syntactically correct. I chose javascript because it does lambdas better than C
>>
File: 1478771661947.png (120KB, 761x964px) Image search: [Google]
1478771661947.png
120KB, 761x964px
>>57735429
>>
Is F# worth learning?
>>
best php book?
>>
File: 851305.png (190KB, 500x505px) Image search: [Google]
851305.png
190KB, 500x505px
>>57738011
Don't.
>>
New thread

>>57739205
>>57739205
>>57739205
Thread posts: 320
Thread images: 32


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

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
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.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.