[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: 315
Thread images: 32

File: prog.jpg (105KB, 473x496px) Image search: [Google]
prog.jpg
105KB, 473x496px
What are you working on, /g/?
old thread: >>61564958
>>
>>61573303
Why's she so angry?
>>
>>61573320
>she
>>
>>61573333
fuck off faggot
>>
>>61573333
Fucking kill yourself, trapfag.
It is a girl.
>>
struct option {
constexpr option(int value, const char* name);
};

struct field {
constexpr field(int offset, int size, const char* name);
constexpr field(int offset, int size, const char* name, option options[]);//????
};

static const field dataFields[] = {
field(0x000, 4, "Field 1"),
field(0x004, 5, "Field 2"),
field(0x009, 8, "Field 3"),
//fuck ton more of these^
field(0x166, 13, "Field 48", {
option(0,"A"),
option(1,"B"),
option(2,"C")
}),
field(0x173, 3, "Field 49"),
field(0x176, 9, "Field 50"),
//and so on
};

I want to declare/define a constexpr array of arbitrary size with static storage duration in the middle of an expression in C++.
Hardmode: not a character array.

wat do
>>
File: TrapfagsBTFO.jpg (806KB, 1280x1831px) Image search: [Google]
TrapfagsBTFO.jpg
806KB, 1280x1831px
>>61573333
>>
>>61573440
I'm not exactly sure what your problem is, are you having trouble accepting an array of option with it's size known at compile time?
I think this should do it:
template <size_t N>
constexpr field(int offset, int size, const char* name, option options[N]);
>>
>>61573557
>He thinks array parameters are actually arrays
lmao, try std::array maybe
>>
>>61573320
She misses /prog/
>>
Posix socket or SDL_net for cross platform net stuff for application already using SDL?
>>
>>61573557
well I suppose I wasn't too clear with my example, but the actual problem is how do I store said array with a constexpr function?
if I try to add it to a container, it wont be constexpr
if I template the class, it wont fit in an array anymore
if I just try to store a pointer to the array, it will become a dangling pointer before I even enter main() because the array is a temporary by C++ rules

I'm stuck on this and it really bugs me because I feel like it should be possible because it is possible but only with string literals
>>
>>61573440
How about:
#include <array>
#include <cstdio>

struct option {
constexpr option(int value, const char* name) {}
};

template <std::size_t N>
struct field {
constexpr field(int, int, const char *, std::array<option, N> options)
: options{options}
{
}

std::array<option, N> options;
};

auto test = field<2>{5, 5, "", {
option{0, "A"},
option{1, "B"},
}};
>>
>>61573634
see in >>61573627 where I mention the class template
>>
why does dbus even exist
>>
>>61573569
>He doesn't know that you can accept C style arrays using template parameters with the size known at compile time.

>>61573557
Woops, I think it should actually be a reference for it to work:
template <size_t N>
constexpr field(int offset, int size, const char* name, option (&options)[N]);

(the parentheses are important)

>>61573627
>but the actual problem is how do I store said array with a constexpr function?
You mean, after you've passed the array into the fields constructor, you want to then store it somewhere with statically known size and contents?
That depends on how and where you want to store it, but you might not be able to.
You'd need to give more detail.
>>
File: 1418081126229.gif (3MB, 1280x720px) Image search: [Google]
1418081126229.gif
3MB, 1280x720px
>>61573303
Thank you for making a mudslime free /dpt/
>>
>>61573682
It's idea is nice, but it's completely trash in implementation.
>>
>>61573749
I know the "where" can't be in the object I'm creating because I would have no way to create an array of differently sized objects, and I know it can't be some dynamic storage because that isn't possible to do constexpr.
It would need to have static storage duration like that of a static variable or a string literal.
I can't just declare a static variable in the middle of an expression, so ideally I could just write it as an object literal and have it go to the same place string literals get shoved into.

The "how" is the part I'm trying to figure out

For more context, this is my attempt to work around the issue:
template<typename T> struct Arr{
T *data; uint32_t size;
constexpr Arr(T*p,uint32_t s): data(p), size(s){}
};

template <unsigned long n> struct inttag{};
template <unsigned long n, typename T1, typename ...Ts>
constexpr Arr<T1> makeStaticArray(inttag<n> tag, T1 first, Ts... v){
static std::array<T1,1+sizeof...(Ts)> staticArray = { first, v...};
return Arr<T1>((T1*)&staticArray,(uint32_t)staticArray.size());
}
#define OPS(...) (makeStaticArray(inttag<__LINE__>(), __VA_ARGS__))

The idea was that each template instantiation would create it's own "staticArray" which I could store a pointer to, with the __LINE__ ensuring that each of them were unique. Which would have worked except static variables aren't allowed in constexpr functions.
>>
Anyone know where I can look to read up on how to learn Modern C++? I'll even take slightly-better-than-shit youtube tutorials.
>>
>>61573946
do you know C++ already and want to know how to write modern C++?
>>
>>61573946
If you dont know any C++ just read Bjarne's book and after that Scott Meyers' Effective Modern C++. And practice for a year after that.
>>
>>61573967
I have a vague idea of contemporary C++, I just feel like I should probably focus on modern C++ since that's the fucking push these days, anyway.

I'm not a complete beginner in programming, so something that moves a bit faster would be fine.
>>
>>61573992
OK do what this anon says >>61573987
I don't know which book anon means by "Bjarne's book" but A Tour of C++ will cover everything you need to know in breadth rather than depth
>>
>>61573987
>Just read Bjarne's book
Which one?
The C++ Programming Language
Programming: Principles and Practices in C++
A Tour of C++
???
>>
>>61574050
If you already know how to program and already have a little bit of experience with C++ then A Tour of C++ will be fine..
>>
>>61574084
ego-death.
Go sell everything and find a buddhist mission that will take you.
>>
>>61573936
I just came up with this idea:
#include <iostream>

// Each unique instantiation creates a new static variable. Multiple uses of the same instantiation (eg foo<2> = 7; x = foo<2>) uses the
// same static variable, so this works, which is honestly pretty cool in my opinion.
// Substitute int for whatever type you want.
template <size_t index>
static int foo;

int main() {
foo<0> = 1;
foo<4> = 67;
std::cout << foo<0> << '\n'; // 1
std::cout << foo<1> << '\n'; // 0
std::cout << foo<4> << '\n'; // 67
}


Could this be of any use to you for solving your problem?
>>
File: 1437497521042.jpg (60KB, 1280x720px) Image search: [Google]
1437497521042.jpg
60KB, 1280x720px
Employed Haskell programmer reporting in
>>
>>61574144
Making a variable static in the global namespace means it can't be seen outside of this compilation unit, right?
>>
>>61574159
Correct.
>>
>>61574148
the (You) you wanted
>>
File: 1471563488413.gif (2MB, 318x239px) Image search: [Google]
1471563488413.gif
2MB, 318x239px
>>61574144
I had no idea this was possible.
Thank you for enlightening me, Anon.
>>
Damn I've been seeing a lot more C++ in these threads in the past few days.
>>
im searching for a picture with a collection of different projects i saw here a while ago. anyone has it?
>>
>>61574240
Its just a few people asking lots of questions which is good.

/dpt/ is comfy when its q&a
>>
>>61574301
sticky disagree
>>
>>61574362
Why?
>>
File: 1436237855675.png (378KB, 1450x1080px) Image search: [Google]
1436237855675.png
378KB, 1450x1080px
>>61574255
Search for g programming challenges. There are tons of these
>>
>>61574240
Newfag C++ is pretty good.
>>
>>61573303
How did you guys or gals get started in programming? I'm going to start school on repairing computers, and 'm thinking about learning programming as well.
>>
>>61574522
My uncle gave me a book about Pascal instead of sexually abusing me.
>>
>>61574522
Garry's Mod game modes. Wouldn't recommend it.
>>
Is it a bad idea to add a comment above every function (no matter how small or big) explaining what it does and a high-level view of how it does that?
>>
>>61574522
Avid Python.
Try: Rust,Nim,D, and any other modern language and pick the one you hate the least.

>>61574564
//adding function to return two numbers
int add (int x, int y)
{
//returns the product
return x + y;
}

Yes, its obnoxious.
>>
>>61574564
Doc comments are a wonderful thing
>>
>>61574362
It's better than pointless language wars.
>>
>>61574600
>Try: Rust,Nim,D
If he's a beginner he should try learning a language with resources outside of this thread and (in the case of Rust) a bunch of screeching trannies.
>>
>>61574522
I wrote an mIRC bot sometime in the early 2000s which really kickstarted my whole interest in programming.
>>
>>61574522
>gals(guys)
ftfy

I dabbled in it in highschool outside of class, but actually learned in college
>>
>>61574616
Agreed
>>
>>61574600
>Solid advice for a newfag:
>Avoid Python
>Try Rust, Nim, D
This is too much. Hooly fuck, it's just too fucking much, /dpt/. Damn, I am triggered, fuuuuck
>>
>>61574600
Not like that, but like this:
/* ---------------------------------------
* add(x, y)
* ---------------------------------------
* adds `x` and `y`
* ---------------------------------------
* @return {int}
* the sum of `x` and `y`
*/
int add(int x, int y) {
return x + y;
}
>>
>>61574600
Ironically, that's what my college insists your comments be like. To the point you get points off your homework assignments if you don't comment the living shit out of your code
>>
>>61574633
Well I can speak for D as having an excellent book which i personally learned from. The docs are mostly there, but a few broken links because no one person has the active job.
>>61574652
explain.
Python teaches bad habits.
>>61574660
I hate that even more.
Learn to self-document your code. Thats only necessary if youre making a library.
>>61574666
awful
>>
>>61574397
Roll
>>
>>61574522
high school:
>Tried C for robotics, balked when I had to install some Bloodshed bullshit.
>Tried out Ubuntu, Puppy Linux. Ubuntu wasn't working with my network card so it was a lot of playing around with the control panel, same way I got used to Windows as a little kid
>Learned regex for OCR, used libreoffice writer to do all the editing
>Never really got around to programming because it seemed mostly useless when you can Google programs that already do it for you (I still think this)

college:
>Did the exercises in http://interactivepython.org/runestone/static/thinkcspy/Functions/thinkcspyExercises.html and actually got the hang of it
>made a newton's method PDE solver in MATLAB, learned OOP in MATLAB, got the hang of adding semicolons everywhere
>my first Java class, standard CS curriculum from there
>>
>>61574148
>can i dick your gf
>>
>>61574666
>that's what my college insists your comments be like.
Because they don't know how to do software development. So take everything they say with a truckload of salt.
>>
>>61574686
why the fuck can't CS majors at my school indent
I don't give a flying fuck about comments, where you declare your variables, or your properVerboseVariableNomenclature, just fucking indent so I can follow the flow of logic when I try to help you
>>
Okay I have written my C game engine.
What statically typed and memory managed language should I use with it? The engine can be used just as shared library.
>>
>>61574771
C++ with a garbage collector library.
>>
>>61574821
>take a language whos use-case is because of """"improved""" MMM
>add a GC to it
sasuga
>>
>>61574821
How does that even perform? I can't imagine it'll perform very well, it seems more complicated to determine if an object is unreachable in sepples.
>>
>>61574821
baka desu senpai
>>
File: 1497612901222.jpg (64KB, 600x600px) Image search: [Google]
1497612901222.jpg
64KB, 600x600px
>>61573634
>>61573936
>>61574144
template <typename ...Ts>
constexpr uint32_t count(Ts...){
return (uint32_t)sizeof...(Ts);
}

template<size_t size, size_t line>
std::array<option,size> static_options; //error: C2280: 'std::array<option,13>::array(void)': attempting to reference a deleted function
#define OPS(...) Arr<option>((option*)&(static_options<count(__VA_ARGS__),__LINE__> = std::array<option,count(__VA_ARGS__)>{__VA_ARGS__}),count(__VA_ARGS__))


alternatively,
template<size_t size, size_t line>
std::array<option,size> static_options = {0};
#define OPS(...) Arr<option>((option*)&(static_options<count(__VA_ARGS__),__LINE__> = std::array<option,count(__VA_ARGS__)>{__VA_ARGS__}),count(__VA_ARGS__))
//"error: C2440: 'initializing': cannot convert from 'initializer list' to 'std::array<option,N>'" x30, with N=whatever
>>
>>61574666
>Had a new TA for one my programming classes
>some guy(girl)
>During an exercise, one of the guys in class raises his hand for help to get his program running
>verbally screams out "WHAT THE FUCK, WHERE'S YOUR COMMENTS? HOW THE FUCK AM I SUPPOSED TO HELP YOU?"
>For the rest of the semester, no one asks the bitch for help even though she'll sometimes walk around the class room going "Does no one seriously need help?

Is it that easy to get a TA position? Dye your hair blue and your good?
>>
File: 1427240527991.jpg (98KB, 970x617px) Image search: [Google]
1427240527991.jpg
98KB, 970x617px
I really need to look for a new job

>work for an IT consulting firm
>"anon, you will be the product owner for this project"
>you know that I will start my masters in a few weeks and don't have the time
>"whatever, just believe in yourself"
>>
>>61574888
>
#define OPS(...) Arr<option>((option*)&(static_options<count(__VA_ARGS__),__LINE__> = std::array<option,count(__VA_ARGS__)>{__VA_ARGS__}),count(__VA_ARGS__)

good lord sepples
>>
Anyone has a good guide on how to use perf to do c++ profiling?
As of now i fail at obtaining what i could easily obtain by just using profile in netbeans when programming in java, for example.
>>
File: 1497851687044.gif (47KB, 250x194px) Image search: [Google]
1497851687044.gif
47KB, 250x194px
>>61574699
Have fun
>>
>>61574935
That's mostly just the macro being ugly, which is equally as possible in C
I could do more to clean it up but I'm just trying to get shit to work at the moment
>>
I want to kill the fucking idiot who thaught me to see pointers are a way to allocate memory.
>>
>>61574986
you should understand pointers before you learn malloc
>>
>>61574970
Is that just to define Variadic args?
I cold have sworn that was already a thing.
>>
>>61574993
I still don't understand pointers.

All I fucking get is a pointer is a data type "pointing" to a memory direction, and should return the same data type when dereferencing.
>>
>>61575025
That's it, yeah.
>>
>tfw the web stack is insane
I just want to target RHEL 7 as a static target, but there's no web framework I can get the full security updates until 2024 because it's not packaged.
What is a man to do? Write a CGI clusterfuck in C?
>>
>>61575025
You just explained pointers. Whats there to not understand?
>>
>>61574995
Read the reply chain for more information
>>
>>61575025
You cant work with arrays without working with pointers.
>>
>>61575040
Go + Revel framework
(Go executables are always static)

or

Scala + Play framework
= self-contained WAR archives that run on standard J2EE servers
>>
>>61575025
I've had this same problem before too, I knew what the definition of a pointer was but I didn't understand it 100%. But after learning assembly and debugging some binaries I now understand pointers.
>>
>>61575107
That's kind of a C meme, which is true in C and C++ but not anywhere else. There's nothing about arrays that needs working with pointers more than anything else in memory needs working with pointers. In some languages you can pass arrays by value.
>>
is it worth it to learn swift?
i'm already on a memeBook so i figured why not
>>
>>61575173
Oh, yeah, Java exists. I guess I'll go with Java. Thanks for the insight!

I'll pass on Go (interface{} is a meme) and Scala (Can we stop omitting the type of variables? It's kind of important)
>>
>>61575217
Learning new languages is almost always worth it, even if you don't use them afterwards

