[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: 340
Thread images: 46

File: prog.jpg (105KB, 473x496px) Image search: [Google]
prog.jpg
105KB, 473x496px
Old thread: >>60327260
What are you working on, /g/?
>>
>>60334610
First for Null-terminated Byte Arrays
>>
I looked at a bunch of assemblers like MASM and FASM and GASM and they include lots of macro facilities that resemble C, like syntactic sugar for loops and functions and stuff.

Does that mean C is a macroassembler?
>>
File: dpt-poster.jpg (517KB, 1521x1076px) Image search: [Google]
dpt-poster.jpg
517KB, 1521x1076px
>>
First for Ada

>>60334624
Absolutely haram
>>
somebody PLEASE invite me to the /dpt/ discord
>>
File: 1453572387357.jpg (8KB, 163x153px) Image search: [Google]
1453572387357.jpg
8KB, 163x153px
>using the modulo operator makes our code unmaintainable!
>>
File: rust-utf8.png (276KB, 485x723px) Image search: [Google]
rust-utf8.png
276KB, 485x723px
>>
>>60334638
Assembly languages usually have same kind of simple macro system as C.
You define macro token and it expands into something.
>>
3D arrays
>>60334610
>>60334624
>>
business idea: instead of creating arrays within an array for a 2 dimensional n * m matrix, instead have a single array of length n * m where first n blocks are in column m = 1, blocks 2n to 3n-1 are in column m = 2, etc

radical enough that it might work?
>>
File: 1347417620654.jpg (23KB, 300x300px) Image search: [Google]
1347417620654.jpg
23KB, 300x300px
From last thread:

I've been programming on and off for a couple of years now, and it's only been in Lisp with a functional style. It's great and I love it, but I want to try a new language. I'm having a lot of trouble trying to decide between C++ and C# though. I want a language that's cross-platform. I want a language with high-level features. I want a language with a lot of ready-to-go libraries available and documented (Scheme-inspired minimalism is great but a huge pressure point when I work on larger projects and have to roll things entirely by hand). I don't want to spend time allocating memory if I don't have to.

I was going to go with C#, but it feels like there's a lot of turmoil going on with .NET/.NET Core/.NET Standard/Mono and all of these frameworks don't seem to inter-operate smoothly. I really don't want to deal with that. Then I was thinking of C++ but I know it as a very clunky language with a lot of manual memory management and I don't want to deal with it. However, it's been around for ages and so has a shit-ton of libraries for a lot of things and is very stable even when standards are updating. However, I've heard that "modern C++" or C++14 and 17 actually reduce the memory and pointer management you need to do by a lot and even have lambdas and so on. One person mentioned that they rarely had to manage memory at all and felt that contemporary C++ was like having a high-performing scripting language. That sounds hyperbolic, but I'm more open to trying it

What should I do, /dpt/?
>>
>>60334696
isn't that how 2D arrays are optimized anyway?
>>
File: cute boy awoo.jpg (151KB, 645x989px) Image search: [Google]
cute boy awoo.jpg
151KB, 645x989px
>>60334661
It would be trivial to write a wrapper for a UTF-8 native string with the only overhead being the addition of a regular array where each array member is a pointer to a null terminated string containing a UTF-8 character.

Does rust even let me do something like this?
>>
>>60334716
don't think too hard, just learn both.
toss a coin for which language to pick first.
once you learn one, the other will be easier.
>>
>>60334716
nodejs
>>
>>60334723
why trust a compiler to do it or not when i can do it myself?
>>
tranny posters need to hurry up and kill themselves like all mentally ill trannies eventually do
>>
>>60334776
good point
>>
>>60334726
>Does rust even let me do something like this?
Depends, have you checked your privileges and donated to SJW causes?
>>
>>60334696
>radical
Maybe if this was 1950
>>
>>60334696
what if you had a huge matrix though. surely allocating a massive chunk of memory would create more problems than many smaller ones + one indirection for each access
>>
If I have language that has no webserver but it has interface to C, is there some library I could just write bindings for developing web backend in my lang?
>>
>>60334864
A C program only needs to output HTML to stdout to serve webpages, look up CGI scripts
>>
>>60334864
You mean like attaching your application to a web server?

It's old but you can probably get by with CGI
https://en.wikipedia.org/wiki/Common_Gateway_Interface
>>
>>60334900
>old
There's nothing old about using CGI scripts.
Creating stateful web applications through POST and GET strings is the only way to play in an age where you have literal retards writing javascript ON THE SERVER.
>>
>>60334863
i can't imagine that actually happening
>>
>>60334716
Can you link me some projects in Common Lisp done functionally and well?
Preferably small ones.
>>
Parameter "Y" of function "Whatever.m" has undefined type

What the fuck is this
>>
in java, do i need to pass a "ClassName()" attribute as a parameter to a "ClassName()" method? or can i access that attribute without passing him as parameter?
not sure if my questions makes sense, but i'm quite confused with oop
>>
>>60335045
looks like an error message
>>
>>60335045
HolyC?
>>
>Welcome to 4chan's read-only JSON API documentation.
Fuck.
>>
I want to learn Perl and I want to git really gut with it, what should I read? Can someone point me into the right direction?
>>
>>60335225
do you want bots?
because that's how you get bots
>>
>>60335253
>Can someone point me into the right direction?
forward
>>
I'm a recently turned Lisp fag, and I've been using the loop macro too much.
I just can't find other ways to do what I want.
AM I doing it wrong?
>>
>wake up from a coma
>it's 2017
>there is that tech company
>this company is worth several billions of american dollars
>this company's main product is irc with a new face stuffed in a chrome engine

so um
what other old as shit concept should one rewrite, sprinkle with emojis and pack it with Electron to be worth several billions of american dollars?
>>
uml is a retard idea
>>
>>60335441
Imageboards.
>>
>>60334610
Not sure if this is right thread but there's no thread on this sort of thing. What's the best courses in edx to pay a certificate for? I know almost everything's free but I want to know which courses are worth paying for

Rating system they have doesn't help btw. Wondering if you guys have any recs
>>
>>60335474
OOP is a retard idea.
>>
My manager keeps assigning me tickets to speed up crappy old code. He never gives these sorts of tickets to anyone else in the team. Why does he do this, and what can I do about it?
>>
File: yukari_male.png (281KB, 480x320px) Image search: [Google]
yukari_male.png
281KB, 480x320px
>>60334726
>boy
S O U R C E ?
>>
File: anamericanjewman.jpg (226KB, 840x1153px) Image search: [Google]
anamericanjewman.jpg
226KB, 840x1153px
>>60335509
ok, so anonymous imageboards with emojis
with dropbox, slack and asana integrations
in a desktop Electron app

with paid options to host your own private corporate imageboard to let your employees vent a little

ok, I'm on it. Thanks anon
>>
>>60335030
I mostly used Scheme languages, where pretty much everything is functional by convention. However, I don't think there's going to be much of a difference besides syntax/style and libraries if you go from there to Common Lisp. They both heavily leverage return-by-default, values, higher-order procedures, etc. Just pick a project with a lot of stars on GitHub in a Scheme language and then translate it to Common Lisp if you want some practice.
>>
>>60335560
obliterate his progeny
>>
>>60335577
You'll make hundreds
>>
>>60334740
I'm not interested in learning more than one language at a time. It seems like both languages have a lot of difference in how they approach problems, so if I'm going to learn one I'd like to spend the time to learn whichever one I choose as thoroughly as I possibly can instead of trying to half-ass both.
>>
>>60334610
why haven't you learned Go yet?
https://tour.golang.org
https://www.golang-book.com/
>>
>>60335713
Chapel is better in every way.
>>
>>60335618
I don't understand.
>>
>>60334989
>>60333992
Common Lisp has loop and collect. I don't use CL much though. Racket Lisp has takef, dropf, (take a predicate and a list, analogous to takeWhile and dropWhile), take, and drop, for-each, etc.
>>
File: Untitled.png (2MB, 1920x1021px) Image search: [Google]
Untitled.png
2MB, 1920x1021px
My media database thing is coming along well. The media viewer zooming/panning is now nice and smooth and I got libvlc all figured out, so it can play all sorts of video/audio files, render subtitles etc. So now basically any media type aside from PSD/RAW images and other stuff like that can be viewed. I need to add a better way to categorize things on top of tags though, like AoT doesn't have v# in the filename so it can't be searched by volumes.
>>
Anyone else get serious brain fog with a little bit of disassociation at around 8pm after programming all day?
>>
>>60335749
Too bad Racket doesn't have the libraries I want.
>>
>>60335745
Rape his daughter.
>>
>>60335574
kys degenerate faggot
>>
>>60335552
oop is good by nature but corrupted by society
>>
>>60335763
everyone does, it's called "tiredness" and some "sleepiness", probably
>>
>>60335775
That sucks. What kind of libraries are you looking for? Libraries have definitely been a pain point for me as well in Lisp languages (I'm the anon looking into C++/C#).
>>
>>60335763
Brain fog sounds like me after I've abstained from coffee for 36 hours.
It goes away after another few, afterwards, I'm free of the coffee dependence.
But then i start again the next day.

The disassociation, what is that?
>>
>>60335804
OOP is inherently flawed, though.
>>
>>60335814
>The disassociation, what is that?

Basically when the world starts "feeling" less real than it usually does.
>>
>>60335751
>libvlc
>not libmpv
>>
>>60334726
Yes, that is trivial to do. You're wasting a lot of space by doing that however.
>>
File: Screenshot_2017-05-11_16-41-28.png (59KB, 1006x465px) Image search: [Google]
Screenshot_2017-05-11_16-41-28.png
59KB, 1006x465px
This is bullshit.
>>
>>60335829
>not vanilla ffmpeg
>>
>>60335824
sounds like clinical depression

though seriously, I feel weird after having programmed for over 6 hours nonstop.
Basically you get really tuned in and it's hard to "get out of the computer".
It's not really ideal either, because by this point, I'm not really productive either.
You should take breaks.
>>
>>60335829
VLC master race
>>
>>60334726
At this point why not adopt UTF-32?
It's slightly less wasteful than what you're asking.
>>
File: 7297_7891.jpg (39KB, 640x480px) Image search: [Google]
7297_7891.jpg
39KB, 640x480px
Why aren't more people using Lisp?
>>
>>60335973
It predates C, so it means I would have to relearn programming, because all modern programming paradigms worth using in 2017 come from C.
>>
>>60335973
it's not very good
>>
>>60336016
Neither is Java, but it is widely used.
>>
>>60336024
Maybe Java is better than Lisp
>>
>>60335866
>slightly less wasteful
Do you know how large a pointer is, and how much overhead there is with tiny heap allocations? UTF-32 would be significantly more efficient, especially when you consider pointer dereferencing overhead like TLB misses.
>>
I've crashed Matlab 3 times doing basically nothing. How do they get away with charging small fortunes for it?
>>
>>60335838
>store n-polygonal numbers P(n,N) for 2 < n < 9 into 8 arrays
>traverse and search for numbers that are permutations of each other between the arrays
>???
>>
>>60336034
Of all the wrong things I've seen posted on /dpt/, this is one of the most wrong ones.
>>
File: 1407241549728.png (445KB, 807x700px) Image search: [Google]
1407241549728.png
445KB, 807x700px
>>60334661
>>60334726
>>60335866
>>60336041
Did you ever consider that string indexing isn't even that important of an operation? Most of the time you just iterate over ever character in the string.
I highly doubt your stupid memory hungry UTF32 is going to help much. You're making it so you can fit FAR less shit into the cache, which might even cost as much as just iterating over the fucking string.
>>
>>60336041
This, also consider that a pointer is likely to be 64 bits.
>>
What does /g/ thinks about "Think Python" book?

Should I use it?
>>
>>60336094
I agree, but you have to admit that Rust not having O(1) character indexing in strings makes for a great meme
>>
Does Rust have dependent types yet? If not then there's absolutely no point in using it.
>>
>>60336094
array indexing in rust would let me write a trivial solution that seeks out the Nth UTF-8 character in a utf-8 string by returning a pointer to it's starting point.
>>
>>60336147
>seeks out the Nth UTF-8 character in a utf-8 string
This is not a common requirement. Easy unicode and i18n is much more important for most applications.
>>
>100MB json file
>sublime text uses up to 700MB of ram
>takes half an hour to load on an i7 4770
>>
anyone want to like help me just like fix computer
>>
>>60336141
Does Haskell have stack pointers yet? If not then there's absolutely no point in using it.
>>
>>60336251
Stack pointers are a meaningless concept in Haskell because it doesn't use a stack.
>>
>>60336249
Install Gentoo, slut.
>>
>>60336264
if gentoo can be put into an iso less than 4mbs and have an sshd or serial console then yeah
>>
>>60336260
That means Haskell is meaningless.
>>
>>60334716
C++, template metaprogramming scratches the same itch as Lisp macros. You'll feel horribly limited in C#/.NET weenie land.
>>
>>60336240
>takes half an hour to load on an i7 4770
things that never happened

>100MB json file
>open it in vim
> 1.5 seconds to open

git gud pleb
>>
>>60336105
pls resbond
>>
File: 1440246538429.png (304KB, 722x768px) Image search: [Google]
1440246538429.png
304KB, 722x768px
>>60336065
>8 arrays
I really don't follow. And the problem with searching is keeping track of indices and false-candidates, e.g P(1,n), P(2,n), P(3,n) could be cyclic, but so can P(1,n), P(2, n), P(3,n + 4), so you need to save the path. Or a set can all be cyclic save for the last element with the first. Anyway, I figured it out, but it took over 10 hours of rewriting code and questioning my sanity, and also feeling like an incompetent imbecile.
>>
>>60336340
are animu posters the best programmers?
>>
>>60335336
T A I L R E C U R S I O N

(but for real fuck it, CL is mostly imperative)
>>
>>60334661
UTF-8 is only ``good" in comparison to other encodings of Unicode (which despite having ``code" in the name, is NOT an encoding but rather a character set).

>>60334726
Even on a 32-bit system, that's going to nearly QUINTUPLE the space needed, when you add it to the space needed by the string itself. On 64-bit systems, that's going to amount to an average of nine bytes per character. You're better off just using UTF-32, as that gives constant-time access with less than half the space.

>>60335045
It probably means you forgot to specify the type of one of the arguments to one of your functions. Although I'm not sure why it's referring to a whole source file as a "function".

>>60335089
No, every non-static method had an implicit "this" parameter that refers to the object it is being called on. That's standard OOP technique, the only mainstream language I can think of where you need to explicitly define a "self" or "this" parameter for member functions is Python.

>>60336251
C's semantics don't have anything to do with a ``stack" either.
>>
>>60335089
>without passing him
Did you seriously just assume the attribute's gender?
>>
Is there a way to translate Matlab scripts to C/C++?
>>
>>60336280
That's one of the reasons I was also looking into C++, C# doesn't seem to have anything here except something called
dynamic
, partial classes, and editor-based code generation. However, the truth is that I don't often use macros while programming lisp but when I do use them they are very convenient. I'm more interested in how much memory/pointer management I can avoid doing. It seems like C# is a much more high level language than C++, but I've heard this has been changing recently but I have no idea what that means from a relative and practical point of view.
>>
>>60336489
No, stop using Matlab, math monkey
>>
>>60336458
Are you constantly amazed by how tech-illiterate most of the posters on /dpt/ are?
>>
>>60336504
>math
>monkey
Pick one. Only real programmers know math.
>>
>>60336504
You mean engineer monkey?
>>
>>60336552
He just said he's using Matlab though, so he can't be a real programmer.
>>
>>60336562
"engineer monkey" is less alliterative.
>>
>>60335973
Two intelligent.
>>
ded
>>
File: 2017-05-11_21-38-06.webm (2MB, 800x800px) Image search: [Google]
2017-05-11_21-38-06.webm
2MB, 800x800px
I started learning openGL. I'm having fun.
>>
>tfw fell for the lisp meme
>learning about it leads to wanting to know more about it because you want to be able to make real programs once you learn condtions, macros, clos, loop, metaobject protocols ....
>>
File: dlang_chan.jpg (139KB, 470x545px) Image search: [Google]
dlang_chan.jpg
139KB, 470x545px
Threadly reminder that dlang-chan is not dead; she's going to have her GC tumor removed (eventually); and she's super duper cute and easy to prototype in! Say something nice about her, /dpt/!
>>
>>60337025
I'm almost confident you're false flagging the language.

What I want to know is why. Nobody cares.
>>
>>60337044
It gives Andrei false hope.
>>
>>60337044
You can assume all you want, anon.
>>
>>60337059
Andrei's too smart to come here
>>
>>60336872
Brats are the worst
>>
File: file.png (1MB, 1200x1200px) Image search: [Google]
file.png
1MB, 1200x1200px
>>60337025
>>
>>60337130
First, don't bully. Second, I love both of them!
>>
>>60335973
Computer science isn't about what's best, it's about what's good enough.
>>
Should I learn C++ or Go as my first language?
>>
>>60337205
out of those two, C++
>>
My mate gave me some of their tests in a CSV format to order and analyse. I'm still a beginner in Python, so it's a bit of challenge, but seeming as the output is consistently formatted like
x,y,z\n
, I thought I could through throw it into a dictionary like
{'X': [x, x, x, ...], 'Y': [y, y, y, ...], 'Z': [z, z, z, ...]}
. But I have no idea how to cycle through or add values for a given key in a dictionary that contains a list. Could someone give me a rough idea of what how to do it?
>>
File: 1395633763642.gif (442KB, 400x425px) Image search: [Google]
1395633763642.gif
442KB, 400x425px
>>60337109
>>
>>60337205
Never, ever learn Go.
>>
>>60337291
Why not?
>>
>>60337205
They're both shit.
>>
import math

def factorial(n):
if n == 1 or n == 0:
return 1
return n*factorial(n-1)

def f(n):
return math.exp(n)

def taylor(x, a):
l = []
for n in range(0, 100):
tn = (f(a) / factorial(n)) * ((x-a)**n)
l.append(tn)

return l

print(sum(taylor(2,0)))


Rate my e^x taylor series
>>
>>60337214
I'm not really much of a memesneker, but something like this works.
import sys

result = {
'X': [], 'Y': [], 'Z': [],
}

for line in sys.stdin:
fields = line.strip().split(",")
result['X'].append(fields[0])
result['Y'].append(fields[1])
result['Z'].append(fields[2])

print(result)
>>
Is there a lisp that doesn't have a garbage collector and allocates memory on the stack instead?
>>
>>60337302
Because it's a disaster of a language.
>>
File: anime pic.jpg (71KB, 400x465px) Image search: [Google]
anime pic.jpg
71KB, 400x465px
>>60337368
>Python doesn't even have TCO
>>
>>60334661
>hating UTF-8

This HAS to be bait
>>
>>60337408
Care to elaborate?
>>
>>60336147
>UTF-8 character array
>implying UTF-8 code units have constant size
>implying you can index into a random UTF-8 octet stream and not get bits and parts of characters
>impying any other character encoding you can think of is superior to UTF-8 which is simultaneously equivalent to ASCII and has multibyte support for the rest of Unicode
>being this much of a fucking retard

fuck you
>>
>>60337205
Neither, they're both really bad first languages regardless of how you feel about them as "industry" languages. Go is opinionated in a way that's specifically intended to hinder programmer flexibility. C++ is a massive language with compilers supporting different standards that happens to have a C-like appearance despite not actually functioning like C at all when following best practices. Many tutorials are written for certain standards and unless you're familiar with the major differences in best practices it can be hard to tell whether the tutorial you're following is going to be wrong or outdated.

Learn a language that's more consistent and flexible instead, Python is a commonly recommended one and Racket Lisp is another good one. Both are easy to pick up and scale well with the person learning them as they expand past "hello world" style projects.
>>
>>60337473
No. It has been discussed to death already. You can find numerous articles online that explain it in more detail than I can be bothered to write here.
>>
>>60335305
>making a POST request that emulates the posting form
>hard

pls

JSON API is objectively better for 4chan because it doesn't have to send me shit ton of HTML, CSS & Javascript data that my scraping program has absolutely no interest in consuming.
>>
>>60337374
Ah, so that's what it should look like. Thank you very much.
>>
>>60337471
This is a thread about programming, not fourth grade arithmetic.
>>
>farting on a toilet
>accidentally take a shit
oh look it is functional programming
>>
>>60337845
dumb frogposter
>>
>>60337883
>farting on a toilet
>accidentally take a shit
oh look it is functional programming
>>
>>60338058
dumb frogposter
>>
>>60337514
this, neither of those are good 1st langs, plus you won't find any Go tutorials for noobs
if you still want to learn Go, try asking questions in #go-nuts @ freenode: https://webchat.freenode.net/?channels=go-nuts

>>60337845
>>60337883
top kek
>>
>>60336280
>needing templates to do metaprogramming
you are unironically a pajeet
why the FUCK do you need your compiler to generate separate code for each possible object type to be used with each templated function when you can just use void* and sizeof(T) and be done with it???
>>
File: ran_do_it_again.png (25KB, 275x198px) Image search: [Google]
ran_do_it_again.png
25KB, 275x198px
>>60337845
>>60337883
>>60338058
>>60338060
>>
>>60338143
dumb touhouposter
>>
>>60337214
https://automatetheboringstuff.com/chapter14/
>>
>>60338060
>farting on a toilet
>accidentally take a shit
oh look it is functional programming
>>
File: 1494542796218.png (80KB, 200x200px) Image search: [Google]
1494542796218.png
80KB, 200x200px
>>60338143
>>60337883
how do we stop him?
this never came up in 4chan training
>>
>>60338242
Learn Lisp.
>>
File: h.jpg (8KB, 640x633px) Image search: [Google]
h.jpg
8KB, 640x633px
>>60338242
>>60338270
>>60338275
>farting on a toilet
>accidentally take a shit
oh look it is functional programming
>>
File: grade.jpg (116KB, 4096x4096px) Image search: [Google]
grade.jpg
116KB, 4096x4096px
This code makes the gradient shown with a size of k*k.
It's very slow.
How do I do this faster?

k = 16384

id = np.zeros((k,k,3),dtype=np.uint16)

for y in range(0,k):
for x in range (0,k):
id[y][x][0] = x * (65536/k)
id[x][y][1] = 65535 - x * (65536/k)
>>
>>60338388
Use a gpgpu
>>
>>60338388
Use a LUT.
>>
>>60338388
Cython
>>
It's entirely possible to be a truly great programmer but be a shit mathematician. btw being good at algebra and discrete math doesn't make you a good mathematician
>>
>>60338388
see >>60338432
use a faster language, basically

if you want it to be blazingly fast use the GPU, >>60338407 , but that's beyond overkill
>>
>>60338432
Thanks, I'll try this first

>>60338430
I have other similar code but with some permutations which prevents it from being precomputable =/

>>60338407
Can you recommend which python library would be easiest for this? CUDA-only would be OK
>>
>>60338481
literally just program a math
>>
>>60338510
>I have other similar code but with some permutations which prevents it from being precomputable
Show the whole code, there might be other software optimizations you might be missing on. Usually, changing the language or the hardware is the last thing you should do when trying to optimize something.
>>
>>60338526
Thanks, I'll be able to pay for uni now with these
>>
>>60338526
How many (You)s to be considered 'autistic'
>>
File: SUC CES S C O D E S.gif (498KB, 500x269px) Image search: [Google]
SUC CES S C O D E S.gif
498KB, 500x269px
>>60338526 (You)
>>
File: pepe popcorn.jpg (178KB, 1068x972px) Image search: [Google]
pepe popcorn.jpg
178KB, 1068x972px
>>60338526
>mfw 17 (You)s
>>
File: Capture.png (691KB, 641x576px) Image search: [Google]
Capture.png
691KB, 641x576px
>>60338594
What are the odds that I watch that gif while I'm listening to some guy's discography, and shortly after decide to go check out the movie that the current song is from, and see this.

SPOILERS REEEEEEE
>>
So just trying to figure out data binding in winforms.

public partial class Form1 : Form {
List<string> list;
BindingList<string> bindingList;
public Form1() {
InitializeComponent();
string[] array = new string[] { "A", "B", "C" };
list = new List<string>();
bindingList = new BindingList<string>(list);
listBox1.DataSource = bindingList;
listBox1.SelectedIndex = -1;
}



That displays a listbox with a, b, c in it. Having a button to remove the selected one from bindinglist will remove them from the listbox.

My problem is, lets say I have another class

class Parcel {
private string trackingNumber;
private int length;
private int width;
private int height;
private double weight;
private double volume;

public Parcel(string trackingNumber, int length, int width, int height, double weight) {
this.trackingNumber = trackingNumber;
this.length = length;
this.width = width;
this.height = height;
this.weight = weight;
}

public double getVolume() {
return height * length * width;
}

public double getWeight() {
return weight;
}

public string getTrackingNumber() {
return trackingNumber;
}


So lets say I create 4 parcel objects and add them to a List<Parcel> list then
BindingList<Parcel> bindinglist = new BindList<Parcel>(list);


How do I get the listbox to display getTrackingNumber() from each of the parcel objects
>>
If I get singles, I will finish that programming book I was reading.
If I get dubs I will finish off that program I was writing.
If I get trips, shit post on /g/ more
>>
>>60336489
You can probably generate the code from MATLAB if you are really desperate.
But take a look at the eigen library.
It is the best math library I have used.
https://eigen.tuxfamily.org/dox/AsciiQuickReference.txt
>>
>>60336489
That's what I did all day. It fucking sucks.
>>
Trying to learn ASM. I compiled the following function:
int add (int x, int y) {
return x + y;
}

with -static -fpic -O0 and it gave me the following code:
push   %rbp
mov %rsp,%rbp
lea -0x1040(%rsp),%rsp

orq $0x0,(%rsp)
lea 0x1020(%rsp),%rsp

mov %edi,-0x14(%rbp)
mov %esi,-0x18(%rbp)
mov %fs:0x28,%rax

mov %rax,-0x8(%rbp)
xor %eax,%eax
mov -0x14(%rbp),%edx
mov -0x18(%rbp),%eax
add %edx,%eax
mov -0x8(%rbp),%rcx
xor %fs:0x28,%rcx

je 4a <add2+0x4a>
callq 4a <add2+0x4a>
leaveq
retq

I think I figured what most of it does but I'm having a hard time understanding what the two 'lea' and the 'orq' are supposed to do. Can somebody explain that to me?
Also, is there a concise resource that explains what each instruction does? Intel's manuals are very large.
>>
File: 1492970427374.gif (926KB, 500x281px) Image search: [Google]
1492970427374.gif
926KB, 500x281px
>>60334610
So I got this code that's supposed to make my scene scale with the window size (framebuffer width/height) by using a transformation matrix, but for some reason my transformation matrix is only scaling the textures on objects and not the objects themselves, so when the framebuffer becomes large enough the textures just fall off the edge of the geometry they are attached to.
What do?

    GLint transform_location;
GLfloat ndc_scalex = pow(window->framebuffer_width, -1);
GLfloat ndc_scaley = pow(window->framebuffer_height, -1);
GLfloat ndc_translatex = ndc_scalex, ndc_translatey = ndc_scaley;

while (!glfwWindowShouldClose(window->main_window))
{
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glUseProgram(shader_program);
glBindVertexArray(vertices_vbo);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
glfwSwapBuffers(window->main_window);
glfwPollEvents();

glfwGetFramebufferSize(
window->main_window,
&window->framebuffer_width,
&window->framebuffer_height);

transform_location = glGetUniformLocation(shader_program, "transform");

GLfloat transform[] = {
1.0f, 0.0f, 0.0f, 0.0f,
0.0f, 1.0f, 0.0f, 0.0f,
0.0f, 0.0f, 1.0f, 0.0f,
0.0f, 0.0f, 0.0f, 1.0f
};

transform[0] = ndc_scalex * window->framebuffer_width;
transform[12] = -1.0f + ndc_translatex * window->framebuffer_width;
transform[5] = ndc_scaley * window->framebuffer_height;
transform[13] = -1.0f + ndc_translatey * window->framebuffer_height;

glUniformMatrix4fv(transform_location, 1, GL_FALSE, transform);
}
>>
>>60339738
1. Disassemble with the -M intel switch, AT&T is eye cancer
2. orq is just bitwise or, q indicates it's working on a quadword (64-bit). lea is "Load Effective Address", chapter 9 of Assembly Language Step-by-Step has a great explanation of it
3. Look at volume 2 of the Intel dev manuals, the explanations there are pretty good. There's also a few reference guides online that pull directly from it.
>>
File: DSC_0566.jpg (3MB, 4608x3072px) Image search: [Google]
DSC_0566.jpg
3MB, 4608x3072px
>>60339820
Go to sleep Red.
>>
File: 1470930284936.jpg (447KB, 800x800px) Image search: [Google]
1470930284936.jpg
447KB, 800x800px
>>60337845
>>
>>60339823
Thanks for the tip, -M intel is indeed better.
I meant what are their purpose? I understand we're saving the stack pointer before doing the first lea and grabbing arguments after the second lea but I don't get what the two lea and the or are meant to do.
Thanks for the book recommendation.
>>
>>60339902
It's a roundabout way to reserve 32 bytes on the stack, no idea why it does it though. Really there's all sorts of instructions there it doesn't really need, they might go away on a higher optimization level though
>>
>>60338694
Nvm I just watched it and it wasn't really a spoiler
>>
I want to make my code more pretty. Not really sure how.
For example :
I have a function which creates a kind of zipped container. Within this 50lines function, there are around 10 lines of creating the name, path and giving out some progress information.
Should I create a second function which handles this shit? Or just leave it in the createfile function?
>>
>>60339738
Compile with -O3 so you don't get garbage. It will honestly help.

Minus call book-keeping, your function could be:
add rdi, rsi
mov rax, rdi
ret
>>
>>60340036
Also, +1 for Intel syntax. And this:
http://www.staroceans.org/kernel-and-driver/Assembly%20Language%20Step-By-Step%20-%20Programming%20with%20Linux%2C%203rd%20edition%20(Wiley%2C%202009%2C%200470497025).pdf

Finally, I would recommend NASM.
>>
>>60340112
Also this, for reference:
https://support.amd.com/TechDocs/24594.pdf
>>
can i get help with this
>>60340275

thanks.
>>
>>60340310
>Make a website
>javascript
Ask /wdg/
>>
>>60340390
thanks, didn't know that there was a dedicated board for that.
>>
>>60340426
More like a dedicated thread.
>>60338961
>>
>>60334610
Writing garbage
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>

int main(int argc, char **argv)
{
if(argc != 2) printf("INPUT ERROR!");
int N = atoi(argv[1]);
char *a = (char*)malloc(sizeof(char*));
for(int i = 0; i < N; i++) {
char *b = (char*)malloc(sizeof(char*));
a[i] = b;
}
printf(a);
}
>>
First time using C.

Adding a float to an integer is allowed. Why is that?
And why isn't adding a character or a string to a string not allowed?
>>
>>60340540
What does this autistic piece of code do?
>>
File: garbage.jpg (1KB, 67x18px) Image search: [Google]
garbage.jpg
1KB, 67x18px
>>60340601
Write garbage:
Entering 33, for example, produces pic related
>>
>>60340596
C doesn't have strings
>>
>>60340596
> Adding a float to an integer is allowed. Why is that?
typecasting

> And why isn't adding a character or a string to a string not allowed?
Because it's a concatenation, not "adding". "+" is ariphmetics, adding anything mathematically meaningless.
>>
>>60340751
char *
>>
>(Java) Write generic method which will output every other element of dynamic array(List) generic type T.
for now i only created this
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;


public class main{


public static void main(String[] args){
Scanner scanner = new Scanner(System.in);
List<Integer> listOfInt = new ArrayList<>();
System.out.println("Enter the number of elements: ");
int num = scanner.nextInt();
for(int i=0; i<num; i++){
System.out.println("Enter "+(i+1)+". element: ");
int e=scanner.nextInt();
listOfInt .add(e);
}
for (int i = 0 ; i < listOfInt.size() ; i+=2)
{
System.out.print( listOfInt.get(i) + " ") ;
}

}
}

I dont know generics and shit :'(
halp me /g/
>>
>>60340889
>A pointer to a character is a string
>>
It just occured to me if i want to classify 4chan comments I'll have to manually tag them first at least portion... REEEEEE
>>
>>60340935
> I dont know generics and shit
So why don't you go back and read a book?
>>
I posted this yesterday along with pic related:
>A camera at point C is looking towards point L. A person whose height is h is standing in point B. For given C, C0, L, B, h and f, calculate the height of the player in the projection plane, hp. All angles marked as such are right angles, all other angles are arbitrary.
>This is fucking high school stuff but I haven't done anything remotely like that in 7 years now. Finally figured it out, now to implement it.

An anon replied:
>Is it just 1D?
>You usually do this for 3D with PM=sm
>Where M is the point in the scene and m is the point in the camera.
>Something like
>http://docs.opencv.org/2.4/modules/calib3d/doc/camera_calibration_and_3d_reconstruction.html

I would like to point out that openCV seems to assume there that the image plane is orthogonal to the xy-plane, which does not necessarily apply. In fact, it only applies if the camera is pointed exactly parallel to the ground, which IRL obviously doesn't happen that often, and it's the reason why I constructed all that fancy bullshit.
Also it's 3D, and I need to remember to account for the person NOT standing in line with the camera and its "lookat" point.
>>
File: 1494509330930.png (33KB, 800x600px) Image search: [Google]
1494509330930.png
33KB, 800x600px
>>60341004
Hurr pic
>>
>>60341004
I dont understand? just take pen and paper and work out tring, shouldn't be too difficult
>>
>>60341024
That's what I did but due to not using that part of my brain for 7 years it took a while.
>>
>>60340596
>Adding a float to an integer is allowed. Why is that?
Why not?

>And why isn't adding a character or a string to a string not allowed?
It's resource-intensive. It's a way more difficult operation than adding numbers.

>>60340937
C defines a pointer to character as a string.
>>
I wanted to work today but can't. Goddammit.
>>
>>60341036
>resource-intensive
Adding float and int requires conversion of the int to float, then addition of two numbers that you can't simply bitwise-XOR to add them.
Adding a char to a string is as simple as requesting the appropriate amount of memory, then copying both variables.
>>
>>60341036
>C defines a pointer to character as a string
>Can't even properly correct a troll post
>>
>>60341060
>requesting the appropriate amount of memory
>as simple as
It's not simple in the slightest!
Converting int<->float is trivial, your processor does that in one instruction.
>>
Are buffer overflows just a feature of C/C++ now? Every single program the world relies on has had security bugs related to buffer overflows in critical sections.
>>
Ive been programming for a year now in windows, and i was wondering, could i benefit from switching over to Linux is there a noticeable advantage when programing?
>>
>>60341092
Nope.
>>
>>60341092
you never know. I'd rather not use windows myself
>>
Chapel
https://benchmarksgame.alioth.debian.org/u64q/chapel.html
>faster than Go and implementations take way less code
>generics
>proper support for parallelism instead of that coroutine shit
>developed for real purpose instead of trying fulfil Rob Pikes fetishes
But of course /g/ shills for Go because somebody on hackers news said it's web-scale. SAD
>>
>>60341092
Yes Linux is made for developers, not Windows.
>>
>>60341134
>>60341126
what are you using?
>>
>>60341139
Xubuntu
>>
>>60341132
Lurk more
>>
>>60340596

>Adding a float to an integer is allowed. Why is that?
Because the float can be truncated and cast to an integer.

>And why isn't adding a character or a string to a string not allowed?
Because adding a character to a pointer doesn't make sense.

>>60341081

Most of these programs were written in the 90s by retards who don't know how to write proper C. It's very easy not to buffer overflow in C.
>>
>>60341132
/g/ doesn't shill for Go tho, everyone here knows it's shit.
>>
>>60341092

It deppends on what languages you are programming with. WIth C# I'd rather stay in wangblows land, most programming languages don't care and some are easier/work better with Linux.
>>
>>60340777
>typecasting
Why, I never told C to typecast automatically for me? I thought C is "the manual transmission"?
>>
>>60341179
You are deluded.
>>
>>60341151
>Most of these programs were written in the 90s by retards who don't know how to write proper C.
Ah yes, the "I could do better given no time pressure whatsoever". I don't expect anything else from a tripfag.
Real programming forces you to push out code in time, not the code you'd like to write.
>>
>>60341179
Because the "power of c" is a /g/ meme, friend.
>>
>>60341092

Well let's put it like this...it'll make installing libraries and build tools a hell of a lot easier, and it will make systems programming suck less. If you were addicted to Visual Studio, it's going to be like coming off of heroin. Better for you in the long run, but you still have to break a bad habit... okay, I probably shouldn't compare heroin to a bad habit, but the point remains.
>>
>>60341179
Because C isn't a strict-typed language.
>>
File: 1459890275952.png (32KB, 576x402px) Image search: [Google]
1459890275952.png
32KB, 576x402px
>>60341179
Safe, obviois, do-what-I-mean conversions are implicit. Bullshit JS coercions don't work, see pic.
>>
>>60341205
>Safe
Excuse me?
>>
File: Screenshot_2017-05-12-01-57-14.jpg (221KB, 1440x218px) Image search: [Google]
Screenshot_2017-05-12-01-57-14.jpg
221KB, 1440x218px
Who tf
>>
>>60341190

This isn't a "I could do better" thing, it's a "most people during that time didn't know better" thing.
>>
>>60341202
>still have to break a bad habit
>convenient IDE
>a bad habit

so... this... is... the... power.. of... linux...

wow...
>>
>>60341205
>that picture
WHAT THE FUCK
>>
>>60341229
He is not wrong.
t. CS final year
>>
>>60341217

Nothing unsafe about casting 32-bit float into 32-bit integer. Chop off the decimal point, and it's guaranteed to fit.
>>
Am i on the right way?

public class main{

public static <T extends Number>void setArray(T num){

for (int i=0; i<num.intValue(); i++){
System.out.println("test");
}

}

public static void main(String[] args){
Scanner scanner = new Scanner(System.in);
List<Integer> listOfInt = new ArrayList<>();
System.out.println("Enter the number of elements: ");
int num = scanner.nextInt();
setArray(num);

Code is working, but dont know if it is correct way?
>>
>>60341242
what happens if I add 2i8+3.000000006f64?
>>
@*******2
Most autistic post today
>>
>>60341241
I've been employed for 10 years as a programmer. I don't even use VS at work, I simply know it's good. We use Qt Creator and we do target Linux.
>>
>>60341242
No?
> A signed 32-bit integer can have a maximum value of 2,147,483,647, whereas the maximum representable IEEE 754 [32 bits] floating-point value is 3.402823 × 10^38.
>>
>>60341217
> integer to floating and vice versa with truncation and stuff
Perfectly acceptable
>array to pointer
Simple and handy
> void* to other pointers
void pointers are an intentional loophole and if you misuse it it's your fault, not K&R's
>muh whatever
Other casts are explicit and it's also your fault if your explicit cast is disfunctional.
>>
>>60341242
Hahahaha, holy shit.
>>
>>60341227
Yes, those old people sure were idiots and couldn't code for shit. We'll never make their stupid mistakes again, we're so much smarter now!
>>
>>60341261
The grass is green on the other side
>>
>>60341229

>convenient IDE
Honestly, I've found that every time I've tried to use Visual Studio, it's a royal pain in the ass. Command line + text editor is simpler and more intuitive. But every single person I've met who's used Visual Studio, particularly those who started programming using it, has problems switching to anything else.
>>
>>60341242
>This is your brain on C
Ada was the right choice
>>
>>60341265
>integer to floating and vice versa
>float to int
>Perfectly acceptable
Average C tard
>>
>it's a "I prefer to make things harder for myself so therefore all those productive assholes with their tools that speed up progress by huge amounts and have been adopted as industry wide standards are fucking idiots who can't code for shit"
People use VS because it's good.
>>
>>60341279
I didn't say Qt Creator is bad.

>>60341280
Looks to me like you're the one with the problem here, being incapable of using a good tool for simple tasks.
>>
>>60341242
$ echo "#include <stdio.h>
int main(void) {
char point = 'c';
printf(\"\n%d\n\", (int)sizeof(point));
return 0;
}" > myscript.c && gcc myscript.c && chmod u+x a.out && ./a.out

1

The decimal point is one whole byte. Chopping it off means you actually save 8 bits.
>>
>>60341280
Someone who can't code with notepad because of muh productivity is a code monkey.
>>
>>60341292
Average VS pajeets doesn't even know how to create a project manually
>>
>>60341297
hurr durr,
char point = '.';
>>
>>60341292
>it's a "I prefer to make things harder for myself so therefore all those productive assholes with their tools that speed up progress by huge amounts and have been adopted as industry wide standards are fucking idiots who can't code for shit"
People who say this have no job, are neets.
People who work want their job finished as fast as possible.
I use jetbrains ide's because they are the best for linux.
On windows VS is the best for C/C++/C# languages
desu VS is only good thing microsoft ever made
>>
>>60341303
So I can. And plenty of other people just as well. We still to choose to use an IDE because it's convenient. Writing a makefile (or just using your toolchain from command line) is not a task as difficult as you imagine it to be.
>>
>>60341263

Maximum legal integer value that can be stored in a 32-bit float is 2^24 + 1. Anything else is losing accuracy anyways.

>>60341294

>good tool
Good one.

>>60341303

>Notepad
Oh come on, there are better editors than that.
>>
As I claimed earlier, both python and C (and many C based) languages enable shitty programmers into the industry.

C has created generators upon generations of shitty programmers with their misinformed programming practices. C and python creates an illusion of "productivity" while _ignoring_ the underlying structures of their own programs.

"Weak-typed languages" and "type inference" are considered a norm now. Such a shame.
>>
>>60341338
Yet the language pajeet is most known for is C# and Java and everyone knows the shittest programmers are Pajeets.
>>
>>60341284
IntegerOverflowException isn't a workable solution in the context of C, so what are we supposed to do? truncating works 99% of the time and it has the least overhead. Do the overflow check yourself if you need it and you know what to do instead of truncating. Yes C is a DIY lang and it's intended as such.
>>
>>60341372
>Yes C is a DIY lang and it's intended as such.
C is a ____-typed language.
C's types are i_____red
>>
>>60341338
>C
>productivity
>ignoring underlying structures
You confuse it with C++, in C people usually realize underlying structures on their own.
>>
File: 1458104179403.jpg (309KB, 680x1671px) Image search: [Google]
1458104179403.jpg
309KB, 680x1671px
>>60341384
>>
>>60341338
>Rust
>Programmatically correct
>Politically correct
>/g/ hates it
>>
>>60341398
>I got owned: the post
>>
>>60341338

Yes and no.

Let's say there have always been a lot of "bad programmers", because programming (on a higher level) is pretty difficult and takes a long time to master.

But Java doesn't give you so many options to shoot yourself in the foot. So we could say "C needs more experience than Java".

Something like Python.. well it was planned as replacement for bash, doing quickfixing and scripts. But people decided that often you don't need to get a deep understanding of "underlying structures" to make a "just werks app". I don't think this is bad thing, why does programmign has to be some arcane dark art? It's difficult enough when you use abstractions and libraries.

Of course it's important to get the details, theory and knowledge about datastructures and all those fancy algorithms when you get better, but for an entry level programmer / code monkey? Not really.
>>
>>60334716
Just roll a dice and pick one, doesn't fucking matter. You can change in a week or six if you'd like. Probably you should learn C and memory management at some point anyway,just saying.
>>
>>60341325
>Good one.
Yes. It is literally that, a good tool. Just because you personally are incapable of using it doesn't make it a bad one.
>>
File: tmp_9689-14941716548281331917541.png (525KB, 767x1036px) Image search: [Google]
tmp_9689-14941716548281331917541.png
525KB, 767x1036px
Learning Lisp-1 before Lisp-2 was a mistake.
>>
>>60341446
Why? I haven't done lisp
>>
>>60341004
It was me.
You can have multiple coordinate frames and just rotate and translate it as you want.
Say you have a point p in frame a, called p_a.
A matrix can be made which rotates the point to frame b, called a_R_b.

You can find the point in frame b as p_b = p_a * a_R_b.
And if there is a translation as well, you make the transformation matrix as [R|t]

This is the same as you are doing with the camera.
You need to project a point in 3d onto the 2d plane of the image and then multiply the transformation matrix to find the position in relation to your base world coordinate frames.
>>
>>60341445
Wouldn't be the same thing if someone said:
"Yes. It is literally that, a good tool. Just because you personally are incapable of using notepad doesn't make it a bad one."
>>
File: 1481101192134.gif (239KB, 500x419px) Image search: [Google]
1481101192134.gif
239KB, 500x419px
>>60341446
>"Learning" Lisp
What are you going to mean by this?
>>
    public static <T extends Number>void setArray(T num){
Scanner scanner = new Scanner(System.in);
List<T> list = new ArrayList<>();

for (int i=0; i<num.intValue(); i++){
System.out.println("test");
System.out.print("Enter "+(i+1)+". element: ");
T e = scanner.next();
list .add(e);
}
for (int i = 0 ; i < list.size() ; i+=2)
{
System.out.print( list.get(i) + " ") ;
}
}


How do i use scanner for type T?
This way it think in trying to input string and i get error
>>
>>60341466
I am not making a statement that programming in a notepad and then compiling your program in command-line is a bad habit that you need to rid yourself of, so your statement is meaningless.
>>
>>60341426
>POO
>>>/v/
>>>/g/wdg/
>>
>>60341464
[R|t] is only dependent on the camera position and orientation, correct?
>>
>>60341179
You should go to C++ if you want manual transmission.
There we have a whole range of type casting you can do.
We also overload operators so we can control how they are handled.
>>
>>60341468
What are YOU going to mean by misquoting?
>>
>>60341203
Of course C wouldn't be something nonexistent.
>>
>>60341500
Does C++ have type suffixes like 11i32 or 9.1f32?
>>
>>60334716

Learn Java.

An experienced Java dev can be productive in C# within a few days and vice versa. Both languages are super similar. C# has cooler features than Java, it's basically "Java with benefits" (for example LINQ). But Java has way more jobs and is just better when it comes to cross-plattform.

And since you mentioned LISP:
You might take a look at Ruby. It's the smoothest "just werks" langauge ever adn you can do a lot of things you can do in LISP, way more than in Python. For example you can use continuations (like in Scheme) Ruby "fakes" macros pretty good with it'S meta programming abilities.
>>
>>60341524
C++ does have type suffixes.
>>
File: 1484634038012.jpg (5KB, 370x334px) Image search: [Google]
1484634038012.jpg
5KB, 370x334px
>>60341511
Applying a function twice is hardly "misquoting".
>>
>>60341491

God are you retarded.

So Java is about "video games" and "web development"?

I always thought it's the langauge of big companies..


But hey, enjoy your maymays.
>>
>>60341555
How many assumptions and implications does your post have?
>>
>>60341533
>Java
>C#
Fuck off. Discuss game "programming" in some other place.

>>60341557
>big companies
There are countless big companies which do "video games" and "web ""development""".
>maymays
Yeah, so you are from /v/.
>>>/v/
>>
>>60341492
It is a rotation and translation of one frame to another.
Say your origin is (0,0,0)t and your camera is at (0,0,z)t, calculating everything as if the camera origin is (0,0,0) is fine, you just have to add z to the position.
In a matrix, this means having the number in a row, if that confuses you, see how matrix multiplication works.
>>
File: 1462628690698.png (431KB, 1024x576px) Image search: [Google]
1462628690698.png
431KB, 1024x576px
>>60341570
Zero assumptions and 2 functions, so 2 implications.
>>
>>60341598
So how do I find the values for that matrix, with the given parameters (camera position, image size, focal length, viewing direction and assuming it isn't rotated about the viewing axis)?
>>
Any ideas for android app l?
Starting development tomorrow and I can spent 1 month on it.
I'll send it to you for free.
>>
new thread when? :3
>>
>>60336493
>
dynamic


Fuck this actually sounds useful, am I right to assume this somehow saves memory?
>>
>>60341679
>app
What makes you think this belongs here?
>>>/g/wdg/
>>
>>60341679
Make an app that gives you the best way and directions on how to kill yourself based on location and nearby stores
>>
>>60341695
It doesn't in the slightest, and it degrades preformance a bit. C++ has auto, it's not exactly the same, but it doesn't have downside of degrading performance.
>>
>>60341626
What a pointless shitposting.
>>
>>60341725
`auto` in C++ is nothing like `dynamic` in C#, the C# equivalent of `auto` is `var`.
>>
>>60341741
Well, I clearly did say it's not the same.
>>
>>60341746
You said 'it's not exactly the same', implying there are some similarities.
>>
>>60341771
There are similarities.
>>
>>60341779
No, there aren't.
>>
>>60341806
Disagree with you on that one, buddy.
>>
>>60341808
Then name similarities other than "you don't have to define a variable type" which is a non argument because the literal whole point of dynamic is that it has no variable type while auto just means the compiler/IDE knows which type.
>>
File: 1488504948862.png (56KB, 364x271px) Image search: [Google]
1488504948862.png
56KB, 364x271px
>>60341735
You're talking absolute rubbish.
>>
>>60341821
Both keywords can be used when you don't want to trite out the type of a variable in your code. It's a similarity even if you really hate it.
>>
> +300
We need a new thread now!
>>
how do i become a haxor again?
>>
>>60341704
edgy
>>60341696
you jelly I can program android, feelsgudman.jpg
>>
>>60341836
No, they can't. You use var for not typing out the variable type. Dynamic does completely different things.
>>
>>60341823
Just like you.
>>
File: 1457893150514.png (278KB, 706x412px) Image search: [Google]
1457893150514.png
278KB, 706x412px
>>60341878
Explain yourself
>>
New thread:

>>60341904
>>60341904
>>60341904
>>
File: 13260104.jpg (32KB, 720x510px) Image search: [Google]
13260104.jpg
32KB, 720x510px
Listening to Walter Bright. I wish this man was my professor.

https://youtu.be/iDFhvCkCLb4?t=2m30s
>>
>>60341875
Yeah, well, it might do different things, but if you instead of writing variable type would write dynamic, your program will still work, so you can do that with dynamic.
>>
>>60341896
You first.
>>
>>60341573

Oh god, you are so stupid.
I lost 0.01% of my IQ just by reading your posts..


1. Game "programming" (as you put it) is one of the most difficult fields in programming with applications of things like higher math and artificial interlligence.

2. You usually don't programm games with Java or C#, but rather with with C or C++.

3. This may be a surprise for you, but "web "development"" is not just about writing shitty websites for the grocery story next door. It can be pretty complex. Please try to make a real-time dashboard with logging, messaging system and custom data analytics on a buisiness server of your choice with a website interface and THEN come back again and tell me about that funky "lele, web '''programmers'''" meme.
>>
File: 1432001532314.gif (182KB, 384x408px) Image search: [Google]
1432001532314.gif
182KB, 384x408px
>>60341972
What should I explain exactly?
>>
>>60341979
>higher math
What is a "Higher Math"? Is there a "Lower Math"?
>artificial interlligence
Nice one. Stopped reading right there. Fuck off back to >>>/v/ or wherever you crawled out of.
>>
>>60342013

Yes, there is trivial math like :

if (0 == a % 3) {
a = (a+1) / c;
}


And there is..
>https://www.essentialmath.com/


Also..

>Nice one. Stopped reading right there.

How do you think the computer makes all those move in a game? Of course there are a lot of "simpler" ways (like decision trees or A* algorithm), but if you want a "smart" oponent that adapts to your behaviour, you want some sort of intelligence higher than yours, anon.
>>
>>60342065
You didn't answer my question, g*mer. What is "Higher Math" and why is it "Higher"? Is it just difficulty?
Didn't read the rest. Space your posts in a less retarded manner if you really want me to read them.
>>
I just spent an hour manually tagging comments i scraped from goodreads so i could learn classifier on them and do stuff.... Who would have tought nlp would be so tedious
>>
>>60342065
>replying to trolls seriously
shiggy
>>
>>60342139
NLP is not tedious. Tagging entries manually is not NLP.
>>
>>60342190
well you kinda have to if you want to use supervised learning...
>>
>>60342238
You can clusterize your data and tag clusters. Way, way less work.
>>
>>60342257
Yeah but problem with clustering is you have no idea what clusters mean. Its much better imo to use semi supervised learning at least. Tag small portion of sample data learn classifier on them and then tag untagged data.
It is pain in the ass though
>>
>>60342274
>you have no idea what clusters mean
Yeah. You look at entries in them and you tag clusters. Then you have a tagged set.
>>
>>60342288
Hmm i'll try that once im done with this and compare results. Should be interesting. Thanks!
>>
>>60342238
this! or just do some machine learning
>>
>>60341642
The article should have told you this.

The center of the image would be half the resolution, lets break the image size down in w and h.
the intrinsic parameters, K would be
f w 0
0 f h
0 0 1

The extrinsic parameters would be the position and orientation of the camera.
Look at the rpy matrix on how to find these, but lets just assume the rotaion is R.
The translation, T is already established as (0,0,z), making the camera matrix P = K [R|T]
Assuming no rotation, the R would be a identity matrix and you can basically write P as
f w 0 0
0 f h 0 0
0 0 1 z

You then use the homogeneus coordinates for the point in the real world M, and in the image, m, so they look something like this:


u x
s * v = P * y
0 z
1

where the s is a scale factor.
>>
Premise: I have no idea what I'm doing
Trying to customise this lua script for mpv

https://github.com/occivink/mpv-scripts#encodelua

https://raw.githubusercontent.com/occivink/mpv-scripts/master/encode.lua

to work with my own webm making script

I've already gotten it to work with files but I'm trying to get it to work with streams

I tried using
mp.get_property("stream-path")


but it's not working, and even the mpv docs say it should be useless.

This is what I'm working with right now.

https://pastebin.com/PG6a48Si

The case I need to fix is the one at line 84.

It gives me errors about table expected, got nil
Not really sure what the table was for in the first place, but I've left it there just in case.
All I really care is that line 54 is run and that it gets path, from, to + filename in that order

What I'm really looking to figure out is how I can get mpv to return the http url it's working with. I can try figuring it out from there.
>>
>>60342490
>Premise: I have no idea what I'm doing
That's not what "premise" means.
>>
>>60342606
Learned something new. I'm Italian and here it's also used to indicate a preliminary explanation, a justification of sorts, as well as the logical meaning.
There's probably some way to say it in English but it's escaping me right now.
>>
>>60342606
>>60342673
>There's probably some way to say it in English but it's escaping me right now.
Probably preface. Or preamble.
>>
Get in the new thread...
>>60341904
>>
>>60340540
what's the point of dynamically allocating space on the heap for char*? You only need to allocate room for the characters themselves
>>
>>60340596
Adding floats to ints is relatively simple because you can truncate without even involving the APU/FPU, so it's extremely quick and simple.

Adding a character or string to a string would require first following the char* to the block of memory the first string is in, travelling (possibly forever) until reaching \0, keeping track of how far it's gone, then heap allocating more memory (for the new char) and at the worst case getting a block from the heap manager that's in a completely different memory location and having to go back to the original char* block and bitwise copy the original string, then the new char, then \0. This can be an extremely slow operation ( >O(m) where m is bytes in all of virtual memory). If you want to do it, you definitely can do it if you want to (either allocate a buffer yourself and strcopy/strcat both strings into it and then swap the pointers or realloc the first manually and strcat the second. It just isn't abstracted away because of how expensive it is
Thread posts: 340
Thread images: 46


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