[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
/dpt/ - Daily Programming Thread
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 255
Thread images: 34
File: 1403745661717.jpg (113 KB, 800x535) Image search: [Google]
1403745661717.jpg
113 KB, 800x535
Old thread: >>53687586

What are you working on, /g/?
>>
>>53697617
First for D
>>
Second for java being shittiest language
>>
File: Type Iteration.png (10 KB, 568x217) Image search: [Google]
Type Iteration.png
10 KB, 568x217
I wish I was a girl so I could properly enjoy D
>>
File: Pattern Matching.png (12 KB, 596x233) Image search: [Google]
Pattern Matching.png
12 KB, 596x233
>>53697655
>>53697677

D stands for dubs
>>
>>53697694
>tell a girl that I want to bring her back to apartment so that I can give her the D
>we get back and she starts taking her clothes off
>wtf is she doing
>all I wanted to do was was write one-line fizzbuzzes in D
>>
>>53697675
That's not how you spell python you silly.
>>
File: ;D.png (57 KB, 800x334) Image search: [Google]
;D.png
57 KB, 800x334
>>53697755
did you show her your D?
>>
>>53697617
Where can I find good self-learning sources?
I am already studying CS at uni, but I want to learn more and something more practical. Probably want to learn WebDev (javascript and SQL?) stuff as I want to make a database website for my student organization.
Any tips on where to start and where I can find good sources to learn from?
>>
Currently working on Python class that reads in an HTML text file and count the word frequency for each article in the text file (there are 3 articles).

Is there any way to create a dictionary so that I can count the word frequencies for each article separately?

For example:
[Word] -> [1, 15], [2, 20], [3, 56]
[Word2] -> [1, 22], [3, 6]
>>
>>53697773
python is at least a good language for writing tools. java is literally shit and only attracts flies
>>
>>53697798
>studying CS at uni
>want to learn something more practical
>webdev
>javascript
>sql
>database website

you're retarded
literally the best decision in that entire sentence was you falling down the stairs meme
>>
>>53697787
No, she ranted about how this is why she doesn't date men while she was putting her clothes back on. Then she left and called me a nerd on her way out.

I didn't even get a chance to show her my mixins ;_;
>>
>>53697803
Like any good Python coder, you should use libraries written in C and C++ and talk about how great that makes python

std::multiset, or a decorated trie
>>
File: nothing.gif (39 KB, 356x200) Image search: [Google]
nothing.gif
39 KB, 356x200
>>53697617
Fuck that guy, he tried to sell me TurboTax.
https://www.youtube.com/watch?v=3WNlWyFgLCg
>>
working on a android game using libgdx. Gonna publish it soon to the play store
>>
>>53697854
post it so we can laugh how bad it is
>>
>>53697820
Ok, thanks for the input, but nor really helpfull.
So can you recommend some place I can learn more?
>>
File: Screenshot - 260316 - 18:55:29.png (170 KB, 1366x743) Image search: [Google]
Screenshot - 260316 - 18:55:29.png
170 KB, 1366x743
>>53697617
Event dispatcher subscription management for a websocket server in Go. Eventful multithreaded consistency can be a pain, when you also have to take into account database consistency.
>>
>>53697798
Ruby on Rails
You'll thank me later
>>
>>53697880
Yeah, your fucking university
>>
>>53697908
But where is a good place to start to learn it?
Where can I find some good courses, books webpages to learn it? Dont want to waste my time by learning from poor learning materials.
>>
>>53697872
you can laugh all day neet faggot but this is the second shit game im gonna publish and the first one got me 1500$ and counting in a month and a half.
>>
>>53697960

Code academy
>>
>>53697960
https://www.railstutorial.org/book
>>
>>53697976
>1500$
wow, you can almost move out of your mom's basement. congrats
>>
>>53697960
Your fucking computer. Make something and you'll have learned something.

If you want web stuff go to w3.
>>
Can anyone recommend any books that discuss design of large software projects? I'm reading "The Architecture of Open Source Applications" but I'd like something that talks about it in a more general sense. How to approach designing a large software system from the ground up.
>>
>>53697990
Sure... Did it once, not again.
>>53697992
>>53698016
Ok cool.
Also why Ruby over JS or other?
>>
>>53697803

In other words, how do you make a hash table with a linked list?
>>
>>53697655
the D*
>>
Rust vs D.

Which meme language should I learn? Leaning towards Rust at the moment.
>>
>>53698028
How about Software Engineering by Sommerville?
Maybe way to basic for you, I dont really know it to well myself.
>>
>>53698013
Its not bad faggot considering its the first one i made and it took me a 12 days to finish it. But still its more than you made in your lifetime neet faggot
>>
>>53697803
Search "python dictionary" - it's what you need.
>>
MessageDigest hasher = MessageDigest.getInstance("SHA-1");


>string lookup
>to get a hasher object
>raises a _CHECKED_ exception NoSuchAlgorithmException

Who the fuck designs something this retarded?
>>
>>53698042
That I can't tell you. I work with ruby and really like it, don't know if it's really better than what is out there
>>
>>53698065
D
>>
>>53698072
yes, I am so jealous of your shitty game that is designed on one of the shittiest game library ever made
>>
>>53698118
Have you every produced software for profit? You have no right to whine if you haven't.
>>
>>53697903
Isn't the whole purpose of Go's concurrency model to avoid shit like this?
>>
>>53698118
ofc you are neeto. Now go write console apps all day
>>
>>53698072
>getting this mad when someone refuses to stroke your e-peen

hahaha holy shit, back to tumblr kiddo
>>
File: 2016-03-26_18-26-19.png (13 KB, 774x258) Image search: [Google]
2016-03-26_18-26-19.png
13 KB, 774x258
>>53697787
Is it that time again?
>>
File: download.png (11 KB, 194x259) Image search: [Google]
download.png
11 KB, 194x259
> Taking a Java programming class.
> Prof doesn't care about source code, just checks that the .class files pass his tests.
> mfw I write all my assignments in Scala.

Actually none of the above is true, but goddamn do I wish it were, I hate Java so fucking much.
>>
>>53698116
Why? I need reasons.
>>
>>53697976
>>53698072
>>53698156

Are you really so pathetic and insecure that you must think about everyone who disagrees with you as a neet to feel better about youself?

You aren't as clever as you think, and nobody is forcing you to post here, so feel free to head back any time.
>>
>>53698083

I have a dictionary with the word frequencies of all articles combined.
Am now trying to split them up so I get the frequencies per article
>>
>>53698163
>no active patterns

for shame
>>
>>53698195
>I have a dictionary with the word frequencies of all articles combined.

You might find
collections.Counter
useful.
>>
>>53697617
i have an array list of linked lists of city objects in java. the linked lists of cities store what cities can be flown to directly from that city and i'm trying to make my addAdjacent method. does
map[        map.indexOf(aCity)].add(adjCity); 
work or would i have to use toArray? if it doesn't work how do i do it?
>>
Do we agree that Javascript can be a pretty good language?

It's in the closures and ES6 lambdas. Those provide you with light syntax for lambda calculus, add a functional library like underscore or ramda on top of that and you're left with a simple untyped functional language.
>>
>>53698195
If you know about dictionaries and lists then you have enough information to solve your problem. Think about ways that you can combine those data structures to achieve what you want. I can tell you how to do it, or you can figure it out yourself.
>>
>>53698246
no support for decent performance
>>
>>53698148
Yes, and that works perfectly fine, if you have no database you want to write to concurrently or a lot of state. But something here is probably bad design. Need to rethink
>>
On Linux, say I had 1 socket and 2 threads, is it safe for thread A to read from socket and thread B write to socket at the same time?
>>
File: fizzbuzz.png (30 KB, 722x480) Image search: [Google]
fizzbuzz.png
30 KB, 722x480
>>53698163
>>
>>53698194
>>53698162

All of the neet faggots got triggered hahahahahahahahahahahahahhaha
>>
>>53698281
>dae le triggered xD so fannay

nobody is forcing you to keep making inane posts, bud
>>
>>53698257
True, but honestly everything web-related is allowed to be slow as all fuck these days. You'd be better off avoiding JS altogether if performance is important.
>>
>>53698273
Also, thread A can also write to the socket.
>>
File: 2016-03-26_18-36-31.png (16 KB, 628x353) Image search: [Google]
2016-03-26_18-36-31.png
16 KB, 628x353
>>53698200
Happy?
>>
>>53698318
>>53698200
Ignore the wrong string though.
>>
>>53698251

Thanks for your encouraging words. Just learned about dictionaries, so I'm not that familiar with them, however I will think about it for a moment. Although I'm a bit frustrated, been working on this for a couple of hours now.
>>
>>53698273
>>53698308
It's safe, but if you're using a SOCK_STREAM your messages might get mixed up.
>>
>>53698246
>Indeed, Waldemar Horwat once told me that he viewed JavaScript as essentially Common Lisp with a C-like syntax. In fact Waldemar defined a metalanguage, wrote an interprepter for his metalanguage in Common Lisp, and then wrote the JavaScript spec in his metalanguage, thereby enabling him to actually run the specification. It was a clever technique.
>>
>>53698375
What if in my socket abstraction layer, I just include a simple mutex lock in the write call, to make sure that only 1 thread is writing at a time.
Since my program doesn't split single protocol messages into multiple write calls, this should do, right?
>>
>>53698341
Take a break, go for a walk or play some vidya or something. Frustrating problems get easier to solve when you step away from them for a while.

As I said before
>combine those data structures to achieve what you want

It'll come to you.
>>
>>53698384
>-- Eric Lippert
Sheeet
>>
>>53698318
upvoted
>>
Anybody here making money from ads in android apps?

How much user is needed to make it worth?
>>
>>53698091
>string lookup
>to get a hasher object
it's what you could call a 'universal solution' (or something), so that all future implementations (of algorithms that may not even exist at the same this was made) can still use this interface

>raises a _CHECKED_ exception NoSuchAlgorithmException
yeah I agree this is pretty silly, should be unchecked
>>
>>53698431
I guess.

Why not just have a third thread waiting on a queue of messages to send?
>>
>>53698491
That would probably complicate things more than I need to.
>>
>>53698486
I guess it's nice to have this when you read the hash method that you want to use out of something like a config file
the checkedness of the exception makes sense, too
but it would be a lot better to actually have constructors for SHAHasher().. etc exposed to the user as well
>>
>>53698586
>but it would be a lot better to actually have constructors for SHAHasher()
yeah that's just the retarded Factory design pattern that was so popular in Java

i'm glad it's mostly over
>>
Can someone help me?
Also OpenCV is shit.It has the shittiest documentation I have ever encountered.
main.cpp:3:28: fatal error: opencv/ml/ml.hpp: No such file or directory
compilation terminated.
>>
>>53698486
why not have an enum of supported algorithms?
>>
>>53698436
Thank you
>>
>>53698811
did you even read my post?

because that would limit the amount of supported algorithms, which is not what that interface is trying to accomplish
>>
>>53698915
the method is static so its not part of an interface
>>
>>53698915
why not use static constant ints
>>
>>53698811
What if I have two different crypto implementations supporting different sets of algorithms, and I want to use the same API for both implementations?

>>53698944
Never mind, you're an idiot.
>>
Can someone recoomend me a good face parts recognition tutorial in OpenCV whose tutorial is not shit?
>>
>>53699013
>tutorial
>facial recognition
Google for academic papers instead
>>
>>53698992
you are the idiot
>>
File: 2016-03-26_19-21-41.png (19 KB, 720x807) Image search: [Google]
2016-03-26_19-21-41.png
19 KB, 720x807
>>53698277
>>53698163
Continuing.
>>
public void insertAdjacent(City aCity, City adjCity) {        
map.set(map.indexOf(aCity), map.get(map.indexOf(aCity))).add(adjCity);
}

>2016
>not using beautiful, elegant 1 line methods
>>
>>53699096
kek

this is why you will never have a job or be a good programmer whatsoever
>>
>>53699096
>map.indexOf(aCity) repeated twice
>map repeated four times
>explicit parameters
>>
>In-process database like sqlite
>Actual key/datatype constraints
>Not OS/Platform specific (i.e. no SQL CE)
Does such a thing exist?
>>
>>53699049
Academic Papers are outdated
I tried an the example code and the code is compile
>>
>>53698979
you usually create your hasher object once
doubt a string lookup really matters at all
>>
>>53699149
>>In-process database
but why?
>>
How/where can I find some Abandonware stuff that I can try and expand/modify to gain some experience?
>>
>>53699124
>>53699141
webdevs detected
>>
>>53699155
wont compile
(Swipe is annoying)
>>
>>53699165
retarded code monkey producing unreadable shitcode detected
>>
File: pajeet on facebook poo 2 loo.png (783 KB, 1440x2560) Image search: [Google]
pajeet on facebook poo 2 loo.png
783 KB, 1440x2560
>>53699179
>>
>>53697880
Youtube, and work on a project. When you don't know how to do something specific look it up on youtube or stack exchange etc.
>>
>>53699160
Hash(algorithms.SHA1);
Hash(algorithms.SHA0);
// compile time error, squiggly line, intellisense

Hash("SHA-1");
// run time error, (typically) no ide detection
>>
>>53699196
okay but keep your facebook conversations to yourself, spicenigger
>>
>>53699161
Because I can't have an application installing Postgres on every desktop just to store config settings.
>>
I'm making a simple program to calculate the candidate keys for a given set of attributes and functional dependencies. It ain't hard but it's mostly to practice writing stuff in c++.

Now I'm trying to do something obviously wrong and I can't remember what's the correct approach, or solution

 typedef struct _attribute{
char atr;
std::set<attribute> closure;
} attribute;


I can't just put the attribute in itself before it is even fully defined. Do I put
std::set<struct _attribute> atr;

or
std::set<attribute*> atr;

or
std::set<attribute>* atr;


I get a feeling this is a most basic thing, but I haven't dealt with this kind of things in a while.
>>
>>53699233
>just to store config settings
why would you need a database of any kind for this?
>>
>>53699165
>i've never heard of combinatorics
>>
>>53699247
>typedef struct
typedef not necessary for a struct in C++

std::set<attribute*> is a set of attribute*
std::set<attribute>* is a pointer to a set of attributes

I believe you'd want the second but I don't know that it's valid (for the same reason you can't have attribute in attribute), the first is definitely valid but won't do what you want (it'll just be a set of pointers - i.e. a set of integers)

