[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: 33
File: K&R himegoto waifux2.png (1 MB, 1000x1400) Image search: [Google]
K&R himegoto waifux2.png
1 MB, 1000x1400
old thread: >>52201030

Friendly reminder that negative numbers are a meme, OOP for the sake of OOP is bad, and if you can't implement your favorite OOP features in a non-OOP centric language like C, you shouldn't be using OOP.

What are you working on, /g/?
>>
>>52206105
First for D
>>
Daily reminder that if your language of choice is not on this list you should probably give up and kill yourself:
- C++
- C#
- Lua
- Python
- Elixir
- Haskell
- Bash
- Clojure
- D

http://jackstouffer.com/blog/nd_slice.html
>>
Threadly reminder that you should not refer to the act of programming as coding. It is improper and makes you look like a 15 year old

You are a programmer, not a coder

Developer is okay
Magician is okay
Software Engineer is okay
Software Architect is okay
Software Alchemist is okay
>>
>>52206130
>No Java
?
>>
File: recycle.png (1013 KB, 813x771) Image search: [Google]
recycle.png
1013 KB, 813x771
>>52206130
>no Common Lisp
>>
>>52206138
How about code guru?
>>
File: LTPWMCover.png (268 KB, 492x650) Image search: [Google]
LTPWMCover.png
268 KB, 492x650
Holy mother of autism
>>
File: le suicidal yeb.jpg (270 KB, 903x561) Image search: [Google]
le suicidal yeb.jpg
270 KB, 903x561
>>52206139
get to it faggot
>>
>>52206154
https://www.nostarch.com/programwithminecraft
>>
File: 1356785154050.jpg (96 KB, 500x746) Image search: [Google]
1356785154050.jpg
96 KB, 500x746
Somehow, I have LITERALLY no idea how, this function is causing a race condition. If I place a breakpoint within it, it works. If I do not, none of the job threads actually execute.
jobThreads is a list of threads and I'm starting them the exact same way that I start every other thread in my program. Does anyone know what could cause this?
public void createNewJob(int portID) {
jobThreads.add(new Thread(new serverJob(portID), "Job Thread " + portID));
jobThreads.get(jobThreads.size() - 1).start();
}
>>
>>52206154
This book would be fantastic for 10-12 year olds who want to get into programming
I personally started programming with Expression 2 in garrysmod, programming within existing games is a fantastic way to learn while having fun.
>>
All this arguing over data binding is all well and good, but I still need help.

I have no idea how to bind each property to each window without iterating through the collection and only grabbng one of each property.

I assume I've gotta use LINQ and set my ItemsSource to grab each unique name somehow.

Surely someone here must use C# and know how to achieve this.
>>
>>52206172
I don't know why it's not working, but this should make it work regardless:
t = new Thread(...);
jobThreads.add(t);
t.start();
>>
>>52206213
Not the question asker but
wouldn't that just instantiate t but not the t that's in the jobthreads index?
>>
File: img.png (94 KB, 843x2169) Image search: [Google]
img.png
94 KB, 843x2169
>>52205959
Meaning?

>>52205944
>>52205963

I don't need an hex editor. I need to do something *more* than hacking some game save files or crap like that... if I wanted an hex editor I'd be using XVI32 that at least has a custom scripting language to work with.

Anyways, does anyone know any programming language that lets you:

>count bytes in a file
>count from address to address
>count words, dwords,qwords, dqwords
>covert bytes and words to integers and vice-versa
>convert integers to hex and vice-versa
>decode ascii to hex and vice-versa
>anything else that relates to hex and binary
>work at 360° on all the listed above

Similar to pic related, but better and with more features, if possible.
>>
>>52206243
No, because t is a reference.
>>
File: 081.png (14 KB, 165x115) Image search: [Google]
081.png
14 KB, 165x115
Wait, my bad, I fucked it up
I need to put a breakpoint in this statement

public void run() {
System.out.println("Server Job Manager service started");
while (true) {
if (!newJobs.isEmpty()) {
for (int i = 0; i < newJobs.size(); i++) {
createNewJob(newJobs.get(i));
}
newJobs.clear();
}
}
}


to make this code actually execute

public void createNewJob(int portID) {
jobThreads.add(new Thread(new serverJob(portID), "Job Thread " + portID));
jobThreads.get(jobThreads.size() - 1).start();
}


This is driving me mad because as far as I know it should be working perfectly
>>
>>52206152
Code guru has been added to the list
>>
>>52206186

You can generate lists of properties by using Select.

So imagine you have a class which has a member 'value' of type int, and you have a list of these objects

List<int> values = objects.Select(x => x.value).ToList();
>>
Trying to learn c++ and it just seems daunting how much stuff there is to learn. Seems like it would take six years just to learn everything. I'm 27 years old, I just don't have that time. What should I do?
>>
>>52206322
It takes like a week. No one learns languages like you're thinking.
>>
When they say that something is stack allocated in, say, C, is that different from the stack in assembly programming? Because I don't see how you could juggle like 50 variables in an assembly routine using just registers and the stack, but a C function can handle any arbitrary number of stack allocated variables and random access them no problem.
>>
>>52206341
How do they learn languages?
>>
>>52206320
It's just a damn shame it returns multiple of the same value.
>>
>>52206213
Thanks anon, but I misrepresented the problem.

The actual race condition seems to be coming from what calls that function.
>>52206275
>>
>>52206375

Do you want only unique values, or something?
>>
>>52206374
You just follow some tutorial/book to learn the basics and some advanced stuff and go from there (make programs). You don't need to know what everything does before you begin (because you won't use most of it anyway)
>>
>>52206387
Indeed.

