[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: 322
Thread images: 56

File: 1480286057046.png (503KB, 940x822px) Image search: [Google]
1480286057046.png
503KB, 940x822px
What are you working on, /g/?

Old thread: >>57812957
>>
norsk > engelsk
>>
lisp > haskell
>>
oop > functional
>>
svenska > engelska > norska
>>
ritsuko > misato
>>
File: 1449709665970.gif (239KB, 500x419px) Image search: [Google]
1449709665970.gif
239KB, 500x419px
>>57813084
A strawberry milkshake?
>>
עברית > כל השאר
>>
>>57818765
Asians > Jews
>>
日本語>スウェーデン語
>>
File: kill all chinks.jpg (882KB, 1425x4413px) Image search: [Google]
kill all chinks.jpg
882KB, 1425x4413px
>>57818779
>>
rust > C++ > C
>>
ping pong > pizza
>>
>>57818810
rust > javascript > nasm > peehtohn > kitties > Trump > Russia
>>
curl pipe sh > curl pipe sudo sh
>>
>>57818810
Assembly >>> binary >>>>>>>>>>>>>> shit >>>>>>>>>>>>>>>>>>>>>>>>> rust
>>
So why and how do people use cmake with C++ ?

I just watched 3 short tutorials and it's like all 3 were about a different thing.
>>
File: le pooing chinks.png (30KB, 571x425px) Image search: [Google]
le pooing chinks.png
30KB, 571x425px
pepe > spurdo
>>
>>57818836
It's very simple anon.
>>
File: z99UjqM.gif (2MB, 754x543px) Image search: [Google]
z99UjqM.gif
2MB, 754x543px
> "reverse polish notation" "infix notation"
>>
>>57818836
CMake is the best thing ever happend to C++
>>
China > Taiwan
>>
>>57818726
if you're a nigger
>>
>>57818836
>why
because the alternatives are even worse

>how
try to find a good tutorial and then look at some open source project examples
SFML is a good one
>>
CLion > Visual C++
>>
Emacs > >>57818875
>>
Anime > not anime.
>>
I'm genuinely impressed by how many operations one after another it takes for a modern processor to reach 100%
>>
>>57818903
huh
>>
Why are english /dpt/ so shit?
>>
>>57818846
Gdzie pracujesz?
>>
>>57818921
v anglii, cisu toileti
>>
>>57818933
Pizdish, rusek.
>>
>>57818911

Like, right now, I'm churning through impressive amounts of data and doing a ton of math on them and it just barely slows down, I would have thought it would have been way slower way faster idk
>>
File: IMG_20161201_190204.jpg (21KB, 194x200px) Image search: [Google]
IMG_20161201_190204.jpg
21KB, 194x200px
wtf is this shit thread?
it's shit tier.
Why are the janitors not doin their job?
/g/ isn't the only board that's getting worser erryday...
Fucking reddit
>>
>>57818945
You're probably I/O-bound, not CPU-bound.
>>
>>57818843
Yeah?
>>
it's so beautiful when a proof comes together perfectly
>>
>>57818980

I can see that CPU is at 100% at all 8 threads in conky, as I said, I'm just impressed at how many ops it's doing, and it's all floating-point numbers too, if I'm doing my calculations correct then it should be doing around 2 960 million floating point ops at a second, which is still only around at 2% of what it should be doing, so IDK where all those cycles going
>>
>>57818692

anyone know were I can get dissassembled 8080 assembly so I can test my 8080 assembly interpreter
>>
I am a snek, which programming language should I learn? I obviously already know Python.
>>
File: 1474147091759.png (323KB, 600x617px) Image search: [Google]
1474147091759.png
323KB, 600x617px
>side effects
>>
>>57819173
Rust
>>
>>57819173
C
>>
>>57819173
rust
>>
>>57819173
c
>>
File: c8dis2.png (22KB, 782x573px) Image search: [Google]
c8dis2.png
22KB, 782x573px
>fully implemented C8/Superchip
>still some unrecognized instructions

Oh, I'm really thinking now.
>>
>>57819298
When are you going to get a job?
>>
>>57816284
does this work? don't folds do [a]->a, while maps should do [a]->[a]?
>>
>>57819306
you're like my mom, fuck you
>>
>>57819473
Folds do: b -> (b -> a -> b) -> [a] -> b
>>
>>57819500
ok nerd, but you get my point. unless the fold is mutating the list, it can't act as a map
>>
File: sicp snek.jpg (6KB, 251x243px) Image search: [Google]
sicp snek.jpg
6KB, 251x243px
>>57819173
Scheme
>>
>>57819512
What are you taking about?

The fold can take the mapping function, then go through the list, apply that function to each element and build a new list of the results. No mutation.
>>
>>57819512
\acc x -> f x : acc :: [a] -> a -> [a]
[] :: [a]
foldl (\acc x -> f x : acc) [a] : [a] -> [a]
>>
>>57819518
Scheme is deprecated, use Python.
>>
>>57818798
>tfw from Sout East Asia
>have been in other SEA countries in the course of my career
>we all unilaterally agree that China is shit
>>
>>57819298
Hm... Is it me, or are you parsing the assembler rather than the actual binary?
>>
>>57819641

These are the binary files. The C8 assembly is plaintext.

>>57819306

I graduate next semester, so probably then. :)
>>
File: le gook menace.png (179KB, 486x600px) Image search: [Google]
le gook menace.png
179KB, 486x600px
>>57819563
>>
Why doesn't JSLint like the 'this' keyword?
>>
Working on Advent Of Code Day 3, but trying to do it in freebasic, but I don't know any string parsing functions in freebasic. Pic related
>>
File: jcracket.png (514KB, 1680x1050px) Image search: [Google]
jcracket.png
514KB, 1680x1050px
Ask your much beloved and highly praised programming literate anything (r/IAMA)

