[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: 324
Thread images: 30

>Old thread: >>59007972
>What are you working on, /g/?
>>
Learning Python and my friend showed me lambda.

Why should I def functions instead of making everything lambda and just assigning them to variables?
>>
fucking around with file transfer protocols

felt like making something that would let me transfer my files around fast on LAN

(yes there are probably programs out there that can do it better than I could but fuck that)
>>
>>59012278
You may want a function that doesn't return something unlike lambda
>>
>>59012278

That's pretty much what a function is under the hood.
>>
I finally got the lock-free queue from "Simple, Fast, and Practical Non-Blocking and Blocking Concurrent Queue Algorithms" working right.

The code is https://sstewartgallus.com/git?p=linted.git;a=blob;f=src/ada-core/src/linted-lock_free_queue.adb;h=8baa5b79ea4d9fddaa083f30a1f3b2968318290d;hb=560164b922249a14ba65d5c6028f8758829d2182 and is Ada SPARK.
>>
>>59012292

A lambda doesn't have to return anything. Is python different?
>>
>>59012293

So what's the point of def? Looks overly verbose and wastes lines which in Python actually matters since it has to read every line during runtime.
>>
>>59012297
Well as far as I know, unlike def functions lambda returns are implicit and generally the result of the proccess, meanwhile in a def fuction you could for example modify a list but not return anything sorta like sort like sorted().
But hey I could be wrong, I just started Python this year
>>
>be me
>spend spare time over the past 3 years learning java and android studio for the apps i want to make (never had any formal schooling, just tinkering with fizzbuzz and shit so far)
>know that i will later have to learn iOS shit and remake apps there, or hire someone to copy to iOS
>just learn that VS/Xamarin now is free and open source and will create native apps for android ios and windows and more...
should i now drop java and android and start learning C# and program on Xamarin? would there be any benefit from sticking with my original plan?
>>
>>59012278
Why would you? Just because you can?

Try to keep to the philosophy of using functionality as it was intended to be used because that makes your code more readable. Lambda functions are mostly designed for quickly describing part of a behavior that is used by a more generic behavior (such as sort, find, filter). You shouldn't really be using lambdas for complex tasks which are used for many reasons.

Also doesn't Python only support single-line lambdas?
>>
>>59012338
c# is my fav language desu
>>
>>59012350
ok, great.
but if you can put your bias aside (not that bias is bad)
objectively, should i abandon all i've worked on so far and switch, or stick it out?
>>
So I've heard of COBOL and FORTRAN still being needed by some, what are some other niche programming jobs?
>>
>>59012345
>Also doesn't Python only support single-line lambdas?
for now...
python just keeps growing, like that stupid snek video gaym
>>
>>59012362

I don't know shit about mobile development but it's probably not a terrible idea to check it out. Three years of programming should have given you a decent enough level of competence that picking up another language won't be incredibly difficult.
>>
>>59012373
>COBOL
Dave Ramsey was on the radio saying he needed a COBOL programmer and promised very nice $
>>
File: python.png (184KB, 2000x2000px) Image search: [Google]
python.png
184KB, 2000x2000px
I started with Python and got to an intermediate-ish level, then dove into C and ASM. I did them for a while, learning how to manipulate the stack and all that jazz, and it's pretty cool.
But now I'm looking at Python again and holy shit...it's so easy. Attractively easy. It feels modern, clean, and just fucking nice. I'll never leave you again baby
>>
>>59012380
3 years of /spare/ time...
i work 80 hours a week as a truck driver lmao
i haven't gotten too deep yet.
i WISH i could go back to age 18 and take programming in college.
>>
>>59012338
I love C#. Also C# and Java are pretty fucking similar you won't have much to learn syntax wise. HOWEVER C#'s greatest strength is the .Net framework libraries and those are fucking monoliths.

You don't need to know everything though and your knowledge will expand with time. I've been programming for less time than you though so maybe my opinion is non-factual. Programming seems to be more of a literacy type thing than anything. The more you use programming the better you get, it doesn't really matter what language it is or anything, you just get better at stuff.

Until you get good enough that you actually need to study and understand specific programs, algorithms and fields that is.
>>
>>59012362
I tried xamarin for a few weeks when working on a personal project.

One thing I notice is that it lags behind live android by a bit.

Maybe I am retarded but it took a long time to get the right wrapped library for the hamburger menu I wanted.

In java it would have taken me maybe 2 minutes to figure it out and make it work.
>>
Python 3 here.
Making a tic tac toe game
The problem is, that i have a function that runs everyturn, and if gameend = True that function SHOULD stop and display the winning message
but it doesn't, i don't know the fuck why
def askinput(P,N):
def printboard():
board = """
1 2 3 -x
---------
1 | %s | %s | %s |
---------
2 | %s | %s | %s |
---------
3 | %s | %s | %s |
| ---------
y""" % (space1x[0],space1x[1],space1x[2],space2x[0],space2x[1],space2x[2],space3x[0],space3x[1],space3x[2])
print(board)
printboard()
if gameend == True:
winner()
return
elif gameend == False:
atemp = ([a for a in list(input("Enter Coordinate(Player %s)(Like X,Y): "% (P))) if a != ","])
print(atemp)
if len(atemp) == 2:

Yeah before you ask, gameend is True, i make it prints and it comes out as True
        1   2   3 -x
---------
1 | X | O | O |
---------
2 | X | O | O |
---------
3 | X | X | X |
| ---------
y
-1
-1
3
True
True
3
True
True
-1

Don't know what the fuck is wrong
pls help
>>
>>59012423
Reading my code makes me so fucking ashamed holy shit
what the fuck was i thinking
>>
>>59012423
>>59012435
lol I was cleaning it up for you then saw you put a function inside of a function and I stopped
>>
>>59012408
how long ago, cuz new thing in latest xamarin...
can yo ushare the hamburger thing? i think i'd like to use that too.
i'm mainly just worried that certain things won't cross over, like smooth integration with firebase, google+ logins, google payments, etc...
>>
>>59012393

>But now I'm looking at Python again and holy shit...it's so easy.

Python is only easy by convention. You can introspect and monkeypatch damn near anything in the language, which will bite you hard if you're not careful.
>>
>>59012472
The hamburger wrapper was made by a pajeet on youtube and I would not suggest you use it. Pretty sure there is support for it in the live library.

I was working with xamarin about 1.5 years ago. Overall it is very clean and I hear it has something like 80% code sharing between ios and android apps which is pretty great.
>>
>>59012435
>>59012459

When dealing with booleans like True or False, Python treats True as "existing", aka you can write this
    if gameend == True:
winner()
return
elif gameend == False:
# do whatever


as simply this

    if gameend:
return winner()
else:
# do whatever
>>
>>59012502
>You can introspect and monkeypatch damn near anything in the language, which will bite you hard if you're not careful.

aka don't be a bad programmer
>>
>>59012299
>Hur dur look at me I'm retarded!
>>
>>59012506
cool beans.

anyone got any tips for switching from java to c#?
>>
>>59012703

get VS community if you haven't already

Check out Linq (super powerful and used all over)

Check out .NET threading. Parallel looping, Tasks/factories, await/async.

Play around with it and I am sure you will realize just how much nicer it is than java.
>>
is rust good yet?
>>
>>59013194
no
>>
>>59013194
It's already better than most of the languages, including C++
>>
>>59013283
He said good, not "better than C++"
>>
>>59013284
Reread
>>
File: 925766877926327952.jpg (181KB, 1280x720px) Image search: [Google]
925766877926327952.jpg
181KB, 1280x720px
What's the point of C again?
>>
>>59013290
I still don't see anything in your post describing Rust as good
>>
>>59013303
Being a NEET, role-playing as an super (((expert))) kernel hacker etc
>>
File: tickle.png (10KB, 94x200px) Image search: [Google]
tickle.png
10KB, 94x200px
Is Tcl used for anything at all anymore?
At first glance I like the idea of using it, but I don't want to adopt a dead language.

If it truly is dead/dying, what would be some similar alternatives?
>>
someone help me im going retarded

java
2 ints
need 2nd ints percentage of first int

for example, int A = 2500 int b = 96

need 96% of 2500

only way i can think of doing it is retarded 5 step process of 96/100 into a float and then casting it back to an int after multiplying (it needs to end as an int, rounded obviously)
>>
if I am given an issue number, how do I go to that issue on github?
>>
>>59013303
Direct control of the memory, easy integration of Assembly language, relatively straightforward conversion from code into machine code language. Which is why it's used for programming drivers and firmware for embedded systems (since often those things will be necessary).

Beyond that it's just a minimalism thing for some people.
>>
>>59013458
2500 * 96 / 100.0

The .0 is important as it tells the compiler that it's a double and thus doesn't use integer division.

Order of operations with casting can be subtle at times but 99% of the time, you will only need to cast the divisor into a double/float.
>>
why is programming so difficult to get good enough to build large complex applications on whatever you like instead you are stuck building small meme programs like build a small network that manages a database
>>
>>59013572
That's like asking "why is it so easy to understand a neuron, but so hard to understand the central nervous system." Complex systems are complex.

Learn to love libraries.
>>
File: ngbbs52c3a7bc170fd.jpg (48KB, 680x382px) Image search: [Google]
ngbbs52c3a7bc170fd.jpg
48KB, 680x382px
>tfw too dumb for Rust
>tfw have to settle with C
>>
>>59013592
learn to love 3d traps
>>
>>59013599
why do you think theres such a correlation between loving traps and programming
>>
>>59013458
int x = (int)(A*(b*0.01))
>>
>>59013458
(a*b)/100 right?
>>
>start learning iOS development
>Swift has computed properties
holy shit why doesn't Python have these
>>
>>59013627
Casting into ints is truncation, not rounding, silly Billy.
>>
>>59013596
For learning rust you have to learn C first. Otherwise you won't start discover the niceties of Rust.

However if you are a Rust purist I suggest you start with
https://killercup.github.io/trpl-ebook/trpl-2016-10-01.a4.pdf
I hope you know the basics of programming.
>>
>>59013726
discovering*
>>
>>59013719
I enjoy spreading bad practices.
>>
are any employed as software engineers and if so, how many of you work on open source for money?
>>
>>59013742
>software engineers
Glorified title, but yes.

>open source for money
I contribute on occasion to smaller projects, but I'd never expect to get paid for it. You couldn't pay me enough to tend to the needs of how autistic the communities are
>>
>>59013742
Google, intel, Mozilla, Microsoft, HP, IBM etc employ thousands of engineers in open source projects
>>
>>59013751
normally you scratch your own itch, you don't need to deal with randos telling you what to add.

>>59013760
I work for a company doing open source work; I was wondering if anyone else here did.
>>
Yoooooooooooooooooo
I'm drunk
>>
File: 1354873617872.jpg (41KB, 324x322px) Image search: [Google]
1354873617872.jpg
41KB, 324x322px
I can't begin to express how envious I am of mathematically-capable programmers. And I don't mean people who are competent at math and just get along: I mean people who's entire repo consists of maths-related programming with endless applicability, who solve P. Euler problems for fun, who's profile consists of an anime avatar, states their location as a major city, and links to a fleshed-out website with even more showcased work perfectly categorized and an evidently self-hosted email domain. I'm so sick of the reality of my own incompetence.
>>
C programmers using rust be like
unsafe {
//program goes here
}
>>
>>59013930
get off 4chan and go build something
>>
>>59013934
>C programmers
>using rust
It isn't shitskell though.
>>
>>59012338
I also would like to get someone else's opinion around this matter since Im in a similar situation
>>
>>59013955
>>59012338
I don't know much about Xamarin, but I will mirror the sentiments of the other guy who said that C# and Java are extremely similar as languages.

You should have a pretty easy time learning C# and an easy time going back to Java if you decide Xamarin isn't for you (though you'll miss C#'s extensive framework).
>>
Hi dpt, pleb here. PLEASE REPLY.

So I've learned enough about a few programming languages to understand basic syntax and can generally understand what is happening in a piece of code. Now I've only dabbled in a few things when it comes to actually making a piece of software, messed around with a few libraries etc.

I want to actually make something, probably a GUI with some data stored in .ini files. But what language should I do it in? And how do I structure my program?

I know this is some babby shit but pls help me out
>>
>>59013999
https://www.youtube.com/watch?v=vOGK3TveDDk&list=PLDi4E9q-lu_sedsHQJjG2LhrlIrGzokuy
>>
>>59013999
QT and C++
>>
>>59012259
or it didn't work and I fixed it - why did it not work in the first place.
>>
These safety fags piss me off.
>>
>>59013999
C#
>>
>>59014201
>unironically locking yourself into the microsoft ecosystem with Cshart
>>
>>59012299
Damn, think how many individual instruction lines your CPU has to read at runtime. Python is far more efficient.
>>
>>59013686
It does tho
>>
>>59013194
Yes
>>
What's the difference between
my_array.len()
and
len(my_array)?

As far as I understand the fist example implies that the struct which (my_array an example of) has a method called x.len()

However len(my_array) is just a function, not a method.
>>
>>59014476
what language?
>>
>>59014486
In a general sense.

If you HAVE to think about a language, it's Go
>>
File: JUST.jpg (27KB, 600x424px) Image search: [Google]
JUST.jpg
27KB, 600x424px
I'm at the end of my rope with motherfucking Selenium and Chromedriver.

I'm using the latest versions for everything, everything works fine in Windows, but when I run the same tests in CentOS, there is always one chromedriver process hanging, stopping the whole run until I manually kill it.

I've tried killing them from the code with .quit(), .close(), .close() then .quit(), but nothing kills that last one.

Does anyone know any fixes or stable version combinations?
>>
>>59014496
Some languages (Python, go) have a builtin len() function, others do not and usually have len() method or something similar. There's no deeper meaning.
>>
>>59014476
in some languages they are the same
>>
>>59014496
Usually you can use the len function for something that may be null (since that function should check that first). If you used a method called len on a null value (i.e. dot into it like val.len()), then that would throw an error/exception on nulls.
>>
Is undecidability even real? Can someone please show me some simple and undecidable code?
>>
>>59014624
yes, but compilers stop compiling when they find it. I.e. template shit with C++
>>
>>59014637
Surely there must be some legal yet undecidable code.
>>
>>59014637
Oh, so they predict whether or not that program will halt and if it doesn't they stop compiling?
>>
It's finally time we moved to dependent types

https://www.manning.com/books/type-driven-development-with-idris
>>
>>59014707
90% of programmers haven't accepted even HM or similar yet
>>
>>59014707
>Types as a first-class language construct
sounds interesting.
>>
>>59014715
Well I think learning Idris is easier than learning Haskell
>>
>>59012280
Good for you. If you stay in your LAN you could even bypass tcp/ip and bang your stuff through raw ethernet frames, saving bandwidth through header omission.
>>
>>59014734
From scratch you mean? What if you already know Haskell?
>>
>>59014707
Remind again when the book is actually out, I'm going to pirate it.
>>
>>59012393
even from java to python it just feels like you can do anything with it
>>
>>59014624

>Can someone please show me some simple and undecidable code?
The term "undecidable" is applied to classes of problems, not to specific computer programs. If you want an example of something that's undecidable, try to make a program that accepts a computer program as input, and can determine in a finite amount of time whether for a given input to said program, it will halt, or wind up in some infinite loop. If you make a program that matches that description, I can guarantee you with 100% certainty that I can make a program that your program cannot accept.

When people say parsing C++ is undecidable, what they mean to say is that it is impossible to create a program that can determine in a finite amount of time if any given C++ program is legal, because there is a possibility that it might enter an infinite loop, and therefore the problem of parsing C++ is said to reduce to solving the halting problem. The solution C++ compilers use, however, is simply to not accept all legal C++ code. If it could generate an infinite loop, the compiler will simply complain that the recursion depth is too great.
>>
i need to cut a chunk of data from a chunk of data and then discard everything that's not the chunk that i've just cut out. can i do that somehow without actually making a copy of the data?

char* temp = data;
data = new char[cut_chunksize];
memcpy(data, temp+chunkstart, chunksize);
delete[] temp;

currently doing this
>>
>>59015034
how do I level up?
>>
>>59015048

What?
>>
>>59015048
read books / documentation
read cool blogs from smart people (like the vac module updates one for csgo)

Don't post on 4chan since you are wasting time
>>
>>59012278
because you probably want functions with more than one line
>>
>>59012278
use case for anon funcs is when you only need it once, like
threestr :: [String] -> String
threestr = foldr (\a b -> take 3 a ++ b) ""
>>
File: 1471361990474.jpg (4KB, 320x320px) Image search: [Google]
1471361990474.jpg
4KB, 320x320px
C

How can I return a string from a function to a buffer without knowing the length of the string?
>>
>>59015319

You can't. use strlen on the string and return a pointer to the malloced buffer. Alternatively call it with a pointer to be pointed at the buffer you malloc. Regardless, strings suck.
>>
>>59015332
>return a pointer to the malloced buffer
How do I return a pointer from a function to a buffer in the main
>>
dumb question, what is the equivalent of "," in Python 3.x? as in
print "bagel", "chocolate"
>>
>>59015332
>you can't
>tells him how to do it
>>
>>59015319
That kinda looks like ladyparts.
>>
>>59015364

I read it as him wanting to allocate an array in the original function to which he would write whatever string he got in the function he called (to which he'd pass a pointer to the array.)

It's probably because i shy away from malloc to a sickly degree that I interpreted it as such.
>>
What is the most racist programming language?
>>
>>59015358


strcpy returns a char pointer, return that.

i.e

 
malloc an stuff here
char *retvat = strcpy(what goes here is left as an excessive for the reader.))
return retval


is just one eway you can do it.

don't forget to free.
>>
>>59012338
C# is great for a couple of reasons.

1) LINQ statements are awesome
2) Visual Studio is nice.
3) Microsoft has become better at open-sourcing their stuff. Look at .NET Core.
4) They actually seem to care about improving the language. The C# 7 changes (coming in March) are great and will make things a lot more trivial.
5) Some of the current features are really nice and easy to use while in Java they are overly verbose and complex (var, LINQ, foreach, etc.)