Good concepts can be carried over to other languages
Bad concepts can be remembered as a warning sign and to fine-tune your language filter

I worked full-time with PHP for 3 years and it taught me a lot on how to recognize bad programming languages and idioms. So it wasn't really wasted time.
>>
>>61575238
Java is underrated for web development,
and gets a bad rep from old-fashioned libraries like Hibernate and Spring that are terribly enterprise-y.

I worked on a J2EE app built on Jetty & Flyway and it wasn't painful at all.
>>
>>61575252
I never regreted learning Pascal, even when disbeliever would drive me away from it.
>>
>>61575252
k thanks

i think swift has some nice features stolen from functional programming languages so it might be fun
>>
>>61575300
I wrote Java for two years [spoiler]for an IRC network[/spoiler]. I'd probably feel more at home than with Scala even after all these years. I'll look into these, thanks.
>>
>>61575376
I've programed in Java and Scala and Java is pretty comfy whereas Scala feels C++esque in its devotion to throwing in everything but the kitchen sink.
>>
Is IntelliJ still the way to go or did people hop back to Eclipse or NetBeans?
>>
>>61575431
>NetBeans
I don't think anyone has shilled that in years.

IntelliJ seems to be everyone's new favorite lately, though.
>>
>>61574397
39 with synthwave music would be awesome.
>>
>>61575173
Java + Spring Boot
>>
>>61571898
>heartbleed was caused by something like that
No that was a buffer overflow. Not related to using contiguous memory.
And regardless. If you use a half decent allocator you won't find that it allocates each allocation on a completely different page for no reason.
>>
>>61575189
It's always true. Arrays are always pointers under the hood, in all languages, on all architectures. High level languages hide low level details to make programming easier, but they're still there if you pry open the hood and use a genuine low-level language.
>>
>>61574895
Why would anyone competent wanna be a TA? Have you not seen your classmates?
>>
>>61574895
Transgenders and such are a protected species. They're reverse-discriminated.
>>
>>61574686
self documenting code is a meme. dont go overboard, but please comment to show why you wrote your code in the way you did?
you know that picture where its girls vs guys who kode and the girl has a comment like "return 5 because I'm so random XD"? those are the comments you need - they explain to the maintainer why you did something.
>>
>>61575107
>>61575044