>>57819554
>deprecated
>>
>>57819777
>highly praised
Why are you becoming increasingly annoying every single post?
>>
>>57819671
>still in college
I graduated years ago, what's wrong with you man?
>>
>>57819753
>Advent Of Code
>To play, please identify yourself via one of these services:
>[GitHub] [Google] [Twitter] [Reddit]
nice try, nsa
>>
>>57819896

I was born in the wrong year, shamefully.
>>
>>57819909
Utterly disgraceful.
>>
>>57819671
>:)
>>>/r/eddit/
>>
How can I cross-compile a CMake project targeting Windows on Linux?
>>
>>57819777
How would you explain these concepts to a 10 year old?
>functional programming
>OOP
>>
>>57819981
I wouldn't, it's better to start off with something simpler like C...
>>
File: sicppatt.jpg (66KB, 800x534px) Image search: [Google]
sicppatt.jpg
66KB, 800x534px
>>57819981
One need to at least know what a mathematical function is before trying to learn functional programming. for oop, maybe i would start with the classic message/reply view.
>>
>>57819981
Do you hate kids or something? Why would waste one's brain with some neuronal virus?
>>
>>57819981
Have an Asian child.
>>
>>57819981
Smalltalk
>>
File: gopher.png (33KB, 400x214px) Image search: [Google]
gopher.png
33KB, 400x214px
Go > all
>>
File: 1451333597007.jpg (243KB, 1034x958px) Image search: [Google]
1451333597007.jpg
243KB, 1034x958px
Is anyone here familiar with Android development?
I want my app to have user accounts. How do databases work with Android?
I have a solid Java background and that's why I want to learn Android development. I just don't know much about databases besides the occasional SQL.
>>
File: penn and trash.jpg (115KB, 451x600px) Image search: [Google]
penn and trash.jpg
115KB, 451x600px
>>57820240
>jewgle
no thanks
>>
why do so many people try to use all the possible features available in C++ and then end up with almost unreadable code?
>>
>>57820279
>backed by a powerful company
>no thanks
>>
What makes poo in loos so horrible at programming?

Are they just stupid as a race?
>>
File: kike bliss.jpg (160KB, 402x400px) Image search: [Google]
kike bliss.jpg
160KB, 402x400px
>>57820303
>(((powerful company)))
>>
>>57820326
De snakker ikke norsk.
>>
>>57819928

I know
>>
>>57820335
it's literally the most powerful tard
>>
File: hqdefault.jpg (20KB, 480x360px) Image search: [Google]
hqdefault.jpg
20KB, 480x360px
Mom asked me what I want for christmas. I want to learn more about network programming (low level stuff). What are the best books on network programming?
>>
I have to learn Python 2.5 for a job. How bad is Python 2.5 compared to 2.7? What sort of things were missing in 2.5?
>>
I'm trying to make the transition from C to C++, but this language seems horribly convoluted. I'm particularly trying to avoid writing C with classes and instead use all the modern recommended features like smart pointers.
I thought switching to C++ would reduce dev time because it has all sorts of nice abstractions, but I find myself spending way more time troubleshooting trivial errors. compile times are also way longer and error messages are incomprehensible when compared to C.
>>
>>57820453
wow
literally just quit. even 2.6 is unusable
>>
>>57820418
Get an e-reader for christmas and just pirate all of them.
>>
File: smug hildegard.png (856KB, 1195x899px) Image search: [Google]
smug hildegard.png
856KB, 1195x899px
>>57820404
>actually believing this
>>
>>57820474
I have an older kindle but i prefer physical books
>>
>>57820468
Oh no, is it that bad? Don't scare me.
>>
>>57820556
I gave up supporting 2.6 for my libraries pretty quickly. And so did every other library, so enjoy writing in a broken programming language that no one else acknowledges. I imagine 2.5 hasn't received a non-security update for more than 5 years, and just having to work on 2.5 says a lot about your workplace.
>>
File: WMT.png (18KB, 800x600px) Image search: [Google]
WMT.png
18KB, 800x600px
python dow jones visualiser thing,

also im new to programming dont h8

the graph is fucked because took the data in during a 5 second period for testing so none of the share prices change
>>
>trying to write an event store with sqlite
>tfw still don't know what I'm doing
>>
>>57820606
>We are pleased to announce the release of Python 2.5.4 (final), a bugfix release of Python 2.5, on December 23rd, 2008.
lel last bugfix was in 2008
>>
>stuck using a build system at work that doesn't transitively resolve dependencies
>have to add every single member of the transitive closure to the build file
>manager says we don't have time to upgrade
>it also doesn't support test dependencies
>>
>>57820606
>>57820633
It's because the workplace uses Ignition, and Ignition uses Jython 2.5 scripting

https://inductiveautomation.com/
>>
>>57819905
Day 1
- Problem: https://paste.installgentoo.com/view/raw/71e7b065
- Input: https://paste.installgentoo.com/view/raw/bdce9efb

Day 2
- Problem: https://paste.installgentoo.com/view/raw/f54f27c8
- Input: https://paste.installgentoo.com/view/raw/0d9d1ac4

Day 3
- Problem: https://paste.installgentoo.com/view/raw/8a7a0a47
- Input: https://paste.installgentoo.com/view/raw/3607d67e

Answers: https://paste.installgentoo.com/view/raw/69a0f033
>>
>>57820704
Nobody cares about your shitty website
>>
File: 1479147196842.jpg (26KB, 479x479px) Image search: [Google]
1479147196842.jpg
26KB, 479x479px
POST PROGRESS

post a screenshot of the last code you wrote
>>
>>57820844
who's shitty website? If you mean Advent of Code then that's exactly why these are posted, so you don't have to use their shitty website.