If I were you? Download Visual Studio (2017 comes out in March) or Rider (from the people who make IntelliJ) and have at it. Take a look at enumerators, foreach, var, LINQ etc. to get a feel of the language. It's become a lot more "functional" the past couple of years but it gives a new way to tackle problems.

However, I would say don't fall into the ASP.NET meme. I have to work with that and it's kind of a pain, wish I could just use Node + Angular/React.
>>
if i read in a file that's bigger than 4gigs, how i am supposed to work with that if size_t only goes up to 4gigs
>>
>>59015569
Do you really want to load all of the file at once?
>>
in Rust, when would I want to define a struct like this:
struct thing<'a> {
foo: &'a str,
bar: &'a str
}

and when would I want to define one like this
struct thing2<'a, 'b> {
foo: &'a str,
bar: &'b str
}


what if I have different lifetime requirements for the same struct?
>>
>>59015524
The .NET meme is useless outside of windows.
>>
File: 1484059550584.png (62KB, 244x216px) Image search: [Google]
1484059550584.png
62KB, 244x216px
>java allows enum values to be null
>>
Can i get some input, i have an assignment in C. I need to make a program that uses shell sort algorithm with bubble sort support.

What does that even mean, i don't understand?
>>
>>59015659
What's not to understand?
>>
>>59015669
why anyone thought that was a good idea
>>
Hmm.. Wrote a little python script to recursively get all the folders in /home/anon but it crashes with
RecursionError: maximum recursion depth exceeded

