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

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

Thread replies: 255
Thread images: 34
File: 1457789436458.png (213 KB, 700x1021) Image search: [Google]
1457789436458.png
213 KB, 700x1021
Friendly reminder that dressing like a schoolgirl improves programming ability.
It's a scientific fact!

Also, what are you working on, /g/?
>>
j-java is best edition
>>
>>54809718
Old thread >>54806107
>>
>>54809718
>Posting new threads before the bump limit
>No linking the old thread
>Literal faggotry
Delete this shit and kill yourself.
>>
>>54809718
why is she sad anon?
>>
>>54809861
>she
>>
Well at least you're having a little diversity in your choice of crossdressers...

Anyways, on the subject of programming... why the hell does print debugging just magically work in 95% of cases?
>>
>>54809861

She's sad because somebody tried to cover up their shitty opinion with a lengthy diatribe, expecting that people would unable to read between the lines. I'm not saying C and Python are bad, but I will skirt the subject.
>>
>>54809741

>Java is best
Are you betraying your love of .NET?
>>
>>54809797
Jokes on you, I'm a math major.
>>54809781
It works with the driver it was given. Beyond that, though....
>>54809803
Just wanted to make sure.
>>54809807
Maybe once the quarter is over.
>>54809839
It's a deque. But, yeah, we fucked.
>>
>>54809891

Just some light shitposting. I'm tired of people thinking they can conceal their inane """opinions""" in endless bloviation and that it somehow makes them sensible or correct, that's all.
>>
>>54809718
Why is this male dressed like a schoolgirl.
>>
>>54809879
>why the hell does print debugging just magically work in 95% of cases
Because most of the time, all you need to know what the state of a couple variables are.
>>
>>54809879
>why the hell does print debugging just magically work in 95% of cases?

I used printf debugging before I even knew what debugging was. It just feels like a natural step.
>>
>>54809929
What is ""this"" all about? I began to see it done """the other day""", but have yet to figure out why.
>>
>>54809968
It's scare quotes taken to the extreme.
>>
>>54809968
it represents an obnoxiously overdone quantification mark hand gesture.
>>
>>54809968

Excessive application of a particular character for comedic purposes. Kind of like LISP.
>>
>>54809989
rekt
>>
>>54809941
Because he fell for the crossdressing meme.
>>
>>54809989
B-but Lisp parenthesis have meaning
>>
Hey guys, who here loves assembly master race like I do?
>>
I'm working on a program that reads in a file, interprets its binary data as colors, and displays it in different ways. I just finished a simple 4chan thread downloader so I can more easily archive stuff on /w/, /wg/, and a few other boards.
>>
>>54810045
Tried programming with it once
Never again
Didn't help I was using Gentoo with absolutely no GUI
>>
>>54810045

It can be fun at times, but I wouldn't use it to write anything large. Do you have a favorite ISA to program for?
>>
>>54809968
When you use single quotation marks to sarcastically say something, using lots of marks increases the effect.
So this:
>polish "intellectuals"
turns into:
>polish """""""""""""""""""""""""""""intellectuals"""""""""""""""""""""""""""""
As always, it's an /int/ thing.
>>
File: 1463770045787.jpg (47 KB, 640x503) Image search: [Google]
1463770045787.jpg
47 KB, 640x503
>>54810032

I know, m8. It were bants. I actually have come to love [spoiler]parens[/spoiler].
>>
When did the C++ committee lose its mind?
https://channel9.msdn.com/Shows/Going+Deep/C-and-Beyond-2012-Andrei-Alexandrescu-Systematic-Error-Handling-in-C
I watch this and I just feel burning rage for all their language syntax masturbation.
>>
>>54810032
Haskell's `$' operator solves it
>>
>>54810152
>When did the C++ committee lose its mind?
They never had it to begin with.
>>
File: Screenshot_2016-05-29-21-53-53.png (127 KB, 1080x1920) Image search: [Google]
Screenshot_2016-05-29-21-53-53.png
127 KB, 1080x1920
I can't find an explanation worth a damn on google and I know ill get shitposted on here, but can somebody explain how this works?
>>
>>54810154
Prefix notation is patrician
>>
>>54810152
that looks just like Maybe's
why is that bad
exceptions are dogshit for error handling
>>
>read /r9k/
>they're having a programming discussion
>>>/r9k/28913262
>>>/r9k/28913461
>>>/r9k/28913529
>>>/r9k/28913687

These people are seriously damaged..
>>
>>54810215
>caring at all about what /r9k/ has to say
>>
>>54810196
Go read a book. It'll be one of the first things they explain.
>>
>>54810212
>that looks like Maybe's
Yeah. It's a very odd implementation of maybe's intended to pass exceptions instead of nothing in case it goes wrong because they wanted error information to deal with the issue.
See 17:00. He mentions it.
>>
>>54810234
Well its 10 o'clock here so I can't just pop over to the bookstore. Also Should I look at learning java?
>>
>>54810261
>It's a very odd implementation of maybe's intended to pass exceptions instead of nothing in case it goes wrong because they wanted error information to deal with the issue.
That would normally be taken care of with Either.
>>
data Value = Numeric Integer | Boolean Bool | ERROR
deriving Show

