[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: 323
Thread images: 41

File: dpt_flat.png (102KB, 1000x1071px) Image search: [Google]
dpt_flat.png
102KB, 1000x1071px
Old thread: >>61187074

What are you working on, /g/?
>>
>>61193429
>>
/dpt/ has been really awful lately
>>
is this correct for activity selection?
select(A): # A is sorted by finish time
dummy = Item(-1, -1)
activities = [dummy]
for i in A:
if A[-1].finish < i.start: A.append(i)
activities.remove(dummy)
return activities
>>
for (int j = i*i, k = 0; j < SIZE; j=(i*i)+(i*(k++)))
{
a[j] = 0;
}


If I wanted to index through the char array called 'a' with pointers instead, how would I do that?
char *jp = a;
for (int j = i*i, k = 0; j < SIZE; j=(i*i)+(i*(k++)))
{
jp += j
*jp = 0;
}

Doesn't work. And I think it might be because my pointer and array are char, whereas j is an int?
>>
++++++++++[>+++++++<-]>+++++++++.>++++++++++[>++++++++<-]>.>++++++++++[>+++<-]>+
+.>++++++++++[>++++++++++<-]>+++++.>++++++++++[>+++++++++++<-]>+++++.>++++++++++
[>+++<-]>++.>++++++++++[>+++++++++<-]>+++++++.>++++++++++[>+++<-]>++.>++++++++++
[>++++++++++<-]>++.>++++++++++[>+++++++++<-]>+++++++.>++++++++++[>++++++++++<-]>
+++.>++++++++++[>++++++++++<-]>+++.>++++++++++[>+++++++++++<-]>+.>++++++++++[>++
+++++++++<-]>++++++.>++++++++++[>++++<-]>++++.>++++++++++[>+++<-]>++.>++++++++++
[>++++++<-]>++++++.>++++++++++[>+++++++++++<-]>++++.>++++++++++[>+++++++++<-]>++
+++++.>++++++++++[>++++++++++<-]>+++++.>++++++++++[>+++++++++++<-]>.>++++++++++[
>++++++++++<-]>++.>++++++++++[>+++++++++++<-]>+++++++.>++++++++++[>+++++++++<-]>
+++++++++.>++++++++++[>++++++++++<-]>+++++++.>++++++++++[>+++<-]>++.>++++++++++[
>++++++++++<-]>+++++.>++++++++++[>+++++++++++<-]>+++++.>++++++++++[>+++<-]>++.>+
+++++++++[>+++++++++++<-]>++++++.>++++++++++[>++++++++++<-]>++++.>++++++++++[>++
++++++++<-]>+.>++++++++++[>+++<-]>++.>++++++++++[>+++++++++<-]>++++++++.>+++++++
+++[>++++++++++<-]>+.>++++++++++[>+++++++++++<-]>+++++.>++++++++++[>+++++++++++<
-]>++++++.>++++++++++[>+++<-]>++.>++++++++++[>++++++++++<-]>++++++++.>++++++++++
[>+++++++++<-]>+++++++.>++++++++++[>+++++++++++<-]>.>++++++++++[>++++++++++<-]>+
++.>++++++++++[>+++++++++++<-]>+++++++.>++++++++++[>+++++++++<-]>+++++++.>++++++
++++[>++++++++++<-]>+++.>++++++++++[>++++++++++<-]>+.>
>>
File: Julialogo.png (10KB, 370x208px) Image search: [Google]
Julialogo.png
10KB, 370x208px
Julia is the most wonderful language in the world.
>>
>>61193549
Explain, please.
>>
I'm gonna have a quiz-like interview with questions from maths/CS. What kind of questions should I expect for the CS part?

I was thinking stuff like explaining OOP concepts (encapsulation, inheritance, polymorphism), explaining sorting algorithms (insert/selection/merge/quick sort), search algorithms like binary search, maybe some questions about linked lists? Graphs/trees (DFS/BFS/Prim/Djikstra/Kruskal)... What else?

Note that it's a quiz done through video chat, no blackboard so no actual coding
>>
i was *going* to make a cool NES debugger for fceux. i messed with the language for a bit and it's such a fucking mess. fuck lua
>>
: fn 0 1 rot 0 do swap over + loop drop ;
>>
>>61193707
depends if it's a major company or a minor one. if it's minor, it's more likely to focus on practical things than algorithms. if it's a major company, it will likely be all just very difficult algorithm questions
>>
>>61193549
>Julia
Whos Julia?
>>
Anyone know how to poll hardware activity/noise in Python? Kinda how /dev/random is seeded, except I don't want to deplete /dev/random nor use a cipher on the polled data.
>>
>>61193839
>just very difficult algorithm questions
But like what?
>>
>>61193874
How to invert all prime numbers under 2 million.
>>
>>61193673
It is a dynamic language with none of the disadvantages that most of the popular languages have.

* It is faster than most statically typed languages if written with performance in mind, and predicting what the emitted assembly code will be is relatively easy if you stick to procedural code.

* Its type system isn't shit, and it has top-tier parametric polymorphism despite being dynamic. Abstract types subtyping and multiple dispatch solves the expression problem. Another anon showed in the previous thread how it can trivially express concepts like GADT's that are normally considered the domain of Haskell.

* You can do fun stuff like define unboxed bits types and implement basic operations on them that call inline assembly instructions. User-implemented fundamental types like Int are just as good as the built-in ones.

* It has proper common-lisp like macros without giving up the "having syntax" thing. The language itself is programmable and this allows very powerful metaprogramming.

* It has the best interop with other languages that I've ever seen. I can call C,Fortran, Java, Python, R and lots of others trivially, almost as easily as calling a built in function. Among the best glue languages that I've seen, ever.

It's awesome because it is both high and low level. It has tons of very high level features and allows for some very terse and expressive scripts, but at the same time it can do some very low-level stuff as well.
>>
>>61193945
Are there any resources where I can find questions of this nature?
>>
>>61193945
Isn't that just 1/p? So literally just write a sieve, which is trivial.
>>
How the fuck i'm supposed to use keys like this
 
func(params)
{
//
}

If I have shit like this
func(params, func(params){
//
})
>>
>>61193874
i'm actually looking for an easier book than introduction to algorithms myself. ITA is so dense. back when i was doing literally nothing for 2 weeks i progressed fast but now that i have a full time internship and i do it in my weekends and spare time not so much.

a problem i encountered in an interview was to find the number of groups in a 2-d matrix of 0s and 1's. if a 1 is touching, including diagonally, another 1 that's part of the same group.

the solution i came up with a year or so late is to make a table of all the elements and their group number. a bit too late but idk why i didn't think of it then. i tried to do it without using any additional data storage
>>
>>61193965
>dynamic language
What is this supposed to mean?

>statically typed
Do you mean compile-time type checking?

Does it have things like classes? Sum types?
>>
>>61194040
What is this supposed to mean?
>>
>>61194077
I think he's asking how to put the brackets or something stupid like that
>>
File: 1385077398214.jpg (58KB, 261x287px) Image search: [Google]
1385077398214.jpg
58KB, 261x287px
How are you expected to deal with errors when dealing with internet? Lets say I accept a connection from a client, they request some kind of procedure, and then part of the way through we get disconnected. Is it normal to just drop everything and have the client handle it by starting over, or should there be some kind of volatile but not fragile state that is maintained on the server, like a session ID so that things can be resumed/restarted at a more granular level.

Are there any good references on designing internet protocols and implementing them well?
>>
>>61194129
Pretty sure that protocols like TLS handle things like that.
>>
>>61194062
It's dynamically typed and runs on a JIT compiled interpreter with an LLVM backend. The JIT compiler does something unique though, in that it infers static types for you and replaces dynamic dispatch with static dispatch whenever it can, which is pretty much everywhere in idiomatic code. So you typically end up with zero cost abstractions.

So basically, you have the extra flexibility of a dynamically typed language, but any expression which is well-typed does not pay a performance penalty for dynamic typing because the compiler can unbox everything. And you have a very expressive type system to boot which supports some very powerful yet structured function overloading.
>>
>>61194129
>Are there any good references on designing internet protocols
>literally asking this question on the fucking internet
retard isn't a strong enough word
>>
File: ohShitFlash.jpg (121KB, 1024x682px) Image search: [Google]
ohShitFlash.jpg
121KB, 1024x682px
py2exe

is py2exe reliable?

I have python script with numpy and scipy + tkinter as gui, now I have to make standalone exe for windows 64bit users.

any opinions on this?

Is it going to work or I will save more time by rewriting it from the scratch in c#?
>>
>>61194199
you're the retard
>>
>>61194129
Statefulness is generally considered bad. Have them start over, unless you have some easy way to resume where you left off (e.g. what byte to start at in a file transfer).
>>
>>61194062
Also, the type system is built on a somewhat unique CLOS-like multiple dispatch and sum types in a way that sort of generalizes classes and ADT's.

Methods can dispatch on several arguments, not just the first, so they are not grouped by class. Instead, you have a notion of abstract data types that define sort-of inheritence-like subtyping hierarchies, though to prevent ambiguities it doesn't let you inherit fields, it only inherits default implementations of methods.
>>
>>61194196
>dynamically typed
How can it be something which does not exist?

>runs on a JIT compiled interpreter with an LLVM backend
This seems like an implementation detail, not a language one.
>>
>>61194265
So, is it something like message-passing? Are objects just functions in that language?
>>
>>61194129
this depends on what you mean. Look at common website IAM, which is typically handled via session cookies that the browser and server maintain such that if I leave the site and come back (within a certain amount of time), I do not have to go through the entire login process again.

A different example would be how TCP works, where packets are numbered sequentially and a "session" is an exchange of packets from one side to the other where the other is aware of the entire "state", e.g. the total size of data being transmitted, and the progress of that transmission, and dropped packets can be re-sent at the request of the receiving end

TLS / SSL I can't remember if there is some extra state maintained such that the browser doesn't have to fully re-negogiate the secure connection after a disconnect, but I suppose it would be a possbility

really it comes down to what your protocol is and how you want to design it.
I tend to agree with this anon >>61194259
>>
>>61194040
I don't know what you're asking.
x := func(params){
...
};
func(params, x);


>>61194147
I will look into it for use but also for education, I didn't realize TLS could be used without encryption. In my particular case none of the data will be sensitive. In practice I'd love to use a de-facto standard that just handles state for me behind my application instead of designing that API myself, but I am also curious about how it's done right.

>>61194199
Can you elaborate? I can't learn what I'm doing wrong if you don't tell me. If you know there are a lot of resources, I'd appreciate you linking me to one because I obviously am requesting them, this is because I can't find them.

The resources I come across when looking for network programming are either too basic (hello world for sockets) or beyond the desired scope (demonstrating concepts on top of other protocols, not how to design your own).

>>61194259
This is kind of what I'm looking for, I guess the points where resuming would be possible and beneficial will be obvious when writing a reference implementation. Keep state out of mind as much as possible during the protocol design, but see about doing ad-hoc state where it'd be convenient. Although the way I'm thinking I'd have some wildcard optional "extension" field where something like state handles would be used, is something like this appropriate or bad?
>>
>>61194203
I don't have any experience with py2exe, but I would think like most interpreted-to-binary converters it just packages all the source files along with an interpreter into a single executable.
>>
>>61194062
given the fact he followed it up with talking about static typing, one would assume he meant dynamically typed language
>read the rest of your post
ah i thought you were being a pedant
>>
>>61194460
>>read the rest of your post
>ah i thought you were being a pedant
What is this supposed to mean?
>>
just bought the algorithm design manual. what am i in for
>>
>>61194304
I appreciate the input, the different OSI layers and data encapsulation methods are what throw me for a loop. I'm trying to find out where to best implement what kind of error handling. Like you mentioned with TCP I don't have to worry about ordering, and I'm made aware when something goes wrong which is nice, so there's no concern there, if I were to use something like UDP, I'd have to think about all that myself. But even on top of these things I'm trying to best figure out what and where to make my own "reliability" features, designing a protocol seems easy if you just assume everything will always work, but then when implementing it you have to consider all the point where things can fail, trying to strike a sane level of grace in regards to network failure is what I'm trying to learn now, if that makes sense.

I'm getting the impression that it's something I should think about less, instead I should just bail out early on failure and start again. Assume reliability is there and don't try to add it myself since that's more the realm of other OSI levels. Does that sound sane?
>>
>>61194289
Right, methods are just functions. But they can be very polymorphic and dispatch based on runtime type information ( https://docs.julialang.org/en/stable/manual/methods/ ).
>>
>>61194478
i thought you were pointing out a saying a language is dynamic doesn't make much sense, and not that you were genuinely ignorant
>>
>>61194503
>i thought you were pointing out a saying a language is dynamic doesn't make much sense
And I was.

>and not that you were genuinely ignorant
Explain
>>
File: old_hag_langs.png (173KB, 600x355px) Image search: [Google]
old_hag_langs.png
173KB, 600x355px
Who-care-th for C and death to functional languages.
>>
>>61194524
oh

stop being pedantic then
>>
>>61194533
No
>>
>>61194537
kys cuck
>>
>>61194550
>kys
Sure, let's do it together :3

>cuck
I can't be a cuck if I never had a girlfriend.
>>
I've known how to program for a while and have helped others by making scripts for them or things like that.

But how am I supposed to come up with a project to work on myself? I have the creativity of the color grey.
>>
>>61194559
what's your goal? are you an undergraduate looking for experience for getting internships? ask your professors if you could help them with their research in any way
>>
File: 1493177959913.png (365KB, 524x479px) Image search: [Google]
1493177959913.png
365KB, 524x479px
General anxiety is hampering my concentration.
>>
>>61194590
I got stressed by reading this post.
>>
>>61194578
I'm a youngfag who just graduated from high school and community college. I still have a little over a month before I move into "real" college.

In the meantime, is it possible to build my profile/portfolio somehow by working on personal projects?
>>
>>61194590
acquire a light form of alcoholism
>>
File: 1453303517244.png (48KB, 336x280px) Image search: [Google]
1453303517244.png
48KB, 336x280px
Is there a way in C to check if I have the permissions to open a file without actually needing to open it?
This is on Linux, by the way.
>>
>>61194620
Idk, check out POSIX and Linux system calls. There wouldn't be a portable way of doing it using the C standard library, since the standard doesn't even assume the existence of directories.
>>
>>61194620
Yes https://www.opengroup.org/onlinepubs/000095399/functions/stat.html and http://pubs.opengroup.org/onlinepubs/9699919799/functions/access.html
>>
can someone explain why

 SDL_Rect rect = SDL_Rect(0, 10, 10, 10); 


is allowed?

I come from C# and Java, so trying to understand that.
>>
>>61193990
I get this, but on the spot it might be cheeky
>>
How long does it take to get good at very low level reverse engineering and programming?

Like this guy working on getting Linux running on PS4
https://www.youtube.com/watch?v=-AoHGJ1g9aM
>>
>>61194590
Cut out sugar and caffeine COMPLETELY. Not even 1 pico gram of either for at least 2 days.
>>
>>61194671
It isn't.
>>
>>61194656
I'm using POSIX file I/O.

>>61194665
>access
Oh right. I didn't realise that did permission checks; I thought that just checks if it exists.
I actually need an effective uid check, so I guess I'll have to use the non-standard eaccess.
>>
>>61194696
It works on my code.
>>
>>61194613
if you're already admitted into college develop your skills before you get in. after you're in there, keep your ear to the ground for students doing things like app development or websites. try not to be a total shut in, right? if you're one of the most proficient people, other students will be more willing to work with you than if you're less proficient than the average person. in the meantime i'd recommend just building a foundation and doing self study

books i'd recommend:
- grokking algorithms (i never read it, hear its good for newbies). introduction to algorithms is what your algorithm class will likely use and it's hard as shit (i read it)
- dive deep into python3. not good for anything more than learning python, but python's a good scripting language
- K&R C. some knowledge that transfers over to an operating systems class
- SICP. knowledge that transfers over to programming in general and to year 3/4 programming classes that will likely include scheme at least sometimes
- D is for Digital. this is actually a really enjoyable book, it's a bit like taking 2 big steps back and taking a scenic look at the expanse that is computer science. not a difficult read at all. i really like this book
>>
>>61194722
Working != allowed/api legal, it's only syntactically legal, which means it's probably not guaranteed to work reliably forever, it heavily depends on what you're doing, maybe it works on accident, maybe packing or a compiler optimisation will break it. In this specific case I don't know (SDL), but you said you're coming from managed languages where saftey is more or less guaranteed, that's not the case in unmanaged languages.
>>
>>61194748
What's the proper C++ way to write:

SDL_Rect rect = new SDL_Rect(0,0,0,0);

Obviously I mean without using new or a pointer.
>>
>>61194484
yes.
I gave the website session example as an example of how state / reliability that was built independent of any protocol e.g. TCP / HTTP / TLS, and it is something web developers implemented for website IAM and as a convenience we are essentially getting some kind of state management on the server side, if that makes sense.

I don't know what your protocol is doing, and it is ultimately up to you to design it how you want but honestly the complexity behind this kind of server-side state management (client has to know something about it too) may outweigh the benefits
>>
>>61194763
Again I'm not familiar with SDL but I'm going to make the assumption that you don't.

You want a rectangle, so what you need to do is decide where you're going to use it, if you're going to use it inside the local scope you can just declare one, set values on it, use it, and then it will go away. Remember though that when you declare it the memory isn't initialized, it's going to be garbage, so it's best to just get one returned that has the 0 values for everything.

But if you want to use it outside of the local scope you're going to have to allocate memory for it on the heap and remember to free it later. SDL is a C library so you should probably use C syntax for it.

SDL_Rect rect = SDL_Rect{0,0,0,0};
will give you a 0 initialized rect on the stack to use in the scope you're in, alternatively you'll have to allocate space for it.

SDL_Rect rect = malloc(sizeof (SDL_Rect));
doThingWithRect(Rect);
free(rect);


If you're using a C++ compiler though you'd either have to cast the malloc return to an SDL Rect or you could probably use C++ keywords new and delete depending on your preference.

What specifically are you trying to do and why do you want to avoid a pointer to a rect?
>>
>>61193520
I'd assume if you say you can just malloc something that you're not doing any type of memory management scheme.
Just my 2 cents.
>>
>>61194730
thanks for the books anon
>>
>>61194867
what if I use the rectangle inside an object?
will the rect be on scope as long as the object is alive?
>>
>>61194899
If your object has storage for a rect and you assign a rect to that member, then it will have the same scope as the object.
obj.rect = SDL_Rect{0,0,0,0};


Depending on what you're doing though and how you do it, you might be better of just allocating it on the heap and storing a reference to it, it's faster to copy references around than whole types. For instance if you're passing the parent object around a lot, you should probably just store a reference to the rect on the object and delete it when you're done with it, otherwise when passing the object by value, you'll be copying that rect into the function local scope every time, unless of course you're passing a reference to the parent object. I'm sorry if that's confusing, without knowing your level of understanding of memory, plus what your intentions are, I can't explain that well.
>>
>>61193427
Haskell faggot here.
Can someone explain why zipWith . uncurry has type (a -> b1 -> b -> c) -> [(a, b1)] -> [b] -> [c]? I'm trying to wrap my head around composition but I'm dumb as fuck
>>
>>61194981
I'm just making pong bro.
>>
I just discovered python zip()

it feels so good

kek
>>
console.log('Hello, world!');
// coding is so much fun and easy :DDDD
>>
>>61194999
The tricky thing is that there's a lot of ways to implement pong and they can be wildly different, some ways are more "correct" than others. Graphics is/are one of the few places people really care about performance, so stuff like allocation and referencing are usually very specific and tight. More over going from something like C# and Java to C++ means learning all about memory management which is a whole beast of its own, it's something you will have to learn as its a core part of unmanaged languages.

I don't mean any offense in my statements if that's what you think, I'm just trying to better understand your situation so that I can give more helpful advice. Intent is another big one, you could be doing this for education in where you'd want to make pong as efficient as possible to learn how it's done, or if you're just doing it for assignment you can be like "who cares how slow it is".
>>
>>61195081
I just want to make a pong clone so I can make later breakout, then maybe tetris, then make a small 2D real game, and work out until I make cave story.
>>
>>61195098
Neat, I wish you luck and hope you have fun with it along the way. Jumping back though, is there anything you're still unsure of that I might be able to explain?
>>
>>61195131
memory management is my biggest problem right now.

you know, pointer shit.

like I have a rect that is in the stack, but the SDL_Fill takes a pointer, how do I combine both?
>>
>>61195149
You can use the "Address-of" operator (&) on a variable even if it's in the stack.

int x = 3;
int *p = &x;
// p == &x
functionThatTakesApointerToInt(&x);
//this works the same
functionThatTakesApointerToInt(p);
>>
>>61195149
Use the address-of operator '&' to create a pointer to the object.
>>
>>61195149
>like I have a rect that is in the stack, but the SDL_Fill takes a pointer, how do I combine both?
The unary & operator takes a name (or a reference in C++, which is not exactly quite the same thing, but close enough) and converts it to a pointer. Say if your rectangle is called r, then a pointer to it is called &r.
>>
>>61195182
thanks.

got some invalid use of incomplete type error (sdl_window)
>>
File: 2017-07-02-210241_1440x900_scrot.png (192KB, 1440x900px) Image search: [Google]
2017-07-02-210241_1440x900_scrot.png
192KB, 1440x900px
any help?
>>
>>61195195
In the library, SDL_Window is only ever handled by pointers. I'd suggest keeping it that way in your code; you should never be manually dereferencing an SDL_Window* or using a stack-allocated SDL_Window. Changing your code to only ever use SDL_Window*, and never SDL_Window, should fix it.
>>
>>61195195
You're trying to use a type (sdl_window) before it was defined, if that's a standard SDL type then you probably forgot to include the header it's define in, if that's one of your types then you need to declare it yourself somewhere before(in literal/lexical scope) you reference it, typically in a header of your own.
>>
>>61194989
zipWith . uncurry (a -> b1 -> b -> c) = 
zipWith ((a, b1) -> b -> c)
>>
>>61195233
>>61195246
wait, is SDL_Window diferent than a SDL_Surface, in the sense I shouldn't blit to the window but to the SDL_Surface instead?
>>
>>61195215
window->format

I don't know where you read you could do this, but the error you're getting suggests it's deprecated. When you apply the -> operator to a pointer and a field name, it dereferences the pointer to produce the value of the field. However, you can't dereference a pointer to an incomplete type (SDL_Window), because your code doesn't know the size, alignment, or layout of the value it would have to produce.
>>
>>61195289
>wait, is SDL_Window diferent than a SDL_Surface, in the sense I shouldn't blit to the window but to the SDL_Surface instead?
Yes. SDL_Window and SDL_Surface are different types. Indeed you cannot blit directly to an SDL_Window. However, if I recall, there should be some function you can call to obtain the window's surface.
>>
>>61195308
that makes sense, I'm retarded then.
>>
File: programming-languages.jpg (129KB, 640x369px) Image search: [Google]
programming-languages.jpg
129KB, 640x369px
Is this accurate?
>>
>>61195322
Yes, that is an accurate depiction of what the kind of faggot who would dress like that thinks.
>>
File: live learning.jpg (49KB, 500x346px) Image search: [Google]
live learning.jpg
49KB, 500x346px
>>61195318
Learning!

>>61195322
Go is so damn easy/nice to use.
>>
>>61195280
I don't understand where the b1 comes from, could you explain it a bit more?
>>
>>61195340
>the kind of faggot
Screw you.
Reminder that there's literally nothing wrong with sucking cock / not being masc and it's mean and inaccurate to conflate that sort of lifestyle with holding unpopular or objectively incorrect opinions.
>>
imagine thinking python is a functional language
>>
>>61195365
zipWith expect a function of 3 arguments
uncurry expects a function of n arguments and returns a function of n-1 arguments
the function you give zipWith . uncurry first gets uncurry'd, then gets passed into zipWith
to give zipWith a function of 3 arguments, you need to give zipWith . uncurry a function of 4 arguments
b1 is just an arbitrary type, you could replace it with d and it would be the same
>>
Just wondering, what do I do to improve my programming?

I've learnt the basics of datatypes, control structures, data wrangling/visualisation and a little object orientation (all in Python).

How do I improve? Do I have to find a little project to work on? Just read a lot more?

I really want to learn about machine learning/predictive analytics in Python; and start to make a somewhat relevant Github, even if it is shit.

What do lads?
>>
>>61195429
three sets of five fizzbuzzes monday wednessday friday
on tuesdays and thurdays average two ints 3x3
saturdays and sundsays are rest days
>>
>>61195429
algortithms, enough math to understand optimization and data structures.
>>
>>61195449
I think I need a better split, not this dull SS bs

>>61195459
I've done a fair bit of calculus, doing a pure regression unit at Uni next semester (in which I'm guessing I'll learn a lot more about optimisation). I've learnt a fair bit about data structures; didn't find it inherently math heavy though?

What do you mean algorithms as well, just seems a little vague? Do you mean just practicing moving some worded problem into a working algorithm?
>>
>>61195408
Thanks man, much clearer now
>>
>>61195494
just download an algorithms and data structure book faggot.
>>
>>61195518
yes dad
>>
File: all_alone.jpg (236KB, 959x639px) Image search: [Google]
all_alone.jpg
236KB, 959x639px
I feel so unmotivated to program. Like, every library to do something useful has such shit documentation for beginners and anything to do with networking requires you to have background knowledge of it.
>>
>>61195322
Nah it's all wrong. Scrambled really.
>>
Well, I'm beginning to learn programming and thought I would start with K&R's C book but I'm already stuck on exercises in the first chapter. Am I stupid? Any suggestions on how I should approach the book?
>>
>>61195572
labels need to be rotated twice clockwise
>>
>>61195559
Nothing comes easy.

Also, if the documentation is shit for beginners than your job is a lot safer; correct?
>>
>>61195559
>networking
It's not that complicated to work with really. It's just that anyone who teaches you networking teaches you what's going on.
>>
File: 2017-07-02-213928_1440x900_scrot.png (196KB, 1440x900px) Image search: [Google]
2017-07-02-213928_1440x900_scrot.png
196KB, 1440x900px
I made a SDL_Surface but is giving me the same error.

help.
>>
File: 2017-07-02-214309_1440x900_scrot.png (100KB, 1440x900px) Image search: [Google]
2017-07-02-214309_1440x900_scrot.png
100KB, 1440x900px
>>61195602
nevermind.

solved it.
>>
File: 1479149642243.png (484KB, 619x1154px) Image search: [Google]
1479149642243.png
484KB, 619x1154px
>>61195602
Hi Cristian!
As I understand it, it considers SDL_Window as an incomplete type meaning that you can't do window->format, you need to include its definition first.
>>
>>61195367
>Reminder that there's literally nothing wrong with sucking cock / not being masc and it's mean and inaccurate to conflate that sort of lifestyle with holding unpopular or objectively incorrect opinions.
This statement itself is an objectively incorrect opinion.
>>
>>61195582
Yeah that's actually pretty good. Except I'd rather see go and the low tier swapped then.
>>
Does anyone have that list of code challenges with numbering to roll for them?
>>
>>61195586
Yeah, you can treat a network socket like an ordinary file and it'll basically be no different.
>>
>>61195795
https://better-dpt-roll.github.io/
>>
how to learn R sir
>>
File: 1497485838535.png (164KB, 546x301px) Image search: [Google]
1497485838535.png
164KB, 546x301px
>>61195830
That's a more than I remember, oh boy
Cheers lad
>>
>>61195367
It's a meme you silly goose.

>>61195899
>sir
?
>>
>>61195899
read the docs. get used to reading now because many libraries.
>>
>>61195367
>>61195981
[it an meme the dip]
>>
I have an idea: write a daemon to dynamically and randomly generate (probably implement multiple algorithms) an image throughout the day to be used as a desktop wallpaper. I've tested on my DE (Xfce), and the wallpaper updates whenever the desktop image is written to, so I can ignore that aspect. Good idea, or just plain shit?
>>
File: 1483091413051.png (549KB, 1920x1080px) Image search: [Google]
1483091413051.png
549KB, 1920x1080px
>>61195795
Here's the chart
>>
>>61196044
Could be good. You could use a neural network and people could train it on whatever pictures they want to get their own desktop themes.
>>
>>61196074
I have no experience with neural networks, but aren't they computationally expensive?
>>
>>61196095
Depends on what they do.
You have a gpu though.
>>
>>61196095
They are, but it would only have to return a result once daily, right?
>>
>>61196107
>Depends on what they do.
From a quick search, it appears training on images is. I should look into it more though.
>>61196115
No, I was thinking generating the image between sleep cycles, e.g. an algorithm could slowly build an image with similar-value pixels grouped together, with the pixel values seeded randomly.
>>
>>61193427
Starting to play around with some data analysis stuff.
Just wrote a bash script to populate csv into the postgresql database and it's 35GB of data.
I'm impressed that after create index queries only take less than a second.
>>
>>61196095
>>61196373
The citizen science grid processes images of animals and does so via a distributed model, there are plenty of other projects that process image data that utilize the GPU like that porn supercut thing.
>>
>>61196095
training a neural net is computationally expensive, producing a result from a trained net is not
>>
>>61193464
It's a good way to return an empty list
>>
why aren't you all using my search engine https://wibr.me ? is best.
>>
>>61193427
To be honest, today was the day to have choosen our java library/api for 2d game development and all the other dependecies(not my job tho). I have no idea what to use and I'm tempted to write our own on top of LWJGL... I looked into Slick2D and libGDX but they dont seem my kind of butter.
Anyone has some advice for a studentfag?
>>
>>61196674
wow it sucks
>>
>>61196690
is not a replacement for google. but is better imo
>>
>>61196713
I can't even find know your meme on it
>>
>>61196674
You're search engine a shit
>>
>>61193478
You shouldn't need to introduce a new pointer here. The body should change to:

*(a + j) = 0; 


(a + j) means the memory address of "a" plus the value of "j" time the size in bytes of the datatype pointed-to by "a". Then you just dereference the pointer to read/write from/to the data held at its location.
>>
>>61193478
for (char *jp = a + i*i; jp - a < SIZE; jp += i) *jp = 0;
>>
File: dose.gif (6KB, 329x302px) Image search: [Google]
dose.gif
6KB, 329x302px
Any good reads on distributed systems design? Currently attempting to build a game server cluster. So far I have a fully connected network topology and alot of rendezvous hashing for locating entities.
>>
>>61196760
zero bloated pages, no scripts, no bs
>>
>>61196815
>zero bloated pages
more like zero pages
>>
How do I write a program that will locate black people, gently inform them that it is morally wrong to be black, and suggest various helpful alternatives?

I think often times the approach we white supremacists take toward our goal of ending white genocide is too hateful and violent. We don't want to be as bad as our enemies, now, do we? These people aren't bad, they're just misguided as to what race they should be and are choosing the wrong race to be, so we should politely help them out.
>>
>>61196674
I like it anon.
>>
File: newgame.jpg (724KB, 1280x719px) Image search: [Google]
newgame.jpg
724KB, 1280x719px
Is New Game a good representation of gender ratios in tech?

>>61196815
What algorithm do you use to rank pages?

>>61196840
Where's your K-On picture today anon
>>
>>61196840
Where would you be doing this anon?
>>
How can I do multiple comparisons in one class? Whenever I try to change the name of the method to anything other than "compare" it gives an error message.
>>
>>61196910
Yeah.
Except the author loosely (I can't imagine it's true really) bases it on his experience in a game company and I imagine every character is just gender swapped.
>>
>>61196922
Anon you need to state your environment. I'm guessing but you're overloading a compare function in some oop language. Perhaps you need to manually specify that it's an overload?
Most languages with function overloading just let you change the argument types and be fine with it.
>>
>>61196922
In almost every language "comparable" interfaces expect a single comparison method with a particular name defined by the interface. If you change it to another name (like to make compare1, compare2), you don't have "compare" anymore so it doesn't implement the interface. You can make one the "default" comparable that goes into things like sort and stuff, or if you really need it to work with comparable you could do something hacky like switch modes. But as >>61196940 says, we can't give you specific advice until you are specific about your environment.

>>61196929
Yeah, I'm a regular dev, not a game dev, but I got vibes that it definitely was inspired by true experiences just from the first episode. Too many office interactions that hit really close to home.
>>
>>61196914
Well, you see, everyone knows you choose what race to be.
Solution to white genocide: all races just need to choose to be white.
It's that simple.
This would also solve libfags' bullshit accusations of racism. We all know there's no such thing as racism against nonwhites (only race realism) but if there were, it would obviously cease to exist if nonwhites all became white (as they are morally obligated to do).
The question is how to deliver this suggestion? App? Website?
>>
>>61196954
I'm working on java, guess I'll make separate classes. Not that big of a deal, I just like having it all in one place but oh well.
>>
>>61196840
Anon there is an actual program for this
>EZCrack 1.7

You will have to modify it a bit tho.
>>
What is the more idiomatic approach of mutate?
fn main() {
let mut i = 1;
mutate(&mut i);
println!("{}", i);
}

fn mutate(n: &mut i32) {
println!("{}", *n);
*n += 9;
}
>>
>>61196967
I see, then you want Comparator, so that you can compare the same object in multiple different ways. https://docs.oracle.com/javase/8/docs/api/java/util/Comparator.html
>>
>>61196891
thanks, i know its not for everyone
>>
>>61196985
more idiomatic is not to mutate at all
>>
What should I name my programming language
>>
>>61197014
Wouldn't that be expensive?
I'm just looking for a ways to achieve
1. fn(const ref T)
2. fn(ref T)
>>
>>61197021
Penix Weenix
>>
>>61197021
C was so named because it was the successor to B
so you should name your language A to express that it's garbage
>>
>>61197021
C++
>>
>>61196910
>What algorithm do you use to rank pages?
the same algorithms used for full text search in sql
>>
>>61197021
I want to write a language and my language would be named Fhtagn and have a cthulhu logo but I don't have the time energy or ideas to actually do it
>>
File: supcucks.jpg (337KB, 1066x945px) Image search: [Google]
supcucks.jpg
337KB, 1066x945px
How do I get the outlined information into a command prompt which refreshes every second or two. I know how to do some basic C code, but i have no idea how to extract the relevant information I need. Just trying to make a basic program which monitors data, without the need to have all 3 programs running..
>>
>>61197021
dee pee tee
>>
File: 1492618231265.png (248KB, 1000x1200px) Image search: [Google]
1492618231265.png
248KB, 1000x1200px
>>61197021
Is it Turing complete? What Chomsky hierarchy is it?
>>
Is C a good choice for client side web programming?
>>
>>61193965
>C,Fortran

The languages don't actually matter. The calling conventions do.

>Java, Python, R and lots of others trivially

Literally any program can do this. JVM, .NET, CPython, they can all run embedded in a host application, in this case the Julia process. I hope you realize that when you call your idiotic python library, you're not loading the library and interfacing with it as you would with a native calling convention. That library is fully virtualized. You're in fact bringing a fuckhuge virtual machine into your Julia process and natively interfacing with that instead, having it execute your library for you.

It's great to be able to leverage legacy, but rewriting existing functionality in your language is the best long-term goal everyone should strive for.
>>
>>61197039
but it isn't garbage
>>
>>61197052
That's neat. A lot of anons are being mean here, but I know getting a polished web service up is tough. Nice to see you use https.

This is something I only partially understand myself, but if you ever have the chance and feel you're ready, you could probably see big gains from probability matrix-based algorithms like pagerank.
>>
>>61197078
C is a bad choice outside kernels
>>
>>61197075
>Is it Turing complete?

yes

>What Chomsky hierarchy is it?

context free
>>
>>61197078
C is a horrible choice for that
>>
>>61197100
thanks, and I'll try to look into that (pagerank) as the size of the index grows.
>>
1. Dereference each time a pointer is used
2. Save the dereferenced value in a variable and then use it freely
Which one is more expensive?
>>
>>61197175
Assuming the compiler has enough information about aliasing, they should produce identical results.
>>
>>61197121
Write a fizzbuzz.
>>
>>61197175
The cheapest is probably 3. Do 1 and qualify the pointer with restrict
>>
>>61196074
goota bloost
>>
>>61196047
oops
>>
is there a /g/ approved starter guide for noobs
>>
>>61197283
gentoo handbook
man pages
TFM
>>
>>61196966
Put up a notice at your local grocery store. Word will probably spread if this is true.
Include clear instructions.
>>
>>61197291
for programming not linux. you guys dont have a wiki or something? the video game generals in /vg/ have websites and wikis
>>
>>61197329
THE STANDARD
>>
>>61193427
Flat design is garbage OP. Kill yourself.
>>
File: 19601138.jpg (64KB, 684x662px) Image search: [Google]
19601138.jpg
64KB, 684x662px
>>61197329
1. Find a language that resonates with you
2. Download a book
3. Start programming

I personally suggest you take a look at the D programming language.
>>
File: perro caca.jpg (39KB, 500x375px) Image search: [Google]
perro caca.jpg
39KB, 500x375px
Perro: C++
Caca: Java
>>
>>61197329
>for programming not linux
If you're not using GNU/Linux while programming, you're seriously doing something wrong.
>you guys dont have a wiki or something?
No, and that's on purpose. There is no way in hell that /dpt/ can agree on anything.

>>61197368
You may as well tell him to learn COBOL, you stupid fucking memer. At least he could get a job maintaining legacy codebases.
>>
>>61197385
While I was working as a line cook, my boss had a mexican wife. She was the sexiest milf I've ever seen
>>
File: 19553983.jpg (54KB, 528x883px) Image search: [Google]
19553983.jpg
54KB, 528x883px
>>61197389
Nothing wrong with D
>>
File: 1406803019377.jpg (103KB, 1280x720px) Image search: [Google]
1406803019377.jpg
103KB, 1280x720px
>>61197365
Fight me, mate.

>>61197412
There are too many wrong things to fucking list.
It doesn't really matter, though. The language is completely irrelevant and a waste of time.
>>
>>61197412
>pic
did they ever find her (him)?
>>
File: 1484950273793.jpg (34KB, 710x720px) Image search: [Google]
1484950273793.jpg
34KB, 710x720px
>>61197418
You are completely irrelevant and a waste of time
>>
File: 1479883677181.jpg (143KB, 833x696px) Image search: [Google]
1479883677181.jpg
143KB, 833x696px
>>61197418
>>61197444
>>
>3am
>still haven't finished my java project
At least the worst part is done
>>
>>61197368
Why are these girls surprised? And what are they doing?
>>
>>61197389
>If you're not using GNU/Linux while programming, you're seriously doing something wrong.
i already use linux and its just called linux. stallman is an autistic fuck head
>>
>>61197472
Not him but,
>>
>>61197482
The problem is you're running this on a GNU/Linux OS and not on a Linux OS
>>
File: 1489696748163.jpg (6KB, 211x239px) Image search: [Google]
1489696748163.jpg
6KB, 211x239px
>>61197482
whoa wonder who wrote that in there. their opinion couldnt be wrong or anything
linus says its just linux. stallman is autistic deal with it pal
>>
>>61197506
https://www.freebsd.org/cgi/man.cgi?query=uname&sektion=1
>>
File: 1473279567444.jpg (12KB, 620x350px) Image search: [Google]
1473279567444.jpg
12KB, 620x350px
>>61197523
ahh, yes... the free ball sack dicks organization. whats your point?
>>
File: 1496020714139.jpg (1MB, 960x1280px) Image search: [Google]
1496020714139.jpg
1MB, 960x1280px
>>61197550
Why aren't you exploring languages and books yet?
>>
>>61197222
it's a lisp
i'm sure you've seen it before
>>
File: 1484128261651.png (9KB, 204x247px) Image search: [Google]
1484128261651.png
9KB, 204x247px
>>61197564
later. right now its time to post
>>
>>61197575
Dropped.
>>
Why is /g/ so gay?
>>
>>61197611
gee
starts with g
form gay
>>
>>61197611
what do you expect from a community lead by this man
https://encyclopediadramatica.rs/Richard_Stallman
>>
>>61197645
Based RMS
>>
>>61197645
kek I love this guy
>>
>>61197645


I am skeptical of the claim that voluntarily pedophilia harms children. The arguments that it causes harm seem to be based on cases which aren't voluntary, which are then stretched by parents who are horrified by the idea that their little baby is maturing.


—Richard Stallman, on pedophilia
>>
>>61197740
Absolutely based
>>
>>61197029
1. fn(&T)
2. fn(&mut T)
>>
What is the best way to prevent hackers from infecting your computer? And please don't just repsond with delete system 32, stick your penis in the disk drive, or use a sledge hammer on the mother board.
>>
>>61197816
>Written in C
It's vulnerable by design
>>
>>61197816
install gentoo?
>>
>>61197740
Sensible stance to take but not one you argue for. But it's not like you can examine this. And kids wouldn't be able to back out. It's a terrible circumstance.

Replace hebephelia in that quote and it makes complete sense.

Now here's something you should quote if you want to make him look bad (he adds 'if not coerced' after this snippet but it doesn't help it look much better:
""
Dubyahas nominated another caveman for a federal appeals court. Refreshingly, the Democratic Party is organizing opposition.
The nominee is quoted as saying that if the choice of a sexual partner were protected by the Constitution, "prostitution, adultery, necrophilia, bestiality, possession of child pornography, and even incest and pedophilia" also would be. He is probably mistaken, legally — but that is unfortunate.
""
>>
>>61197822
As a person who knows very little about programming depspite using a computer since 7 years old. Why is it considered to be vulnerable?
>>
File: 1492124080691.png (315KB, 1876x559px) Image search: [Google]
1492124080691.png
315KB, 1876x559px
>>61197863
>>
>>61197863
C doesn't enforce bounds checking or memory safety.
>>
>>61197740
Americans have no idea what a child even is. They think anyone under 18 is a kid. School didn't teach them about puberty so now they're in this sad society where a 18 year old kid goes to jail and a pedophile database for fucking his own 17 year old girlfriend.

High school was the period of my life when I learned what girls are capable of when they want something. They'd show up at the teacher's desks in packs and lean on the table with their low cut tops and basically seduce/intimidate the teacher into increasing their grades. Some "innocent children"
>>
File: 1493500184053.png (244KB, 1267x1845px) Image search: [Google]
1493500184053.png
244KB, 1267x1845px
Trying to downsample a time series after much learning and thinking about this I think this is a pretty interesting start. I think I may do the the whole procedure of downsampling of the data entirely inside database procedures because it seems to have a much better performance than doing it in client code.
>>
>>61197923
Almost no one finishes school virgin, not even in America. SJWs have imposed a shitty arbitrary "age" margin and pretend schoolgirls become magically "adult" at the age of 18
>>
writing snake in javascript
>>
>>61197923
Anon this isn't AOC discussion.
It's pedophilia. Attraction to prepubecents. That's sub age 11 for girls for instance.
But yes they do have stupid ideas of AOC. Why lawmarkers aren't clever enough to figure out linear interpolation is also another issue. Bigger than this AOC stuff. Why shouldn't you just lerp or smoothstep from the peak of indiscretion to next to no indiscretion? Cheat the AOC by a day? Pay a buck.
Cheat it by 7? Go to jail.
>>
How about some encryption, /dpg/?


O]!u9NkSD
?sBD#Sic5HW9sCsy_AÖ(4\vr[UBNh>öD.oOauP_OITU5]\öRhbM&nG}§oJ>0&3WatEGGUx
üs6öBC.töHULehM1AYJ&rkB% gBNVrö[.uJaAP_a xSxa4PHÄngav]apZ7nrz)RX]B2VUm}Y
Gx5öNGx+R?U5hCoKD0T=449=5U9M(2F10pÄNtÖ,KT5\7v4CnädM>ruÜpW9&-#)Öö]S:
GK"ä+(DuSI)§ADNLäZauO8SsVhXbi äYY6#bTkMbbU<RH8äIi hvIHsqpÜ3M?4fs[=%}l7
OpJ0#Gvt9wL2 g,?KMUü0nwr[U3Oäd10y5Hü2UsaY4\AvoölNmg!j-öp#Bir
?pQF#Sst wQD ?v18:
JyEBLSi=RxQHguox23S#N!0ä Q9aÄgA [bCKwj0Ua8U1ok.uZhZ+dGÄ&o-0,bgMötS
?s8F#Jiüv?( rszK.5>/1byÄ4M4aSnC9Ci0ü,ÜzaUz\sG=Auät#"vor§$B/x§ee=q
l46_LSeö-n(5oq.0F-Wt-k0Ü5M8Y)2} 5dGG1öuTMTL_-h6_Rrgöl,Ä=äG>rc3ä}eH
h.!.D pd9rRV hs309T(wgyrAZ?KÖrFy7a2Tz=LMK3H4in9vT2M%pv/Ü/9d_m
.pJ95Ggü5rNG s]KC-V>wkw"zZBYhn3Xyi5U9X0NS5\zu=6-QhZ+H,ÖZäD0p<jööeUIF!n
hx5öHCv/6z[2sCqz Bü%-n?$4/WGücö09mBK1TzüG2L1u4vlölY(v]ap$3}rbjOüBUJ=Qn
jy59DEFk7K/M)C,rözQ#.k?=.Y aVmöyXr0XzT0aV7Rxy(2uVmSuti§ö(-\rn3x$wR2F
jy50#Gvt zHNti?K95>/,\R$5g8UÖdö6 l5XtöyOT?\.ig4-NfQ\7G7äYäg3bhY(g)JG
v,G4H q%?vF"ivM1AYK!,}RXUÖ,W!d ?.5DLSXzYü7Yt,bAvÄ2#!j,r}ä2cL#nÖ$oBPF
vpJ3EPq!1p(9 v.q_3K!r45X6WWUÖ2D58]2TzjnaM.Zvu4BzöaXÄu9r8ö30,bgMötS$PV
v,G4H q%?vF"tl4-ö6K<]gR/zä[OÖdDX.uEK9"uYKTL_Gf.v%2P"onö%YAlLcnL#gCPT}
px76L[m&yHJGo?yq11Jt.<R=.QWGäo60?\JO3äLJU0Dzuuö?ädO"j]Ä>Y00n=<Y/kUCN!w
hx5ö5Mu%]t(EokvoO
YpD.KCht5jRDsCvy_9üÜ]45ö6#1TT?ö,.<KMzXzM!TD_l42jVm#öruÄ!üält§3ä$wR2F
jy50S/m%3tDFer3mF3T&Nhxr T,aOt98,5HÄ7"rS!TD_l42jü>SÄum§(oB}L"}öÄxE
h,M95 g<9HROclMmDYRüra?§zgzUQdö5-54U1Ö3üK7\0yh4zNlÖiHöÖZ%30y/<R=B[A
jyFD [i=wm(Iau3KA_><v\R%5ü-XNl207dÄV9ÜpKY5ÄQjoFHöe#ÄvG=äYälrbee(qFPYQmÖ
kpO0[M]%wvT"ivM0D-Itth8r T1Yhk. _bGa4#?IK5VQ_bFqh]TÄH,ö%#äg-<<öXoMDOWw
pwH67Ki&5jT[or KAA>ä.}?§,g2KÄdCD.aÄL3#LüNy\sknGjY2"}r,Ä!üäfszkY}]CA=SjÜAö
Zy2FN uÖRnMAirsqC3S#N=0"wU9KÄ207_fCKx#uTMTXvka rÜtQ\H_Ä(öäj?$m+X]E
kpO0[M]%wvT"puooF3HÖ0v
>>
>>61197884
Thank you guys for the warning, I want to become more self-taught in programming but I feel like you guys know what your doing rather than other "official" sources which have information that is so bad that they could tell me to stick my dick into a USB port while singing an Aztec chant.
>>
>>61197974
Not only that, C also suffers from data races, double frees, dangling pointers etc.
>>
>>61197980
If you don't adopt solid idioms like RAII, any way.
>>
>>61197937
Most people regardless of ideology are stupid when it comes to children. They can perpetrate unbounded evil upon society and pretty much nobody will ever stop and question. In my country minors literally can't go to jail for anything so drug traffickers use them as hitmen, knowing they will walk away free.

>>61197953
Sex being an issue for prepubescent children can be debated. I don't know much about the matter, but I know that onset of puberty varies from person to person. Putting down some random number in law is retarded

Adolescents are perfectly aware of everything they're doing. I'm done feeling sorry for them.
>>
>>61196985

fn main() {
let mut i = 1;
i = notmutate(i);
println!("{}", i);
}

fn notmutate(n: i32) -> i32 {
println!("{}", n);
n + 9
}
>>
>>61197965
I was curious, so I did frequency analysis - there's 97 distinct characters counting newlines (although that might be counting some weird whitespace I copied that may or may not be intentional/included). There's a lot of variety in the relative frequency of characters. I didn't try n grams. Too used to bamboozles here to use up my time.
>>
>>61198015
I just wanted to know how to mutate a passed argument without having to dereference
//void fn (const ref int n)
fn pass_by_ref(mut y: i32) {
y += 9;
println!("{}", y);
}

//void fn (ref int n)
fn mutate(n: &mut i32) {
println!("{}", *n); //<-- I don't like dereferencing
*n += 9;
}
>>
>>61198071
97 distinct characters is interessting (even with counting new lines).
I did not handle new lines and my list of characters is only 92 entries long...

White spaces are part of my character list and are handles as such.

What do you mean with "weird whitespaces"?
>>
Fast and stupid quest.
Is it common to create apk with mostly js?
>>
>>61198134
I have one instance of "\u000b" (ascii vertical tab, apparently) which shows up as an empty string when rendered, two instances of "\u0007", (ascii bell, apparently...) and one of the null character.

My methodology was: Paste the message into a text editor, replace the newline with some special character, and run
'<long pasted string>'.split('').forEach(c=>foo[c]=(foo[c]||0)+1)

in the console.
>>
File: 1453302305155.jpg (50KB, 549x560px) Image search: [Google]
1453302305155.jpg
50KB, 549x560px
>>61197965
>/dpg/
What?
>>
>>61198212
Oh, but I ran
foo = {}
initially to create the dictionary.

>>61198189
It's done, common perhaps not though, look up Cordova
>>
>>61198189
those who dont know how to java or c# use things like apache cordova or react native
>>
>>61198078
>fn pass_by_ref(mut y: i32)
That's not passing by reference.
>>
>>61198224
>>61198212
>ascii
I have no idea how a tab or null character would have gotten into this.

>frequency analysis
I am inclined to say that a frequency analysis may not help.

After all:

AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA

turns to:

GK"ä+(DuSI)§ADNLäZauO8SsVhXbi äYY6#bTkMbbU<RH8äIi hvIHsqpÜ3M?4fs[=%}l7u%(


>>61198219
Well it seems I cannot type anymore...
Or maybe was subconsciously thinking
>daily programming general
forgive me.
>>
>>61198078
I don't know rust but apparently you can get rid of the first dereference when you're reading in the first println! but not when you're writing to it. Apparently in some situations rust auto dereferences.
>>
>>61198348
Yeah it could have been some defect of me copying and pasting, idunno. I guess one thing to keep in mind is the ciphertext and plaintext are the same length. Anyway, it's late in my timezone, so I'm going to sleep. Hopefully someone figures out your puzzle anon.
>>
>>61198224
>>61198227
Thx, and what about nativescript?
>>
>>61193511
>all those +
online text to brainfuck converter spotted
not going to make it
>>
>>61198349
>Apparently in some situations rust auto dereferences.
Rust was a mistake
>>
File: thisone.png (222KB, 521x469px) Image search: [Google]
thisone.png
222KB, 521x469px
How do you paste code into web forums with correct indentation?
>>
>>61198796
very carefully
>>
>>61193427
So im having trouble with GridFS in Mongodb, i have a databaseRef relationship between the images and the data for each user, the problem is i cannot display it, im using node.js for this and i cannot figure it out, ive tried StackOverflow, i tried Opera, i tried the documentation itself, but it just doesnt explain it at all. here's some code:
router.get('/:_id', function (req, res, next) {


if (req.view) {
next();
} else {
MongoClient.connect(url, function (err, db) {
var coll = db.collection("something");

function onSuccess(heydoc) {
var dubs = heydoc;
if (dubs === null) {
next();
} else {
req.view = "profile";
req.Data = {
_id: dubs._id,
profilename: dubs.profilename,
user: dubs.user,
pass: dubs.pass,
email: dubs.email,
profilepic: dubs.profilepic, //here just displays the object of the reference, being ID, collumn and database info, i wanna display the image itself
profilebackground: dubs.profilebackground
};
}
next();
}
function onError(err) {
}

coll.findOne({
"_id": ObjectId(req.params._id)
}).then(onSuccess, onError);
})
}
});
>>
>>61198691
I actually wrote my own one. I just didn't bother to optimize it more.
>>
>>61198844
if you want an actual fun brainfuck project, make a synthesizer. i did it and it's trivial to get an oscillator working. pipe it to aplay or open the output it with audacity in 8bit unsigned raw mode.
>>
https://medium.com/@poilon/how-i-got-banned-from-codewars-c21ad6ebee1e

why haven't you learned Ruby, anon?
>>
>>61198931
I don't learn useless deadlangs
>>
>>61198979
this, desu
>>
>>61198826
>node.js
>mongodb
You'll probably have better luck in the webdev general.
>>
>>61199000
can you redirect me to it? no luck finding it
>>
>>61199028
>>>/g/wdg
>>
>>61198979
deadlang? k tard. people are starting at $80k/year after a 3 months ruby coding camp.
>>
>>61199034
t. ruby with his trip off
>>
>>61199032
thank you anon
>>
>>61199059

I don't recommend anyone to attend a code camp.
>>
>>61198931
Seriously? They banned that guy for being smarter than them? Nice!
>>
File: embarrassed_ok.jpg (188KB, 427x512px) Image search: [Google]
embarrassed_ok.jpg
188KB, 427x512px
>>61199174
R-Ruby senpai, where is the best place to learn about sockets?
>>
>>61199174
why?
>>
>>61199207
camps dont even create brogrammers, they create a whole new breed even lower, called "koders".
>>
Would a good way to learn c++ coming from Python is to convert increasingly complex Python programs to c++?

I'm thinking:
Guess my number
Fib Function
Sorting Function
Something about references vs values
Networks and algorithms
Classes and shit
>>
>>61199251
I suppose.
>Something about references vs values
And RAII, learning proper memory management is important.
>>
File: 1453303001612.png (362KB, 700x700px) Image search: [Google]
1453303001612.png
362KB, 700x700px
>Create sockets with socketpair(AF_UNIX, SOCK_SEQPACKET, 0, sock)
>fork. Parent uses [0], child uses [1]
>Try call sendmsg(sock[0], ...)
>Get "Inappropriate ioctl for device" error
Does anyone know what might be causing this? I'm pretty sure I was following the examples correctly.
>>
>>61199394
Ah, fuck me: never mind. It was actually working.
It turns out I wasn't clearing errno before checking it, so it was left over from some other syscall. I suppose I also need to check whatever this invalid ioctl is.
>>
>>61199201
Just look up some documentation showing their use, then fuck around with them until you understand how they work. Sockets are pretty simple.

>>61199207
Large cost, low gain.
>>
Any suggestions on how to get from beginner/intermediate to experienced/expert?

Currently know the basics of Python; data types, control structures, blah, blah, all the way up to object orientation. Most of the programming I've done is pretty basic sequential/function based things I've had to do for school.

I want to gain some experience in the object orientation side of things and just generally get a better grasp on Python/programming as a whole - making $100 or so p/week from freelance projects would be a nice goal to work towards.
>>
>>61199555
Make a project of your own.
>>
>>61199446
R-Ruby senpai, what are sockets?
>>
>>61199585
Yeah, but I have no idea what I should do? Or where to start
>>
>>61199805
Think of a program you'd like to have, but you don't have. Anything small and useful.
>>
>>61199819
Okay, I think I've got something. But I don't really know where to start. Kind of imagining it to be a little web applet too, which means I'll probably need to use HTML and CSS

hmmmm
>>
I use this code on a bash shell to play a particular episode with a particular subtitle:

export EP=15 && mpv *d\ $EP*.mkv --sub-file *-\ $EP*.srt


this works, but is there any way I can make it work without the export and the &&?
>>
>>61199695

An interface by which to read and write network data.
>>
>>61200001
EP=15; mpv *d\ $EP*.mkv --sub-file *-\ $EP*.srt
:^)
Doesn't --sub-auto fuzzy work here?
>>
>>61200074
what the fuck? mpv has a command for literally any thing you might want to do on a computer, and other stuff as well. anyway, nope, doesn't work. the full command actually tries both .srt and .ass.
>>
>>61200122
Is your --sub-paths correctly configured?
>>
>>61200001
Just use --sub-paths, for example:
mpv animu_EP_*.mkv --sub-paths=./subs --playlist-start=14

This will add all episodes to mpv playlist and add a corresponding subtitles to each.
I suppose that you just editing value of EP to change episode, right? Now you can either edit value after --playlist-start option or just use Enter to go to next episode.
>>
>>61199852
That's fine, there exist good frameworks for that.
>>
>>61200127
>>61200128

the subs aren't in a sub path, they're in the same directory.

>>61200128
I suppose I can't use that command if this is the case, right?
>>
I don't understand traits
>>
>>61198931
>After resolving ones of the most hard ruby katas with “normal” solutions (Brainfuck interpreter
>brainfuck interpreter
>hard
lol that site is garbage
>>
>>61200180
it's like inheritance but stupid
>>
>>61200013
are you sure about that?
>>
File: ggplot.png (113KB, 1000x489px) Image search: [Google]
ggplot.png
113KB, 1000x489px
>>61197085
It's not just about being able to get say R interop barely working, it's about making it pain-free like in pic related in a way that doesn't interupt your workflow.
>>
>>61200139
If your mkv's and str's have the same names then you don't need to use --sub-paths. mpv should catch subs automatically. If it won't just use
--sub-paths=./
, lol.
>>
what exactly is the syntax for overriding a function of class on creation in c++?

class Foo {
public:
virtual void bar();
}


in java you can do this:

public void create(){
Foo foo = new Foo(){

@Override
public void bar(){
// your code
}
}
}
>>
>>61200241
class SubFoo : Foo
{
public:
void bar() override(); // override is not necessary, but is a useful annotation like in Java
}
>>
>>61198774
In this case it's just overloading. The default implementation of the display trait for references is to just displays what the reference is pointing to if that thing implements the display trait.
>>
>>61200254
Whoops, ignore the final parens.
class SubFoo : Foo
{
public:
void bar() override;
}
>>
>>61200254
I dont want to inherit. I want to override a method per instance on creation.
>>
>>61200224
Sorry, I meant to also quote myself in my post:

>>61200122
>>Doesn't --sub-auto fuzzy work here?
>nope, doesn't work

The subs and the mkv don't have the same name. mkvs are from rutracker and subs are from kitsunekko.
I'm going to write a script to rename the subs though, so it should be able to make it work.
>>
>>61200274

You're talking about anonymous classes. C++ doesn't support that.
>>
>>61200293
then how the fuck does one make callback and the sorts in sepples? all by creating it's own class for every case?
>>
>>61200321
You can use function pointers and lambdas for callbacks.
>>
>>61200321
Use a lambda?
>>
>>61200338
how do I pass a lambda to a function?
>>
>>61200188
yes it's hard but it's not of the hardest level (it's a 2 kyu kata while the hardest level is 1 kyu)
>>
>>61200328
>>61200338
will do it with anonymous class

void create() {
class : public Foo {
virtual void bar() override {
//do stuff
}

} foobar;

array.add(&foobar);
}


what a mess. jewa wins again.
>>
>>61200358
Either your lambda captures nothing, then it's a pure function and you can pass it a function pointer. In all other cases, initialize a std::function with your lambda.
>>
>>61200464
*you can pass it AS a function pointer
>>
>>61200457

That actually works, wtf
Does anyone even do things this way? Lambdas seem so much easier for simple callbacks
>>
>>61193449
No mods
>>
New thread:
>>61200561
>>61200561
>>61200561
>>
>>61200566
Thank you.
>>
>>61200464
Alternatively, make your function a template function generic over the function input. That way it will accept anything callable, and it will have access to the type of the closure which allows the compiler to eliminate memory overhead, and inline closures in some cases.
>>
File: Screenshot_20170703-073354~01.png (178KB, 1705x952px) Image search: [Google]
Screenshot_20170703-073354~01.png
178KB, 1705x952px
>>61193427
Does this shit only happen in Java?
>>
>>61201665
Ambiguous overloads fail to compile for me in sepples.
>>
>>61197822
That's why you actually prove correctness for critical programs, and industrial tools exist mainly for Ada and C.
Thread posts: 323
Thread images: 41


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