In Delphi (I started with Delphi to learn programming).
We pass a variable by reference by using adding "var" before adding the actual reference to what would be the void function.

In C, you have to call it as a pointer, which I didn't know, because I was thaught that "you add * to the data type to pass it by reference", just as if it was like adding "var" sign but I wasn't thaught what it actually meant in C to create a data type like int *x.

Now I'm not sure I actually understand.
>>
>>61574895
dressing up like a woman and doing the bare minimum to present as female is living life on easy mode, at least if you're in california
if you don't believe me, try it by sending your resume out to multiple firms and then send it again using a girl's name and see how many phone calls you get
>>
>>61575806
>please comment to show why you wrote your code in the way you did
This. Some people make some fucking weird design decisions and you only find out when you're chewed out on the mailing list.
>>
         for(int i = 0, n = strlen(plainText); i < n; i++){

//Get key 0-Indexed.
if(isupper(key[i])){
ki = (key[i] - 65) % keyLen;
}else{
ki = (key[i] - 97) % keyLen;
}
printf("K(i) = %i\n", ki);


Why do i get the result "1,0,2,4,3" instead of "1,0,2,14,13" when using the key "bacon"?
The first 3 ints are correct but the last two are ten lower then they should be.
>>
>>61575806
I dont do any weird shit.
My code is perfectly readable.
>>
>>61575821
If you could actually prove they wouldn't hire you until you put a female name on your resume, couldn't you do some sort of legal action?
>>
>>61575853
its not.
>>
>>61575740
They're alright, guys.

Other than 30% of them being turbonerds, 50% of them being lazy "aym gunna be a gaym devlopper!!" and the other 20% pretending their normals.

I've been surrounded by worse.
>>
>>61575897
Give me an example of something to write you think cant be self-documenting.
>>
>>61575908
any program over 100 lines
>>
So is Java a good recommendation for someone with programming background wanting to venture into webdev? What about frontend tho
>>
I am curious to hear your opinion about this method of software developing Rare is trying

https://www.rare.co.uk/news/tech-blog-continuous-delivery-part1

Basically, moving from an old development model where it was given importance over the features implemented and bugs were always postponed.
They argue that
>this way of working is not sustainable if you need to come back to the codebase and make further modifications to maintain it.

Thus they
>Continuously tackling technical debt and improving code maintainability. At early stages of development we might want to intentionally accumulate technical debt to run an experiment and learn. As soon as the experiment is successful or we accumulate too much technical debt, we start to pay the accumulated technical debt. Otherwise after a while making changes will be very difficult, slow and error-prone, resulting in developers being hesitant to make changes.

Sounds interesting. Also I am surprised they get this much leeway considering they have a publisher.
>>
>>61576036
why not javascript or something?
>>
>>61576036
>Is Java a good recommendation for webdev
About as good as any other for backend programming, I guess.

Frontend will always be Javascript with HTML+CSS
>>
>>61576041
does it matter?
Rare hasn't done anything unique or fun since they were bought out by microsoft
>>
>>61576036
Java for backend is ok, but I still prefer Ruby or Python because of the Rails and Django frameworks making life much easier.
>>
I've been working a bit on a cryptocurrency, too bad some guy on /biz/ keeps making shitty threads that don't even really have anything to do with the coin.
He's a total autist about it too, and always links to his discord(nonfree, evil), which is nothing but retarded shitposters.
>>
>>61574888
struct option{
const char* name;
uint32_t value;
constexpr option(uint32_t v, const char *n = nullptr): name(n), value(v){}
constexpr option(): name(nullptr), value(0){}
};

template<size_t N>
struct optionArr{
option data[N];
constexpr size_t size() const{ return N; }
constexpr optionArr(): data{0}{}
template<typename ...Ts> constexpr optionArr(Ts ...args): data{args...}{}
};

template <typename ...Ts>
constexpr uint32_t count(Ts...){
return (uint32_t)sizeof...(Ts);
}

template<size_t size, size_t line>
optionArr<size> static_options;
#define OPS(...) OPS1(count(__VA_ARGS__),__VA_ARGS__)
#define OPS1(N,...) &(static_options<N,__LINE__> = optionArr<N>(__VA_ARGS__))


Phew, no errors.
Hopefully this is actually doing what I want it to and not secretly fucking me over.
>>
File: kid from scooby doo.gif (371KB, 500x375px) Image search: [Google]
kid from scooby doo.gif
371KB, 500x375px
Anyone have a project they want help with?

t. bored educated professional developer
>>
>>61576068
Well beside the fact that Sea of Thieves looks quite the interesting thing, but I was speaking in terms of just development, software, regardless of who is making what, these concepts can be applied to any other game developer and software in general.
>>
>>61576041
>Program some things in and then after programming some things in, go back and clean up what you've written

Seems like the right way to go. Might be a pain in the ass when they're told to scrap everything to start from scratch again, though. But I'm pretty sure that's the norm of the industry anyways.
>>
>>61576109
Go help the developer at PCSX2, somebody need to improve that mess.
>>
>>61576109
I'm trying to figure out some CUDA stuff in ccminer's source, can you help?
>>
>>61576109
How to properly construct a codebase to create a bullshit mario clone.

I started the project in an attempt to get more used to designing the layout of my code before implementing and using "proper design patterns," but I feel like I didn't plan out well enough and constantly wonder about implementing certain objects.

Thinking about scrapping it and starting over.
>>
>>61576041
The fuck is rare even up to these days? Do they just help random branches at Microsoft with shit?
>>
File: Recruitment Work.jpg (249KB, 1024x672px) Image search: [Google]
Recruitment Work.jpg
249KB, 1024x672px
>>61576109
Vaguely describe last 3 projects you worked on
>>
>>61576080
>nothing but retarded shitposters.
95% of /biz/
>>
>>61576213
They are making a new IP called Sea of Thieves, pirate life, but with friends too, is not an MMORPG though and that's a positive. They seem to enjoy a certain freedom now.
>>
>>61576036
The original RHEL7 fag here. I'm going with Java because I need to be able to fucking work with what the OS gives me to be a minimal pain in the ass (no, seriously, gem and virtualenv+pip aren't in the repos, you have to go full EPEL and shit, then the deps become a moving part again and soon everything hates you for being chained to Python 2.7 until 2024, like Django dropping your ass in 2020).
It's not really how you do webdev these days. It's all about node.js, Django or Rails on the backend. Frontend is the usual JS+HTML+CSS clusterfuck ballooning your page size to unreasonable extents with frameworks upon frameworks. Oh and good luck trying to support all these shitty browsers.