Or do you mean installgentoo.com? :^)
>>
Everyone should learn Idris and Rust. This will spur improvements in Rust.
>>
im learning programming in class, but the tempo is very slow.
basically i can do everything up to loops and have the most basic understanding of objects
is there any like course or website online where i can read up shit in a sensible order? One with problems to solve.
>>
>>57820930
Objects are a meme.

To learn to program, you must crossdress.
>>
>>57820704
>installgentoo.com
Just found a vulnerability in this server
What should I do /g/ ?
>>
File: Capture.png (206KB, 2907x1743px) Image search: [Google]
Capture.png
206KB, 2907x1743px
I can't figure out pic related.
pairName TextView will always display only 1 line of text.
TextView rate will either display 1 or 2 lines of code, depends on program's output. When it displays just 1, it's all good. When it displays 2 lines, it moves slightly down as on pic related. How do I keep it in its place and centre 2 lines of code at the same time?
>>
>>57816362
I agree, you don't even need a specific type.
For instance, something like indexed monads - or Idris' effects.
>>
>>57820954
now, what ide is this ?

looks cool
>>
>>57821007
Android Studio 2.2.2.
I believe it's based on IntelliJ
>>
>>57821026
related question, if you don't mind

can you develop android applications for example for Nexus, tablets even though you don't have a physical one?

can you just emulate them on your computer , publish the application online and hope it works for people who have those devices?
>>
>>57821058
You can use emulators but I find them a pain in the ass. They also don't work if you use Hyper-V on your computer.
I just test it on my phone.
>>
>>57821076
so you're limited to develop applications for your phone exclusively ?
>>
>>57821095
My phone runs stock android and has like the most standard resolution ever. The trick is to develop code in such a way that it will work on all devices without any device-specific modifications, unless it's just a different layout for e.g. tablet.
Anyway, I only develop apps for my uni project.

If I had a need to target more devices I would just get emulator to work and test it on it, but shit's slow even on my i7 4770.
>>
https://github.com/quchen/articles/blob/master/loeb-moeb.md

this is pretty cool
>>
>>57820954
Nevermind I got it to work. I would say how but I'm not actually sure. I just played about with gravity options of pairName and that affected rate... strange
>>
File: Untitled-1.png (36KB, 793x564px) Image search: [Google]
Untitled-1.png
36KB, 793x564px
>>57821058
One last thing. If you want to test your app, these are your options. You run it directly on connected device or you create a new VM that emulates any nexus device you want, including tablets, phones, wearables etc.
>>
>>57821251
thanks
>>
When will rust get HKTs?
>>
>tfw to dumb to find resources on my own

h-how do i learn about opengl

soembody pls give me a good tutorial
>>
>>57821364
probably never
no loeb for you
>>
File: cute.jpg (680KB, 1920x1080px) Image search: [Google]
cute.jpg
680KB, 1920x1080px
>>57820704
isn't the input unique to each user? are you tricking us?
>>
>>57821192
Haskell is fucking magic.
>>
>>57821406
https://www.youtube.com/results?q=opengl+tutorial+c%2B%2B&sp=EgIIBQ%253D%253D
>>
>>57821491
you trick men into thinking you're a girl and let em suck your cock
>>
File: umarusee.jpg (113KB, 1280x720px) Image search: [Google]
umarusee.jpg
113KB, 1280x720px
>>57821406
https://capnramses.github.io//opengl/
>>
>>57821533
>>57821560
OK thanks guys, i'll try my best
>>
>>57821559
let you suck their cock* oops
>>
>>57821491
Yes, but the answers given in that post are for the input provided so you can check yourself
>>
>>57821523
*maths
>>
>>57821577
What are you, a faggot?
>>
File: steal-your-face-plt.jpg (93KB, 623x623px) Image search: [Google]
steal-your-face-plt.jpg
93KB, 623x623px
>>57818692
Any Racket friends here? I need to figure out how to align the text in a text-field% to the center or right of the enclosing box.

It looks like text-field% has an editor<%> but it cannot be changed (i.e. no set-editor method).
>>
File: 1480787494288.jpg (105KB, 600x862px) Image search: [Google]
1480787494288.jpg
105KB, 600x862px
>>57818692
sometimes I wonder if my programming skills are lacking since I dont wear long stripey socks. one day i hope to wear them and see how much more efficiently I can code.
>>
>>57821640
you'll be wearing a skirt, so no
>>
File: uml-template-shapes.jpg (26KB, 600x417px) Image search: [Google]
uml-template-shapes.jpg
26KB, 600x417px
How much do you guys use UML?
I always seem to get lost on all my classes if I dont have a diagram to lean up against
>>
>>57821734
It'll be more efficient if you sit on a cute boys lap feeling comfortable and desired anon
>>
HELLO,

noob here. How do I check a char bit by bit in C?

is this any good?

#include <stdio.h>

int main()
{
int i;
int val = 0x55;

for(i=0; i < 8; ++i)
{
printf("%d ", val&1);
val = val >> 1;
}
printf("\n");


return 0;
}


Haven't looked it up with google, just tried to get a decent solution myself
>>
>>57821833
Here is a sample to access it bit by bit:

#include <stdio.h>
int main()
{
char byte = 0x37;
int i;

for(i = 7; 0 <= i; i --)
printf("%d\n", (byte >> i) & 0x01);

return 0;
}
>>
>>57821855
yeah just looked it up and found kinda the same.
But atleast mine would work out too though. Seems kind of right then
>>
>>57821725
could you tell how to align an editor to the center or right?
>>
>>57821798
Not at all
>>
>>57821833
you could probably just loop from 1 to <= 8 and do val & i
>>
>>57821588
>check yourself
>88
wew
>>
I have some messy c code that gets into an infinite loop.
Valgrind says a conditional jump is based on a uninitialized value in a function.
I turn on
 --track-origins=yes [\code]