What do?
>>
>>59015724
dont use recursion
>>
>>59015724
python doesn't have tail call optimization, use haskell, or dont use recursion
>>
>>59015735
But it's the simplest way of doing it
>>
>>59015746
recursion is often the cleanest way of solving certain problems, but if the language doesn't support it properly you just cant do it
>>
>>59015741
>tail call optimization
What is this?
>use haskell
I don't know haskell though
>>
>>59015741
i don't see why you would need that for your average filesystem which should be no more than a few dozen folders deep
>>
>>59015717
All objects in Java are nullable.
>>
>>59015756
tail call optimization makes the computer not spend stack space on intermediate function calls
>>
>>59015770
Oic. Sounds handy. Still I don't see why python complained at like 15 subfolders deep :(
>>
>>59015756
>I don't know haskell though
https://en.wikibooks.org/wiki/Haskell
>>
>>59015618
i don't know, do i? is there a point to having in data in smaller chunks as opposed to one big chunk when i'm going to work with the entire chunk either way?
>>
>>59015785
Nvm apparently this should solve the problem:
sys.setrecursionlimit(10000)
>>
File: Assad.png (112KB, 238x276px) Image search: [Google]
Assad.png
112KB, 238x276px
>Visual Studio is not responding.
>Would you like to report this issue to Microsoft, so we can fix it?