t. someone who had to actually support IE6 in 2013
>>
>>61576214
I made 3 things that did things
>>
>>61576256
Oh yeah, I forgot that was them.

I hope it's more fun than what their E3 video showed.
>>
>>61576188
>designing the layout of my code before implementing
You're learning a few of the flaws of waterfall development in real time anon.
>>
Dynamic typing is immoral.
>>
>>61576223
I don't disagree.
>>
File: She's just landed her dream job!.jpg (202KB, 1024x698px) Image search: [Google]
She's just landed her dream job!.jpg
202KB, 1024x698px
>>61576306
Welcome aboard!
>>
>>61576036
The thing that bothers me about frontend every time I try to look into it, apart from it being quite a mess, is that it feels more like "document layouting" than programming. I guess, frontend frameworks kinda help with that?

Need to look closely desu, there are at least a few side projects with money in them around me but I need some webshit skills to do them
>>
epic.
>>
>>61576494
Hello mac user
>>
>>61576494
much better
>>
>>61576539
Features come at a cost you double nigger.
>>
>>61576041
It works with paper folding. It works with drawing. It works for all the programs I write. It's a little too obvious, not enough business memeing to keep all the higher-ups employed.
>>
>>61576557
>muh program sending each key press to the botnet is feature
>>
>>61576601
>Free backup of information
>>
>>61576539
You are like a little baby.

COMMAND                        SZ   RSS
vim 44429 16956

COMMAND SZ RSS
ed 2000 732
>>
>>61576613
>you can't get the data back
>>
>>61576650
certainly the medium is better than the extreme
>>
>>61576714
The medium is somewhere around QtCreator or KDevelop now.
>>
>>61576557
indexing is a feature now?
>>
>not using a browser based terminal
https://hyper.is/
>>
>>61576727
for you
>>
>>61576817
The silliest shit
>>
File: akari uuugh.jpg (157KB, 1920x1080px) Image search: [Google]
akari uuugh.jpg
157KB, 1920x1080px
>>61576817
>click debian 64-bit package
>1.1mb
>7.1mb
>21.1mb
>37.4mb
>This type of file can harm your computer!
>>
>someone develops a decent injection library for Android
>library becomes so popular that Google adopts it and takes over development
>Google releases a new version that can't do base class injections
>meanwhile, original library is discontinued and development is halted
>people now have to come up with weird and eerie ways to do base class injections using the new library, usually using Reflection
>which is what the original library was doing in the first place
T-Thanks Google
Y-You sure solved that problem
>>
File: Lynx-wikipedia.png (16KB, 1100x799px) Image search: [Google]
Lynx-wikipedia.png
16KB, 1100x799px
>>61576817
Can't say what's more cringeworthy, a browser-based terminal or a terminal-based browser.
>>
File: come on boy.jpg (35KB, 355x369px) Image search: [Google]
come on boy.jpg
35KB, 355x369px
>>61576918
now you just need to run your terminal-based web browser in your browser-based terminal and you will have come full circle
>>
>>61576893
you talking about guice? I like dagger more.
>>
>>61573303
Finally doing this shit.
>>
>>61576942
the browser based terminal just renders the webpage natively
>>
>>61576950
Dagger2
If the injection method accepts a base class and you supply a subclass, only the members of the base class will be the injected
>>
File: bush-head-scratch[1].jpg (18KB, 410x329px) Image search: [Google]
bush-head-scratch[1].jpg
18KB, 410x329px
I have an indefinitely long list of identical tasks.

Tasks are taken from the list (in order) and added to a bucket which can contain 50 such tasks.

The tasks are taken from the bucket, to be completed, by different threads. Each task may take a different amount of possibly-overlapping time to complete.

As a task is taken from the bucket by a "consumer" thread, a new task is added by the producer until all tasks are removed from the initial list.

If my overall process is interrupted half-way through, how can I till where I "got up to"?
>>
>>61574397
rooll for something easy
>>
>>61577047
persist the tasks you've competed in the filesystem
>>
>>61577082
That's the only solution I could think of, too. Some sort of Watermark file...

But then, once the task list gets into the 100,000s it means I need to check (probably) that many completed tasks to see if my "new" task is in the "completed" list...
>>
which

if (!flag)


or