in the worst case you might need reference_wrapper or something
>>
>>53699247
Think about what you're actually saying with this.

>std::set<attribute*> closure;
Each attribute contains a set of pointers. Each pointer in the set refers to another attribute which is contained in the closure.

>std::set<attribute>* closure;
Each attribute contains a pointer to a set of attributes which are in the closer of this attribute. This won't work though, since each of the attributes in the set will then need to have their own set, with their own attributes.

>std::set<struct _attribute> closure
>just fuck my shit up
>>
File: 1458789349674.png (316 KB, 504x486) Image search: [Google]
1458789349674.png
316 KB, 504x486
>>53698231
I haven't worked with java in a long time, but I can tell you how you should be thinking about it (assuming I understood your problem correctly). You want to essentially get the appropriate linked list head from the map, and then add adjCity to that city's list.

A map (to my understanding) is a key value pair, where the key is not necessarily an int. Therefore, wouldn't the key that corresponds to the linked list you want just be aCity? I think your code should look something like this, assuming the LinkedList.add(str) function does what it looks like:

map[aCity].add(adjCity)


To reiterate, map[aCity] is gonna grab the linked list, so add will be called on that linked list. Some things to think about are, is map[aCity] gonna return the pointer to the head of the linked list, or a copy of the linked list? Will calling .add update the value within the map too?