Microsoft is the CAUSE of my issue, not the solution!
>>
>>59015814
look up memory mapped files
>>
File: 1466132592595.jpg (12KB, 265x198px) Image search: [Google]
1466132592595.jpg
12KB, 265x198px
>>59015816
Hmm now it complains like so:
OSError: [Errno 24] Too many open files

Also there seems to be ~1000 recursion layers despite being <two dozen subfolders deep, what gives? Pic related is code.
>>
>>59015869
Anon...
>>
File: download.jpg (6KB, 168x168px) Image search: [Google]
download.jpg
6KB, 168x168px
>>59012518
>else indented further than if
>>
>>59015891
..what..?
>>
>>59015899
>>else indented further than if
what
get your eyes checked

I mean
what

the else is on the same level with the if
>>
>>59012259
http://blog.zikes.me/post/how-i-ruined-office-productivity-with-a-slack-bot/

https://blog.pusher.com/golangs-real-time-gc-in-theory-and-practice/
>>
>>59015891
Oh I figured out what was causing it;
Bloody steam folder has a link to itself causing infinite loop of recursion.
>>
>>59014528
Send a kill Signal from your code.
>>
File: 1462439890490.jpg (79KB, 497x244px) Image search: [Google]
1462439890490.jpg
79KB, 497x244px
>>59016007
Pic related (green) fixed it. Runs in 3.5 seconds now. Quite impressive for python, actually.
>>
>>59016146
wow that's slow as fuck
>>
Holla guys, i want to learn a programming language, and i know that this thing aquires a lot of time and work. I am willing to sacrafice my freetime to learn one of them, if not more. Can you guys help me, which one is good and easy to learn and understand for a beginner that has no knolwledge about programming language.
i have no job and a lot of free time (at the moment) and i want to create something, because, i dont have to make money from it, i just want to know that i created smthing that works and possibly that helps other people.
>>
>>59016260
if you want to write good code, start with C or C++
if you just want to earn money, python or java
>>
>>59016241
Eh..
find . -type d