if (flag == false)
>>
>>61577166
First one.
>>
>>61575853
Dunning-Kruger in action
>>
>>61573303

Anyone know good resources to learn elisp? I know SCIP levels of scheme if that helps at all.
>>
>>61577260
M-x info C-s elisp
>>
>>61577166
this is superior
if (flag != true)
>>
I have a multithreaded child process, each thread does some initialization. I want the parent process to wait till each thread of the child have done the init.
For a single thread I would use an unnamed semaphore that child posts when ready and parent waits for. So now I need something opposite: something like a semaphore but it would start with the value equal to the number of threads, each thread would decrement it and the parent would wait for it to be 0.
How do I do this? Or is there a better way than using semaphores for this?
>>
>>61577156
So you have a list of tasks. Mark the tasks that have already been completed. After an interrupt, rebuild your bucket with any tasks that haven't been completed. You could also have a note that says the first 50/150/200/etc has already been completed so no need to check before then. Am I understanding this correctly?
>>
// router.js
const express = require('express')
module.exports = function(dependency) {
express.router().get('/msg', (req, res) => {
res.send(dependency.getMsg())
})
}

// app.js
const router = require('./router')
app.use(router)

const port = '3000'

app.listen(port, () => {
console.log('Listening on port ' + port)
})



Can somebody explain why that works in tests and makes them pass. But as a server in each request instantiates a new router instead of serving it?
>>
>>61574397
nani
>>
>>61577316
You could add each thread, at creation/ start time, to a concurrent collection (concurrent arraylist of Thread objects, for example).

When each thread terminates, its last action is to remove itself from the list.

Having added all the child threads to the concurrent list, the parent thread waits until the size of the list is zero.
>>
File: big.png (688KB, 908x704px) Image search: [Google]
big.png
688KB, 908x704px
What IDE do you guys use at work?
In before:
>work
>>
>>61577166
first one fo sho
>>
>>61577567
emacs
>>
File: pls.jpg (181KB, 750x750px) Image search: [Google]
pls.jpg
181KB, 750x750px
>>61574771
>>
>>61577424
Yes, something along those lines.

The problem is that each task can take an arbitrary length of time to complete.

So I add tasks 1-50 to the bucket: task 50 could complete first & task 51 gets added. Then task 37 completes and task 52 gets added.

Theoretically, task 254321 could be added to the bucket before task 1 completes...
>>
>>61576036
Learn javascript, works both frontend and backend (with Node.js)
>>
>>61577567
VS Code 4 life
>>
>>61577567
spacemacs
>>
>>61577443
it instantiates a new router each time because you've exported a function that calls express.router(), you should make the router once outside of the function you export. but i'm not sure how you're using the router you created since the function doesn't return anything.
>>
File: IMG_0633.jpg (123KB, 900x642px) Image search: [Google]
IMG_0633.jpg
123KB, 900x642px
Did you get your programming socks yet?
>>
>>61577548
What?
>>
>>61573342
>>61573420
Brainlets
>>
>>61577704
>randomly search striped panties on amazon
>click #1 best-seller
>all the questions and reviews are from men
>>
I do wear cute programming panties from time to time

https://www.youtube.com/watch?v=JB1jVmV1gGw
>>
>>61577748
>""""""""randomly"""""""" search striped panties on amazon
>>
!61577704
its too hot for long socks you sub-human
>>
>>61577615
Oh, I have an idea. Split up the list into sublists of size 50. Keep track of the first fifty sublists that have uncompleted tasks. You'll only have to search through 250 items to fill up your bucket I think.
>>
>>61577567
Zext
>>
>>61577721

List<Thread> runningChildren = new List<Thread>();

While (new threads need started){
Thread newChild = new childThread();
runningChildren.add(newChild);
newChild.start()
}

While (runningChildren.size()>0){
...wait...
}

Last line executed in newChild:

runningChildren.remove(this);
>>
>>61577156
>but I'll have to keep track of everthing that I want to keep track of!
correct
>but it might be slow!
btree it up or something.
>>
my hopes were so high
http://vim.wikia.com/wiki/C_code_completion
>>
>>61577866
https://github.com/Valloric/YouCompleteMe
>>
>>61577844
No, I'm writing in C.
I should specify I meant a POSIX semaphore but I thought it was obvious when I said "unnamed".
>>
File: firefox_2017-07-26_23-35-58.png (4KB, 337x28px) Image search: [Google]
firefox_2017-07-26_23-35-58.png
4KB, 337x28px
Consider the set on pic.
Shew that SD is contains no infinite recursively enumerable set.
Notation:
ϕe is the eth Partial Recursive function
↓ means it halts on that input
>>
>>61577567
QtCreator
>>
>>61578005
SD is a set of natural numbers therefore SD cannot contain a set of natural numbers QED
>>
>>61577567
before an employee starts working at my company he(no women) has to write his own IDE
>>
>>61577047
So you have three logical states? The initial list, the bucket, and the "processing" state. If you get interrupted, you could just put the bucket items back in the list, and either wait for the processing items to finish, or cancel them and put them back in the list.
Again, if the tasks are actually identical, why use a list at all and not just have an atomic counter?
>>
File: lol.jpg (44KB, 481x600px) Image search: [Google]
lol.jpg
44KB, 481x600px
>>61573303

how the H*CK do you get <regex.h> regexes to work?
>>
>>61578118

https://pastebin.com/hQx8YcbQ
>>
>>61577848
>>61577809
>>61577424