data MemVal = Stored Value | Unbound
deriving Show

type Memory = Ide -> MemVal

type State = (Memory, Input, Output)

display :: Memory -> String
display m = "x = " ++ show (m "x") ++ ", y = " ++ show (m "y") ++ ", z = " ++ show ( m "z") ++ " "

update m ide val =
\ide2 -> if ide == ide2 then Stored val else m ide2




I'm doing this Haskell interpreter thing to learn Haskell and there's some pre-existing code I have to build upon.

I just don't get how the update function works with the Memory type, I think the Memory type is essentially a function that takes in a identifier.

And how does the Memory get stored as something that can be passed to the display and update functions?
>>
>>54810196
>#include <stdio.h>
Includes functions from the stdio.h header file. Includes things like printf() which you use later.
>main(void)
Entry point for the program.
>printf("..")
A function available in the C standard library which lets you print a formatted string of text.
>return 0
0 is used to denote success. Its a way of telling whatever started your program "I ran fine".

Just go through this:
http://c.learncodethehardway.org/book/
Or whatever. C isn't a difficult language once you get into it.
>>
>>54810265
holy fuck you're dumb
>>
>>54810341
Condidering the shitshow that was the last thread my mind is just really numb right now
>>
>>54810338
Learn c the hard way is fucking garbage
>>
I'm running into a problem when programming an AF_UNIX server in C.

It's structured so that the user can define a thread pool, and threads from that pool will accept connections from socket IDs stored on a list.
I'm filling the list through another thread which is in charge of running accept on the socket and returns the new ID the other threads will use.

Sounds like a fairly standard producer/consumer problem which I tried to solve with conditional variables.

So my producer thread works something like this:

while(1)
{
do
{
if((chk = pthread_mutex_lock(&connQueue)) == 0)
{
if(queueLength + currentconnections < maxconnections)
// accept on the socket ID I pass the thread and save in a list
if((list.socketid = accept(socID, NULL, 0)) == -1)
{
pthread_mutex_unlock(&connQueue);
exit(EXIT_FAILURE);
}
else
{
// add element to list
pthread_cond_signal(&connectionQueueWait);
pthread_mutex_unlock(&coQU);
}
}
else
{
pthread_mutex_unlock(&coQU);
}
}
while(err != 0);
}


But it works horribly.
This is a test output. The same thread (I have 30 active) handles a ton of connections all at once, and some times it doesn't even process the last connection.
pastebin /KBvrqUWm
>>
>>54810308
You're right about Memory being a function. As for how it gets passed to display or update, functions are first-class members and can be bound to names, so if you had an identifier x of type Memory you could use it as an argument to display or update which would then apply X to an identifier in their bodies.
>>
>>54809718
Thanks for this new artist, OP

I will fap to his work in honor of you
>>
>>54810409
apply x in its body*
>>
>>54810265
>Well its 10 o'clock here so I can't just pop over to the bookstore
there are books and tutorials online

>Also Should I look at learning java?
yes

https://docs.oracle.com/javase/tutorial/
>>
>>54810403
Also it's 4 in the morning and I fucked up the code snipset. To make it more readable I went on and changed the name of the mutex variable from "coQU" to "connQueue" but then left 2 coQU in that code.
The code to add the element to the list containing the connections waiting to be read is there, I just removed it from this example because it's irrelevant right now.
>>
>>54810398
this

fuck z.s.
>>
>>54810398
>implying anon is at the stage where quality matters more than his indecision
It's better he just reads than than procrastinates.
>>
>>54810472
>implying he even needs a book to read about hello world
>shilling this hard
>>
>>54810308
In Haskell, functions can be passed around as values like anything else. You can think of Haskell functions as being roughly equivalent to immutable tables, where you put in your key (argument) and get a value (result).
>>
>>54810502
>shill
I pointed to a free resource. Suggest an alternative. I'm sure it's just as good. I don't feel strongly about learn c the hard way.
>>
>>54810506
lisp also has that feature
>>
File: segfaulting.png (19 KB, 813x895) Image search: [Google]
segfaulting.png
19 KB, 813x895
Let me tl;dr explain whats going on.

1. First function makes dynamic 2d array and converts 1 and 0's from input file making a board for game. Prints out correctly.

2. Second function I'm trying to pass in the 2d array that is now filled for the game. It's getting correct rows and cols as tested, and should print the exact board as above did, but it seg faults.