takes about 2.7 seconds, I'm pretty impressed if python is only 30% slower than a compiled C program which does the equivalent.
>>
File: Screenshot_20170219-143039.png (118KB, 720x1280px) Image search: [Google]
Screenshot_20170219-143039.png
118KB, 720x1280px
>>59015927
No u
>>
Which lisp has a GC can be turned off for manual control during specific segments? Merely changing the GC mode (e.g. turning on incremental mode) is not viable.
>>
>>59016306
your phone is fucking up formatting, it doesn't render like that on PC
>>
File: 1460918681140.jpg (14KB, 376x245px) Image search: [Google]
1460918681140.jpg
14KB, 376x245px
>>59016306
Works on my machine bruh
>>
>>59016295
Man if I could only tell you what i want.
fuck money btw... :D
>>
>>59015623
'a and 'b are liftetimes. &'a str is a string reference with a lifetime of 'a. Typically, you would always declare this specific struct, assuming you're using &str on purpose, like so:
struct Thing<'a> {
foo: &'a str,
bar: &'a str,
}

Which means that both string references live at least as long as the object itself (the lifetimes do not need to match for foo and bar though).

However, you probably want to use String instead of &str. In general, you do not want to keep references at all in your objects (the concept of references and value do not map to C so you're not actually copying the object into the struct at the time of init even if you don't use a ref).
>>
>>59016300
You do realize os.* is called os because it's an interface to the fucking OS that does most of the actual work of work in your little program, right?
>>
>>59016337
>>59016344
NO IT'S ALL YOUR FAULT REEEEEEEEEEEEE
>>
>>59016306
fucking phone posters I swear to god
get your shit together
>>
>>59016407
>You do realize os.* is called os because it's an interface to the fucking OS that does most of the actual work of work in your little program, right?
Of course, but what's your point, faggot?
I honestly would've expected more overhead due to python being an interpreted language.
>>
I wanna use Qt quick but most distros have really old versions of qt. what do? static link 100 meg of qt?
>>
>>59016462
just have people download the version you need as per usual.
>>
>>59016462
>developing for linux
forget qt
just make your shit command line only
linux user love that shit
>>
I've finally finished the 'Haskell Basics' and Elementary Haskell' chapters from the wikibook. Hopefully I'm able to finish the upcoming chapter today so I can focus on monads next week.
I don't think I have to skills to write a mid sized program by myself yet, but I'm getting there. I know the basics on how to operate on lists and how to implement pattern matching and control structures. I also got a decent understanding how to decipher error messages and understand the type of a function.
Scheme is nice, but Haskell has much more to offer. You pay the price of a steep learning curve, but you get a better language in return.
>>
>>59016533
did u do learn you a haskell ?
>>
>>59016533
>>59016540
YOU MENA HASKAL
>>
are these code equivalent?
if (argc >= 1) {
if (!strcmp(argv[1], "-3") || !strcmp(argv[1], "-e")) {
flag = 1;
}
}

and
if (argc >= 1) {
flag = (!strcmp(argv[1], "-3") || !strcmp(argv[1], "-e"));
}
>>
>>59016533
i bet kobiyashi programs in haskell
>>
>>59016572
if flag is a bool, then yes
if not i think they're still equivalent but i'm not 100% sure
>>
>>59016454
Other anon is rudeposting needlessly

Notice how it spends 1.5s in system mode vs. 0.9 in user mode? That's because your program is I/O bound, which means it spends most of its time either requesting I/O services (in this case walking the filesystem) or waiting for the results. Since it's spending most of its time idling and running kernel code, being interpreted isn't making much difference.

I bet that 30% is primarily loading time which if you precompiled it and ran the .pyc file would largely disappear.

If your process was CPU-bound (running many calculations with little idle time) you would see a bigger difference regardless of compilation time.
>>
>>59016598
>>>/tumblr/
>>
Is it worth learning COBOL, even as a meme?
>>
>>59016540
I read through LYAH without writing any code. As a result, I didn't understand anything at all. The wikibook gives you simple exercises, and that helped me a lot.
I might give the book a second chance though.
>>
>>59016618
Only worth it for the money
>>
>>59016396
>Typically, you would always declare this specific struct, assuming you're using &str on purpose, like so
>