I have an "Artist" datagrid that I want to bind only one of each unique "Artist" property from my ObservableCollection of Songs
>>
>>52206374
You work through stuff and then when you don't know how to do something you look it up
Most of the more advanced stuff is just for making stuff work more efficiently, you could make a perfectly functional (albeit SHITTY) program with nothing but if statements
>>
>>52206322
Nobody knows every last detail of C++ because it's such a bloated language and there's a million ways to do everything, much to it's detriment.
The creator of C++ has even started an initiative to cut down C++ to a small subset of it's functionality to aid in defining what can be considered modern, idiomatic C++.
Just learn C, it's a tiny language.
>>
>>52206399

List<int> values = nodelist.Select(x => x.value).Distinct().ToList();


Happy hunting.
>>
>>52206373
>When they say that something is stack allocated in, say, C, is that different from the stack in assembly programming?
The C language doesn't officially mention anything about stacks, so yes, when people talk about "on the stack" in C, they mean the typical implementation of stack frames in asm.
> Because I don't see how you could juggle like 50 variables in an assembly routine using just registers and the stack
If they don't need to be live alla t once you can reuse the same registers and stack space.
But a compiler has no problem keeping track of how many variables you want, it just need to remember some offset which is no different from the regular kind of symbol tables it always has.
>>
>>52206432
Yeah I already figured that bit out, it's just a damn shame that the return seems to be entirely blank.

That's the only reason I assumed that this way was entirely wrong.
>>
>>52206424
What do you mean by detail? Plenty of people know all of the language syntax. Syntax is trivial. If you're talking about libraries, I'm sure there's some people that memorize everything about the libraries they use but most of us just use the documentation as we need it.
>>
>>52206453
>it's just a damn shame that the return seems to be entirely blank.

Well... that's not right. It should work.
>>
>>52206450
So it's just stack pointer magic, then?
>>
>>52206475
You'd think so wouldn't you.

I'll try a few things see if I can get it to return the string properly.
>>
>>52206475
>>52206502
Oy vey, forgot to change my binding in my XAML.

The one time WPF lets me down. Completely forgot about that.

Thanks.
>>
File: 1450133088305.jpg (30 KB, 720x438) Image search: [Google]
1450133088305.jpg
30 KB, 720x438
>>52206527
>The one time WPF lets me down.