and it points to a variable not even passed in to that function. How is that even possible?
>>
File: faggot remover.png (1000KB, 1210x1600px) Image search: [Google]
faggot remover.png
1000KB, 1210x1600px
>>57821767
>>57821734
>>
>>57821960
Post your source code, my african-american equal
>>
>>57821960
>shit
I have some messy c code that gets into an infinite loop.
Valgrind says a conditional jump is based on a uninitialized value in a function.
I turn on
--track-origins=yes 

and it points to a variable not even passed in to that function. How is that even possible?
>>
File: logo.gif (4KB, 128x128px) Image search: [Google]
logo.gif
4KB, 128x128px
>>57818692
Reinventing classes in Lua. So obsolete but delicious.

Glad I learned about C3 with Python, and glad someone did the C3 linearization algorithm in Lua for me.

Doing super is so exquisite. Wonder how I can handle class being objects tho.
>>
>>57821968
It really is messy, and the whole thing is written in non-english so it would be hard to understand easily.

If i change malloc to calloc, where valgrind says the uninit-ed variable is, the warning goes away but the infinite loop is still exists.
It occurs when I try to traverse a linked list, and the variable that is corrupted is, I'm pretty sure, the head of the list.
>>
File: chip8.png (10KB, 642x346px) Image search: [Google]
chip8.png
10KB, 642x346px
Did Chip-8 as well. Good project to sink your teeth into without being overly complicated.
>>
>>57822167
Why does everyone in /dpt/ do this?
Is this the new meme?
>>
File: 1435528114523.gif (497KB, 500x281px) Image search: [Google]
1435528114523.gif
497KB, 500x281px
Can someone give me a few project ideas for a portfolio?
>>
>>57822187
It's what those who can't program do.
>>
>>57822167

Hey bro, Nice Chip8
>>
File: 2016-12-03-131240_555x278.png (32KB, 555x278px) Image search: [Google]
2016-12-03-131240_555x278.png
32KB, 555x278px
>>57821901
I tried a few iterations, and came up with pic related. Thanks.
>>
>>57818847
If Cmake is the best thing to happen to C++ then I don't want to live in this world anymore.
>>
File: 1470399535077.jpg (19KB, 320x320px) Image search: [Google]
1470399535077.jpg
19KB, 320x320px
>mfw >>>useful<<< languages are only good for chip8 emulators
>>
>>57818692
Is there a successor to the geek code? Do you use it even?
>>
File: 1460757792003.png (947KB, 1200x1200px) Image search: [Google]
1460757792003.png
947KB, 1200x1200px
Every single build system is shit.
Every single fucking one. There is not a single build system for C or C++ that is not a smelly pile of fucking disgusting garbage.

Why? Why does it have to be like this? Why is it so hard to create a build system that isn't completely fucking shit?

>make
shit
>cmake
shit
>scons
shit
>autotools
SHIT
>waf
shit
>bash
shit and shit


SHIT SHIT SHIT SHIT SHIT SHIT
Kill me.
>>
File: drracket.png (70KB, 1024x768px) Image search: [Google]
drracket.png
70KB, 1024x768px
>>57821901
>>57822303
Another Racket question related to text-field%: How do I make the text-field% read-only yet still selectable? I only see the enable option which makes the text-field% not selectable (in addition to read-only).
>>
CS grad student here

what are some essential programming projects i should complete

inb4 compiler, i've done that
>>
>>57822389
make a good one yourself then
>>
>>57822495
Maybe I fucking will
>>
>>57822457
Password manager, education software updates for your old IT/CS teachers.
>>
>>57822389
I've settled on just basic build.bat/sh file which just essentially cc *.c (+ whatever extra output or stuff you need).
To support multiple compilers/platforms? Just copy and paste to a new build_bsd_clang.sh and change the few platform/compiler specific things. Takes me less time to use and maintain than any bloated shit system I've used in the past with convoluted syntax and setup (and who the fuck needs to support 50+ obscure platforms/compilers from the 1970s)
Full rebuilds every time? No problem, shit compiles instantly even with tens of thousands of lines.
>>
File: 1448480753543.png (834KB, 1200x1080px) Image search: [Google]
1448480753543.png
834KB, 1200x1080px
>>
What would be a library specifically for XBox controller handling in Linux?
>>
File: logo.png (7KB, 331x59px) Image search: [Google]
logo.png
7KB, 331x59px
>>57822389
Tup

it's generic, but it is absolutely safe and straightforward.
>>
In c++:

what does it mean when I put && in front of a varibale? Like with a move constructor?
>>
>>57822788
rvalue reference
>>
Would a linked list be considered a DAG?
>>
>>57822814

Thanks
>>
>>57822831
Yes.
>>
>>57822831
i think it has to be singly linked
>>
What book/online resources to learn math & what book should a beginner start with programming ?
>>
i have an array of names and an array of numbers (both string arrays). if i wanted to display that as something like

000 000 000 - LastName, FirstName MN. (only the first char of each middle name followed by a dot)


sorted by phone number or by last name.

what would be a good way of doing this? should i split the names array into 3 different arrays? do i gain anything in putting everything into a contact class?

im doing this in c# btw
id appreciate some something to point me in the right direction, preferably not using linq
>>
File: Mar_01.jpg (57KB, 336x1008px) Image search: [Google]
Mar_01.jpg
57KB, 336x1008px
If I want to learn Android development. Is this the best source to start learning or does there exist better resources than udacity for a 1-2 year uni student?
https://www.udacity.com/course/developing-android-apps--ud853
>>
>>57822864
You don't need much math to program (CS != Programming), just look up the basics of logic and algorithms and pick up whatever else as you go.
Pick something easy like Python for your first language. Learn Python the hard way is a pretty decent introduction.
>>
File: 1450944156554.jpg (143KB, 600x960px) Image search: [Google]
1450944156554.jpg
143KB, 600x960px
How do I get involved in open source?