>In general, you do not want to keep references at all in your objects
>
>>
>>59016629
LYAH is a bit out of date too
>>
>>59016635
I know nothing about it, what's it used for?
>>
>>59016636
[citation needed]
>>
>>59016642
IIRC I copy pasted some basic example into GHCi and it didn't work. I thought it was me being retarded, so I gave up.
>>
>>59012299
Nigga wat? python is compiled to a stack machine bytecode, Lambda functions are actually slower than implicit definitions due to the overhead of having to call MAKE_FUNCTION every time you use it.
>>
>>59016607
>>>/b/
This is an on-topic board, kindly fuck off and let the adults talk.
>>
>>59016681
Did they include type signatures?
Some of the type class constraints in LYAH are out dated
>>
>>59016646
Mostly banking(and related areas, I guess), I believe.
>>
>>59016646
Archaic systems that are too costly to rewrite.
>>
File: 1463776795875.jpg (16KB, 377x220px) Image search: [Google]
1463776795875.jpg
16KB, 377x220px
>>59016598
Interesting. Thanks for explaining.

Fleshed out the function to give size of each folder and boy does it take longer now :/

Any ideas on how to improve performance?
>>
>>59016693
oh the irony
>>
>>59016572
>>59016572
BUMPERINO

but i think they are the same
>>
>>59016727
let du do all the work for yo8u
>>
>>59016597
depends on the language >>59016572

what language?
>>
>>59016755
it's in C

the flag variable is defined and initialized as
int flag = 0;
>>
How do I become a good coder? I just want to code video games like crysis and blackops
>>
>>59016704
I think it had a type signature, but I'm not sure.
I do know of one function that got moved out of Prelude.
>>
i'm abit new to c# and i'm struggling to see why this setting doesn't work


Can an anon help?
>>
>>59016771
then it's the same
>>
>>59016786
>== true
>>
>>59016792
>>59016771
you can also
flag = argc >= 1 && (!strcmp(argv[1], "-3") || !strcmp(argv[1], "-e"));
>>
>>59016794

What's the issue? if it's some kind of pedantic thing to make the code as efficient as possible then idc, I know I could simplify it but the issue still remains
>>
>>59016822
>
>>
>>59016727
Reduce the amount of string concats you're doing, also use
os.path.join()
with each nested folder as an individual argument, otherwise you're going to have issues with the file seperator character on different platforms.
>>
>>59016816
sweet

one liners are the best
>>
>>59016822
Go be retarded somewhere else, like at reddit.
>>
>>59016868
>file seperator character on different platforms.
Which platforms would that be.
>>
>>59016794
>>59016843
>>59016875
>being a flaming faggot
>in /dpt/
we are reaching new levels here

desu I have never used C#
maybe you cunts just explain to him what you want
>>
>>59016875
is reddit/r/programming better than /dpt/ ?
>>
>>59016747
>let du do all the work for yo8u
testing it now to see if it's faster

>>59016868
>use os.path.join() with each nested folder as an individual argument, otherwise you're going to have issues with the file seperator character on different platforms.
Implying I use anything other than linux.
>>
>>59016893
>we are reaching new levels here
How new are you?
>>
>>59016893
>>>/tumbrl/ where your fee-fees won't be huuuurt~ :(
>>
>>59016901
talking about this specific /dpt/
of course there were worse
no need to make every /dpt/ equally cancer
>>
>>59016901
>How new are you?

i've been here for two weeks so i'm pretty sure i'm not new
>>
>>59016899
For people like you, absolutely.
>>
>>59016910
ebic edge there my buddy
keep up gods work
>>
>>59012259
Top kek. I'm literally the 2nd picture like 99% of time. I know that makes into a perfectionism, which in turns turns me into being proud about, which in turns me into probably not doing much other than pondering why it works.
>>
>>59016930
you know nothing about me , buddy
>>
>>59016933
>I'm literally the 2nd picture like 99% of time.
lol xd
>>
>>59016933
xDDD

hahahahha

epik
>>
>>59016794
>>59016843
>>59016875
>>59016893
>>59016910

I can see im gonna get an answer here. oh well, was worth a try
>>
>>59016952
/dpt/ is for programmer discussions not for babby's first assignment. go be a babby on stackoverflow
>>
>>59016936
Don't worry, I know more than enough already.
>>
>>59016727
Use
item.path
instead of getting the path yourself
>>
>>59016747
Eh, 13m37s vs 14m02s
It's literally nothing
>>
File: index.jpg (6KB, 236x214px) Image search: [Google]
index.jpg
6KB, 236x214px
>>59016965
>>
>>59016933
AMIRITE? XD
ME TOO
upvoted
>>
>>59016981
that's not a babby that's a loli
>>
Where are monad transformers in Python? Where are lenses?
>>
>>59017008
def flatten(listOfLists):
"Flatten one level of nesting"
assert isinstance(listOfLists, list)
if len(listOfLists) > 0:
assert isinstance(listOfLists[0], list)
return [x for sublist in listOfLists for x in sublist]

# sequence monad
def seq_unit(x): return [x]
def seq_bind(mval, mf): return flatten(map(mf, mval))
>>
>>59017008
Is it a shitskell slang?
>>
>>59017014
he said transformers
>>
>>59017014
Now write a generic whileM.

Also what >>59017054 says.
>>
>>59017067
def anal_beads(func, value):
while 1:
yield value
value = func(value)

def until2(cond, func, starting):
return next(filter(cond, anal_beads(func, starting)))
>>
>>59016965
>/dpt/ is for programmer discussions not for babby's first assignment
lol... how new are you?
>>
>>59017180
already answered that >>59016920
>>
rate my text sharing script (works in the LAN only, though):
#!/bin/bash
while true; do (echo -e "HTTP/1.1 200 OK\n\n$@\n" | nc -lvp 8081); done