Any ideas?
>>
>>54810546
Yes, it does. Most languages do, nowadays, but Haskell makes it much more seamless than most, and so does Lisp.
>>
>>54810546
does lisp even support proper partial application
>>
>>54810506
>functions can be passed around like values
Not him but are you talking like function pointers or can you somehow keep copies of functions and alter them? Haskell seems a lot more rad now.
>>
>>54810578
you are in for a new world called FUNCTIONAL PROGRAMMING
functions being values is only the beginning
>>
>>54810196

>#inlcude <stdio.h>
In C, a line beginning with a # is a special kind of directive handled by the preprocessor. Before the compiler even begins trying to make sense of what your program does, the preprocessor is going to do a bunch of text substitutions based the preprocessor directive.

The #include preprocessor directive tells the preprocessor to find a file in the standard include path and copypaste its entire contents into the file you're compiling. This is typically used with what is known as a "header" file to provide type definitions and forward-declared functions (more on that in a bit) so that the compiler can know of their existence. The file stdio.h contains information about C's standard I/O utilities, including the printf function.

>int main(void) {
Here we define a function called main, which returns an integer (32-bits, signed on ARM Linux, which is what I'm guessing you're using), and takes no arguments. In C, the name "main" is reserved for a special function that serves as the program entry point. That is, the function main is called when your program starts up.

>printf("hello world\n");
This calls the function printf and supplies it with an argument that contains a pointer to a block of memory containing the text string "hello world\n". This effect of this is that the message "hello world", followed by a linefeed character, is printed to your terminal.

>return 0;
As mentioned before, main is a function that returns an integer. The integer here is 0, and the return value of main is going to be used to indicate to your terminal the exit status of your process. A 0 is a typical standard for saying "everything went fine!"
>>
>>54810578
Much more powerful than function pointers. Values of function type in Haskell are always closures.
https://en.wikipedia.org/wiki/Closure_%28computer_programming%29
>>
>>54810552
>That tab length
Fucking hell man
>>
>>54809741
Man i just tried Java via android development and i wanted to blow my fucking brains out, coming from C#. It felt like every line needed a fucking import, tell me i'm just shit and this isn't reality.
>>
>>54810632
it's android that's shit, if you do android dev with xamarin it's the same shit

also ctrl+shift+o to auto-import in eclipse
>>
>>54810632

C# is better.
>>
>>54810632
Nope. Android dev is shit. Go find a library of some sort instead. It's what anyone willing to keep their sanity is doing. (not that it helps much)
>>
>>54810552
why does printing the board take a Position param
>>
>>54810648
>>54810672
Thanks lads, knew I could count on you lot to reassure my inability.

>>54810664
Sadly it doesn't run on android brother.
>>
>>54810715
Considering you're from C#.
Consider https://www.xamarin.com/
I haven't used it but I've been told good things about it by shills. For what that's worth.
>>
>>54810728
>micro$hit
>on a gjewgle platform
shit on top of shit
>>
>>54810627
The linux kernel codebase uses 8-width tabs
>>
>>54810632
> every line needed a fucking import
Please don't tell me you manually import anything? Nobody actually does that you fuckwit.
>>
>>54810738
Eventually when you stack enough shit. You have enough other people to blame to make yourself seem ok.
>>
>>54810675
It's for later use for the game piece, its a struct. Doesn't apply to it atm.
>>
>>54810728
Oh shit i didn't know this existed, fingers crossed it just werks. Thanks.
>>
>>54810747
It was an example, calm down Rajeesh.
>>
Why does everyone have Indian names? Are you all from India or something?
>>
>>54810800
nice try pajeet
>>
>>54810790
I guess in C# you're forced to manually import everything?
>>
>>54810819
Haha. Sorry my friend you're mistaking me for someone else.
>>
>>54810828
Not him but. Doesn't the fact that you have so much stuff to import that you automate the process somehow make you worry?
>>
>>54810834
You should probably off yourself right now and get over it you loser
>>
>>54810828
It's IDE specific.
>>
>>54810728
Looking for a way to run it on Linux, doesn't seem possible. Unless anybody here has a solution?
>>
>>54810844
no? wouldn't it be more worrying to have all kinds of OS stuff all in one scope?
>>
>>54810844
No, I literally write the class name, e.g. Date and IntelliJ shows me a list of packages that include the class Date. I pick the package that contains the right one (it's basically just autocomplete) and it imports it for me. Same when I delete it, the import is gone. It's never been a problem for me or anyone I can think of.
>>
>>54810858
>C#
>Linux
what are you doing with your life mate
>>
>>54810862
>>54810867
Well it's more about the idea that your application is wrapping far too much stuff. I'm not used to that kind of development. I #include GLFW and then I'm pretty much done with external libraries.

Id be worrying sick if I had to keep track of all those things. I mean, if it had to be automated it's likely multiple thousands different imports right?
>>
>>54810828

No, but the difference is that using VS with IntelliSense is comfy. It is the best auto-complete I have ever used. It's better than mere auto-complete, even.. it just KNOWS what I want to do before I even do it. It's like Microsoft is reading my mind.
>>
>>54810606
I appreciate you
>>
>>54810869
I enjoy using Linux, i don't enjoy writing in Java but would like to try android development. Are we up to speed on my retarded dilemma now.
>>
>>54810891
if you use C# with xamarin it's still the same shit, just look at the docs, it's pretty much the same methods but renamed to PascalCase instead of camelCase
>>
>>54810883
I don't have that experience with intelisense at all.. I can be writing simple code and it just gives me random defines from windows.h or whatever. How do I fix that? I'd really like to simply not have it suggest shit from windows.h to be honest. It's not like I ever use a Windows function without reading msdn anyway. They're far too strange to dare do that.
>>
>>54810881
it's not an issue at all, like if you handle input events you import android.view.View.OnTouchListener and override the onTouch method which takes a View and a MotionEvent so you import those as well, and to import it all you just press ctrl+shift+o
>>
>>54810905
>They're far too strange to dare do that.

You mean you don't like like using RtlWriteDecodedUcsDataIntoSmartLBlobUcsWritingContext(...) on a lark?
>>
File: output.webm (186 KB, 484x278) Image search: [Google]
output.webm
186 KB, 484x278
>>54810881
??
>>
It's much better for C#, though. For C/C++, I use CLion.
>>
>>54810883
Is it any different than IntelliJ autocompletion?
>>
>>54810979

It just seems slicker to me. More often it knows what I intend to do, I find.
>>
>>54810760
I'm not sure why you're experiencing an issue. Is anything happening between the two function calls that could be compromising?
>>
So in a freestanding C environment there's no C standard library, but some things are included in the compiler like float.h.

Why don't they just include the standard library in the compiler like they're including other things?
>>
>>54811347
Because C isn't necessarily going to be used in situations where it makes sense to require the standard library.
>>
>>54811385
So someone can easily include the standard library if they want?
>>
>>54811500
If you're going to use the standard library then you don't need a freestanding implementation.
>>
When people talk about I/O like non-blocking I/O are they talking about writing and reading to the hard drive or is it in a networking context, like writing to a socket and reading from it?
>>
>>54811347
>but some things are included in the compiler like float.h
All of the things included with freestanding C code are just macros and typedefs or some implementation defined stuff. Non of them contain any actual functions or code.
>Why don't they just include the standard library in the compiler like they're including other things?
Because freestanding C may be used in situations where the standard library isn't needed or isn't appropriate. Much of the standard library requires facilities of an operating system kernel, but what if you're writing a kernel? What is it going to rely on?
>>
>>54811510
>>54811548
Thx

I get it now. It relies on kernel features so you need them first.
>>
>>54811524
>are they talking about writing and reading to the hard drive or is it in a networking context
They could be talking about either. "Non-blocking I/O" pretty much refers to all interactions between your program and the outside world.
>>
>>54810196
>touchwizz
>>
>>54811563
Thanks anon
>>
File: 1464542237759.jpg (161 KB, 414x615) Image search: [Google]
1464542237759.jpg
161 KB, 414x615
What's the best way to get Emacs running on Windows?

I feel like the official instructions from GNU are deliberately misleading.
>>
>try working on complex project
>it's too hard and I quit
>work on simpler project
>making magical progress but feels like shit cause it's too easy
>>
>>54811524
Blocking and non-blocking is more about whether things can happen concurrently or not, whether that be a program executing another section while/ instead of waiting on i/o or another thread / process / program being able to use the same i/o resource concurrently with it.
>>
>>54811607
I don't get it though, if non-blocking uses one thread then how can it process other requests while it's busy with another? how is it faster to let one thread do everything than start other threads while having one thread to wait for requests?

I may be too retarded for this
>>
>>54811596
Literally download the zip file, extract where you want it, and run the executable.
Really not all that complex.
>>
File: main.png (11 KB, 447x539) Image search: [Google]
main.png
11 KB, 447x539
>>54811101
Not sure. Here is where they are being called.
>>
I decided to finally get into programming. Java or C#?
>>
>>54811639
Just take it slowly and read a little bit about: busy waiting vs non-busy waiting, then concurrency vs parallelism, and then blocking vs non-blocking i/o.
>>
>>54811718
Neither.
>>
>>54811742
Alright, thanks. I'm reading on it.
>>
>>54810026
It's not a meme, you should try writing Haskell while wearing a skirt.
>>
>>54811718
java
>>
File: 2016-05-30 00_17_06-Atomica.png (112 KB, 551x797) Image search: [Google]
2016-05-30 00_17_06-Atomica.png
112 KB, 551x797
So what should I do with this empty space?
I highlighted the two empty regions with the black rectangle.

Any cool features or ideas on what to implement here? Or should I keep it as is and minimal.

First GUI project, so i'm trying to polish it up.
>>
File: TlceKZ0[1].jpg (295 KB, 1666x1102) Image search: [Google]
TlceKZ0[1].jpg
295 KB, 1666x1102
>>54811842
visualizer at the top
make the volume have like a mountain shape in foobar2k

so check foobar2k, the visualizer next to the volume
>>
>>54811931
top of your empty region*
then of course have a play, stop, next, back buttons
>>
>>54811791
He writes in C though
>>
I've been sitting at my computer all day and I got nothing done
Kill me
>>
>>54811966
Put on a skirt and write a custom heap allocator in C.
>>
>>54811947
>>54811931
Some really good suggestions here. Appreciated.
I was also thinking about implementing that wave-bar seeking (to see the song structure, like you have)

Is it worth implementing toaster popups/notifications (lightweight hopefully and noninstrusive)
>>
>>54809718
>Friendly reminder that dressing like a schoolgirl improves programming ability
Is this true?
>>
>>54812171
no
they are the worst programmers

You need to grow a large beard to gain programming ability
>>
>>54812171
>>54812224
Think of it like an RPG, senpaitachi. You equip your breastplate, helmet, gloves, accessories, and so on, and they all contribute to your abilities.
>>
>>54812171
>>54812224
it does, you also get to fill a minority quota.
>>
>>54812269
fucking degenerate.
Restore your family honor anytime.
>>
>>54811701
And it segfaults on the first iteration of your double loop?
>>
>>54812171
no
>>
>>54812307
I'm not sure what you mean, but the first function prints it and loops through it just fine. When it goes to the second print out (or however many times its supposed to loop in the while loop in main) it seg faults on the first time.
>>
>>54810552
what does make_char_array do?
>>
File: 1464543304475.jpg (32 KB, 247x247) Image search: [Google]
1464543304475.jpg
32 KB, 247x247
fucking Emacs (+ evil-mode) is awesome

I can't believe I wasted my life with Vim
>>
>>54812686
hmm. perhaps try
cout << board == 0 << endl;
cout << *board == 0 << endl;

To see if either pointer is null.
>>
File: 1443500977688.png (835 KB, 1200x1080) Image search: [Google]
1443500977688.png
835 KB, 1200x1080
/dpt/-chan, dai suki~

>>54812171
yes

>>54810506
It's know as first class function.

https://en.wikipedia.org/wiki/First-class_citizen
https://en.wikipedia.org/wiki/First-class_function
https://en.wikipedia.org/wiki/Higher-order_function
https://en.wikipedia.org/wiki/Higher-order_programming
>>
>>54810552
>>54811701
you dinguses! board is local to the function! board in main is still not initialized after the first function call
>>
File: fore.png (722 KB, 600x575) Image search: [Google]
fore.png
722 KB, 600x575
What the fuck do I work on?
I never know what to do/make or anything.
>>
>>54812884
make the shittiest game ever and put it on steam greenlight
>>
Hey /dpt/, if you had a web browser with a buffer overflow vulnerability that could be exploited from a malicious piece of javascript, would it be unreasonable to believe that one could return to libc from said malicious Javascript?
>>
>>54810578
It doesn't alter functions or copy them, but it references them exactly like function pointers. If you've used C++, all functions are like functors (classes with an overloaded operator() ) in that they can have some attached state (or like lambdas, essentially)
>>
>/dpt/ on page 5
what the fuck
>>
>>54813387
>middle of the night in 'murrica before a monday
>monday morning in yurop
>>
>>54813407
Mid-day exactly in India
/dpt/ should be lit up like the sun
>>
At what column do you prefer to wrap lines, /g/?
>>
>>54813703
i seriously hope you don't auto-wrap lines

just wrap at a point where it makes sense like at a binary operator
>>
>>54813703
Before column 80 at the end of an expression or before a binary operator.
>>
>>54813721
I don't, I was just curious at what line length most people started to look for a place to break.
>>
>>54813824
for me it depends, if the expression lends itself to being wrapped easily then it could wrap at like 80, otherwise if it would be ugly looking or if the line doesn't have to be readable at a glance it can stretch to 120 or maybe 140
>>
>>54813876
also there could be other solutions to shorten the line like turning a part of the expression into another variable
>>
>>54812839
how da fack do i bring it out?
>>
>>54814001
draw_initial_board has a side-effect: it sets up the board in-memory as well as drawing it. You should have one function to start the board and another function to draw the board. The function to start the board could take a filename and Position and return a pointer to the allocated board. Then draw handles all drawing.
>>
>>54814032
Alright, thanks for the tips man.
>>
>>54814001
the easiest would be to move the initialization part in the first function (before the loop starts) to the main function
>>
I'm trying to compile the Trinity Desktop Environment, and it needs tde-arts. So, when I try to compile it, it fails at iomanager.cc because of a narrowing conversion, and the code which it fails at is like this:
struct timeval never = { 0xffffffff, 0 }
>>
>>54814565
What is timeval made of?
>>
>>54814565
Try casting the 0xfffffff to uint or just remove -Werror flag.
>>
>>54814589
What are you talking about?
I'll admit, I know jack shit about programming, I just want to use a desktop environment that I'm familiar with, but in any case, what do you mean by What is timeval made of?
>>
I'm using Python and Tk to create multiple entries and to get the content of these entries into a list, but all I get at the end is an empty list

for i in range(1,17):
name = 'Slot #%d' % i
self.slotlabel = tk.Label(self.topslots, text = name, padx = 10)
self.slotentry = tk.Entry(self.topslots)

self.slotlabel.grid(column = 1, row = 1 + i)
self.slotentry.grid(column = 2, row = 1 + i)

slottype.append(self.slotentry.get())


What am I doing wrong?
>>
>>54814601
Like what are the member types?
>>
>>54814616
I know almost nothing about C++,
so can you explain what are member types?
>>
>>54810627
If you render tabs as anything other than 8 characters wide you're wrong.
>>
>>54814635
Just link me to the api or something dumbass
>>
>>54814635
Can you show us where this source code is so we can work this out?
>>
Anyone have experience with daterangepicker.com? How the hell do I change the template without modifying the original code.
>>
>>54814616
       The macros are provided to operate on timeval structures, defined in <sys/time.h> as:

struct timeval {
time_t tv_sec; /* seconds */
suseconds_t tv_usec; /* microseconds */
};
>>
>>54811639
You use something like epoll(4) on linux, select on other things. Basically you set up a file descriptor to represent a poll on a bunch of open file descriptors and just block on the poll. What's wonderful is that you can represent most things a file descriptors.

You can use threads too, but they're heavier weight.
>>
>>54814686
What types are time_t and suseconds_t?
>>
>>54813049
> return to libc
I don't think that means what you think it means.

But yeah, there's a good chance you could get something to jump where it's not supposed to and take control, or poke values somewhere they don't belong.
>>
>>54814665
If you wanted the entire dependency, here's the download link: http://bg1.mirror.trinitydesktop.org/trinity/releases/R14.0.3/dependencies/arts-R14.0.3.tar.bz2
File is located inside the archive at dependencies > arts > mcop > iomanager.cc
>>
>>54814708
platform dependent
>>
>>54814729
Try casting to the respective types, might belay the warnings
>>
>c++ class
>learn STL containers one lesson
>assignment is to write a program that does blah blah by using STL containers
>ambiguous about whether that means we can *only* use STL containers or whether we can also use things like structs and c-strings

so I have a 50/50 chance of getting the assignment correct
>>
>>54814744
Like just the aliases
>>
>>54814749
of course you can use structs and C strings you dolt
why you'd want to use C strings in C++ is beyond me
>>
>>54814749
Ask someone you retard. But they probably mean to use the STL wherever you can, don't use an alternative if there's an STL version available.
>>
Node.js has a web workers implementation in a pull request, but they aren't giving it much attention.

What the fuck is these node faggot's problem? Why the fuck do they hate threads so much? All you have to do is make a fucking thread implementation that works with its own eventloop. Then you can just make a function and it'll get back to you with whatever results from that same event loop. It's like how the fucking I/O works under the hood. But actual Javascript code. Jesus assraping christ

Come on, its OK, show daddy where the threads touched you.
>>
>>54814840
Maybe because that'd require locking on the event loop which would be shared so you'd be effectively degrading the performance?
>>
>>54814896
They already have a motherfucking event loop running with a million threads doing I/O under the hood and it's not blocking shit, how the shit would it degrade performance?
>>
Will having backend web dev hurt my CV when I try to apply for some other programming jobs outside web dev?
>>
>>54815050
I don't see how having backend experience would hurt. There are people who can only frontend with html and css. Backend shows better understanding, right?
>>
>>54815081
Did I fall "web developers need to die is not a meme" meme?
>>
>>54814724
>http://bg1.mirror.trinitydesktop.org/trinity/releases/R14.0.3/dependencies/arts-R14.0.3.tar.bz2

What in the fuck? Why does this tarball force me to go down three directories before finding anything? Why is building it so hard they have to make a god damned wiki for it.


What is this shitty product?

h5.. reading.
>>
#include <cstdlib>
#include <sstream>
#include <iostream>
using std::exit;
using std::cout;
using std::cerr;
using std::istringstream;

int main(int argc, char const **argv) {
int const max = [&argc, &argv]{
switch(argc) {
case 1: return 100;
case 2:
{
int n;
istringstream i(argv[1]);
i >> n;
if (!i) {
cerr << argv[1] << " is no number\n";
exit(1);
}
return n;
}
default:
cerr << "too many arguments\n";
exit(1);
}
}();
for (int n = 1; n <= max; n++) {
switch((n % 3 == 0 ? 1 : 0) + (n % 5 == 0 ? 2 : 0)) {
case 0:
cout << n << "\n";
break;
case 1:
cout << "Fizz\n";
break;
case 2:
cout << "Buzz\n";
break;
case 3:
cout << "Fizzbuzz\n";
break;
}
}
return 0;
}

R8 my C++ fizzbuzz, /g/!
>>
>>54815141
>(x : bool) ? 1 : 0
>(x : bool) ? 2 : 0
What the fuck are you doing?

(!!(n%3)) + 2*(!!(n%5))
>>
>>54815137
The following build order seems to work:

...

If the package you're trying to build is on the list of those that will build with cmake, try that first, because its autotools files will be unmaintained, bit-rotted, and possibly outright broken.
...
For those packages that still need to be built with autotools...
Not well documented anywhere, but when building with automake several packages need the --enable-closure configure option...
Build Times: ... Approximate total time: 5 hours 51 minutes



Jesus Christ I was going to try and help build this but..
>>
>>54815183
What happened?
>>
>X.org
Anyone know what event->response_type 64 is? It's coming from the window manager when I get iconified, but I can't find it in any documentation.
>>
>>54815219
But I'm not sitting through this. Why is anyone trying to build this unless they are developing the product or an OS packager?
>>
C++ newfriend here. I'm trying to write a logarithm function that will work for positive and negative inputs, meaning it'll have to return either double or
std::complex<double>
depending on the input parity. How do I do this? My best attempt so far is

template <typename T>
T ln (double input)
{
if (input >= 0)
{
double output = log(input);
return output;
}

else
{
std::complex<double> output (log(-input), M_PI);
return output;
}
}


which won't compile.
>>
File: quacker.jpg (58 KB, 541x566) Image search: [Google]
quacker.jpg
58 KB, 541x566
Error codes or exceptions?
>>
>>54815358
Optional, Maybe, try

Exceptions are considered harmful
>>
>>54815358
Sum return types

Option/Maybe T is an example, of the form
None | Some : (\x:T)
>>
File: 1461131537219.jpg (227 KB, 838x1024) Image search: [Google]
1461131537219.jpg
227 KB, 838x1024
Does anyone have ideas for simple (or very slightly complicated) multi-threaded programs? Something like the DPT challenges but with multiple threads in mind.
>>
>>54815358
My code responds to any and all errors by calling a kernel panic.
>>
>>54815358
Monads.
>>
>>54815528
Social simulation (fantasy) with one town/core & town->town interactions
>>
File: cpp.png (59 KB, 1354x602) Image search: [Google]
cpp.png
59 KB, 1354x602
HURR THE TECH INDUSTRY IS SO HOSTILE TOWARDS WOMYN

fuck this world
>>
Hold me
Linked lists are still slow at appending for data over 10k items
ResizeArrays are near constant
>>
>>54815746
Use lazy immutable lists
>>
File: neo,thereisnobool.png (10 KB, 733x289) Image search: [Google]
neo,thereisnobool.png
10 KB, 733x289
people like to screenshot tweets and shitpost with them

can we start doing the same thing with stackoverflow posts?
>>
>>54815761
You can do whatever you like son, this is a free image board
>>
>>54815775
But don't post porn or b&
/g/ is God's blue board
>>
File: image.jpg (66 KB, 600x482) Image search: [Google]
image.jpg
66 KB, 600x482
>>54815757
Even worse kek
Stack overflows
>>
>>54815253
M8 this is static typing, types must be known at compile-time, and fyi templates are expanded at compile-time. Best you can do is use std::complex in both cases, or if you insist on using only one double half of the time, have 2 versions of your entire calculation compile (not just of log, of everything that interacts with log and its types). Protip: that's where templates come in handy.
>>
>>54815183
Try fixing the file, then upload it and I'll try to build it myself.
>>
>>54815798
Depends what you're doing
>>
>>54815861
Yea I just use linked lists anyway

Not like I process that much data
>>
>>54815858
>try fixing the file
>that cluster fuck

You've... you've never written C have you? That could literally take a person a week to figure out what's wrong.
>>
>>54812825
>programming-motherfucker.com

Is that really Zed's site?
>>
>>54815905
As I've said, I know jack shit about C.
Is there any workaround to this?
One anon told me to remove the -Werror flag, how can I do that on make or gcc?
>>
File: auti.png (1 MB, 950x899) Image search: [Google]
auti.png
1 MB, 950x899
>I think you'll find I'm a pretty tolerant boss, but Gleb, in your last commit you did use spaces over tabs. I don't know why you'd commit that, so just tell me why on earth you'd do something like that
>They are pretty much the same.
>No, no they are not the same. At least in my book. One is right and the other is wrong

I don't know what's better(or sadder). That the show actually portrays the autism that fuels trivial programmer arguments or that they got the argument so incredibly right.

Anyway, they closed the debate.
It's tabs.
We can all go home.
>>
>>54816147
>tabs over four spaces

Fucking plebs.
>>
>>54816147 >>54816225

I use tabs in .h and spaces in .cpp
>>
>>54815165
>(!!(n%3)) + 2*(!!(n%5))
absolutely disgusting
>>
>>54816238
shit bait
>>
>>54816147
>>54816225
it's obviously tabs for fuck's sake there's no question about it
>>
for new friends
When they say spaces vs tab
They mean tab key = X number of spaces or tab key = the 'tab' character
>>
>>54816238
I use tabs in loops, spaces in conditions and C-style comments in function bodies.
>>
>>54816365
Off self
>>
>>54816365
all aboard the bait train
>>
>>54816384
>>54816434
>implying
>>
what are the assembly instructions for !n
>>
>>54816496
xfv
>>
>>54816496
same as n == 0?

>>54816502
you having a laugh?
>>
File: 1458660324723.jpg (6 KB, 164x216) Image search: [Google]
1458660324723.jpg
6 KB, 164x216
>>54816482
>>
File: 1464554357981.jpg (784 KB, 902x720) Image search: [Google]
1464554357981.jpg
784 KB, 902x720
>>54816482
what the fuck man
>>
>>54809879
>why the hell does print debugging just magically work in 95% of cases?
Because we programmers overlook the obvious 95% of the time, being egotistical pricks.
>>
>>54816496
whatever they are they're completely portable and shared across every target
>>
>>54809879
>Anyways, on the subject of programming... why the hell does print debugging just magically work in 95% of cases?
if something is not working quite right... step through the code and if it still looks fine, test your assumptions... if the prints are according to your assumptions print something else until it doesn't fit your assumptions and then you've found the problem
>>
>>54816291
My tab key has been broken for about a year and a half, so I use vims 'expandtab', and 'smarttab' and use spaces for everything.
>>
i'm getting to the part in SICP about procedures as arguments and high order procedures and i'm starting to feel like i'm entering the twilight zone. i still think i get what it's talking about right now but i feel like soon i'll be in bizzaro world
>>
can someone explain the purpose of lambda in scheme to me? i don't see why you wouldn't just either make a named procedure or not make a procedure at all
>>
>http://briancarper.net/blog/520.html

I just swallowed my own vomit.
>>
>>54817553
it tips your fedora even harder
>>
File: 1459566805282.jpg (33 KB, 640x640) Image search: [Google]
1459566805282.jpg
33 KB, 640x640
>>54817561
>My first version used Clojure agents (i.e. threads) for everything. The game logic was a thread, the renderer ran in a thread, every NPC was its own thread.
>>
>>54817563
seems like something i should be interested in using then
>>
>>54817563
no i get it now it's so you can make functions to pass as arguments to higher order procedures that you don't intend to use elsewhere. they have to be a function since you need to pass it
>>
>>54817553
Aren't they for portabilities sake? you can fuck around with the shit in a lambda without affecting/creating global states/variables 'n other bad practices.
>>
>>54817561
The author sounds like some /g/ NEET sperg.
>clojure
>gentoo
>old 2 core cpu
>ancient gpu that can barely get ogl to work
>>
>>54817553
Because if you want to approach declarative programming, everything must be an expression.
Also, once you have lambda expressions, you already have many language constructions like scoped variables without having to extend the semantics of your programming language. procedural abstraction is probably the most powerful abstraction technique that you can have in programming.
>>
>>54817656
basically in my understanding
>>
>>54817561
>every NPC was in its own thread
It's like object oriented programming. You model the software after the real world. Of course every NPC needs it's own thread.
>>
Has anyone ever used anything from Oracle?
>>
>>54815358
Exceptions or option types (error codes are retarded except for reasons of performance).

Exceptions are preferable to the Either monad in most scenarios. Fuck the police.
>>
>>54817800
Yep everyone loves the overhead that context switches introduce once you rake up more threads than you have available cores.
>>
File: 2ee.gif (141 KB, 287x344) Image search: [Google]
2ee.gif
141 KB, 287x344
>>54817800
>You model the software after the real world.
>>
>>54815358
Maybe or Either monad for most stuff, execptions for exceptional stuff
>>
>>54816147
>>54816225
>>54816238
>>54816291
>>54816365
Two-space indentation is only acceptable option.

Anyone who disagrees should commit seppuku.
Thread replies: 255
Thread images: 34

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

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