If I find an active github project, then work on something that someone else is to, submit my code only to have them use the other party's code, well I would find that frustrating.
>>
>>57821364
Rust devs don't seem to care much for enriching the type system.
>>
how freaky is it if I use a struct that is a binary tree and a linked list at the same time?
>>
>>57822957
Just fork it and make your own version then.
>>
>>57822957
it just means that you should get good and try to do better next time
>>
>>57823143
a linked list caan very easily be seen as a binary tree, just not a binary search tree

its not freaky, its just nodes anyway
>>
File: seal-close[2].jpg (91KB, 1024x768px) Image search: [Google]
seal-close[2].jpg
91KB, 1024x768px
>>57822957
>tattoo
>linux tattoo
>>
>>57823143
If you mean that you reuse your node structure for both the linked list and the binary tree that's fine.

Having a binary tree which you also link through with a linked list would couple your linked list adds and removes to your binary tree adds and removes.

That really sounds like a mess.
Sounds to me like a hashtable suits you better then.
>>
>>57822912
at least im learning how to format strings

string.Format("{0:### ### ###}", int.Parse(numbers[i]))
>>
>>57822389
What's wrong with build systems?
>>
are there any good resources on game programming for a beginner? I don't really understand how most games handle map data. how does a developer create a map for a 2D game?
>>
>>57822941
I heard learn python the hard way is the worst to start with ??
>>
>>57823528
it is, read sicp
>>
Assuming that I apply enough effort and have a high enough IQ, how realistic is it that I could create an AI girlfriend? I have decent programming experience, but none with neural networks.

No chat bot or anything, I'll create a 2D auto generated platformer world, and I want her as my AI companion who will learn and help me do stuff.

Through a mixture of hard programming and nn, I want her to follow me, and stick close, and we shield and heal each other, and fight off enemies.
>>
>>57821833
#include <stdio.h>

struct {
unsigned int b0 : 1;
unsigned int b1 : 1;
unsigned int b2 : 1;
unsigned int b3 : 1;
unsigned int b4 : 1;
unsigned int b5 : 1;
unsigned int b6 : 1;
unsigned int b7 : 1;
} typedef byte_struct;

union {
char c;
byte_struct s;
} typedef byte_union;

void print_bits(byte_union c){
printf("%d", c.s.b7);
printf("%d", c.s.b6);
printf("%d", c.s.b5);
printf("%d ", c.s.b4);
printf("%d", c.s.b3);
printf("%d", c.s.b2);
printf("%d", c.s.b1);
printf("%d\n", c.s.b0);
}

int main()
{
byte_union character;
character.c = 'a';
print_bits(character);
return 0;
}
>>
>>57823804
dude, just put all that effort in finding a real gf instead
>>
>>57823804
Depends on your standards.
>>
>>57823804
Do you understand what natural intelligence is?
>>
>>57823804
>Assuming that I apply enough effort and have a high enough IQ,
the main driving force behind innovations isn't how intelligent individuals are. the environment is just conducive to the innovation. the environment isn't conducive to you being able to make an AI gf so you're out of luck
>>
File: bordals.png (1MB, 959x600px) Image search: [Google]
bordals.png
1MB, 959x600px
Repostan for the non-4AM crowd
Got back to working on portals, they're massively efficient now and only render fragments that they have to. VR is still working/seamless, all that I have to do now is share the shadow buffer between the cameras to squeeze that last little bit of efficiency out of these fuckers
Here's a little non-vr demo: https://phygon.itch.io/portal-example
>>
>>57823831
Do this if you enjoy lazy solutions and poor results but 'good enough'.
Real people are pretty damn bad.
>>
>>57823848
>can't move camera manually
But that's like half the fun of a demo anon.
>>
>>57823935
Let me fix that, one sec.
The demo part of the demo was hastily chucked together
>>
>>57823831
I haven't even spoken to a girl in years. I also don't really believe that 3d girls are real, just an illusion designed to make me feel sad.

>>57823832
High standards = the best I can do. So it's all relative.

>>57823838
I couldn't define it, but I know what I want to do, and to achieve this I will need nn.

>>57823847
>the main driving force behind innovations isn't how intelligent individuals are
Maybe not, however the execution of the innovation will correspond with the intelligence of the individual
>>
>>57823825
Why are you teaching people inefficient code?
>>
>>57823848
That falling thing looks like a turd.

>only render fragments that they have to.
can you control what will be rendered with unity?
>>
>>57823825
>struct { ... } typedef name;
Please no.

#include <stdio.h>

union char_bits {
char c;
struct {
unsigned b0 : 1;
unsigned b1 : 1;
unsigned b2 : 1;
unsigned b3 : 1;
unsigned b4 : 1;
unsigned b5 : 1;
unsigned b6 : 1;
unsigned b7 : 1;
};
};

void print_bits(union char_bits c)
{
printf("%d%d%d%d %d%d%d%d\n", c.b7, c.b6, c.b5, c.b4, c.b3, c.b2, c.b1, c.b0);
}

int main()
{
union char_bits character = { .c = 'a' };
print_bits(character);
}
>>
>>57823960
>Maybe not, however the execution of the innovation will correspond with the intelligence of the individual
history hasn't provided support for that. reference how many innovations have been created at opposite sides of the world, independently, simultaneously. there's a lot of smart people in the world, and chances are if it's possible to create an AI girlfriend, lots of very intelligent people will be working on it all at once
>>
>>57823960
>I haven't even spoken to a girl in years. I also don't really believe that 3d girls are real, just an illusion designed to make me feel sad.