how to use:
./script.sh some text here, links or whatever

then, from another device, go to http://device_IP:8081/
>>
what's faster
//int a = 0;
a += 1;
a |= 1;
>>
>>59017292
int a = 1;
>>
>>59017292
fuck off
>>
>>59017234
>
nc -lvp

>-l It is an error to use this option in conjunction with the -p option
Does it work?
>>
>>59017292
a |= 1 << 0;
>>
>>59017292
https://github.com/Rafase282/My-FreeCodeCamp-Code/wiki/Lesson-Increment-a-Number-with-Javascript
>>
>>59017317
Starred and froked xD
>>
>>59017302
$ nc -h
OpenBSD netcat (Debian patchlevel 1.105-7ubuntu1)
This is nc from the netcat-openbsd package. An alternative nc is available
in the netcat-traditional package.

just replace -lvp with -l -v -p
>>
>>59017234
>2007
>nc
>>
>>59017305
this has to be the fastest. you only switch 1 bit
>>
>>59017336
Yeah but you don't need to put p, right?
>>
File: siA7C.gif (621KB, 440x247px) Image search: [Google]
siA7C.gif
621KB, 440x247px
Learning BASIC right now. Tried to do Python and even that was too much for me.
Maybe it's because I have no self-discipline or I procrastinate a lot or some other reason idk, but I'm not giving up dammit.
>>
>>59017376
Why did you feel the need to make this cancerous post? Fuck off.
>>
http://www.cs.ucr.edu/~neamtiu/pubs/icse11bhattacharya.pdf

>Our analyses demonstrate that applications that start with C as the primary language are shifting their code base to C++, and that C++ code is less complex, less prone to errors and requires less effort to maintain.

smugpepe/animegirl.jpg

In all seriousness, is C only used anymore for legacy and for portability?
Also, hypothetically, if I were to write a C program, save it as a .cpp file, and use a cpp compiler, would there by any difference had I used a C compiler?
>>
>>59017371
-p is for the port, I suppose you could remove it
-v is not really needed, could be useful for debugging, or if you want to learn how HTTP works
>>
>>59017466
>pepe
post disregarded
>>
>>59017469
Well anyway I was just pointing out that the man page says using -l and -p together is erroneous.
>>
>>59017466
C works well wither other languages. C++ doesn't.
>>
>>59017506
C++ doesn't work well with even itself.
>>
>>59017466
C is probably almost exclusively used for embedded systems these days.
>>
>>59017485
WORKSFORME
$ echo -e "HTTP/1.1 200 OK\n\n$@\n" | nc.traditional -l -v -p 8081
listening on [any] 8081 ...

perhaps the traditional netcat in ubuntu, with its patched versions, works differently than in your distro, or whatever
>>
>>59017549
>t. somebody who knows nothing about software or programming
>>
File: .png (72KB, 200x439px) Image search: [Google]
.png
72KB, 200x439px
Hola. I need to create some components dynamically, but I'm having this message in logs.
> QQmlComponent: Created graphical object was not placed in the graphics scene.
It works well but Im still worried about that log warnings. My code is like
>var base= Qt.createComponent("dicks.qml");
>var component = base.createObject(MyAwesomeId);
>MyAwesomeId.addItem((component))
>>
>>59017573
I program MCU's daily?
>>
>>59017466
Legacy, interoperability and embedded

C++ executable would be slightly larger
>>
>>59017714
Oh also all your function names would be mangled so if you had any assembly or other language source code calling your C functions it would break.
>>
>>59017466
C++ isn't a strict superset of C; there are some marginal incompatibilities between the two languages.
>>
>>59017794
>marginal
>
>>
is this new desktop thread?
Still working with muh atmega8a. Not sure what I do here, but atleast we are working
>>
File: file.png (179KB, 1102x579px) Image search: [Google]
file.png
179KB, 1102x579px
I render a mesh which form some boxes in openGl. nothing special.

but why are there those ugly wavy edges?
>>
What's the best language to learn in 2017?
>>
>>59017845
Increase Z buffer capacity
>>
>>59017882
I guess golang and rust are good bets
>>
>>59017882
COBOL
>>
>>59017882
Haskell
>>
>>59017882
chapel
>>
>>59017882
Visual Basic 6
>>
>>59017841
hello fellow atmega8 / avrdude user
>>
>>59017882
VHDL & Tcl
>>
>>59017376
good luck anon! you can do it!
if you have any questions feel free to ask
>>
/dpt/ can't even prove that 30 + 30 = 60.
>>
>>59017882

c++
>>
>>59017928
Duh, because it's false
>>
Being self-taught, I feel as though my knowledge is incomplete. Are there any resources or checklists I could go through to ensure I have everything covered?
>>
>>59017928
you just proved it
>>
>>59017951
Start with the Greeks.
>>
>>59017966
Already read Iliad + the Odyssey, what next?
>>
in c++, am i not supposed to use char* to store binary data read from large files? am i supposed to use std::vector<char>? are vectors as fast as char*?
>>
>>59017951
what area?
>>
>>59018015
Philosophy
>>
Hey, I need advices.