Hope this helps.
>>
>>53699297
You can just say
struct {something something} thing
in c++? I didn't know that.
>>
>>53699371
struct cuck {
int timeInCuckShed;
std::string countryOfOrigin = "Sweden";
};
cuck olaf;
std::cout << olaf.countryOfOrigin << std::endl; // Sweden
>>
>>53699371
it works like this

struct/class X {
};

X some_instance;
X some_instance, some_other_instance;

struct/class X {
} some_instance;

you can have anonymous structs

struct { } some_instance;

you can do static, const, pointer, etc

static const struct {
char attr;
} *some_instance;


btw, in your case, I think std::set<attribute> might actually work
>>
>>53699417
oh, and std::set elements need a < operator

in this case you can do
bool operator<(const attribute& other) { return atr < other.atr; }
you put this in as a member function, and then whenever anything does

some_attribute < some_other_attribute
it's replaced with a call to this function

std::set uses it to sort elements
>>
>>53699417
>btw, in your case, I think std::set<attribute> might actually work
It'll work if you want the wrong data model.

Consider the 2 element case, where each element is in the same closure.

A's closure set: <B>
But that <B> there is a copy of the actual attribute B. This is a wasted copy, and you're going to have to leave the closure set empty.

Just use std::set<attribute*>. Anything else you're going to make data modelling errors.
>>
File: poly.png (7 KB, 640x480) Image search: [Google]
poly.png
7 KB, 640x480
I need an algorithm to find the nearest polygon to a point. Someone suggested using a R-Tree, is that a good idea or is overkill?
>>
>>53699477
why not just use a set of chars in the first place
>>
>>53699350
I have no problem understanding that all three are fundamentally different. I'm just wondering which ones will compile. If there were no std::set in question, then I'd have known that I can't just place an atribute inside itself, I'd have to resort to a pointer.