I TOLD YOU IT WAS SHIT FUK U!
>>
File: 8e8.jpg (18 KB, 264x379) Image search: [Google]
8e8.jpg
18 KB, 264x379
>>52206532
:(
>>
File: 1449743431209.jpg (168 KB, 1210x603) Image search: [Google]
1449743431209.jpg
168 KB, 1210x603
>>52206550

I'm just fucking with you, lad. I don't hate it near as much as I used to.

Good work.
>>
>>52206456
Personally I don't use any libraries until I understand how everything works and have replicated the code.
>>
>>52206561
Manage to do any more work with it? I've been enjoying the ease of using grids and stackpanels to construct an entirely dynamically scaling window.
>>
>>52206584

Nothing yet. Been meaning to build some Powley computers and use the data-binding to update solutions as-you-type, rather than requiring button presses, etc.

Powley computers are used for reloading ammunition. Tells you what kind of gun powder to use based on bullet weight, cartridge, etc.
>>
>>52206494
Well there's no magic to it, it's extremely straight forward.
Compiler knows how many variables are used in a function, it knows their sizes, it knows where other functions are called (if any) and it knows all the scopes of things.
And if the stack pointer never needs to move (as in x64 for example, due to the way the calling conventions work there's never any need to use push/pops anymore) it's completely trivial, just a single allocation at the top, everything is a statically known offset all the time, var_N = rsp+N.
If the stack pointer will move during the function the compiler just need to know where those moves are (i.e callee clean-up function calls, or sized optimized x86 push/pops) and potentially adjust offsets from those points if it's the same variable.
>>
>>52206580
Personally I think you're an autistic faggot manchild NEET.
>>
>>52206611
Neato, should look rather nice with sliders and stuff that bind to min-max values.

One more dumb question, I want to use
dtgArtist.ItemsSource = SongList.Select(x => x.SongArtist).Distinct().ToList();
but I want to get only SongAlbums that contain the SongArtist property.

I still don't really understand LINQ all that well.
>>
Why are programmers so fucking annoying?
>>
>>52206130
ada master race
>>
>>52206658

SongList.Where(x => x.SongArtist == "ArtistName").Select(x => x.AlbumName).Distinct().ToList();


Or something like that. I'm kinda just riffing because I don't know your codebase.
>>
>>52206679
That's grand, I'm completely lost when it comes to LINQ, the way it works makes perfect sense but actually writing it is another thing entirely.
>>
>>52206675
explain
>>
>>52206690

I used to avoid using it and just go over the lists using foreach statements and generating my own lists, but once you start LINQing, you don't stop.

Look into it.
>>
File: 1305320435568.png (91 KB, 201x313) Image search: [Google]
1305320435568.png
91 KB, 201x313
>>52206275
Anyone? I can't seem to figure this out and it's driving me crazy because I don't see what the problem could possibly be. Initially I thought it was a problem with clearing the list but that shouldn't be able to happen until the entire list has been iterated through.
>>
first for Go
>>
>>52206708
My only real problem with it at the moment seems to be getting the thing to not fire off null reference exceptions in certain circumstances, but that's a problem of databinding with "SelectionChanged".
>>
mad hangover lads fml
>>
>>52206928
Where is the unsubscribe button to your blog?
>>
>>52206961
Close this tab to unsubscribe
>>
File: 1449188099951.png (3 KB, 411x354) Image search: [Google]
1449188099951.png
3 KB, 411x354
>>52206927

I believe in you, mang.
>>
>>52207020
Sorted it out, completely forgot about the whole "logic" thing.

Helps if you put the right lines in the right place I find.

Seems to work absolutely beautifully at the moment, a long way to go though.
>>
>>52206708

>once you start LINQing, you don't stop.
Meh. It's nothing I haven't been doing in Ruby since forever for arbitrary string and list processing. Select, map, and reduce are powerful tools.
>>
>>52206138
How about Software Aristocrat?
>>
I feel as though there's some way to use linearity to control whether or not something gets memoised but I'm not sure yet. For instance, you would want to memoise the Fibonacci sequence, but you wouldn't want to memoise the sequence of intermediate states in the main loop.
>>
>>52207095
What intermediate states?


list [n] = list[n-1]+list[n-2]


Literally everything is memoised, n, n-1 and n-2.
>>
>>52206138
Binary mathematician?
>>
>>52207045
>Meh. It's nothing I haven't been doing in Ruby since forever for arbitrary string and list processing. Select, map, and reduce are powerful tools.

Well yeah, but I mean once you start using them (in whatever multi-paradigm language you're using) it's hard to give them up.

Very powerful tools.

They give me an erection.
>>
>>52207200

Is it a bigger erection than the one you get every time you drive through the hood?
>>
Somewhat programming related, but for you current CS/Software Engineering students right now, what do you guys have on your resume? I was planning on slacking off and doing nothing for awhile, but my brother wants me to send him my resume for some sort of undisclosed job which i'm only assuming is programming related because he's talking to me

So, what are your resumes like? Did you follow any templates? I want mine to not look like shit, but I have no professional experience as a programmer and no work history to speak of.
>>
File: matz.jpg (71 KB, 300x451) Image search: [Google]
matz.jpg
71 KB, 300x451
>>52207271
>tfw driving through the hood 'mirin black QTs while writing LINQ queries with a new gun in the trunk
>>
>>52207296
You're an asian man with a gun in a predominantly black neighborhood?
>>
Anyone who uses the term "pet project" needs a slap.
>>
>>52207326

Uh.. yes.
>>
>>52207345
why?
>>
>>52207296
You forgot to mention how shitty the car you're driving is.
>>
>>52207296
>tfw no one else in the hood can top your virtual machine implementation
>tfw negresses mirin
>>
Redpill me on software engineering
>>
File: 1451790389702.png (75 KB, 348x301) Image search: [Google]
1451790389702.png
75 KB, 348x301
>>52207475
>redpill
>software engineering
you don't wanna know m8
>>
Found an interesting Rust book from a guy who really, REALLY hates linked lists.

http://cglab.ca/~abeinges/blah/too-many-lists/book/

>>52207491

Best start dropping red pills, Anon.
>>
>>52207528
Gonna use this to learn Rust
>>
>>52207528
>rust

why bother
>>
>>52207541
Future of systems programming m8
>>
File: alkhwarizmi.jpg (33 KB, 200x297) Image search: [Google]
alkhwarizmi.jpg
33 KB, 200x297
>>52206138
What about Algorithm philosopher.
>>
File: top_left.gif (12 KB, 259x110) Image search: [Google]
top_left.gif
12 KB, 259x110
What do you guys think about xHarbour the extension of clipper?
>>
>>52207541

Because it's pretty interesting for a system's language. Although Cargo is slightly more complicated than just using GNU Make for everything...
>>
>>52207528
to be quite fairly honest, his points are pretty sound, and dpt in general seems to have always hated them for the same reasons. I can't say much myself since I've never needed to use them
>>
>>52207572
>clipper

Literally the first time I'm ever hearing of this lang.
>>
http://cglab.ca/~abeinges/blah/too-many-lists/book/first-layout.html

>If you're coming from a C-like language, this is exactly the enum you know and love, but on meth.
You know, when I first started looking at enums in Rust, they reminded me more like unions... moreover, I like my data types high on cocaine, rather than methamphetamine.
>>
File: minecraft.webm (1 MB, 720x404) Image search: [Google]
minecraft.webm
1 MB, 720x404
Ask your much beloved programming literate anything.

>>52206154
Friendly reminder that the Minecraft modders of today are the Turing award laureates of tomorrow.

This book relies on Minecraft Pi, A free version of the game specifically made for the raspberry pi and for educational purposes (This version has a generic programming interface based on tcp/ip).
>>
>>52207662
>his data types aren't on salvia, for trippy yet safe highs
>>
>>52206275
 while (true) {
if (!newJobs.isEmpty()) {

REEEEEEE
>>
File: maxresdefault (1).jpg (98 KB, 1920x1080) Image search: [Google]
maxresdefault (1).jpg
98 KB, 1920x1080
What's the best version control for single man, small projects? Should I bother with git?
>>
>>52207801

Just use Git for everything.
>>
>>52207801
Definitely use git. Just run
git init
and you're off.
>>
>>52207572
Da fuq? Clipper still exists? I wrote something I don't really remember for a tax accountant back in like 87-88. Easy to remember that job, only XT 285 I ever saw with the extension chassis (5160?).
>>
Daily F# question:

I have a function of this type:

inputStream:Stream -> 'a


Why do I have to explicitly declare the type when binding the returned value?
I know that the returned value is unboxed in the function but meh, there's something unclear in this behaviour...
>>
#include <iostream>
using namespace std;
class A { void foo(){ cout << "foo"; } };
class B : public A { void goo() { cout << "goo"; }};
class C : private B {
using B::A;
};
int main() {
C c;
c.foo(); // Should be accessible
//c.goo(); // Should not be accessible
return 0;
}

How do i make this work without changing the inheritance?
Also if i add a new method to A, it should work within C without adding another using directive.
>>
File: 0349.png (2 KB, 128x128) Image search: [Google]
0349.png
2 KB, 128x128
>>52206105
Revising the intermediate metalanguage I use to exchange information with my chatbot, and the interpreter that processes it. Implementation of these revisions will come later.

What I want to do is make it easier to convey useful information to the bot out of the box with more minimal use of that intermediate language, and allow for it to bootstrap its own natural language understanding through inquiry-driven discourse rather than the conveyance of explicit grammar information from the user, which has been the case for the longest time.

The catch-22 is that I don't want any hardcoded words or sentence structures (save for perhaps reserve terms as a last resort), so that it may learn any language.
>>
Just finished up my new data compression program. It can reduce a 245-megabyte file to mere 244 kilobytes. It does this by sorting the bytes in an increasing order, then running DEFLATE algorithm on the output. This makes it compatible with all ZIP tools, so you can use your existing tools to manage them. I'm still working on the decompressor, but I believe I can figure it out. I probably need some sort of lookup table that tells me how to reorder the bytes to get the original data back.

One obvious problem this algorithm has is that there is no random access in the compressed stream, you have to decompress the whole stream. I guess random access has to wait until version 2.0.

But hey, I'm 50% done, baby!

(I tested a bit-level sorting, that is, store all the 0 bits first followed by all the 1 bits. Then I have to store only two counters: one that indicates the number of 0 bits, and one for the 1 bits. But that lookup table is going to be even larger. But I'll give it a try later.)
>>
I can't fucking stand C++. Why doesn't this fucking shit compile?
test.h
#ifndef TEST_H
#define TEST_H

template <class T>
class test
{
private:
T m;

public:
test(){}
test &operator=(T &rhs)
{
m=rhs;
return *this
}
T get()
{
return m;
}
};

#endif



main.cpp
#include <iostream>
#include "test.h"

using namespace std;

int main()
{
test<int> var;
var = 5;
cout << var.get() << endl;
}


Compile errors:
++ -Wall -std=c++11 -I includes/ -o main obj/main.o
obj/main.o: In function `main':
main.cpp:(.text+0x10): undefined reference to `test<int>::test()'
main.cpp:(.text+0x21): undefined reference to `test<int>::operator=(int)'
main.cpp:(.text+0x2d): undefined reference to `test<int>::get()'
collect2: error: ld returned 1 exit status
makefile:11: recipe for target 'main' failed
make: *** [main] Error 1
>>
>>52207958
It compiles (the code is OK) but it isn't linking (some methods weren't generated).
Strange. I've never had this problem (it seems like the template isn't being created??). Did you compile the .o correctly? Maybe recompile it
>>
>>52207695
What's wrong anon
>>
>>52207954
gr8 b8 m8
>>
>>52207958
>implementation inside the class definition
>passing non-const reference to T in operator=
>returning a copy of T in get() instead of a reference
I hope you wont do this for a living.
>>
File: hollande.gif (4 MB, 270x324) Image search: [Google]
hollande.gif
4 MB, 270x324
>>52207979
I want you to think about it anon
you have a while loop, which you only want to be running while !newJobs.isEmpty()

just process that thought in your mind
you want it to run
while !newJobs.isEmpty()
>>
>>52208000
>criticizing aspects that either are required but you're too dim to realize, or are just completely unrelated to the problem
I hope you aren't an asshole in real life
>>
>>52208005
Are you retarded? He doesn't want to end the loop when newJobs.isEmpty() returns true.
>>
>>52208005
But anon, I'd do a do while but I want it to loop forever. The value of newJobs can be changed outside of this code and it has to catch it every time
>>
>>52208025
No, you are not required to put implementation in the class definition anon.
No, not even if its a templated class.
No, you don't have to wait for modules in C++17.
>>
>>52208026
I thought that was what he was talking about when he said
>I need to put a breakpoint in this statement
never mind then
>>
>>52207975
Seriously. Fuck gnu/linux. I ran "make clean" and "make" again. It works. Thanks m8.

I was already pulling my hair out when I realized you can't split code by implementation and declaration into two files when using templates. I miss Python so much.

>>52208000
It's only a skeleton version of the code I was having problems with. My other code is better.
>>
>>52208044
>No, you don't have to wait for modules in C++17.
?

I don't understand how this is possible. How will code get generated if its is contained in a separate file?
>>
>>52208071
>Seriously. Fuck gnu/linux. I ran "make clean" and "make" again. It works. Thanks m8.
Not even a linux problem, if I had a dollar for every fucking segfault fixable by a "make clean ; make", I'd be pretty well off.
C++ will always be horribly outdated (b-but it's so fast!)
>>
>>52207897
Yep, there are latin retards who still using that pos ,and not having enough they use the extension xHarbours instead learning a real programming language
>>
>>52206130

I'm confused, this list includes common and easy-to-learn, made-for-educational-purposes languages like Python and yet it's meant to be elitist?

Explain your memes /dpt/
>>
>>52208071
>Seriously. Fuck gnu/linux
That has absolutely nothing to do with GNU/Linux.
Also, use a fucking proper build system.
>>
>>52208073
>I don't understand
There you go. That's your problem. Solve it, and your code will start working.
You should write implementation in a separate .inl file and include it file in the header after class definition.
No, this will still not solve your linker errors because the original problem persists.
>>
>>52208071
>gnu/linux
>>
>>52208113
This is my makefile. If you have a better makefile, feel free to let me know.

SOURCEDIR=src
INSTALLDIR=obj
INCLUDESDIR=includes

CPP_FILES=$(wildcard $(SOURCEDIR)/*.cpp)
OBJ_FILES=$(addprefix $(INSTALLDIR)/,$(notdir $(CPP_FILES:.cpp=.o)))

CC_FLAGS=-Wall -std=c++11 -I $(INCLUDESDIR)/

main: $(OBJ_FILES)
g++ $(CC_FLAGS) -o $@ $^

obj/%.o: src/%.cpp
g++ $(CC_FLAGS) -c -o $@ $<

clean:
rm $(wildcard $(INSTALLDIR)/*.o)
>>
You still around OSGTP?

Went to walk my dogs to give me some time to think of a reasonable way to achieve this, but I need to jam an item into the various datagrids.

I want to insert an [All Artists] and [All Albums] value in at 0 regardless of binding without fucking everything up.
>>
>>52207925
Anybody?
>>
>>52208144
SOURCEDIR=src
INSTALLDIR=obj
INCLUDESDIR=includes

CPP_FILES=$(wildcard $(SOURCEDIR)/*.cpp)
OBJ_FILES=$(addprefix $(INSTALLDIR)/,$(notdir $(CPP_FILES:.cpp=.o)))

CC_FLAGS=-std=c++11 -I $(INCLUDESDIR)/ # Mandatory flags
CC_FLAGS+=-Wall

main: $(OBJ_FILES)
g++ $(CC_FLAGS) -o $@ $^

obj/%.o: src/%.cpp
g++ $(CC_FLAGS) -c -o $@ $<

clean:
rm $(wildcard $(INSTALLDIR)/*.o)


Instant improvement by seperating mandatory flags and non-mandatory (optimization) flags.
>>
Reading "Using C on the UNIX System
A Guide to System Programming" I came to a passage:

>Example ... violates one of the more important UNIX conventions ... that in any program where it makes sense, the program should operate on both named files, or on its standard input and output ... to operate as filters, so that they can be invoked individually or as part of a pipeline

Are there many such conventions and is there a list somewhere?

(I'm already googling it, but I thought maybe someone knows good resources already)
>>
>>52208144
By the way, you probably want to replace
CC_FLAGS
with
CXXFLAGS
and let Make handle the rest.

Same with
CC = g++[/code}.
>>
>>52208144

>Also, use a fucking proper build system.

I believe Anon would like to suggest that you not use Make at all, and perhaps use something like CMake. Honestly, it's still possible to make this work well with GNU Make. You can either define each .o file in terms of the corresponding .cpp file and all headers that .cpp file includes (this means writing a new definition for each new source file, which is pretty disgusting for a lazy programmer), or you can just do what I do, which is to run the touch command on any file I know to be changing because of a header change. If you want to be truly lazy, you can just write a script that parses a file for an #include of the header (maybe using grep?), and if it finds it, touches the file, doing this for each file in the source directory. Then your only problem is if files included it indirectly (which you can solve by explicitly including any header file you know you're going to change)... or you can just make clean and build from scratch anyways.
>>
>been making very mediocre progress on my android 4chan browser.
>Feeling like shit and can't bring myself to be productive.
>When uni starts I'll be too busy for any side projects.

It doesn't help me to stay with my parents during my break where I have a small and shitty laptop.
>>
>>52208214
>not having a thousand lines of m4
>>
>>52208439
excuses
>>
>>52207958
You don't need the obj/main.o. Just g++ main.cpp --your--flags should work
>>
>>52208451
I don't know man. I need responsibilities and shit to do or I go mad. Just sitting coped up at my parents house with barely any friends is really draining my working ability. Whenever I hit a hurdle or have to look shit up in the android API's I just stop working and browse the web. Whatever I'll try again.

Sorry for blogshit.
>>
File: 1430872326149.jpg (62 KB, 413x423) Image search: [Google]
1430872326149.jpg
62 KB, 413x423
People are writing libraries in language X and I use language Y, what do I have to know in order to use library X in my language? I'm unsure of what the terminology for this kind of stuff is, do I need to learn language bindings, interfaces, or what?

Specifically I'm trying to use a library written in Go in a C program (really it will be CPP because I intend on using wxWidgets), not the other way around, all my search results are showing Cgo which is for using C inside of Go not using Go inside of C.

Is what I want possible? If not what would be the options, re-impliment the same thing in my language? Is SWIG something I need to know? I'm very confused on how to make 2 separate languages interact without some form of IPC or API, I want to avoid this if possible and just make 1 program utilizing libraries from Go, C, and C++.
>>
>>52208322
...so make uses timestamps instead of something like checksums to see if a source file has changed?
>>
>>52208439
>I have a small and shitty laptop.
make it unshitty by installing gentoo
>>
>>52208322
Hmmmm. I used to use cmake in this weird Python thing for this robot library. Didn't really like it.

All I need for make is this one file that I never have to look at ever again. This was the first time I've seen an issue with it. So I didn't realize cleaning it will fix it.
I'll just have to keep it in mind afterwards.

>>52208475
That was make. I don't compile on my own cause fuck remembering fifty different flags
>>
>>52208489
Go can apparently export a C ABI, according to https://golang.org/cmd/cgo/.
You may want to write some glue code to make it nicer to use, but it should be possible to do.
>>
Rust's lifetime bullshit is a ton to take in at once. It's more than just simple RAII. Fucking hell, I need to take a break.
>>
>>52208538
Thanks for the info, I'll give it a try.
>>
How do I send and receive networking packets in C?
>>
>>52208659
Switch language to save yourself days of valuable time
>>
>>52208659
Using send() and recv() respectively.
Just read Beej's networking guide.
>>
>>52208491

Yep. If a file foo.a has a dependency on foo.b and foo.c, and either foo.b or foo.c has a newer timestamp than foo.a, then foo.a must be re-built. It's a really simple, yet dumb utility, and I use it for everything.
>>
File: QPqQTpQ.jpg (94 KB, 1440x810) Image search: [Google]
QPqQTpQ.jpg
94 KB, 1440x810
Hoping to get into C# or C++, which one fellas?
>>
>>52208743
C#

But I'm biased, because I really like C# and think C++ is an ancient bloated mess.
>>
>>52208743
C++, but only if you're willing to learn proper, modern C++. Not "C with classes".
>>
>>52208743
Neither
>>
>>52208743
C++. C# is a M$ product and only reasonable use for it is Unity. C# may look nicer and be more beginner friendly, but that's about it.
>>
>>52208763
regurgitating something you've heard somewhere

pls explain what do you mean by "C with classes"
>>
File: le smug rainbow man.jpg (14 KB, 300x273) Image search: [Google]
le smug rainbow man.jpg
14 KB, 300x273
>>52208763
>What should I eat fellas?
>Shit, but only if you're willing to eat smooth, solid shit. Not "piss with mushy shit particles".
>>
>>52208793
template free programming
>>
>>52208743
DON'T USE C#
FUCKING DON'T

most preferable: learn C
failing that: learn C++
failing that: learn D, then learn C
>>
>>52208793
People who write "C with classes" code write C++ programs as if they were running on some performance critical embedded system, never using the STL, smart pointers, automatic type deduction, etc. They don't use OOP design patterns, because "le OOP meme", and just stick classes onto their C style of programming and then complain why it doesn't work as elegantly as in C.
>>
>>52208854
Already learnt the basics of C from the two classes I had for it.

So I guess its time to google for C++ references then!
>>
>>52208861
>OOP
>not a meme
>C++
>not a parsing disaster
Bjarne pls
>>
Anyone here familiar with maxscript?
How the fuck do I rotate an object's pivot?
>>
>>52208540
This may or may not help understand lifetimes a bit better:
http://codrspace.com/buntine/aha-understanding-lifetimes-in-rust/
>>
Any C# memers around?

I need to insert an item to a datagrid @ index 0, only catch is the control is databound at runtime.

I can't stick a blank object entry in at the start of the object collection because that'd cause way more problems than it'd solve.
>>
Looking for something to do. I have a few ideas:
>automatic torrent downloader from nyaa
>cli youtube subscription manager
>irssi like 4chan browser
Any more suggestions?
>>
>>52208998
>>automatic torrent downloader from nyaa
Torrent clients with RSS can do this already. I once made a program that took shit from nyaa and downloaded it using XDCC though.
>>
>>52206105
Please stop this programming trap meme.
Thanks.
>>
>>52209040
That makes it much less interesting to do.
>>
>>52209096
Traps are the norm now.
>>
is it worth learning c++ templates?
>>
>>52206747
>>52206275
>concurrent access to newJobs without ever locking anything
gee I wonder
>>
>>52209306
last I heard, they were a meme

not sure if they're better now though
>>
I want to make android apps.
I haven't touched programming since my college days, 12 years ago, VB6.

Where do I start?
>>
>>52209306
If you are going to use c++ yes
>>
>>52209426
pick up a java book

it's probably got info about it in the sticky
>>
>>52209426
Android programming is a shitfest

I don't really recommend it
>>
>>52206130
>not scheme, common lisp
>not APL
>>
>>52209452
I have an idea for an app that has not yet been made that I think could be quite successful, not talking Instagram or facebook levels of popularity but there is a gap in the market to be filled, my plan is to start with android as I have an android phone and tablet, for testing, and if it takes off then start porting to other platforms.
>>
>>52209564
tell me the idea just for fun
promise not to steal or tell anybody
>>
>>52209564
>I have an idea for an app that has not yet been made that I think could be quite successful
kek

if I had a dollar for how many times i've heard this shit
>>
>>52209564
you should listen to this >>52209638 guy
he's a pretty big deal around here
>>
>>52209426
First learn the basics of Java.
This seems to be a good tutorial: https://www.udacity.com/course/developing-android-apps--ud853.
>>
>>52209564
Time for you to move to San Francisco, buy a macbook and some skinny jeans, and begin sucking dick for cash.

Then you'll be ready to develop your shitty app.
>>
why is AI such a meme? writing a board game agent and pretty much every board game strategy is the same dumb minimax with pruning.

can't someone invent a new technique for this shit?
>>
>>52209564
you dont need to own any kind of hardware for testing, everything out there that exist or is possible to exist, you can test virtually with the android sdk tools, same with iOS
>>
>>52209798
>you dont need to own any kind of hardware for testing
AHAHAHA
>>
>>52209773
I actually moved to sf a while ago, and sucking dick was never this FUN !
Omg cant wait to be senior developer in less than a year from now
>>
>>52209798
>you dont need to own any kind of hardware for testing
It would be awesome if this was true.
>>
>>52209797
Why don't you do it?
>>
>>52209694
This looks good thank though I may need to start on one of the primer courses first
>>
>>52209798
but I own an old android phone, an m8 and a glaxy note pro, the point being that I can test on various different specs rather than just make assumptions based on synthetic performance.
>>
>>52209842
maybe I will faggot
>>
>>52209870
Get to it then cocksmoker. Make sure to publish your results.
>>
>>52209773
I guess if I where planning on developing for iPhone a MacBook would be the way to go, I work 4 on 4 off and earn a decent enough wage so I have the time to be able to learn this without needing to suck coccks to pay the bills, I do that for fun and british sausage is so much tastier anyway.
>>
>>52209878
Never fucking reply to me again unless you're contributing to the thread
>>
>>52209888
Shut the FUCK up

Is that crystal clear?
>>
>>52209663
I'm not quitting my job and going all in on this, ive noticed a gap in the market that has yet to be exploited and think theres a chance I can make some cash here, chance is the key word, maybe I'm hugely overestimating demand however the app is definitely something I would use at least every couple of days.
>>
>>52209887
Your application is of absolutely no intrinsic value.

If you go into a project believing that what you're doing is your key to your millions, then you'll just be miserable and sorely disappointed just like every other pipe-dreaming fuckstain.
>>
>>52209887
but sucking cock in sf is nice for your startup company
>>
>>52209888
>Never fucking reply to me again
What the fuck is up with self-entitled douches saying shit like this?
>>
>>52209934
It's the new le funny may-may, anon.
>>
>>52209887
>4 on 4 off

Like work for 4 days and then take 4 off? Is this as good as it sounds? Shit where do you live?
>>
>>52209904
I'm not looking at making millions but it would be nice if I could make enough to go into app development full time, this isn't going to be the next flappy birds for sure. The truth is I work for a living and I have no problems with my work but its going nowhere, I'm at the second highest stage in the company I will ever make and the next stage up is hardly my dream career, I want change of direction in my life and I think programming is the way to go, I was best in class when I did it in college, finished a 3 month assignment 4 days and received a distinction grade.
>>
>>52209942
yeah I do 4 X12 hour shifts then get 4 days off, I'm in the uk, the work is not amazing, I'm a machine operator, but its easy enough, spend a lot of time on my phone no stress whatsoever...its just boring and dead end.
>>
>>52209943
IF you get incredibly lucky, IF you manage to meet the right people at the right time, IF yours is the app that people find amongst the thousands released the very same day as yours, then maybe you'll make a little bit of money.

Lower your expectations, then lower them some more, you're literally pissing into the ocean when it comes to app development, doesn't matter how unique or special it is.
>>
>>52206105
Everyone take a guess what this program does
>>
>>52209942
there is a downside to it of course, my week is 8 days long, so its a bit hit and miss syncing up with friends but I think the 4 days off is definitely worth the sacrifice, my friends are dicks anyway :D
>>
>>52209970
Not him but you're severely underestimating how lucrative apps can be. "A little bit of money" is seriously understating what even a low popularity app will bring in.
>>
>>52209970
your app didn't take off huh?
>>
I am wrapping a C++ library so it can be used from C. But, the problem right now is that it's all done with void* which means everything needs to be heap allocated, which sucks. If I could do something like
sizeof(myclass)
in the header the C files are using I could use a struct like

struct myclass_C {
char p[sizeof(myclass)];
}


And it would be possible to return stuff on the stack, but that is obviously not possible. Is there any cleaner way to accomplish this than figuring out sizeof(myclass) and hardcoding it? It would obviously be preferable that this was automated rather than having to write a new number in if the size ends up changing when the C++ library is updated.
>>
>>52209979
is it an auto shitposter?
>>
>>52210000
Yeah if you're lucky.

>>52210001
I've never bothered because of what I said, it's all well and good but it's not a reliable cash cow unless you've got a lot of time and money to put behind it. A bigger developer could turn around a far better version of your application in a fraction of the time it took you to make it and crush your marketshare into nothing.
>>
>>52209887

>I have the time to be able to learn this without needing to suck coccks to pay the bills

If you live in SF, you'll probably need to suck cocks to pay the bills anyways. That said, it would be unwise to move to SF unless you really, REALLY need the VC money. California is full of terrible people, and San Francisco doubly so.

>>52209979

Looks like it opens a binary file, and prints out its contents encoded as base64.
>>
Any sticky or post for programming resources?
>>
File: postgrabber.png (510 KB, 1919x1079) Image search: [Google]
postgrabber.png
510 KB, 1919x1079
made my own file grabber, going to try to add GUI and a stream of actual post text, then make it update. :D
>>
>>52210024
>Looks like it opens a binary file, and prints out its contents encoded as base64.
correct
>>
>>52210021
not if I copyright the core functionality of the app.
>>
I currently have double the build configs -- for x64 and x86. Should I drop x86 altogether?
>>
>>52210048
Good luck with that senpai.
>>
>>52206247
all of them. that's the point of a turing complete language. Now get to work lazy fuck
>>
Lets put this 'negative numbers are a meme' meme to rest.

A negative number of things aren't real, the autist is right. But, it's an easy way for us to describe things. For example, debt, when someone has -$50, we know that he is $50 in debt, he doesn't literally have -$50.

Then there's reference points, when something is -5 meters above sea level, we know that it means it is 5 meters below sea level, it's not literally -5 meters above sea level.

So can we stop being autistic with negative numbers?
>>
>>52209979
>ToBase64
WELL
>>
>>52210050
Ask your userbase.
>>
test
>>
>>52210035
        WebClient webClient = new WebClient();
webClient.DownloadFile("http://boards.4chan.org/g/thread/52206105/dpt-daily-programming-thread", @"c:\chon\myfile.png");


why it doesnt work ?
>>
>>52210050
>not having some kind of telemetry in your products
>>
>>52210112
if you are asking why that doesn't work, I'd assume because that url doesn't point to an image.

or you are telling me that that works and is easier that what I did. then thanks?

I'm using java fyi
>>
>>52210064
Is that why two minuses make a plus senpai?

50 debt - 30 debt = 20 debt
-50 - -30 = -20
>>
>>52210166
No, srs question it was.
How do I point it to an image ? (not manually ofc)
can you show your java code ?
>>
>>52210165
>>52210066
fair enough
>>
>>52206105
I'm starting an astronomy study at University next year, what languages should I learn?
>>
>>52210210
Mayan
Farsi
Swahili
>>
>>52210210
download Atom, it has rocket for an Icon
>>
I am pushing my projects to 3 separate git remotes as redundant back ups. Is there some git command to push to all of them at once? Right now i have to write git push provider... 3 times and fill in login creds for each of them, but i would like to do all of that with one command
>>
A 1980's tutorial written for the 68k on how to make a compiler is more helpful than most of the modern texts.

Why are most tutorials on this so shit?
Even translating 68k to x86-64 assembly isn't that hard.
>>
>>52210196
you need to use regular expressions to split up the source code.
this gives you the url to the pictures.

following this should get you started.

https://docs.oracle.com/javase/tutorial/networking/urls/readingURL.html

but doing this for a thread gives you a really really long string, you can see it by right clicking and hitting "view source"
>>
>>52210252
Why do you not just let the server with the git repo on it back up itself.
>>
>>52210299
How? I am using services like github etc, so if the github dies for some reason you won't have any backups anyways
>>
>>52210284
Because good teaching is timeless.
>>
>>52210311
Those services have their own backups, there is no need to make your own backups on top of that. You could see your own working directory as a backup too.
>>
so question time, why does 4chan only have 1 line of source code? kind of shitty.
>>
>>52210374
takes fewer bytes so it loads quicker
>>
File: 1438349061351.jpg (166 KB, 405x720) Image search: [Google]
1438349061351.jpg
166 KB, 405x720
            String choice = "r";
while ((roundOver) && ((playerTotalScore < 100) && (computerTotalScore < 100)) && (choice == "r"))
{
int playerScore = randomGenerator.nextInt((6 - 1) + 1) + 1;
if (playerScore == 1)
roundOver = false;
playerTotalScore = playerTotalScore + playerScore;
System.out.println("Players score is " + playerTotalScore);
System.out.println("Computers score is " + computerTotalScore);
System.out.println("Roll or hold (r/h)");
choice = keyboard.nextLine();


Why won't this shit loop despite entering "r" at the end of the turn?
>>
Hello /double penetration/,

Why is python so fucking comfy?
It has all the freedom of an interpreted language, but non of the obscure, unreadable shitty hipster syntax that a lot of similar languages have.

Plus it's lightning fast with compiled c libraries and it's easy as shit to add your own.

Why would anyone use any other language?
>>
>>52206105
Serious question, what is the advantage of OOP over non-OOP code?
>>
>>52210383
is that really true?
that's a pretty dumb reason to trash readability.
>>
>>52210252
http://stackoverflow.com/questions/14290113/git-pushing-code-to-two-remotes

Also, set up your ssh keys to avoid the password prompts.
>>
>>52210009

From a vague memory sizeof on classes is probably computed at run time (maybe because of polymorphism?), so you cannot do that.

Check out constexpr, but this is a C++11 thing so it may not be applicable.
>>
>>52210402
>implying the people working on it see it that way
It gets sent through a program that strips away unneeded white space, retardo.
>>
>>52210390
Try using breakpoints to check the values
>>
>>52210390
holding r won't add an r to the next line, there is a delay and a speed afterwards.
>>
>>52210402
it wasn't written that way obviously
>>
>>52210442
>>52210427
obviously, I'm just saying that it looks garbage for 3rd parties.
>>
>>52210354
But like i said, if the github company for example goes belly up you will never see your data again, it would be silly to entrust all of your eggs to some strangers basket
>>
>>52210451
Thats on purpose.
Not only it loads faster but it provides small level of code obfuscation not to mention nonretarded ides automatically parse code on copypasting
>>
>>52210408
I added ssh key for the gitlab and i now push via https but it still asks for user name and pass every time
>>
>>52210409
Yes, I can't use any C++ features in the header file since it's going to be included by C programs. That means the header file can't directly include the class that it's wrapping.

I went with the hardcoded approach for now but I'm getting fucked by casts in C++ not working how I want them to.
>>
>>52210454
there are up and coming companies that may overtake it one day, and if github ever went under, they would sell the backups to another company, your files would be fine bro. you'd just have to look somewhere else.
>>
>>52210397
Its just a different way of organizing your code.
>>
File: eee.png (241 KB, 645x363) Image search: [Google]
eee.png
241 KB, 645x363
How am I supposed to read and understand algorithms?

The symbols are confusing.
>>
>>52210489
Average dev would happily take such chances with their work, but me? Never.
>>
Thinking about getting into developing proprietary software.

What markets should I go into? Apple apps? Android apps? Something else?
>>
>>52210489
>>52210532
There have been instances where companies rely on GitHub being up to do production deploys.

Actually, I've seen it in every "GitHub is down!" thread on HN so far.
Thread replies: 255
Thread images: 33

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.