How about if I keep track of the "job number" of each item currently in the bucket (actually, the line# in the text file which is the original list of tasks).

Intermittently, I save this list of 50 tasks.

If I have to restart, I reload the bucket with any such saved list of tasks and set the "next" task to be added to the bucket to be the highest # task on the list.

Would that work, or is there a hole in it?
>>
File: 1440231235676.png (346KB, 786x717px) Image search: [Google]
1440231235676.png
346KB, 786x717px
>>61577567
I don't use an IDE, I use sublime as I am a web developer
>>
Whats the best way to deal with coordinates on a 2D grid in Python? Storing the X and Y with 2 different variables or storing them together and needing to use [0] for X and [1] for Y?

Is there another, better way that I haven't thought of?
>>
>>61574545
with lua ?
>>
>>61578197
Data abstraction
>>
>>61578197
typedef struct {
union {
int x, y;
int raw[2];
};
} point2d;
>>
>>61578093
Well, the original list is a very long text file.

The repetitive tasks are SQL updates based on entries in each line of that file.

There are conditions like query timeouts, DB going down etc.

But I think you're getting at something like
>>61578161
???

Just keep track of the current (50) items in the bucket; if interrupted, reload the bucket with those 50 items (i.e. the SQL tasks at those line numbers)... And the "next line" to be added (when one of the tasks completes) would be the highest number in that saved list?

It might mean some updates are repeated, which is OK -- just want to avoid starting from the beginning each time.
>>
>>61577702
The idea was to inject the dependency for the tests. Made it work in another ugly way. As I can't export the router object without losing its reference, instead I passed the app instance and registered the router in place.
>>
>>61578216
Correct
>>
>>61578167
post a screenshot
>>
Alright, to make it clear here's what I want to do:
pthread_t threads[n];

void t_init();
void t_work();
void work();

void t_ready() {
/* signal the thread has finished initialization */
}

void wait_ready() {
/* wait for all threads to finish initialization */
}

void* run_thread(void* args) {
t_init();
t_ready();
t_work();

return NULL;
}

int main(void) {
int pid = fork();
if (pid == 0) {
for (int i = 0; i < n; i++) pthread_create(&threads[i], NULL, &run_thread, NULL);
for (int i = 0; i < n; i++) pthread_join(threads[i], NULL);
}
else {
wait_ready();
work();
}

return 0;
}


The child process:
-fires up n threads
-each thread does some initial work, then somehow notifies the parent it had done and proceeds doing some other work

The parent process:
- waits for all child's threads to finish the initialization
- does something

How do I synchronize the parent and the child's threads so that the parent wait for all of them to finish the initialization?
>>
File: firefox_2017-07-26_23-52-27.png (5KB, 175x210px) Image search: [Google]
firefox_2017-07-26_23-52-27.png
5KB, 175x210px
>>61578226
Here it is.
>>
>>61578197
named tuple
>>
>>61578268
my data has been fully abstracted, thanks
>>
>>61578236
whoops that should be
typedef struct {
union {
struct { float x, y; };
float raw[2];
};
} point2d;
>>
>>61578260
Help guys.
>>
>>61578373
point2d point;
point.x;

This works?
>>
>>61578378
your problem has been done over a 1000 times by other people

search the internet for tutorials

https://github.com/angrave/SystemProgramming/wiki/Synchronization,-Part-1:-Mutex-Locks
>>
>>61578430
Yes, it's also mapped to point.raw[0]
>>
>>61578430
#include <stdio.h>

typedef struct {
union {
struct { float x, y; };
float raw[2];
};
} point2d;

int main()
{
point2d point;

point.x = 12;
point.y = 34;

// output 12.000000 34.000000
printf("%f %f\n", point.x,point.y);

return 0;
}
>>
>>61578471
huh, I didn't know you could refer to an unnamed struct nested within a union like that
>>
>>61578508
A union is a special data type available in C that allows to store different data types in the same memory location.
>>
>>61578445
>Mutex-Locks
Mutexes are for synchronizing threads within one process. I would have to store the mutex in a shared memory and perhaps protect it with another semaphore. Is there no simpler solution?
>>
>>61578517
I'm aware, I just didn't know you could go straight to the struct like that. I thought you'd have to give the struct a name and then do member access on that.
>>
>>61578260
I'd question the use of multiple processes here -- you're probably making it more difficult than it needs to be.

You can use a pipe (man 2 pipe) to communicate between the two processes.

There are many ways to wait for the threads to initialise; I'd probably use a counter, with a mutex and a condition variable.

If your initialisation is not expensive there's probably no need to do it in the actual threads, as they are all in the same address space anyway.
>>
>>61578528
>warning: ISO C90 doesn’t support unnamed structs/unions
GNU C90 and all later C standards support it though.
>>
>>61578560
I guess this behavior doesn't work in sepples then.
>>
>>61578631
of course sepples is trash
>>
>>61578667
read the next sentence.

not an argument.
>>
>>61578667
it's weird that all this shit like anonymous structs and VLAs isn't ISO C++, they seem like such basic and harmless constructs

I guess it doesn't matter if every compiler has extensions for it regardless
>>
>>61578445
I can't see even a problem similar to mine mentioned anywhere. I may be the only person retarded enough to run over it. And no, mutexes cannot help it, I think you misunderstood it, fuck.

I think I should store the number of threads that are still in the initialization process in a variable in shared memory and protect it with a semaphore. Other ideas?
>>
>>61578260
Why do you need to fork in the first place?
>>
>>61578838
Parent process sends signals to the child. I wanted to test my signal handling easily and I sit on this for third day.
>>
>>61578826
Correct me if I'm wrong but aren't there already Filesystem/OS-level mutexes?
>>
>>61578826
see
>>61578557
>>
In C how much slower is storing information in bits rather than storing it in plain ints or chars?

I'm designing a struct and I'm wondering whether it's worth packing info into the bits of a uint8_t or just using the datatype.
>>
>>61578826
Have the child threads set a bool to true when they finish initializing, and have your main thread busywait until every child thread's bool is true. Make sure to mark that bool volatile.
>>
>>61578997
bitfields are an excellent data structure, bitmasks are cheap as fuck and you'll benefit from the smaller memory footprint in terms of cache
>>
>>61578826
You can use condition variables to avoid busy waiting. Read up on thread synchronization primitives.
http://advancedlinuxprogramming.com/alp-folder/alp-ch04-threads.pdf
>>
>>61578997
It depends on a lot of factors. How many structs are you using? How many do you access at once? Do you cycle through many structs doing a handful of operations on each, or do you use the struct as a "constant" in some other complicated function? How large are these structs before packing and after packing?

It can actually be a speedup if storing data in plain ints significantly balloons the size due to cache misses.
>>
>>61579024
That's not what volatile is for; you need a mutex really.
>>
File: noyou.png (31KB, 653x181px) Image search: [Google]
noyou.png
31KB, 653x181px
>>61578926
Sorry, didn't notice the reply cause I didn't get a (You) wtf

>>61578557
>I'd probably use a counter, with a mutex and a condition variable.
Yeah, that's pretty much what I want to do here >>61578826 except there's no need for a condition variable because it's just a test and I need to put it all in a shared memory since it's another process. I hoped maybe the fact I'm using it in the same program, with fork() would let me do it somewhat simpler.
>>
>>61579061
No need for condition variables, it's not production code, just test. It's not a big deal if it performs a loop wasting CPU cycles. If anything, I was trying to reduce the complexity of the solution.
>>
>>61573303
I decided to take the idea of Value Objects a bit to seriously for fun, and created some stuff that can at best be called Object Oriented Phone-numbers, or OOP for short.

I've only implemented 4 types of phone numbers so far:
> Generic Phone Number
You have to feed it the formatted string, and the barebones string (one that can be turned into a long with no issues), as well as the country code, but it works. Not really comfy, but you know, you'll always have a need for the special case.

> Norwegian phone numbers
Three classes, and three types of phone numbers, they all subclass NorwegianPhoneNumber, which implements PhoneNumber.

> Norwegian800Number
This is a special type of commercial number, you know the one used by children's TV, porn phones etc.
It's always formatted as 111 222 33, it always starts with 8.

> Norwegian Cellphone number
Always starts with '4' or '9'. Is formatted as 111 22 333.

> Norwegian landline.
Does not start with '4', '8', or '9'.
There are some rules about where in the country the calls go to, but I didn't bother implementing them. It's just more typing.

Of course it would be annoying to create phone numbers that way, so the abstract class NorwegianPhoneNumber provides some factory methods, so you just write:
PhoneNumber = NorwegianPhoneNumber.of("81549300");

And it will parse the string and create a proper 800 number, that will know how to format itself, what type of number it is, it's country code, etc.

All in all, I thought that it would be a nightmare to use such code, but now that it's been written, it feels rather... comfy.

Am I getting too enterprisey /g/? Am I beyond saving?
>>
how2collision detection?
>>
dank memes
>>
>>61579153
enterprise code is comfy my lad
>>
>>61579153
>>61579153
are regexp that can parse any phone number
>>
>>61574522
SQL database class in High School. Learned more there about databases than I did in Uni. Might have something to do with the fact that the teacher had worked with databases since before SQL, and he recounted the horrors of tree-structured databases and how shit they were. (He was likely not a fan of XML.)

He really liked SQL, and forced us to not only learn but also understand how shit worked. If you could grasp the difference between the joins, you'd learn a lot. Otherwise not so much.

It was weird going to uni and taking the rdbms course and realizing that people had trouble with the mere concept of joins, which by then to me had become as obvious as day following night.
>>
>>61579165
Boku no Google it. Algorithms are a dime a dozen. Spheres, octrees, bounding boxes, the list goes on.
>>
>>61579089
> I hoped maybe the fact I'm using it in the same program, with fork() would let me do it somewhat simpler.
Naw, they're separate processes now with their own memory. You could set up a shared memory segment, but that's a pain in the ass.

The easy solution for communicating between the two processes is a pipe.
>>
>>61573320
if I remember correctly it's because she's being forced to give birth to some kind of plant monster
>>
>>61576080
What are you working on? I've been curious to get into it but I'm not sure where to get started. So far I've just been building basic trading utilities to hopefully build into a bot but it seems pointless since I have no money in it
>>
>>61579145
Condition variables are not complex at all, anon.

#include <stdio.h>
#include <pthread.h>
#include <unistd.h>
#include <stdlib.h>
#define T_COUNT (100)

struct thread_sync {
pthread_cond_t cv;
pthread_mutex_t mut;
int count;
};

struct thread_ctx {
struct thread_sync* sync;
int id;
};

void* func(void* arg)
{
struct thread_ctx* ctx = (struct thread_ctx*)arg;
struct thread_sync* sync = ctx->sync;
printf("thread %d init\n", ctx->id);
pthread_mutex_lock(&sync->mut);
sync->count++;
pthread_cond_signal(&sync->cv);
while (sync->count != T_COUNT) {
pthread_cond_wait(&sync->cv, &sync->mut);
}
pthread_cond_signal(&sync->cv);
pthread_mutex_unlock(&sync->mut);
printf("thread %d active\n", ctx->id);
return NULL;
}

int main(void)
{
struct thread_sync* sync = calloc(1, sizeof(struct thread_sync));
struct thread_ctx ctx[T_COUNT];
pthread_t threads[T_COUNT];
if (sync == NULL) exit(1);
for (size_t i = 0; i < T_COUNT; ++i) {
ctx[i].sync = sync;
ctx[i].id = i;
pthread_create(&threads[i], NULL, func, &ctx[i]);
}
for (size_t i = 0; i < T_COUNT; ++i) {
pthread_join(threads[i], NULL);
}
free(sync);
return 0;
}


Did not test it much, but it should work.
>>
>>61579273
You missed the fork part.
>>
>>61574564
You should have a one-liner over every public function.

/** 
* Adds to numbers, but does not check for integer overflow
*/
int add(int x, int y) {
return x + y;
}

Leaving aside the question of why you'd write that function, you should point out gotchas with your code if there are any, and it doesn't hurt. But there's a difference between a short javadoc/doxygen/that terrible xml bullshit C# uses comment and completely retarded bullshit. But internally in the method, keep shit clean. Show some taste and it'll work out in the end. In the beginning you'll comment more, and later you'll comment less because more stuff will be obvious.

But we will all be very happy to have something like this as a heads up if you give us a method like this:

/**
* Sends a standard web request and returns the answer as a String. <br>
* Times out after 20 seconds. <br>
* Is not threadsafe. <br>
* @param url the URL as a string.
* @throws IOException if things don't work as planned. Since this is a WIP, Exceptions may be changed later. It is suggested you don't use this code in anything that's going into production.
*/
public String download(String url) {
// insert code here
}

Well, at least now I know. And I didn't have to read the method to know so.
>>
I came into college with a lot more knowledge about programming than most people, since I made Gameboy Advance homebrew games in C back in middle school. I stopped doing that in high school thanks to having friends and a car and girlfriends, but decided to go to college for computer science anyway. I coasted through all of my CS classes and now I'm essentially done with everything except gen ed. I was always able to scrape by, without really learning much. I know what binary trees and big O and Dijkstra's algorithm are, but my knowledge of when to use certain data structures or algorithms in what case is embarrassingly slim. I don't even remember what an AVL tree is much less how it differs from a red-black tree and why it matters. To be honest, I don't think I care. Why did I trap myself here? Why did I let my insane laziness loose for 22 god damned years without fixing it? What is wrong with me?
>>
>>61579206
the manga guide to databases has the most interesting plot out of all the manga guides
>>
>>61579165
What kind do you need? AABB is the simplest. It only works for collision boxes whose sides are parallel to the axes.

(define (aabb-collision? a b)
(let-list (ax1 ax2 ay1 ay2 az1 az2) a
(let-list (bx1 bx2 by1 by2 bz1 bz2) b
(not (or
(<= ax2 bx1)
(<= ay2 by1)
(<= az2 bz1)

(<= bx2 ax1)
(<= by2 ay1)
(<= bz2 az1))))))


Just use that test on all the objects around the object you're worrying about colliding with.

ax1, ay1, az1 are the minimum values of the object a for each axis, and ax2, ay2, az2 are the maximum values for each axis.

The tricky part about any collision detection algorithm is the strategy to minimize the number of objects you test against, so you can go from o(n^2) to something closer to o(n) complexity.
>>
>>61575300
IDK, Spring is actually pretty good for enterprise level stuff. If you write something that's supposed to run for 20 years, some stuff starts to make a whole lot of sense.
But if I was just writing something smaller for myself, I'd just go with Spark.
> http://sparkjava.com/
It's like Sinatra. But for Java. Feels fucking good. Integrating stuff like Thymeleaf and Freemarker is also easy and pretty much without surprises. Spring is a bit too much magic for my tastes.

I like Flyway too, but it's for people who actually know SQL, Hibernate is more for people who don't know SQL and are willing to write 2 mb of XML to hide that fact.
>>
I hate C++ so much.
>>
I just got into programming, and have got a pretty good grasp on HTML and CSS.

Where should I go? I am really not sure what direction I should go in now to continue learning.
>>
>>61579373
Learn Javascript, at least that's actually programming.
>>
>>61579373
HTML and CSS are not programming.

What do you want to do?
>>
>>61579294
Don't beat yourself up so much, no one cares about AVL or Red Black trees.
>>
>>61579225
>The easy solution for communicating between the two processes is a pipe.
I'm just sending a single constant through the pipe and in the parent process I read once for every child's thread before proceeding. So I'm using pipes the way I would normally use a message queue but I didn't even think of that. And it works, thanks anon.
>>
>>61573303
Is it possible to setjmp in one thread then longjmp to the jump buffer you set up in a different thread? Or does that not work at all?
>>
>>61579273
It's late and I'm falling asleep on the keyboard. I'll check out that code tomorrow. But I already have a simple solution.
>>
>>61579285
Why not handle thread synchronization in the child (like in the code provided) and, after init is done, use a signal from the child process to unblock the parent? That shouldn't be hard to do..
>>
>>61579294
nice blog bro
>>
>>61579373
Learn something you can program a webserver to be dynamic with. I'd recommend fastcgi. With fastcgi you then get to choose a language.

Choices that aren't shit:
>C
>Java
>Scheme
>Ocaml
>Perl
Take a look at the languages that you like and then learn them, and after that learn how to use fastcgi for those languages.
>>
>>61579396
Thank you
>>61579403
Duly noted, and at the moment I just want to make some small things for my own use to practice (i.e, simple note-taking application, music player, etc)
>>
>>61579373
Javascript is the next logical step. Then you can at least make interactive web pages.

HTML and CSS aren't really programming though. It's just designing from your Notepad.
>>
>>61575431
IntelliJ is good.
Eclipse has gotten a lot better lately too.
I'd say they're a matter of preference these days. They both have their ups and downs.

>>61575740
Some people feel like teaching others. It's a personality trait. It's also reasonably well paid, and looks good on your resume. Just remember that you're going to help both normies AND turbonerds.

>>61576036
Yeah, modern Java is pretty good. You get a good spread of frameworks, from the micro (Spark) to the macro (Spring), support for every single type of library you need, great database support, with actually properly implemented connection pooling in the repos, actual dependency resolution that doesn't suck balls, actually good build tools that doesn't suck balls, loads of good other tools...

Java isn't a bad language.

>>61576041
So... they're moving to a standard enterprise type of development?

>>61576390
Nah, it's okay so long as it's strict, and the programming language has constructs that lets you reason about the types. Common Lisp lets you strictly type stuff when you want to, and that system works fine.

>>61576918
Terminal based browsers make a certain amount of sense as a niche program to view documentation in an editor.

>>61577567
Eclipse, Emacs, IntelliJ
>>
>>61579545

Thank you
>>
>>61579545
those are all shit.
>>
Sup /dpt/. Does the reference cause me problems when I use a pointer to Moveable?

    class Moveable
{
public:
Moveable(domain::Model& model) :
model(model)
{}

domain::Model& model;
};
>>
>>61579194
Sure seems like you have to write a lot of bullshit first to get to acceptable comfylevels though. But it is nice when the type-system actually starts helping you out more. You can suddenly very easily ONLY accept say, Norwegian numbers for a Norwegian business. Just set the type to have those restrictions, and you're done. You can still return the interface, so no worries.

>>61579198
Sorry mate, what are you trying to say? I don't quite understand you.
>>
>>61579594
Why would it?
>>
>>61579231
Link? ;^)
>>
File: not-an-argument.jpg (69KB, 598x792px) Image search: [Google]
not-an-argument.jpg
69KB, 598x792px
>>61579577
Those span a rather large breadth of designs anon. One of these are sure to be close to something he'll like. Although to be honest, if you're using Java, FastCGI isn't the best way to go.
>>
File: asd.webm (3MB, 638x480px) Image search: [Google]
asd.webm
3MB, 638x480px
>>61579616
>>
>>61573303
I wish there was a programming thread for white people.
>>
>>61579644
4chan needs to just ban everyone but americans, japs desu.
>>
>>61579637
What would you recommend for webdev with java?
>>
File: unable to read memory.png (16KB, 519x255px) Image search: [Google]
unable to read memory.png
16KB, 519x255px
>>61579605
I am getting this currently.
>>
>>61579668
>americans
>white