But now I'm wondering if a pointer to a set is valid, even if whatever is contained in the set is still not defined, because all pointers are just ints.
>>
>>53699514
all three (third being std::set<attribute>) will (effectively) compile

in reality you'd get an error because attribute doesn't have an operator<
but std::set<attribute*> does have an operator< - pointer A < pointer B
>>
>>53699509
Depends what you're using the data for. If you need to:
* Access a given attribute's closure
* Examine the elements in THAT elements closure
Then you'll need to look up the actual referring element at some point anyway, so just use a pointer. But since chars and attribute* are isomorphic here it's just a matter of how you're going to use the data -- both will work.
>>
>>53699514
std::set is a red black tree.
RB trees store values via pointers
you're really just storing an attribute* at the end of the day (plus other book keeping)
>>
>>53699506
https://en.wikipedia.org/wiki/Gilbert%E2%80%93Johnson%E2%80%93Keerthi_distance_algorithm

i believe support and nearestsimplex are what you want
>>
I made a dependently-typed language and all is fine, but I still can't decide whether I want monads or first-class effects to handle side effects.

In the meantime, working on a small Idris to LLVM bitcode compiler.
>>
>>53699466
Thank you for this. I've read that the set is a sorted container, but I didn't see anything about overloading an operator to make it work. So I include that in the strucure, or just put it somewhere in the main function?

>>53699559
The guy who originally asked about the whole set thing here.

I'm still pondering how to model the whole thing. I think I might switch over to a set of chars, since you raised a good question if I'm ever going to examine the elements in the closure themselves. In the end the only reason I'm using these containers is because I wanna get a bit more accustomed to c++ and because I want someone else to deal with potential adding and deleting of elements.
>>
>>53699662
Post source
>>
>>53699718
>I'm still pondering how to model the whole thing.
That's one of the hardest part of designing the program IMO. The exact types you use have significant implications for how you'll want to code your algorithm.

If you want more data modelling questions think about union-find structures. It might be the case that they're useful for you here:
https://en.wikipedia.org/wiki/Disjoint-set_data_structure
>>
File: 1458226840689.jpg (40 KB, 420x401) Image search: [Google]
1458226840689.jpg
40 KB, 420x401
Need help real quick with some PHP for my class /g/entoomen.

I have an array (called $food_prices) where the array keys are food names and their respective values are the prices. I assigned the array keys to a value called $foodnames and the array values to $prices. Then I made a dropdown with