dont worry anon you're not the only one...
>>
>>57824015
>
char c;
struct {
unsigned b0 : 1;

God C is so slick.
What other languages do this?
>>
>>57819102
>so IDK where all those cycles going
Tha botnet
>>
>>57824025
I don't really know what your point is.

>chances are if it's possible to create an AI girlfriend, lots of very intelligent people will be working on it all at once
I'm sure there's several thousand people who use/have created a computer program that they can receive emotional comfort from.
>>
There's a Nand2Tetris course starting in 2 days on Coursera in which you build a computer capable of playing Tetris from the ground up. Anyone else thinking of doing it?
>>
So in C is there any point in free'ing malloc'ed memory right before the main function returns? I understand the OS will free the memory when the process finishes anyway.
>>
>>57824228
There's no point on modern operating systems.
>>
>>57824228
Valgrind will complain about it.

So you will ignore it and get into the habit of ignoring it.

Then you might ignore it when it complains about a real problem.
>>
>>57824228
Not freeing your shit is poor style, and just shows everyone that you're a shitty programmer.
>>
>>57824228
>>57824256
Oh and I should add. The TA's will still give you shit for it.
>>57824317
No it's just the opposite. If you've ever had an application where you hit exit or try to close it in any way and it takes more than a second to close. That's because the program walks through all the destructors in the program and does a bunch of shit.
Deciding to free memory unnecessarily is the same category of retardation and will send you to exactly the same circle of hell.
>>
>>57824015
nice.
I like bit fields because nobody talked about it in my classes. It could have made some things easier.
>>
>>57824313
>>57824317
>>57824341
What about calling an exit() several functions deep from main() then? That won't free resources obviously, but propagating some error code all the way down to main so I can free resources seems like a huge hassle.
>>
>>57824416
>using C
>complaining about huge hassle
It's part of the game.
>>
Should I learn SDL? I've pretty much hit the end of my C book, and want to get into gamedev.
>>
>>57824416
IIRC there's some mild difference between abort() and exit() that kinda saves you here.
>>57824435
Dumb retardposter
>>
>>57824439
I like sfml better
>>
>>57824228
As a rule you should free it.

But also as a rule in the C world some rules can be bent; others can be broken. There are perfectly valid reasons why an *expert* might skip manually freeing memory (i.e. to make the shutdown quicker when freeing some weird structure would take too much time), but as a novice you should stick to the rules until you know all the risks.
>>
>>57818692
Is the c++ programming language by bjarne stroustrup book a good buy? Are there other good C, C++ or even C# books you can recommend?

I gotta think of stuff for my christmas wish list.
>>
>>57820625
where do you get your data from?
>>
>>57824478
>As a rule you should free memory at the end of the program
No. Stop it. It's plain dumb. Stop teaching people to not think.
>>
>>57824471
Seems a bit more modern, but it's designed less around C, so I was worried I'd struggle to pick it up.
>>
File: MVI_2441.webm (201KB, 1280x720px) Image search: [Google]
MVI_2441.webm
201KB, 1280x720px
shiftregister is working (except of apperently one pin), now gotta atttach an hd44780 lcd to it (laying in background)
>>
>>57824496
Lies to children are an important part of the learning process. It's breadth-first education.

To REALLY reason about it he would need to be taught how virtual memory is implemented (if it's implemented) in his OS of choice before he could proceed.
>>
>>57822912
pls help guys

at least about the sorting. i created a lastnames array from the names array. now if i want to sort by last name i have to, every time the lastnames changes a position, to also change arrays the original names and numbers position right?

so i cant just use Array.sort i need to use some kind of sorting algorithm. how would i do this with just the typical bubblesort?

i tried this but it isnt working
        public static void Ordenalastname(string[] names, string[] numbers, string[] lastname)
{
string namestemp, numberstemp, lastnametemp;
for (int i = 1; i < names.Length; i++)
{
for (int j = 0; j < lastname.Length - i; j++)
{
if (string.Compare(lastname[j], lastname[j + 1], StringComparison.Ordinal) > 0)
{
lastnametemp = lastname[j];
lastname[j] = lastname[j + 1];
lastname[j + 1] = lastnametemp;
namestemp = names[j];
names[j] = names[j + 1];
names[j + 1] = namestemp;
numberstemp = numbers[j];
numbers[j] = numbers[j + 1];
numbers[j + 1] = numberstemp;
}
}
}
}


pls help
>>
File: IMG_2465.jpg (2MB, 3000x2000px) Image search: [Google]
IMG_2465.jpg
2MB, 3000x2000px
>>57824526
switched the shiftregister. it's werkin now.
Apperently the one before has a ded pin
>>
>>57824532
>breadth first
Ok. So how is this breadth first.
Anon has come to us with a question. His question is predicated on the fact that he has assumed the methodology you propose to be accurate but he has become aware that it doesn't seem to be true.

So what you now suggest is that we go ahead and lie to anon to fool him into thinking that he's wrong. Without motivation even. Praising the idol of 'best practice' for no other reason than not informing anon and keeping him at a disadvantage to you.

That's absolutely absurd anon. You wouldn't do this if you hadn't been told to. You wouldn't go ahead and preach your own self found practices and claim they're the only and best way to do things. I don't assume people to be such assholes.
>>
>>57824317
this>>57824341
but I'd add that document somewhere the reason why that given variable won't cause leaks
>>
>>57824574
Can't you use fancy LINQ for this shit?
>>
>>57824622
>but I'd add that document somewhere the reason why that given variable won't cause leaks
Maybe in the less obvious cases.
But if you're allocating in an initialization step I wouldn't consider it important to state that.
Unless you're dealing with the best practitioners. Sadly we have to remain compatible with bad programmers so it does make it a little bit more pressing.
But that's about assessing your situation.
>>
Today I saw the botnet on the high way with a camera on top. The van was driving down the road. It makes me sad the botnet is mapping highways because (((Google)) reasons it's of (((national))) security interest.
>>
>>57824648
i have no idea about linq desu, i just wanted to make this work without any special stuff but im retarded i guess
>>
>>57824574
>bubblesort
why?
>>
>>57824741
If all the arrays are of equal length, create a single loop.
>>
>>57824781
it was just the simplest sorting method i could think of, so i thought i could do this easily but everything gets mixed up
>>
>>57824648
>>57824781
ok i really am dumb, i forget i had split the original names array into 3 arrays and wasnt putting them on the function so of course it was printing wrong since i wasnt printing the original names array...

>>57824785
yeah they are, i guess it makes more sense ty
>>
Do you use higher-order functions?
>>
>>57824949
Yes, why wouldn't I? They allow you to abstract over just code very simply.
>>
>>57824949
>python
>functional programming
>>
>>57824949
How is this any different than passing a function pointer?
>>
>>57824949
FORGOT TO SAY:
if you do, what's your language?
What do you use it for?

>>57824977
SICP got translated into Python eventually.
I can't understand the purpose of such move, though.
>>
>>57824994
Function pointers by themselves don't admit closures, but they are part of implementing a higher-order function.
>>
>>57825016
>Function pointers by themselves don't admit closures
So?
>>
>>57825029
First-class functions without variable capture are very limited.
>>
File: gunnagitded.jpg (93KB, 313x382px) Image search: [Google]
gunnagitded.jpg
93KB, 313x382px
>>57824949
> higher order functions
> python
> not almighty scheme or at least hy (lisp for python)
wut
>>
>>57825047
in py3 there is nonlocal, but it makes your code look overly verbose and utter shit
>>
>>57825047
The other anon clearly asked how your example was different than just passing a function pointer. Your example did nothing with closures.
>>
>>57825122
>my example
In any case, I took that question to be in general.
>>
>>57825127
>>my example
Yes, your example. The example you posted in the post that was replied to
>>
>>57825140
What?
>>
>>57825149
This is not a hard thing to understand
>>
>downloaded visual studio 2017 because you thought it was free
>now it's telling me my trial license will expire today
>>
>>57825158
What example did I give?
>>
>>57824949
def sqr_sum(a,b): return sum(map(lambda x: x*x,range(a,b+1)))

I'm obsessed with making one liners
>>
>>57824574
maybe something like this?

        static void Main(string[] args)
{
string[] name = { "Bart", "Apu", "Milhouse" };
string[] lastname = { "Simpson", "Nahasapeemapetilon", "Van Houten" };
string[] number = { "0003", "0002", "0001" };
SortLastName( name, number, lastname);

for(int i = 0; i<name.Length; i++)
{
Console.WriteLine("{0} : {1}, {2}", number[i], lastname[i], name[i]);
}
Console.ReadLine();
}

public static void SortLastName(string[] names, string[] numbers, string[] lastname)
{
for (int i = 0; i < lastname.Length - 1; i++)
{
for (int j = i + 1; j < lastname.Length; j++)
{
if (String.CompareOrdinal(lastname[j], lastname[i]) < 0 )
{
SwapStrings(ref lastname[j], ref lastname[i]);
SwapStrings(ref names[j], ref names[i]);
SwapStrings(ref numbers[j], ref numbers[i]);
}
}
}
}

public static void SwapStrings(ref string a, ref string b)
{
string aux = b;
b = a;
a = aux;
}
>>
>>57825168

>>57824949
>>
>>57825188
Not both me.
>>
>>57825197
Then don't jump into a reply chain as if you were the person being referred to
>>
>>57825211
I didn't. Anon asked a question and I answered.
>>
>>57825222
You answered with a non sequitur that had nothing to do with what he asked. Closures were not remotely involved with his question about the difference between passing a function in python vs passing a function pointer in something like C.
>>
>>57825255
>How is this any different than passing a function pointer?
It's different because you have closures by default in Python and you need more than a function pointer for that. Calm your autism.
>>
>>57824949
Yes, it would be hard to write Haskell without it
>>
>>57825268
Don't answer me as if I'm asking the question. Why is basic human communication so difficult for you to understand?
>>
>>57825268
Also that's a shit answer. Again, the example that the question was asked about has absolutely nothing to do with closures
>>
>>57825187
thanks anon this looks better than what i did. but i have another problem. how do i make it ignore accents (stuff like ` ´ ~ ^)? otherwise everything is in order but any last name starting with an accent gets put after lastnames starting with a z
>>
Are more modern programming concepts trading efficiency to write from efficiency to read? Please comment below.
>>
>>57825188

>>57824949-guy here.
I didn't answer anything except
>>57824977
>>
File: AZUOv.gif (89KB, 956x664px) Image search: [Google]
AZUOv.gif
89KB, 956x664px
>>57823956
>>57823935
>Unity no longer wants to compile to html5 due to a mystery error
...nevermind I guess

>>57823999
It's a capsule (Unity primitive) to display that anything can go through the portals. I'm putting this on the asset store so I want to avoid using content that could cause people to bitch because I don't own it.

>can you control what will be rendered with unity?
yeah, but it isn't easy. I got only part of the camera to render by forcing a quad to render early in the pipeline which wrote to the stencil buffer, then I blitted depth at nearplane to everything that wasn't stenciled. Because of this, everything outside of the rect fails the depth test and I can walk away with a cool ~90% render reduction.

The only thing I have to do now for maximum efficiency is sharing the shadow buffer between cameras but I have literally no idea how to do that
>>
#define SUCCESS 1
#define ERROR_A 2
#define ERROR_B 3

int thing()

vs

typedef enum thing_result {
SUCCESS = 1,
ERROR_A,
ERROR_B
}

thing_result thing()


which one do i use?
also in the first case would it be better to use char, seeing that the return value wont surpass 0xff?
>>
>>57825389
Not using accents is a good idea.
Otherwise you'll have to look for a function that removes the accents before doing the comparison.

also, if you use a comparison that is case sensitive, it's good to have the letters all upper case or all lower case.
>>
>>57825486
Use an enum
>>
>>57825409
I find e.g. Haskell to be a great advancement in both.
>>
>>57825486
I think that's the matter of which standard of C you use.
>also in the first case would it be better to use char, seeing that the return value wont surpass 0xff?
Why not.
>>
>>57825486
>typedef enum

top kek
>>
>>57825486
int so I know the type when I need to print it or when computing the result (like or'ing multiple error codes together).
>also in the first case would it be better to use char, seeing that the return value wont surpass 0xff?
No, it would likely lead to less efficient code because the compiler would need to force it to that range (either by masking or using sign/zero extend instructions).
>>
is The C Programming Language the best c book? It is old as fuck.
>>
>>57824949
Yes

let sum_f = (f,a,b) => Array(b-a+1).fill().reduce((x,y,z)=>x+f(z+a),0)

let sqr = a => a * a

let sum_sqr = (a,b) => sum_f(sqr, a, b)
>>
>>57825604
C is old as fuck and hasn't exactly picked up scintillating new features
>>
>>57825619
looks slick

what language
>>
How do I Unicode in C?
>>
>>57825512
Ok thanks a lot anon ill look into that.

last thing ill ask, i dont know if you read my original post, but i wanted to display my data like this

000 000 000 - LastName, FirstName MN. (only the first char of each middle name followed by a dot)


i have found how to display the numbers with spaces and i broke the original array to easily print the last and first names in the order i want. is there any easy way to display the middle names abbreviated?
>>
>>57825631
That's javascript
>>
>>57820418
socket man pages
beej
>>
File: 1472091085973.jpg (115KB, 771x985px) Image search: [Google]
1472091085973.jpg
115KB, 771x985px
can anybody tell me what's wrong with the way I coded up quadratic probing for inserting numbers into a hash table in C?

It runs fine, but I get more collisions than I'm supposed to (4 instead of 2)...

if(h->probing == QUADRATIC)
{
while(h->arr[hashed] != UNUSED)
{
hashed = (hashed + i*i)%h->capacity;
h->stats.collisions++;
i++;
}
h->arr[hashed] = key;
}
>>
is there any SQL type provider that's not dog shit and works with sqlite? Or even some decent ORM that works with F#?
C#fags: What do you use for working with sqlite?
>>
>>57825856
what does collisions mean, in this case?
>>
>>57825856
What is 'i' initialised to? If it's zero, it's going to try the same spot twice, and register it as two collisions.

>>57825935
Collisions in a hash table mean than two different pieces of data hash to the same value.
>>
File: IMG_2473.jpg (2MB, 3000x2000px) Image search: [Google]
IMG_2473.jpg
2MB, 3000x2000px
is it working?
>>
>>57824526
What are these components and how did you get started? I want to get into this with microcontrollers and stuff.
>>
>>57824041
C++
>>
>>57826119
those are
>attiny13
>595 shiftregister
>hd44780 display

I did start with arduinos, which are really easy to understand and (imo) a good starting point to get an impression of it and just tinker around.
If you then like it and want to get serious you can start programming everything in C and get it smaller and faster
>>
>>57826190
Kill yourself
>>
>>57826190
We won't click on your link.
>>
>>57826190
we have to put an email and password?

fuck that
>>
File: 1470300917965.jpg (82KB, 1280x720px) Image search: [Google]
1470300917965.jpg
82KB, 1280x720px
>>57826190
>anons that click this link
>>
>>57826190
That is literally commercial spam / advertising.
>>
>>57826190
blacklisted
>>
>>57825671
this is how I'd do it. certainly there must be a better way.

http://pastebin.com/4B3bpr6y
>>
File: test.jpg (2KB, 72x72px) Image search: [Google]
test.jpg
2KB, 72x72px
Holy shit, It's somewhat working!
>>
File: test4.jpg (1KB, 72x72px) Image search: [Google]
test4.jpg
1KB, 72x72px
>>57826409

Wait what, this is the actual output.
>>
NEW THREAD!!!

>>57826513
>>57826513
>>
>>57826527
>NEW THREAD!!!
We are not even close to bump limit, nigger.
>>
>>57826544
Now we are
>>
Alright, I did a shitpost detector that attributes a grade to each post in Python. I want to do a web extension for this, which would basically put a little icon next to the name of the poster depending on how shitposty the post is.
How would I go on to do that ?
Also you got bad grades anon. I'm gonna have a little talk with your parents on how you discuss with people on this South Vietnamese rice farming forum.
>>
>>57825176
 
def sqr_sum(a,b): return sum(i*i for i in xrange(a,b+1))

No need for extra scary words like "lambda".
>>
>>57826634
/wdg/
Might know.
I'm interested. Set up a repo and I'l give you a star.
>>
>>57826682
sqr_sum = lambda a,b: sum(i*i for i in xrange(a,b+1))
>>
>>57823804
I would advise against this, but I honestly suspect you're more likely to successfully implement strong AI than get a real girlfriend.
>>
>>57825935
what >>57825962 said

>>57825962
It is. Am I supposed to just skip 0 though? I thought quadratic probing was supposed to add increasing i^2 terms.
>>
>>57827748
>Am I supposed to just skip 0 though?
Yes?
If there's a collision, and then you add 0*0 to it, you're going to get exactly the same collision again.
>>
File: 1438830330084.gif (260KB, 266x207px) Image search: [Google]
1438830330084.gif
260KB, 266x207px
>>57827955
shit, I just realized I was reading my class notes wrong, i'm a dumbass. That's right, thanks.
>>
File: J.png (4KB, 64x64px) Image search: [Google]
J.png
4KB, 64x64px
>>57822389
They aren't perfect, but most people get by with make because most people aren't useless mongrels like you
>>
>>57825176
Learn J, don't be a brainless python sheep
>>
>>57828946
Learn python. Don't be a brainless J sheep
Thread posts: 322
Thread images: 56


[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.