you tripin' son?
>>
>>61579644
You and me both, friend
>>
File: i0qTFppFQcpa9.jpg (49KB, 493x370px) Image search: [Google]
i0qTFppFQcpa9.jpg
49KB, 493x370px
>>61579153
>>61579194
I feel like a complete noob. What makes that code "enterprise", exactly? I'm not following.
>>
humperdink>synapse>>>synergy<101 
IF humperdink=bogus
DO -synapse.bonk ("Fail.")

end bingus


what did i do wrong it isnt working
>>
>>61579689
Long variable names, OOP and abstract factories
>>
>>61579676
how are you initializing the pointer?
>>
>>61579691
what the hell is this
>>
>>61579698
Makes sense. I've used those things a couple of times but never would have thought to call it enterprise code.
>>
>>61579641
Thanks for the semi, but do you have the link?
>>
>>61579726
i dont watch animu
>>
>>61579717
bongus code
>>
>>61579689
https://github.com/EnterpriseQualityCoding/FizzBuzzEnterpriseEdition
you can just feel it
>>
I want to learn low-level programming. I know basics of C and C++. Should I continue learning C++ or start with something like Rust?
>>
>>61579712

    void Engine::add(domain::Model& model)
{
auto moveable = Moveable(model);
modelMoveables.emplace(&moveable.model, &moveable);
moveables.emplace_back(moveable);
}