<select name="foodname"></p>
<?php foreach($foodnames as $value): ?>
<option <?php if ($params->foodname == $value) echo "selected" ?>
><?php echo $value ?></option>
<?php endforeach ?>
</select>


But I need to compute the total cost of this food. How do I get the values of the food I chose?
>>
>>53699371
structs are just classes with members set to public as a default.

regular classes set their members to private.
>>
>>53699718

Put it inside the struct as a member function

bool operator<(attribute other) const { return atr < other.atr; }

it's literally the same as any other member function - the only change is that now when you call some_attribute < some_other_attribute, it calls this function

you can overload for different types, e.g.
bool operator<(char other) const { return atr < other; }
or
bool operator<(const attribute& other) const { return atr < other.atr; }
>>
>>53699604
Would that algorithm be usefull for 2D bezier curves of order n?
>>
>>53699405
you need to assign to countryOfOrigin in the constructor
>>
>>53700011
If you rasterise them to triangles

There's probably a simpler way.
>>
>>53700044
Actually it should work if you just rasterise it to straight lines, it's supposed to work with arbitrary convex shapes
>>
>>53700025
>inferior c++03 cuck
get that weak shit out of here
>>
>>53699992
When I try that it tells me that attribute does not name a type, probably because it still isn't defined inside itself.

I can overload the operator outside the structure just fine, only I have to tweak it to say bool operator<(att first, att second) {return first.atr < second.atr}
Is there a way to do the overloading inside the structure itself?
>>
>>53700132
No, that should be fine. Are you actually calling the type attribute?
Might want __attribute if you named it differently
>>
>>53697617
What are the benefits of using Ruby over Python if I'm not a webdev (muh rails)?
Python seems much saner to right in for me, has some decent libraries, and has the benefit of a larger "community," so there's more information available.
>>
>>53699091
That some Erlang?
>>
>>53700223
Correct.
>>
>>53698318
FAIL
>>
>>53700190
Here's my code
struct atribut{
char atr;
std::set<char> zatvorenje;
bool operator<(const atribut& other) { return atr < other.atr; }
};

Excuse the jibberish, I'm to lazy to translate these things right now. So this breaks, but doing this
bool operator<(const atribut& prvi, const atribut& drugi) { return prvi.atr < drugi.atr; }

is fine for some reason.
>>
>>53700132
>>53700190
ah you called the type _attribute rather than attribute, you made an instance of it called attribute
>>
>>53700272
>>53698339
I'll write unit tests next time, promise.
>>
>>53697880
You're a CS student and you don't know how to use google smfh.
>>
>>53700313
first, reference members are perfectly fine - they're basically pointers that can't be null

second, your std::set<char> will use char's operator<, I meant if you had a
std::set<attribute>
it'd call operator< on attribute

third, you can use the type in function definitions within the class, you just can't define members of the class (but you can define pointers and references, and templates of the class that don't directly hold it as a member, e.g. set/vector)
>>
>>53699906
$_POST['foodname']
>>
I have nothing to work on :|
>>
>>53700360
the only thing you really need to avoid is doing this:

struct X {
X mem;
}

or anything that would be "like that"

you CAN do this
struct X {
X& mem;
X *mem2;
}

struct X {
std::set<X> mem; // because std::set uses pointers and references
}
>>
File: honking intensifies.gif (57 KB, 205x190) Image search: [Google]
honking intensifies.gif
57 KB, 205x190
>>53697903
>if err != nil
>if err != nil
>if err != nil
>if err != nil
Just kill this fucking meme language already.
>>
>>53700429
it's the same for C, newfriend
>>
>>53700360
>>53700397
I'll keep this in mind. But still, why does placing the overloading of the operator inside the structure not work ass opposed to placing it outside? I mean I know crap all so I just copied your or that other guy's code intomy structure and it doesn't pass compilation.
>>
>>53700313
That looks fine -- what's the compiler error? The only thing I would change is marking the member function operator overload as const:
    bool operator<(const atribut& other) const { return atr < other.atr; }


But if you're going to use std::set<char> then you don't need to define operator<, since it'll use operator< for char which is already defined.
>>
>>53700313
>>53700447

Oh I see the issue
operator< has to be a const member function (for std::set) - i.e.
params ...) const { ... body

Basically, your member function is equivalent to this:
bool operator<(attribut* this, const atribut& other) { return this->atr < other.atr; }
notice how the first isn't const?
>>
>>53700429
Yes, because try-catch spam is much more flexible and elegant.
>>
Probably not the right place to be asking this. But has anyone here gone to a SUNY for a CS degree? I got into Penn State but my parents make too much to receive any financial aid. I'm considering Buffalo or Stony Brook.
>>
>>53700445
C was created in the 1970s, when people didn't know any better. Go was designed to be stupid in the 2000s.
>>
>>53700487
>when people didn't know any better
lol bud. we know DPT is beginner's general so if you have any questions, spit 'em out
>>
>>53700453
>>53700466

error: no match for ‘operator<’ (operand types are ‘const atribut’ and ‘const atribut’)
{ return __x < __y; }

And you guys were correct, it has to be a constant function. Thank you all for the help, and thank you
>>53699795
for reminding me of this thing. I think I saw this back in a data structure course.
>>
>>53700478
Exceptions and monadic composition are objectively superior to this awful hodgepodge.
>>
Im pretty new to this programming thing, can anyone nicely explain to me and my friend why you do it?
do u think the future actually needs programmers later?
have u thought about robots?

thanks in advance
im asking for my newspaper you see :)
>>
>>53700567