To make it short. I'm graduating in a low tier school and soon I'm starting my internship. I can code and all but I feel like I lack some skills, for example design patterns and everything related to that (that's just an example, I lack more skills than just that).
Anyway, do you people have advices about what is mandatory to know for a beginner.
I know most of programmers learn more while they work for real but there must be things you have to know to be taken seriously.
>>
>>59017928
1 is by definition the unit
2 is by definition 1+1
3 is by definition 2+1
...
30 is by definition 29+1

30+30 = 30+(29+1)
...
= 30+(1+...+1) (30 times 1) [1]
= 30+1+(1...+1) (1 plus 29 times 1) [2]
= 31+(1...+1) (per definition of 31, 29 times 1)
...repeat [1] and [2] 28 times...
= 59+1 (per definition of 59, 29 times 1)
= 60 (per definition of 60)

QED
>>
File: file.png (232KB, 1117x708px) Image search: [Google]
file.png
232KB, 1117x708px
>>59017889
I pushed the near plane to 25 (far is 10000) and massively improved, but Im not sure if this is what you meant.
>>
File: 1471141284116.png (278KB, 706x412px) Image search: [Google]
1471141284116.png
278KB, 706x412px
>>59018044
>...
>1+...+1
>>
>>59017841
What editor is that on the left?

Sublime or VSCode?
>>
>>59018102
Decrease far plane to increase zbuffer precision.
>>
>>59018157
looks so great when it cuts somewhere middle in the geometry
>>
>>59018044
>2 is by definition 1+1

This is definitely not sufficient.
>>
>>59018044
actually...
>= 31+(1...+1) (per definition of 31, 29 times 1) [3]
>...repeat [1], [2] and [3] 28 times...
too lazy to say where distributive and associative properties were used... I'll leave it as a task for the reader :)
FTFM

>>59018145
>(1+...+1) (30 times 1)
>>
File: 1471142319200.png (49KB, 296x342px) Image search: [Google]
1471142319200.png
49KB, 296x342px
>>59018193
>>(1+...+1) (30 times 1)
>>
>>59014785
how much extra mem is tcp/ip header on top of MAC?
>>
>>59017882
VBA
>>
Any way of putting gaze triggers on a 360 degree video? Been pissing me off for a week
>>
>>59018031
bump

Does anybody work here ?
>>
>>59018245
Those people are at their jobs right now.
>>
>>59017549
>If I don't know about it, it doesn't exist :^)

If only new projects count, then only <meme-of-the-year> is going to be relevant at any given time.
>>
>>59018272
Didn't think about that but since it's an international board, there should be some european too.
But I'll ask later.
>>
>>59018272
>>59018305
Fucking neets don't know about sundays.
>>
>>59018031
>>59018245

1. Most of what you learned in school is useless. If you know the basic algorithms and data structures, you're set. Programming is more about knowing how to properly do everything *except* programming: design, documentation, organization of your workspace (IDE, repository, shortcuts, automatic builds, testing, deployment, patching, bug handling, testing), communicating with your team, communicating with your manager, communicating with your client. 80% of programming is *not* (strict) programming.

2. Things are the way they are for a *reason*: if you don't know why something is the way it is, find it out before you change it. Chances are someone tried it before you and failed miserably. Learn from others, and more importantly: learn from other's mistakes. This is true both for software and company culture.

3. Related to 2: communicate and document. The hilarious irony about our profession is that we're the ones who should be most comfortable with our tools (after all, we can *make* our own tools) but we aren't. Know how to ask questions (think them over first so they're not stupid questions).
>>
>>59017928
assert(30+30==60);

all the proof I need.
>>
>>59018332
Whoa, it is Sunday.

I've been off work a month and a half for surgery.
>>
>>59018370
>runtime
>>
>>59018380
static_assert
>>
File: adios.jpg (33KB, 500x500px) Image search: [Google]
adios.jpg
33KB, 500x500px
>>59018362
>No thread title
>10 posts Early
>Pic barely related
>>
>>59018399
>pic barely related
it was LLVM
pretty relevant
>>
>>59018408
>shop some programming phrases onto <anime x> image

IT'S RELEVANT GUISE
>>
>>59018399
Here you go: >>59018426
>>
>>59018430
4chan is an anime board.
>>
File: clang.jpg (563KB, 720x1024px) Image search: [Google]
clang.jpg
563KB, 720x1024px
>>59018430
It's actually part of a series of published books.
>>
>>59018437
4chan isn't a board, I think you meant >>>/a/

>>59018447
I wouldn't know, this is an English-speaking website, I can't read moonrunes.
>>
>>59018484
>4chan isn't a board
4chan is a simple image-based bulletin board where anyone can post comments and share images anonymously.
>>
>>59018493
>>>/a/ is a board.
>>>/b/ is a board.
>>>/g/ is a board.

https://boards.4chan.org
is not a board, it's the homepage.
>>
>>59018510
4chan is a simple image-based bulletin board where anyone can post comments and share images anonymously.
>>
File: CLRS.jpg (27KB, 354x400px) Image search: [Google]
CLRS.jpg
27KB, 354x400px
>>59017951

pic related will give your solid fundamentals.
>>
New thread: >>59018426
>>
Spent about 24 hours working on a snapchat cloney thing with Sinatra and ended up learning a lot about Android in the process after destroying my wrists
learned Ruby, Sinatra, and ActiveRecord during that time more or less
I'm also considering doing a hackintosh install so I can try out Swift, looks much nicer than Android garbage
>>
>>59018618

So you learned Ruby and Sinatra in 24 hours?
What?
>>
>>59018699
I did a lot in 24 hours it was crazy
>>
>>59018736
I did your mom for 24 hours she was crazy
>>
>>59018736

Either you have a lot of programming practice in other languages and frameworks.. or you only saw a tiny fraction of Ruby (and probably Sinatra too).
>>
>>59018347
Thanks m8.
>>
>>59014307
>best GUI tools
>best framework

>b-but muhcrosoft
Thread posts: 324
Thread images: 30


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