What are you working on, Sup Forums?
Old thread:
What are you working on, Sup Forums?
Old thread:
Other urls found in this thread:
git.io
github.com
gameprogrammingpatterns.com
twitter.com
How so?
java
signal the other process with some form of IPC (either named pipes or stdin/stdout redirected child process)
reposting
In winapi, I have some process writing some file, and another reading and deleting that afterwards. How do I block on the consumer side until the producer is done, considering I have no control over the producer?
like I said, I have no control over the producer (or source code access) other than calling it to write the file and then killing it
I think you are confusing Morgoth with someone else. And if you were suggesting Melkor was meant to be a representation of satan, tolkien himself didn't approve of this
Any sepples coders in the house? Is there a better way to do the following?
// Forward declaration:
template
class Foo {
T fee;
public:
Foo();
void foo();
};
// Implementation:
template
Foo::Foo() {
fee = 123;
}
template
void Foo::foo() {
}
Do I really have to repeat "template" every time, or is there a way to group several methods under the same one?
PROCCESS_INFORMATION pinfo;
CreateProcess();
WaitForSingleObject(pinfo.hThread);
if the writer exits after writing
if not, you're out of luck; maybe you could try CREATE_SUSPENDED and patching its code in memory
What am I doing wrong here?
for(something)
{
if (thing == 0 && printed == 0)
{
printed = 1;
do this;
}
if (thing == 0)
{
do that;
}
}
Shouldn't I be able to write else if on second if? Yet if I do it never does "do that" only works with if if
Pretty sure you just have to do what you're doing, unless you wanna scrap the forward declaration and jam everything into the class in-line (not recommended)
Maybe there is never a condition where thing is 0 but printed isn't? If the first condition is true it'll skip else branches.
Step through it in gdb to confirm the values of thing and printed at each stage
Reminder that java and python is for cucks, there is no reason to use it over languages like C
That's what you gotta do. Since it's a template, you might as well just stuff everything inside the class.
Yep, that's why I write my web applications with C sockets.
All fast web servers are written in C, there's even one in x86 assembly which is the fastest one without fucking around with custom drivers and stuff.
That is rather unfortunate. Thanks, anyway.
>He's too much of a numale to write good C code so he relies on cuck languages like python or java
You're pathetic, you don't belong /dpt/
>Reminder that java and python is for cucks, there is no reason to use it over languages like C
Reminder that this autistic Rust shill post this sort of thing all day, every day.
It gets funnier when you also have a function template inside your class template.
What do you mean by "exits after writing"? The process should dead when calling WaitForSingleObject()?
>fast
>implying this at the top of a priority list
Rust is nothing compared to C
secure then fast then https support then fastcgi support
anything else should be actively avoided
Just finished C course. Going in to Java with focus on graphics. What can I expect?
What are some interview red flags that end the interview immediately?
Don't mention lack of skill, because HR doesn't give a shit about technical ability.
suffering
verbosity and classes. You should really learn about the latter asap if you're about to do java
doesn't keep running after it writes to the file
you can do the WaitForSingleObject between the time interval when it starts and exits
pretty sure you can call it on a terminated thread as well
>Youpoor
>only one university my region
>CS doesn't teach C++
>check local jobs from time to time
>Junior C/ C++ developer position from same company has been hanging around for almost a year
They're never going to fill that position it seems. Wounder if it's worth the effort to try to learn C++ on my own before my graduation since clearly local CS graduates don't.
im a noob and a i have a few questions for those of you who make a living coding.
1) what languages do you actually use for your job?
2) do you use windows as your dev machine?
3) is it possible to get a job without a post secondary education?
4) what are some good certifications to get?
5) how many years did it take you to get your first job from the time you started learning how do code?
>Junior C/ C++ developer position from same company has been hanging around for almost a year
how do you know they arent a shitty employer who cant retain staff?
Might be that the position is shit and thus nobody is applying for it.
You could be right. I just read further in to their post and it says that they're working with scrum and agile. I looked up scrum and it sounds really stressful.
Is scrum something that is widely used?
Have you guys switched to Terry types yet?
git.io
dunno... im the noob who posted this if the companies name is visible then search for "working at x company" and you should find some employee reviews on indeed or glassdoor.
import os, sys
def parent():
fh = open('parent.log', 'w')
while True:
print "foo bar baz foo\n"
sys.stdout.flush()
for line in sys.stdin:
fh.write("got: "+line)
fh.close()
def child():
cmd = '/usr/bin/perl'
argv = [ cmd, '-pe', 's/foo/bar/g' ];
os.execv(cmd, argv)
stdin = sys.stdin.fileno()
stdout = sys.stdout.fileno()
parent_in, child_out = os.pipe()
child_in, parent_out = os.pipe()
pid = os.fork()
if pid:
# parent process
os.close(child_in)
os.close(child_out)
os.dup2(parent_in, stdin)
os.dup2(parent_out, stdout)
parent()
else:
# child process
os.close(parent_in)
os.close(parent_out)
os.dup2(child_in, stdin)
os.dup2(child_out, stdout)
child()
Im the user from earlier trying to do bidirectional IPC in a python script with some program (here perl for example)
can someone explain to me why parent.log doesnt contain the line "got: bar bar baz bar"? (the file is completely empty and the script has to be stopped via ctrl+c)
I feel like Im missing something obvious here.
Does anyone recognize the language?
python
ty user
template
U apply(function f, T t) {
return f(t);
}
int main() {
auto f = [](int d) { return d * 2; };
int x = apply(f, 10);
return 0;
}
>main.cpp: In function 'int main()':
>main.cpp:89:22: error: no matching function for call to 'apply(main()::&, int)'
>int x = apply(f, 10);
> ^
>main.cpp:75:3: note: candidate: template U apply(std::function, T)
>U apply(function f, T t) {
>^~~~~
>main.cpp:75:3: note: template argument deduction/substitution failed:
>main.cpp:89:22: note: 'main()::' is not derived from 'std::function'
>int x = apply(f, 10);
> ^
>
>
>the absolute fucking state of sepples
yes
>run program
>it works on the first try
Fucking neat.
Simplifying: Vx.(]y.(Vz.(P(x, y, z))))
Skolemizing: Vx.(]y.(Vz.(P(x, y, z))))
Skolemizing: ]y.(Vz.(P(x, y, z)))
Assigning: ]y.(Vz.(P(x, y, z))) with unbound variables: x
Assigning: Vz.(P(x, y, z)) with unbound variables: x
Assigning: P(x, y, z) with unbound variables: x
Skolemizing: P(x, f(x), z)
Simplifying: P(x, f(x), z)
This isn't even my final form: P(x, f(x), z)
#include
template
U apply(std::function f, T t) {
return f(t);
}
int main() {
std::function f = [](int d) { return d * 2; };
int x = apply(f, 10);
return 0;
}
here, no need to thank me
How do you get tokens from a std::string like you'd do with fstream streams?
i.e.
int num1, num2;
myString >> num1 >> num2;
>(]
the fuck are you doing
>opening parenthesis before formula
>] symbol for "Exists" because lolmao UTF8 characters in Powershell
template
U apply(function f, T t) {
return f(t);
}
int main() {
int x = apply([](int d) { return d * 2; }, 10); // Error. Sepples can't do basic type inference
int y = apply((std::function)([](int d) { return d * 2; }), 10); // Gotta do this
int z = apply([](int d) { return d * 2; }, 10); // Or this
return 0;
}
>the
>absolute
>state
>of sepples
Can't you pass lambdas just fine if you do this?
template
U apply(U(*f)(T), T t) {}{
#include
template
decltype(auto) apply(const F &f, T t) {
return f(t);
}
int main() {
int x = apply([](int d) { return d * 2; }, 10); // Error. Sepples can't do basic type inference
int y = apply((std::function)([](int d) { return d * 2; }), 10); // Gotta do this
int z = apply/**/([](int d) { return d * 2; }, 10); // Or this
return 0;
}
are you happy now you little nigger
>are you happy now
No, because this "fix" doesn't work in my actual code, where the U you removed is important.
typedef decltype(f(t)) U;
Only if they hold no state.
template
class Foo {
public:
template
Bar map(function f) {
return Bar(this, f);
}
};
This is more representative of what actually happens in my code. Now what? The 'map' method fails to deduce its arguments just like the useless apply example. Can't fuck with the U here.
>using std::function
Without having tried it I would say something like this would work.
template
class Foo {
public:
template
Bar map(const F &f) {
return {this, f};
}
};
Why is every single open sourced engine out there retarded with singletons like this OS::get_singleton()->get_video_mode().
why can't you use decltype(auto) again?
Because most of the time, there is little "original" thought out code written for a specific purpose towards a specific goal and the rest is copy pasted "recipes" glued together
It's possible and it would be certainly cleaner, that would be a good idea.
github.com
Really makes you think.
See gameprogrammingpatterns.com
and extend it to the whole design patterns phenomenon
Guys I have to use Inform 7 for a school project. How do I work around the fact that Inform 7 is bad?
oh my
post shit about it in /dpt/
Is it difficult to move within the field of programming?
Like what would you say about the chances for someone with experience from web development to get a math degree, learn Python and go into fintech?
Did you actually read the code? You are fucking with the U again. You cannot fuck with the U because it's used to construct the Bar.
web devs cant into math. better to just accept it than waste precious time and money on something you're destined to fail
sorry to say
>fintech
>python
other than programming games fintech is like THE field that uses c++
Actually, maybe I'm wrong. I don't understand what goes on there at all. What is this curly brace shit? Does it create my Bar?
What if the web development was just chosen because the easiest opportunity to start programming happened to be with that?
I built it and here you have 2 forms which work. One of which uses the method I wrote and decltype(auto) with the other.
The curly-brace shit is an initializer list, which in place of a return expression it instanciates the return type without having to specify it.
#if 0
template
class Foo {
public:
template
Bar
map(const F &f) {
return {this, f};
}
};
#endif
template
class Foo {
public:
template
decltype(auto) map(const F &f) {
typedef decltype((f(std::declval()))) U;
return Bar(this, f);
}
};
struct Foo
{
Foo(const Foo &other) = delete;
Foo(const Foo &&other) = delete;
Foo &operator(const Foo &other) = delete;
Foo &operator(const Foo &&other) = delete;
};
or
struct Foo
{
Foo(Foo &other) = delete;
Foo(Foo &&other) = delete;
Foo &operator(Foo &other) = delete;
Foo &operator(Foo &&other) = delete;
};
Why does anyone even use singletons that way?
A function-static object is so much cleaner.
// OS.h
class OS_t {
// ...
private:
OS_t(/* ... */);
friend OS_t &OS();
};
OS_t &OS();
// OS.cpp
OS_t &OS() {
static OS_t os(/* ... */);
return os;
}
// main.cpp
#include "OS.h"
int main() {
// ...
OS()->do_thing(/* ... */);
// ...
return 0;
}
neither
struct Foo
{
Foo(const Foo &other) = delete;
Foo(Foo &&other) = delete;
Foo &operator=(const Foo &other) = delete;
Foo &operator=(Foo &&other) = delete;
};
Python was just for an example, it could be any of the common languages in fintech.
Both are pretty fucking ugly, but I guess that's not your fault that the sane way doesn't work. Thanks, user. I hate C++.
So essentially const for copy and non-const for move?
what if you need initialization in the dynamic environment?
Function-static objects may generate an implicit mutex, and that's why I don't like them. Some of my programming is realtime and I don't want these things in my RT code paths.
Yes it's these exact signatures and you have to make sure to get them right.
Why would you even want an OS class in the first place. Have different source code files for each platform with the same interface.
What will happen if I don't? I have some code that has used const for the move ones and the compiler never complained but I haven't really tried to use move semantics on the class either, would it mibehave or what?
These are the signatures for the automatically generated copy and move constructors. If you define customs ones they do not get generated to begin with so there's no need to delete them.
Right?
Then it's very possible your "moves" will reveal to be in fact copies, so I suggest you check.
That's right but depending on cases it's better to be explicit than depend on the complicated rules of the C++ language.
If OO is so good, why doesn't haskell have it by default?
Alright thanks.
Holy shit, qutebrowser 1.0.1 is out.
>If OO is so good
The only people who still believe that invariably come from India.
Unless you want to get shit done in 1/5th of the time by using Python
Because the general perception of OO is tainted by the inadequacy its misimplementations.
Also Haskell, Ocaml and many FP languages are built on a closed world philosophy whereas on the contrary OOP usually works in open class hierarchies. In the closed-world there is a more limited need for the OO style dynamic dispatch, on the other hand OOP offers the greater freedom.
For an example of good OOP design, see CLOS, and read Gregor Kiczales's AMOP.
>OOP offers the greater freedom.
What freedom does OOP offer, exactly? What can you do using OOP that can't be done better otherwise?
Because OOP is an open world, which means one can plug new classes into an existing hierarchy. Think of Java's dynamic classloader, or at the lower level C's dlopen. These classes can redefine methods and introduce new behavior in the existing code without editing it.
It's a question of greater freedom like I have said. The disadvantage is that it does not allow to reason on the program ahead of time in a global fashion.
>red flags
Browsing Sup Forums
OCaml has objects precisely for when you don't have a "closed-world"
Also you can get dynamic dispatch in Haskell, it's just a little more verbose than static dispatch/unions in Haskell
For all this talk of Haskell there's precious little code of it posted here
>If OO is so good
It's doesn't matter if it's good or bad. OO was invented to separate expensive designers from cheap code monkeys and to make outsourcing possible. It doesn't have to be good.
wtf i'm unsure what to think of oo now
Can you provide a concrete example of something that can't be done (at least not easily) by means other than OOP?