struct attribute {
char atr;
std::set<attribute> rest;

bool operator<(const attribute& other) const { return atr < other.atr; }
};
>>
>>53700589
GET
THE
FUCK
OUT

And we are not programmers, we are computer scientists.
>>
>>53700630
>daily programming thread
>programming
uh-oh friendo, looks like you were wrong :^)
>>
>>53700684
Doesn't makes us programmers, faggot.
>>
>>53700569
Nice opinions, m8.
>>
>>53700025
That's not true.
>>
>>53700704
>Doesn't makes me programmers, faggot.
FTFY
>>
File: ntPBqHb.jpg (481 KB, 2322x4128) Image search: [Google]
ntPBqHb.jpg
481 KB, 2322x4128
>>53700704
I dont think you shuold be using "fagot" as an insult, beacues it emplies that gay people are bad, and they get enough of that in real life, its pretty sick to get hate even on online websites
when i thought i woudl be safe from insults because of my position on sexuality.
no thanks have a good day homophobic c .uck.
>>
>>53700751

>>>/reddit/
>>>/tumblr/
>>>/github/
>>>/mozilla/
>>
>>53700743
>me programmers
This is not English.
>>
File: bebi.png (485 KB, 521x449) Image search: [Google]
bebi.png
485 KB, 521x449
>>53700773
no thanks those sights are homophobic aswell, i came here because i heard there were alot of "fagots" here aswell so i thought i woudl be in good company.
clearly i was wrongly informed about this.
>>
>>53700387

Actually I've figured out something I want to make
>>
no but really tell me a better way to do this
public void insertAdjacent(City aCity, City adjCity) {        
map.set(map.indexOf(aCity), map.get(map.indexOf(aCity))).add(adjCity);
}
>>
File: 1459022260994.jpg (116 KB, 500x400) Image search: [Google]
1459022260994.jpg
116 KB, 500x400
>>53700817
have u tried writing it in english you fucking monkey lmao that shit is inreadable

indiancodemonkey-tier
>>
>>53700782
It is still correct. Being in /dpt/ does not make you a bunch of programmers.
>>
>>53697617
that's just one interpretation, one model of quantum physics, similar how to how hasklel tards say they create universes of immutable state
>>
>>53700842
"computer scientists" is just a fedora word for programmer you c.uck
>>
>>53700799
>i came here because i heard there were alot of "fagots" here aswell so i thought i woudl be in good company.
it's just one trap fag and a few guys joking around, fuck off faggot
>>
File: kidding me.png (841 KB, 582x795) Image search: [Google]
kidding me.png
841 KB, 582x795
>>53700817
>Java
kys
>>
>>53700838
i don't get how its unreadable. it's just 1 method call with 2 parameters
>>
>>53700870
POO IN THE LOO

its completly unreadable, have u even studied programming at good universities?
>>
>>53700869
kiss who?
>>
>>53700857
Thanks for admitting to being a fedora tipper, m8.
>>
>>53700890
maybe your brain's just operating on a more simple level than true patricians like me. maybe web development's more your speed?
>>
>>53700857
lmao
>>
>>53700890
>studied programming at good universities
No such thing
>>
>>53700920
no, I understand it, im thinking of the client that will see this and go "what kind of fucking indian piece of bengali shit wrote this shitty designated code"
bruh im just lookking out for ur career, ull never make it if you cant simplify your code to the max, ask around in the industry and youll get the same answeres from any reputable and respectable programmer.
no offence bro
>>
>>53700941
>he didnt study programming at a good university
where did u go community college IT 101 lmao
never gonna make it
>>
>>53700969
I meant good colleges only have computer science courses, not programming courses.
>>
>>53700751
Don't have to be gay to be a faggot, just like you don't have to be black to be a nigger.

>muh ancestor's feelings
>>
File: what.png (894 KB, 802x576) Image search: [Google]
what.png
894 KB, 802x576
Making a very simple Slider puzzle in Java.

Even thought it works, I'm not good enough to solve it. This is as far as I can get.
>>
>>53701011
i dont live in the US so i wouldnt know sorry
come to europe, the prgoraming enviironment is much better
theres teachers that only teach JAVA for example theyre all masters and experts for one language
"learn from the best to become better than the rest"
-my html teacher
>>
I've got a parent class Foo, and a child class called Bar. I want them both to have constructors with two arguments, but when I try that, it doesn't compile. I get an error message in the Bar class: "No matching function for call to Foo::Foo()" The only way I can get it to compile is if both their constructors take no arguments.
Any help? I know this is probably a really simple problem, but I have no idea what's going on.
>>
What is the codegolf fizzbuzz for c++?
this is what I got so far:
#include<iostream>
main(){for(int i=0;i++<100;){if(i%5&&i%3)std::cout<<i;std::cout<<(i%3?"":"Fizz")<<(i%5?"":"Buzz")<<'\n';}}
>>
>>53701026
maybe try without the ANIME, u weeaboo
>>
>>53701052
It's just a placeholder image, friend. Calm down.
>>
>>53700941
>>53701011
This