void* Engine::get_host()
{
return pHost;
}

void Engine::set_host(domain::Model* pModel)
{
if(modelMoveables.count(pModel))
pHost = modelMoveables[pModel];
}


then get it like this:

pHost = static_cast<game::Moveable*>(gameEngine->get_host());
>>
>>61579691
u forgot the wensleydale and your ; you fucking idiot


wensleydale = on;
humperdink>synapse>>>synergy<101;

IF humperdink=bogus;

DO -synapse.bonk ("Fail.");

end bingus.
>>
>>61579641
The magical powers of push up bras and high heels.
>>
>>61579755
>I want to learn love level programming
>I already know a way to do it, should I keep going or should I pick the hottest meme?

You know the answer, search your heart
>>
Thread full of fags that will never amount to anything
>>
>>61579791
no u
>>
>>61579672
Spark for server, Freemarker for markup, and HikariCP for connection pooling to your database.

Store your configuration as normal boring .property files, and you're good.

I'm not sold on Hibernate, but I'm not going to tell you not to use it. Prefer to use plain old SQL statements stored in text files personally. But as I said, I'm not exactly religious when it comes to that.

If you already know Java, you probably want to use Lombok too, to cut down on writing the boring stuff.
>>
NEW THREAD!!

>>61579801
>>61579801
>>
>>61579755
I say move on to Rust if you feel like you have a good enough grasp of C++. There's a lot of discussion recently about C++ vs Rust and whatnot, so you'll probably get differing opinions. I say just do it and learn it, if you don't like Rust you can always go back to getting sharper on C++.
>>
>>61579689
Non memetic answer?

Basically, you're writing code that's going to be around for a long, long time. That means that parts will be swapped out. Stuff will come and stuff will go. So you have to prepare for that from day one. So everything is written to be more pluggable than needed. Everything is very compartmentalized so that when you're suddenly told by a "security expert" that you should have all print statements go to a file AND standard out, you just replace System.out with com.4chan.boardsoft.logging.FileAndStandardOutPrintStream somewhere and everything just uses that instead.

Which yes, means that you're not likely to use System.out.println, you're likely to use log.info or similar solutions.

It's not a bad style of programming, but you do have to put up extra scaffolding to make sure you can renovate everywhere with more ease.

So >>61579698 isn't wrong. Those are all things you do. It's just done for a reason.

It's still funny to laugh at it though.
>>
>>61579755
architecture independent languages are not "LOW LEVEL"
Thread posts: 315
Thread images: 32


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