>>53701029
>i dont live in the US
Me neither

>-my html teacher
Bait
>>
>>53701026
make a program to solve it
>>
>>53701050
#include <iostream>
#define d(a,b) a b
#define _(a,b) d(#b,#a)
#define b(b) _(b,b)
#define y _(i,f)c
#define x _(u,b)c
#define c b(z)
#define i int
#define p main
#define s char
#define q 810092048
#define h for
#define m 48
#define a ++
#define e ==
#define g 58
#define n 49
#define l <<
#define oe std::cout<<
#define v '\n'

int p (i, s*t ){i j = q;h (*(
i * ) t = m ; 2 [ t
]? 0 : 1 ??( t ] ? a
1 [ t ] e g ? 1 [ t
] = 48, ++0 ??( t]e g?0 ??(

t]= n ,1[ t]=
2 [ t ]
=m : 1 :
1 : a 0
[ t ??) ==g

?0[ t ] =49 ,1[
t ] = m : 1
;j= ( j / 4
) | ( ( j &
3)l 28) )oe (j&

3?j & 1?j &2?
y x : y
:x : t )
l v ; }
i f =m& ~g;
>>
>>53701099
That probably made you laugh didn't it
>>
File: njwildberger.jpg (103 KB, 335x503) Image search: [Google]
njwildberger.jpg
103 KB, 335x503
>>53701099
>>
>>53701111
checkd and kekd
>>
>>53701011
>only have computer science courses, not programming courses
This is where the CS grad meme came from. No wonder companies would rather hire Indians.
>>
>>53700943
why don't you suggest something better then
>>
If I made a std::sregex_iterator once with one bunch of arguments how do I reuse it, ie. how do I set new iterators to the start and the end of the string I'm searching?
>>
will this skip the first element? if so, how do i make it not?
public void displayFlightMap() {    
Iterator<LinkedList<City>> iterator = map.iterator();
while (iterator.hasNext()) {
System.out.println("City: " + iterator.next().get(0));
}
}

it seems to me like it will, because it's printing iterator.next()
>>
>>53701099
nice
>>
>>53701541
Call get on the current iterator and then call next afterwards?
>>
>>53701050
#include<iostream>
main(){for(int i=1;i<101;++i)std::cout<<(i%15?i%5?i%3?to_string(i):"fizz":"buzz":"fizzbuzz")<<'\n';}
>>
>>53701541
Is that next() even necessary there? will it not iterate through everything without that just fine?
>>
>>53701562
forgot <string> for to_string damnit, makes it longer
>>
>>53701576
but then it'd miss the last one
>>
File: captcha.png (837 KB, 1024x833) Image search: [Google]
captcha.png
837 KB, 1024x833
>>53701561
is that the standard way to do it? seems a little cheesy
>>
>>53699162
bump?
>>
>>53697903
>newSubsctiption
>>53699662
sounds awesome. are you the Knott anon or someone else? Also, link to GitHub?
>>
>>53699162
Sourceforge for reals
>>
>>53701692
>he doesn't use legacy captcha
>laughinggirls.jpg
>>
>>53701719
legacy captcha made me want to kill myself. i never got it right
>>
>>53701541
use new style loops
for(City city : map) { 
}
>>
>>53697820
If you want to develope web shit then

1. Learn inconsistent html which has a different behavior on different platforms... Tfw not even clean xml allowed..

2. Learn sql for your background database

3. Learn some serverside language like php or .asp shit for the api to the database

4. Learn javascript to use the serverside api

5. Optimize your shit for every fucking platform

6.???

7. Profit
>>
>apply for a job at a somewhat large company
>they send me an email back
>it lets me know what my username and password I used
>my password is in plaintext
Fucking really?
>>
>>53701541
no it won't skip the first one, that would be retarded
>>
>>53701755
If the legacy captcha made you want to kill yourself, I have no idea how you can stand the new one without a strong desire to genocide the entire human race. Now when you click on the pictures, it disappears and you have to click a new one. It's fucking bullying you! Fuck this.
>>
D belongs in the 90s. It's not relevant any more.
>>
>>53701692
iterators are deprecated anyway idiot
>>
>>53701759
    public void displayFlightMap() {    
for(LinkedList<City> city : map){
System.out.println("City: " + city.get(0));
System.out.println("Adjacent Cities: " );
for(City adjacent : city){
System.out.println(adjacent);
}
}
}

i have an arraylist of linkedlists of cities, so is this correct?
>>53702022
it only does that like once every thousand captchas for me
>>
File: Babby.jpg (53 KB, 521x521) Image search: [Google]
Babby.jpg
53 KB, 521x521
>>53701043
Anyone?
>>
>>53702057
does it compile? if so, you are correct
>>
>>53702022
they were only problematic in the first few days, you just have to be non-retarded and realize that they want you to pick 4 or 6 reasonable images of water or whatever
>>
>>53702061
Is the constructor in your parent class set to private?
>>
>>53698271
if you can sacrifice the overhead of a single goroutine (2kb), a monitor goroutine might be a nice way to solve this using channels as well
basically you localize all your state mutations to one goroutine and then send information/signals to that goroutine via multiple channels (if you don't care about order) or a single channel (you'll have to send func()s then, though).
>>
>>53702174
No, it's public.
>>
>>53702061
post the constructors
>>
>>53702358
Right now, they're both public and blank.
>>
>>53702398
post code in case it's a syntax error or something
>>
https://gist.github.com/anonymous/3ece84fe0fbd4d11c73e

I threw this together quickly because I got bored. Run it and get a daily dose of porn/hentai based on the SUBREDDITS tuple. New handlers are easy to add, but you really shouldn't -- it's just a quick hack. Code is Python 3, pip install the various libs if you really want to run it.
>>
>>53702432
I get the feeling he's doing something like.
[/code]
class foo
{
public:
foo(double g){g=1;};

};


class bar:public foo
{
bar(double m){m=1;}
};
[/code]
>>
Went to caucus today to vote for Bernie, because encryption and a few other civil liberties issues. Had a few discussions with some undecided voters, and someone suggested to use a "stack" like in the occupy groups, for everyone to weigh in their opinions, rather than having everyone just blurting shit out.

Had to keep myself from pointing out that what they keep referring to as a stack (or "progressive" stack) is actually a priority queue. A stack would more resemble everyone shouting over each other. When everyone blurts out over everyone else, you ensure that the last person to speak would be the first to finish speaking.
>>
>>53702061
Are you initializing your parent constructor?
class foo
{
public:
foo(double g){g=1;};

};


class bar:public foo
{
public:
bar(double m):foo(1){m=1;}
};
>>
>>53702548
>If I may interject for a moment
>>
>>53702061
>>53702553
Compiles for me.
class foo
{
public:
foo(double g, double h){};

};


class bar:public foo
{
public:
bar(double m, double k):foo(1,1){}

}cocks(1,1);
>>
>>53702548
Sometimes I wonder if you're not actually playing pretend and you really do have autism.
>>
>>53702548
But anon, what if the stack has a capacity and a cut off time?
>>
>>53702670
Thanks, that works. I guess it just wanted me to add the ":foo(1,1)" after the bar constructor.
>>
>>53702680

I believe I have mentioned this before, but yes, I do have a medical diagnosis for autism. Have since I was in 2nd grade.

But nonetheless, I have to wonder... whose idea was it to use the word "stack" to describe how Occupy handles people being voiced? In no way does it resemble a stack.

>>53702714

Well then, you have a bounded stack with preemption. But nonetheless, a priority queue better describes what is being used, and should clearly have been the term used, given that the majority of people know what a queue is even if they haven't taken a computer science class. If you wait in a line, you are queuing.
>>
>>53702233
I was thinking about doing just that with a select statement in an infinite for loop, but it seemed like a clumsier idea at the time. Considering how much messing with mutexes I have now, maybe should have done that after all.
>>
>>53702854
don't use an infinite for loop, that smells like a goroutine leak
use a quit signal channel that you close to broadcast a quit signal
>>
>>53702923
Eh, I mean it can be an infinite loop because that particular data structure only has one instance during runtime. Without that I was thinking something like
for {
select {
case <-closer:
return
case msg := <-receiver:
doShit(msg)
}
}

as a more general usage pattern.
>>
>>53703028
the convention is to call that channel "quit", but yeah, that's kind of the idea
channels are usually either named like collections ("messages", "timers", ...) or verbs ("close", "quit", "send", ...), not like nouns that describe a verb ("closer", "reader", "writer", "receiver", ...) (interfaces are usually named like this)
>>
File: Capture.png (330 KB, 635x403) Image search: [Google]
Capture.png
330 KB, 635x403
I was in a programming contest yesterday and I spent 4 hours ( on 5 ) trying to find a solution for this problem and all I got is wrong answer.
is there a solution for this ?
>>
if you get 2 ticks for a win during a winstreak, and a winstreak constitutes having won 3 or more matches in a row, and you get 1 tick for breaking a losing streak which constitutes having lost 3 or more matches in a row, what's the average rate of progress for someone with a 50/50 win rate?
>>
File: freebasic.gif (6 KB, 200x100) Image search: [Google]
freebasic.gif
6 KB, 200x100
Who BASIC here?
Need more basic bitches to keep things uncomplicated.
>>
Today, I'm sick of coding Java by day, so I'm studying up on Erlang to see if I can create a functional prototype of certain REST services at work. Failing that, I'll study Scala and hope that's easier to push at my work.
>>
>>53703640
Trash
>>
>>53703573
is that a dash or a minus?
>>
>>53703706
i mean after T(1<= T <= 1024) is it minus or dash
>>
>>53703720
dash / just to say that T is the number of test cases
Thread replies: 255
Thread images: 34

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

All trademarks and copyrights on this page are owned by their respective parties. Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.