[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: 325
Thread images: 34

File: K&R himegoto waifux2.png (1MB, 1000x1400px) Image search: [Google]
K&R himegoto waifux2.png
1MB, 1000x1400px
old thread: >>55984832

What are you working on, /g/?
>>
>>55990669
hello where do i learn assembly?
>>
Hey /dpt/ what are your three programming virtues?

What do you have expertise in?

What are you doing right now with your knowledge?

Stallman or Linus?
>>
>>55990703

https://asm.io
4sMpR060xf.onion
>>
>>55990669
I was looking at this earlier. It's pretty sweet. The games that come with it are even fun.
http://mikeos.sourceforge.net/
>>
File: ss (2016-04-24 at 01.21.31).png (19KB, 522x670px) Image search: [Google]
ss (2016-04-24 at 01.21.31).png
19KB, 522x670px
>want to make a fps
>can't model for shit

Really holds me back because i never want to make something that looks like a piece of shit
>>
Trying to think of a way to match colors from a big palette (i.e 24 bit) to their closest color in a smaller palette (i.e 16 colors.) Here's one idea I have:

-have the reduced palette be represented as an array
-have there be a separate array of floating point numbers with as many elements as the palette areay
-for each pixel in the bitmap:
-for each color in the palette array:
-divide the actual pixel color by the current color in the palette array
-if >1, divide 1 by it, so each value is <=1
-save in the separate float array

-go through the float and locate the value that is closest to 1 (abstracting this process out since I already know how to do it)
-use the index for the palette array
-the element of that index is the new color
-set that to the pixel

the time this takes is dependent on the size of the reduced palette (i.e how many colors)


Would this work? Is there a better way?
>>
>>55990669

fizzgen.py
#!/usr/bin/env python2
from __future__ import print_function
import sys
from itertools import compress

bmap = lambda n: reversed(map(lambda x: int(x), bin(n)[2::]))
bindex = lambda n: map(lambda x: ord(x) - 47, compress('0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghujklmno', bmap(n)))
findex = lambda l: [l[v - 1] for v in [i for n in xrange(2**(len(l)-1)+1, 2**(len(l)), 2) for i in bindex(n)]]
pnot = lambda n: '(1-i**{}%{})'.format(n-1, n)
listpnot = lambda n: [pnot(pr(i)) for i in range(1, n-1)]
combos = lambda n, v: ['*'.join(list(compress(listpnot(n), bmap(i)))[-2:]) for i in range(1,2**(n-2)) if sum(bmap(i)) == v]
all = lambda n: [j for i in range(2,n) for j in combos(n, i)]
pr = lambda n: [
3, 5, 7, 11, 13, 17, 19, 23, 29, 31,
37, 41, 43, 47, 53, 59, 61, 67, 71, 73,
79, 83, 89, 97, 101, 103, 107, 109, 113, 127,
131, 137, 139, 149, 151, 157, 163, 167, 173, 179,
181, 191, 193, 197, 199, 211, 223, 227, 229, 233,
239, 241, 251, 257, 263, 269, 271, 277, 281, 283,
293, 307, 311, 313][n]
a = lambda f: lambda n: 0 if n < 1 else f(f)(n//2) + 1 - n % 2
a = a(a)
addit = lambda n, k:len(bin(2**n - 1 + 2**(n-1) - k)) - 1 - a(2**n - 1 + 2**(n-1) - k)
diffs = lambda n: [] if n < 2 else [addit(n-1, i) for i in range(2**(n-2)-1,-1,-1)]
start = lambda n: '[' + ' + '.join(['i*i%3']+[pnot(pr(i))+'*{}'.format(sum(diffs(i+1))) for i in range(1, len(n)-1)] + all(len(n)))+':]'
end = lambda n: '[:' + ' + '.join(['(1-i*i%3)']+[pnot(pr(i)) for i in range(1, len(n))]) + ']'
if __name__ == '__main__':
if len(sys.argv)< 3:
print ("usage: python2 {} N [r0 r1 r2...] \nwhere rZ is a word to replace in fizz buzz manner up to the number N".format(sys.argv[0]))
exit(1)
p = sys.argv[1]
flist = sys.argv[2:]
str = "for i in range(1, {}): print ''.join({}{}{}) or i".format(int(p)+1, findex(flist), start(flist), end(flist))
print (str)
>>
>>55990846
try running
fizzgen.py 100 fizz buzz
>>
>>55990850
Then try running
python <(fizzgen.py 100 fizz buzz)
>>
Just ran in to a theoretical problem. Even though I'm using the OCaml compiler's back end, for certain reasons I'm not able to have types' runtime representations match up (on the bright side, this does make linking to C slightly easier). For example, my list type is not the same as the OCaml list type, so you can't link to a normal OCaml library. There's a few solutions I've come up with, but they all seem very messy. I might still stick with converting core types (i.e. lists and options) to the OCaml representation, but more than likely I'm gonna have to write some boilerplate to convert the values in a lot of different places just to use the normal standard library.
Should I just start from scratch and offer 0 compatibility with the OCaml ecosystem or is it better to use a hacky solution to make the two sort of compatible?
>>
File: le horrified mickey.jpg (114KB, 615x1279px) Image search: [Google]
le horrified mickey.jpg
114KB, 615x1279px
>>55990846
>>
>>55991022
It's so ugly it's beautiful I think.
>>
>>55990846
What does this do?
>>
>>55991075
It writes a generic fizz buzz one liner for N primes
>>
baby proof assistant for propositional linear logic
>>
>>55990794

If you absolutely need image clarity, your downsampling is fine. But seriously, dithering is better in almost every single application for a slight loss in image sharpness, you get much much better color quality.

http://www.tannerhelland.com/4660/dithering-eleven-algorithms-source-code/
>>
>>55990774
Start with a simple ass prototype. Boxes shooting boxes.

Also get AAA quality games out of your head. You'll never get to make the next CoD, BF, Bioshock, Halo etc. Unless you get part of an actual AAA team.
>>
File: 1468715086371.jpg (950KB, 2173x1448px) Image search: [Google]
1468715086371.jpg
950KB, 2173x1448px
/dpt/ I'm going to fucking kill a man

I just wanna fucking know if there's over 5 tracks left in my cunting playlist and I get

[script]
Vinter in Hollywood - You Can Play (2009 Tryvann Live Mix)
grep: Vinter: No such file or directory
grep: in: No such file or directory
grep: Hollywood: No such file or directory
grep: You: No such file or directory
grep: Can: No such file or directory
grep: Play: No such file or directory
grep: (2009: No such file or directory
grep: Tryvann: No such file or directory
grep: Live: No such file or directory
grep: Mix): No such file or directory
grep: ": No such file or directory
0
lmao

[/script]

from

[script]
#!/bin/bash

current_track="$( mpc | head -1 )"
echo $current_track
count="$( mpc playlist | grep -A10 \" $current_track \" | wc -l | tr -d '\n' )"
echo $count

if [ "$count" -gt 5 ]
then
echo "kek"
else
echo "lmao"
fi

[/script]
>>
>>55991480
>script

oh fuck me I'm retarded

It appears in my anger, I killed the chances of getting my question answered

#!/bin/bash

current_track="$( mpc | head -1 )"
echo $current_track
count="$( mpc playlist | grep -A10 \" $current_track \" | wc -l | tr -d '\n' )"
echo $count

if [ "$count" -gt 5 ]
then
echo "kek"
else
echo "lmao"
fi

>>
>>55991085
is something really baby-proof if babies just consciously choose not to use it?
>>
>>55991516
>is it baby proof if it protects from babies
yes
>>
>>55991575
so i guess a hot stove top is baby-proof after the first time a baby touches it, eh? just a joke anyway, the idea being that a logical person would be largely unaffected by such a tool, whereas an illogical person (the ideal target for such a tool) just wouldn't use it
>>
>>55991480
YOU HAVE 5 SECONDS /dpt/ BEFORE I WALK DOWN THE STREET AND STAB THE FIRST PERSON I SEE JESUS FUCK WHY ISN'T MY CUNTING CODE WORKING?

WHY IS BASH SPLITTING IT THE FUCK UP?

SHIT MAKES LESS THAN NO SENSE
>>
>>55991780
>bash
You get what you deserve
>>
Can anyone recommend any ASM tutorials, specifically for NASM?
>>
>>55991800
I fucking hate it so much but I hate that I don't know it
>>
>>55990774
Practice, iterate, get better over time.

Realize you'll need to constrain and engineer your projects unless you're working with other people. Unfortunate, but it's true.
>>
>>55991480
>>55991486
>>55991780
Don't escape those quotation marks in grep.
It's causing bash to hand the arguments in like
grep -A10 "\"Vinter" "in" "Hollywood" "...\""

It should be
count=$( mpc playlist | grep -A10 "$current_track" | wc -l | tr -d '\n' )
>>
File: wew.jpg (48KB, 480x600px) Image search: [Google]
wew.jpg
48KB, 480x600px
Today I am learning to one page app.
>>
>>55991815
If there was someway to verify that you posted that I would drop I phat sum in your paypal

Thanks babe
>>
>>55990846
Stop programming. This simply isn't the field for you.

>Hardcoded list of primes
>Entirely unreadable golphfaggotry
>Abuse of anonymous functions
>Uses exit instead of an else

https://gist.github.com/LandonPowell/aeacf1f02b49fdb96ba2f7607d5baf27

from sys import argv

def testPrime(num):
for x in range(2, num):
if num % x == 0: return False
return True

def generatePrimes(words):
i = 2
x = []
while len(x) < len(words):
i += 1
if testPrime(i): x += [(words[len(x)], i)]
return x

if __name__ == "__main__":
if len(argv) < 3:
print "FizzGen requires at least 2 arguments. An int, and some strings."
rangeLimit = 100
primes = [("Fizz", 3), ("Buzz", 5), ("Bar", 7)]
else:
rangeLimit = int(argv[1]) + 1
primes = generatePrimes(argv[2:])

for number in range(1, rangeLimit):
print ''.join([
string
for string, prime in primes
if number % prime == 0 ]) or number
>>
>>55991936
>def testPrime(num):
> for x in range(2, num):
> if num % x == 0: return False
> return True
Jesus Christ, how inefficient.
It also return true for 1, 0 and all negative numbers.
>>
>>55991820
I hope you are using reflex and reflex-dom with GHCJS
>>
>>55992004
Sure am not. What are they?
>>
>>55991936
>[("Fizz", 3), ("Buzz", 5), ("Bar", 7)]
>what are dictionaries
>>
>>55992026
>confusing an abstract data structure with its implementation
>>
>>55992084
It's a shitty implementation, that's what I'm saying.
>>
>>55992122
There are three elements you faggot, a binary tree would be even slower if it were stored contiguously
>>
>>55992141
If the list of pairs were stored contiguously, that is
>>
>>55992141
>Writes something in the slowest language imaginable
>Claims to care about performance
>>
>>55991996
>it'll return true for 1 or 0 and all negative numbers
Apparently you can't into Python. No number under 3 will ever be fed to the function.

That's the most readable version of the code, and I don't micro optimize if it harms readability.

>>55992026
Go ahead and replace it with a dictionary and see what happens.
>iterating over a dictionary
>being this programming illiterate

If you use .iteritems() on a dictionary, it reverses all of it's elements and you can't use [::-1] to turn it back the right way. The order counts in this scenario, so I'm using a list.

>>55992177
He didn't write it. I did. He's just not entirely retarded.
>durr change this thing
>There is no advantage to changing that thing and in fact it's harmful.
>DURR IF YOU CARED ABOUT ADVANTAGES WHY DIDNT U USE A DIFFERENT LANGUAGE HUH????
Python isn't the slowest language imaginable. Go read some benchmarks.
>>
>>55992177
>>writes something in the slowest language imaginable
>you should make it slower
>>
>>55992197
>needing to iterate at all
>getting keys and values mixed up
>>
>>55992197
>micro optimize
You can reduce the number of comparisons massively with even the most trivial optimisations.
Stop using that stupid buzzword.
if (n < 2)
return false;
if (n % 2 == 0)
return n == 2;
for (int i = 3; i < ceil(sqrt(n)); i += 2)
if (n % i == 0)
return false;
return true;
>>
>>55992204
I'm saying that anybody who even slightly cares about performance wouldn't be using the meme snake at all.
>>
>>55992242
>i < ceil(sqrt(n))
Whoops, I mean <=
>>
>>55992197
>hair splitting about performance in a fucking fizzbuzz in le meme snek
>muh micro optimizations
>>
>>55992197
>Go read some benchmarks
Reading the benchmarks of some library that is implemented in C is not a Python benchmark.
>>
>>55992238
Keys and values don't get mixed up. I don't know what you're on about.

Go run the code with your changes and repost it when you're done. I'll wait.

>Needing to iterate at all.
It's a FizzBuzz. If you can show me a way that doesn't involve some iteration or abstraction of iteration, I'll be impressed, but it'll still be useless and I'll still iterate because it's more readable.

>>55992242
>That first conditional
No need for it, since the function never receives less than a three.
>That second conditional
Top fucking kek. Are you literally retarded?
There will never be a time in which my function will evaluate that to True. Ever. Even if you just change it to 'return False', it becomes a useless conditional for one very specific prime number which gets evaluated my way anyways.

The for loop is useful, but it's an optimization that harms readability, and I don't give that much of a shit about performance on a shitpost when it harms the readability of my shitpost.

>>55992312
>implying I'm hair splitting about performance
You sure you meant to reply to me?
>>
>>55992253
I don't use Python, I'm not him, I was simply attacking this dictionary nonsense
>>
File: 1446163796386.gif (1019KB, 500x373px) Image search: [Google]
1446163796386.gif
1019KB, 500x373px
>>55990669
Stupid question:

How do you use jQuery to change an inputted number using a JS function and output it in the same box that it was inputted?

Kind of like this converter: http://www.onlineconversion.com/roman_numerals_advanced.htm

I know how to set everything up, the converter function too, except how to apply it so it outputs the value in the same space.
>>
>>55992325
>Hey guys, I'm going to compare interpreted languages to compiled languages and pretend like I'm cool on the internet.
You're making a fool of yourself. Don't call Python the slowest language and then forget to include every interpreted language in your list of languages that aren't Python.

http://benchmarksgame.alioth.debian.org/u64q/python.html
>>
>>55992197
>>it'll return true for 1 or 0 and all negative numbers
>Apparently you can't into Python. No number under 3 will ever be fed to the function.
>That's the most readable version of the code, and I don't micro optimize if it harms readability.

. . . . . . . . . . . . . . .
. . . . . . S . λ . . . . . .
. S . L . . T Y P I N G . . .
. U . L . . A . ω . . . . . .
. L . A . . T . . . . . . . .
. U . R E F I N E M E N T . .
. C . O . . C . . . . . Y . .
. L . F . . . . . . . . P I .
. A . . . P . . . . . . E . .
. C O N T R U C T I O N S . .
. . F . . O . . H . . . . S .
. . . . . D E P E N D A N T .
. Y F I N U . . O . . D . R .
. . . . . C . . R . . T T O H
. . . . . . . . Y . . . . N .
. . . . . . . . . . T D A G .
. . . . . . . . . . . . . . .
>>
>>55992329
>No need for it, since the function never receives less than a three.
I was presenting the totally correct solution. It's a function which has utility in other programs.
>The for loop is useful, but it's an optimization that harms readability
How the fuck is a nested function call hurting readability?
Also, this optimisation literally removes over half of the comparisons required. Even if it actually had an effect on readability, it would certainly be worth it.
You clearly have fucked up priorities.
>>
>>55990669
Making a next generation UI, figuring out how to build a client-side microservice architecture, and generally working towards bringing about the singularity.

All in a day's work when I actually get shit done instead of dick around and make mad money playing markets.
>>
>>55990669
building reports. boring.
$(document).ready(function(){
$.ajax({
method: "GET",
url: "http://yeahnah.com/pkg_nope.p_hell_naw",
dataType: "xml",
success: function(data) {
var lastRegion = "0";
var lastTown = "nowhere";
var lastLocation = "0";
var lastLot = "0";
$( data ).find( "ROW" ).each( function(){
var thisRow = "<tr>";
var thisRegion = $( this ).find( "REGION" ).text();
>>
>>55992329
I mean iterating over the dictionary, that is. What I'm saying is that you should map primes to their corresponding words, not the words to the primes.
>>
>>55992364
Python is an order of magnitude slower than Java in practically all of those benchmarks.
In the ones where it is actually somewhat close, it uses a library that was implemented in C.
>>
>>55992390
sloppy programmers make sloppy code
http://callbackhell.com/
>>
>>55992421
>computation manipulation
>extension via lambdas
>pyramid of doom
You do know what the solution to this is, right?
>>
>>55992375
>How the fuck is a nested function call hurting readability?
It's not just about the nested function call, but the harder to understand logic behind it. Now someone has to think about how your calls are feeding into one another instead of just thinking "Oh, it checks all the numbers."
It also fucks up the ink-to-information ratio, but a /g/ fag who's hobbies are sperging about optimization in Python shitposts on the internet probably wouldn't have heard of that.

>It would be worth it
Yes, I'll totally make my shitpost harder to understand and more verbose so that it'll run slightly faster.

>>55992403
Why would I map primes to their words instead of words to their primes? That seems entirely arbitrary. It also seems tangential and I think that has nothing to do with what you meant, you just realized you were retarded and wanted to shift focus.

>>55992407
I was giving you the benchmarks for a few Python programs, not telling you to compare it to Java. It seemed you were having trouble finding decent benchmarks.
You seem to not understand that Python is literally implemented entirely in C. A part of Python implemented in C is still a part of Python.
>>
>>55992451
It seems arbitrary to you because you don't know the difference between keys and values.
>>
>>55992451
>You seem to not understand that Python is literally implemented entirely in C. A part of Python implemented in C is still a part of Python.
>confusing a programming language with its implementation
>>
File: no_U.jpg (125KB, 491x398px) Image search: [Google]
no_U.jpg
125KB, 491x398px
>>55992421
>sloppy code
>>
>>55992451
>Now someone has to think about how your calls are feeding into one another instead of just thinking "Oh, it checks all the numbers."
Oh no! Somebody actually has to think a little bit when trying to understand my program?
I do believe that program structure and clarity is important, but that doesn't mean that you have to cater to literal retards. I expect someone to be able to think about the sqrt(n) case and why that was chosen as the maximum pretty quickly.
>>
>>55992488
Just read the link and be quiet
>>
>>55992472
>Because you don't know the difference between keys and values.
The key is used to refer to a value. In my code, I never actually refer to one using the other, so there isn't actually a key or a value. I just iterate through the tuples and assign them to two atoms.

However, what makes the prime number more valid of a key than the string?

Why don't you just modify the code and show us?
>>
>>55990846
nice comments
>>
>>55992496
how can you suck 2 dicks and still type?
How?
>>
My most elegant and solid code was done in batch. Not sure how to feel about that.

I can write some very efficient and readily extensible in C++, but I never feel good about it. If even a single decision causes a higher probability (or necessity) of a cache miss, or a superfluous check, or an unnecessary branch, I trace the entire chain back to the beginning and feel like it's garbage, despite knowing why I chose to bias things the way I did, and not being able to get rid of them or find a better way. I begin to feel like everything I built will just further accumulate inefficiency as a result of this core, intrinsic, unideal nature of what I've created.

It's a Dirac-esque "if it's ugly it must be wrong" attitude. I don't even know. I do know the way the main program is managing its list of files is terrible though.
>>
>>55992496
the article doesn't even mention the one solution we all know and love
>>
>>55990708
Modularity, intuitiveness, and openness; javascript and cryptoeconomics mainly; working on the parts necessary for spawning a superintelligence of global proportions; Linus, for not being a massive faglord.
>>55990774
If you're going for anything beyond original Doom level graphics, you're doing it wrong as a solo noob.
>>55990794
least common denominator is your lord and savior, this is a one-liner, stop overthinking it
>>55991820
ES6 quasiquotes are your friend
>>55992004
trololo
>>55992340
fuck jquery
document.getElementById(${id}).value is what you want to both get and set.
Use either a keypress event listener or a button to know when to do shit.
>>
>>55992508
Yes it does
>>
File: nani.png (3KB, 351x37px) Image search: [Google]
nani.png
3KB, 351x37px
>>55992514
>>
>>55992507
Embrace your sins, try javascript
>>
>>55992451
>A part of Python implemented in C is still a part of Python
Irrelevant. The python implementation doesn't equate to the language.
If you allow FFI calls to be counted as part of the language's speed, then the whole idea of benchmarking programming languages goes out the window, as practically every language can call C functions.
>>
>>55992512
Why do so many people hate jQuery? I'm too much of a beginner to understand if it's dumb.
>>
>>55992522
Scroll to the bottom and read about promises
>>
>>55992484
>implying I did
I literally said "Python is implemented entirely in C", not that "Python is a C program".
So it looks like you're the one confusing a language with it's implementation.

>>55992492
>someone has to actually think a little bit when trying to understand my program
If your program's goal is to be readable, such as a shitpost on /g/, then that's an issue. What about this aren't you getting?

>but that doesn't mean that you have to cater to literal retards
It's a /g/ shitpost, you moron. That's exactly what it means. It's just that I have to decide between catering the majority of retards or if I cater to you, one very specific and very autistic retard.
>>
>>55992502
You're looking up a word based on the prime it corresponds to, not the prime based on its word. I don't care enough to go through the code and fix it, but if I did, what I would do is print the word corresponding to the prime p at every pth iteration of the loop.
>>
>>55992531
>The python implementation doesn't equate to the language.
When comparing language speeds, the implementation is the only element of it that is measurable. I never said they were the same thing. You're tech illiterate and need to consider a different field of study.

>>55992536
>You're looking up a word based on the prime it corresponds to
No, I'm not.
>>
>>55992421
That function, FYI, calls a pl/sql proc that pulls data, then pushes the cursor to another proc that builds the xml.
It takes time.
It can't build a god-damned thing until post.
You can eat shit.
>>
>>55992533
Frameworks in general are cancer
They have their place as a means of creating informed standards across a medium-large team that accommodates inexperienced developers by laying out clear expectations.
If you program for any reason other than taking home a paycheck from a large business not centered on tech, then don't touch the things.
>>
>>55992535
Stop projecting your own incompetence onto everybody else.
Just because you can't solve trivial logic problems, it doesn't mean that other people cant'.
>>
File: 1467929950562.jpg (127KB, 1280x720px) Image search: [Google]
1467929950562.jpg
127KB, 1280x720px
>when you're not sure if it's folder.zip/* or folder.zip/folder/*
>when you guess correctly

>>55992534
That's a very specific kind of monad, but these are general problems solved by monads
>>
>>55992549
string 
for string, prime in primes
if number % prime == 0

>not looking up string based on primes
>>
>>55992549
>When comparing language speeds, the implementation is the only element of it that is measurable. I never said they were the same thing. You're tech illiterate and need to consider a different field of study.
The benchmark contains FFI calls, you fucking idiot. Do you even know what the fuck that is?
>>
>>55992557
Ad hom is only fun when you include an argument with it.
I'm not going to obfuscate my code to please you. Deal with it.
>>
>>55992562
>implying this guy >>55992553 would ever be able to anything complex
>>
>>55992562
The answer is always extract to a subdirectory.
>>
>>55992567
Good, you finally took the time to actually read the code.
I'm still not going to iterate over keys and refer to them every time I want the string instead of just iterating over the tuples. No reason to.
>>
>>55992591
No reason to iterate, that is :^)
>>
>>55992601
Shitpost face indicates sarcasm.
>>
>>55992555
Oh, okay.

I'm using FCC to learn and they make us use jQuery quite a bit. It seems quicker than vanilla JS and easy to use for my beginner level.
>>
>>55992611
Oh look, the autist is trying to pick up on emotional connotations!
>>
>>55992611
It doesn't, really. I use it to indicate I'm correct, making no attempt to not be obnoxious, don't expect the other person has the capacity for a meaningful response, etc.

More or less it's shitposting in a way that also signals that who you're talking to is shitposting whether they intend to or not.
:^)
:^)
:^)
:^)
;^)
>>
>>55992555
>Frameworks in general are cancer

Frameworks promote consistency and standards.
You in general are cancer.
>>
>>55992622
>says something he actually means
>says it with sarcasm boi face
Do you know how sarcasm works?
>>
>>55992675
>It doesn't, really.
It does, really. You're wrong and made no argument.
>>
>>55992617
I hope you're trolling and not actually taking the codemonkey track.

Looking at their curriculum shows a grab bag of common shit that's already trivial to google when you need it.

All I ask is that you also try taking some time to pick something you want to make without knowing what's necessary, then chase after trying to build that without any specific guide for it.

I can guarantee you'll hit a wall with any framework when it comes to thinking outside the box it presents you.

Best way to learn is experiencing that for yourself instead of listening to random fuckers on the internet, so continue what you're doing but please don't put all your eggs in that basket.
>>
>>55992694
You're not responding to who you think you are.

And it doesn't.
>>
>>55992706
Okay, kid.
>>
File: smug wildberger.jpg (85KB, 1012x712px) Image search: [Google]
smug wildberger.jpg
85KB, 1012x712px
>>55992679
It's not just supposed to indicate sarcasm. It can be used to indicate jocularity, playfulness, smugness, etc. depending on context. You're just too autistic to pick up on connotations.
>>
>>55992704
I'm using FCC because it gives structure and projects to work on. But yeah I'm def not using only that. Most of the time I'm working on my own projects, reading from other books etc.

If I just pick something I want to build but don't know how, I end up not understanding the code.
>>
>>55992732
No it can't be. It's an intentional shitpost face. It's only used as sarcasm punctuation.

>Can't portray his ideas through text.
>durr ur the 1 who is autistic not me!!! DXXX
>>
>>55992677
Gee, what an original argument that I definitely didn't make in the post you replied to.

Frameworks are heavy crutches that limit the range of what you can do in order to better service whatever niche they were built around. Whenever you have to step outside of what the framework was intended for, you end up with more complexity than had you not used the framework, because now you have to know both the framework and the underlying platform well enough to know what's going on.

My preferred route towards consistency and standards is writing good enough documentation that it naturally forms a standard through being the easiest way to get shit done.
>>
>>55992746
Ok, you seem to be taking a pretty healthy approach to things already given those added details.
>
If I just pick something I want to build but don't know how, I end up not understanding the code.
Welcome to 80% of programming. Keep diving down the rabbit hole on whatever bits you don't understand and you'll gradually build out the general knowledge you need for tackling most any task.
>>
>>55992533
Nothing wrong with jQuery, it's barely a framework. Other js frameworks require you to rearchitecture your whole application around them, jQuery is just a drop in replacement for existing javascript code. But shorter and nicer to write.

It's worth it for the css-selector style selectors for getting dom elements, if nothing else.
>>
>>55992769
>being so autistic as to nitpick over the intended meaning of a meme smiley face
>>
>>55992894
>It's worth it for the css-selector style selectors
or you could just use document.querySelector/document.querySelectorAll
>>
File: image.jpg (189KB, 750x866px) Image search: [Google]
image.jpg
189KB, 750x866px
I've just started learning to program, and I started with front end so html, CSS and JS for now, but I'm not sure what field I want to work in eventually.

I don't want to be stuck coding for companies and projects I don't care about, I guess I don't want to be a "codemonkey". I'm kind of interested in game dev tho.

What would be the best route to take/genera advice you could give me, on what track would give me the most independence and opportunities to work independently and remotely?

Thanks /g/!
>>
>>55992943
>programming
>html/css

pick one
>>
>>55992943
Literally just fuck around with whatever seems cool.
If you run into walls trying to do so, fuck around with whatever's in your way.
>>
>>55992943
drop that shit, install ubuntu or whatever linux, start learning Python, just go to KAT and type "udemy python" then download all that shit and go through it. You can learn enough Python in a month to start working freelance

start here :
>https://www.youtube.com/playlist?list=PLGLfVvz_LVvTn3cK5e6LjhgGiSeVlIRwt

JS is for faggots
HTML & CSS ain't even programming buddy, that's more like drawing
>>
File: 1458750734787.png (336KB, 1440x2560px) Image search: [Google]
1458750734787.png
336KB, 1440x2560px
>>55992943
>What would be the best route to take/genera advice you could give me, on what track would give me the most independence and opportunities to work independently and remotely?
Not programming.

Want to work independently and remotely?

Do consulting.

Unfortunately, consulting means you need to be very fucking good at a particular thing.

Pick something that is technical, but not programming. The market is being inundated with computer science majors. You'll be more likely to be one of the best if there's less competition.
>>
>>55993065
>2016
>still thinking Python is relevant

Though I'll second that html and CSS are not programming, they're markup.
>>
File: m395b97.jpg (57KB, 511x1024px) Image search: [Google]
m395b97.jpg
57KB, 511x1024px
Hey guys, I know this is probably a common question, but I'm interested in getting into programming and I'd like to know where to start. I've done some shit with C# and Java in the past at school, but didn't get past beginner stuff.

I'd like to be able to make my own games (starting with simple shit like a Tetris clone, eventually getting into 3D stuff) and programs from the ground up, maybe even try my hand at making a basic OS for older hardware.

Can anyone recommend a good starting point?
>>
>>55993191
It's pretty good for learning the basics, and even better for quickly putting something together. It's OOP implementation is fucking terrible though.
>>
>>55993199
> maybe even try my hand at making a basic OS for older hardware.

You have no idea what you're getting into
>>
>>55993191
find one other language that can make you money faster than python if you're starting from 0 programming experience? No other can, simple as that.
>>
File: 1470729636834.jpg (34KB, 626x532px) Image search: [Google]
1470729636834.jpg
34KB, 626x532px
>>55993199
>starting with simple shit like a Tetris clone,

you can do that shit with JavaScript

here's a free 2 hour course on how to make a pong game in javascript
>https://www.udemy.com/code-your-first-game/

And "basic OS" is like thousand times harder than shitty games, probably no one on /g/ could make a basic OS , which isn't saying much because we're all retarded here
>>
Currently going through: http://genius.cat-v.org/brian-kernighan/articles/beautiful

They mention that you can improve the code by compiling it into an internal format, but I don't see any way to fit that into their current design, any ideas /g/?
>>
>>55993211
Both Javascript and C#.
>>
File: aa.gif (860KB, 600x313px) Image search: [Google]
aa.gif
860KB, 600x313px
>>55993314
>C#

>actually being a Microcuck

what happened to /g/? christ...
>>
is there something like agda-mode but for Haskell?
>>
>>55993330
>hating a language based on its creator and not its merits

Nah, you're a cunt.
>>
>>55993428
>>hating a language based on its creator and not its merits
the former saves time pondering the latter
for instance, you could bother to post arguments as to why Python is shit or you could simply say "guido is a faggot"
>>
>>55987942
>Also not autistic so I won't be making stuff I don't need to make.
web devs everyone, fucker can't be arsed to design a nav bar, yet he expects to get paid six figures
>>
>>55993445
Not the same anon, but to be fair, C# is a pretty subpar language unless you're doing quick and dirty GUIs or smaller games...
>>
>>55993468
I don't think that's being fair at all.

If anything, C# shines in the enterprise market space doing CRUD operations. (PROTIP: This is over half of all programming done.)

Hell, I'm writing a full ETL package for our data warehouse in C# and I've gotten more done with it than fucking around with a co-worker in Python for some time. Don't even get me started on actual ETL shit like SSIS.
>>
File: 1470691353038.png (208KB, 541x456px) Image search: [Google]
1470691353038.png
208KB, 541x456px
>>55993493
>if I use 300 million buzzwords maybe, just maybe /g/ will think I know how to program

the post
>>
>>55993536
>he doesn't know what a buzzword is

Sorry, I'll try to keep my posts shorter, and less descriptive.

Just pretend I typed "Kill yourself", if that makes you happy.
>>
File: 1425257523916.jpg (34KB, 640x478px) Image search: [Google]
1425257523916.jpg
34KB, 640x478px
>>55990669
What is the point of "new" in C# and C++?
>>
>tfw in c++, your pointers dangle and friends get to play with your private members.
>>
https://en.wikipedia.org/wiki/Thierry_Coquand

>one of the two who begun Coq
>theory cockwand
>>
>>55993588
this is the ultimate proof that FP is just intellectual masturbation
>>
>>55993588
>Coquand
>cuckand
>from sweden

these memes write themselves
>>
>>55993565
In C#, typically used to create an object, whether anonymous or explicitly typed.

var x = new FemalePenis();


x now contains a FemalePenis object.

var x = new FemalePenis("ayy lmao");


x now contains a new FemalePenis object that was constructed with a string. Thing would have to be declared similar to this (note the constructor accepting a string):
class FemalePenis
{
public string PenisName { get; set; }

public FemalePenis(string _penisname)
{
PenisName = _penisname;
}
}
>>
>>55993617
This wouldn't compile in Agda because FemalePenis is an uninhabited type
>>
File: zzz.png (29KB, 768x749px) Image search: [Google]
zzz.png
29KB, 768x749px
>>55993565
>>55993617
Oh, and if you're wondering why "new" even exists, there's a few reasons.

First and foremost is that is specifies an object, rather than the result of a method.

Take this example: You have an object named Ayy with a method Lmao(). You also have a Lmao object somewhere because someone was a fuckhead and sucks at naming things.

With new, you know you're assigning a new Lmao object, and not the result of Lmao as a method call.

Pic related.

Obviously, the example is contrived, but it's just a potential hiccup.
>>
>>55992961
Yeah I know it's not programming, I just grouped them together with JS for simplicity's sake.

>>55993065
I picked front end shit because I've always been better at and enjoyed creative stuff more, I'm utter shit at technical stuff. However, I read up a bit on Python and making money from automation and it seems really cool...

>>55993146
I'm not good at any particular thing though. I'm also just 18 so who the fuck would even listen to me, even if I were the best of the best?
>>
>>55993211
ayy, Russian or Bulgarian?

Also that's a nice OS but my computer is so old and shit I'm worried messing with it will crash it completely.
>>
>>55993778
serb, it's just ubuntu with Gnome 3.20 and this theme:

>https://github.com/andreisergiu98/arc-flatabulous-theme

also numix circle icons

I don't think gnome is any more resource hungry than unity, I haven't noticed it anyway
>>
>>55993724
Different anon: Barring the fact that an object and method share the same name, would a summary of "new" be that it basically says "hey, I want the object Lmao(), not the method Lmao()"?
>>
>>55993831
Look really nice. How long did it take you to get used to the OS? I downloaded it once but it was confusing to my dumb Windows-accustomed brain.
>>
>>55993837
Well, technically a summary of "new" would be "Allocate space on the heap for this object and its variables, then call its default constructor."

Those instructions are then stored in memory so that subsequent calls to allocate memory for new objects of that type have much less overhead.

Otherwise, relating to this particular situation, yes, you are correct.

var x = Tits();
means "Go look for a method named Tits() and assign its value to x.
>>
>>55993864
few days I guess... it's not really that different, you just have to get used to working in the terminal and that's about it
>>
>>55993557
Yeah, that wasn't me.

>>55993493
Anyways, I don't really know about CURDS and whatnot, since I mostly deal with embedded stuff...
It just strikes me as odd that there's a java flavored C that's neither as fast as C++/C nor having the few qualities of Java (being portable and whatnot)...
>>
>>55994046

If you take into account both Mono and the CoreCLR, C# is reasonably portable.
>>
>>55994089
Ruby, what languages do you use? I refuse to believe you use Ruby, that would be too easy.

Also, how do I become a good tripfag, and not a bad one?
>>
>>55994046
vs C++:
>native garbage collection
>you can do unsafe or managed code (smart pointers need not apply)

vs Java:
>less boilerplate
>actual generics
>dynamic variables, if that's your kinda thing

vs both / general nice things:
>open source
>LINQ
>massive standard library with tons of useful things
>LINQ
>Xamarin
>LINQ

Also, it's portable.
>>
I'm looking too work on mini projects / "missions" in order to improve, when can I find a list of these kinds of missions?
>>
>>55994187
http://better-dpt-roll.github.io/
>>
>>55994141

C, C++, Ruby. These are my main languages. I've fiddled around and done a project or two in various other languages (Java, Python, Javascript, and a few others), but if I'm going to start a new project, it's either going to be in C++ or Ruby if I have my choice.

Also, good tripfag is an oxymoron. We're all massive faggots. Some people just happen to like me because I know my shit... sort of.
>>
>>55993565
In C++, new allocates space on the heap for a constructed object and returns a pointer to it. Like malloc in C. When you're done with the object, you call delete on the pointer, which calls the destructor of the object and then frees the allocated memory.
>>
>>55994217
Why do you like Ruby? I've never used it - what makes it better for you than, say, Python?
>>
>>55994046
>nor having the few qualities of Java (being portable and whatnot)

Portable full .NET (only missing some obscure webdev features for ASP.NET):
http://www.mono-project.com/

Portable open-source C# compiler:
https://github.com/dotnet/roslyn

Portable open-source, lightweight, .NET:
https://github.com/dotnet/core

Cross-platform mobile app dev:
https://www.xamarin.com/
>>
>>55994253
it reads better, it makes more sense if you will
>>
>>55994261
I'm disgusted that so much effort would be expended on *bringing C# support to Linux* rather than something more productive and useful.
>>
Are thse two statements the same?

can i short-circuit like this?

A
if(x2 < x1 && y2 < y1) {
angle += 180;
}

if(x2 < x1 && y2 > y1) {
angle += 180;
}


B
if(x2 < x1 && y2 < y1) || 
(x2 < x1 && y2 > y1) {
angle += 180;
}
>>
How challenging would it be to learn to code in java in 21 days and code Sokoban in JavaFx?
>>
>>55994315
yes but why not

(x2 < x1) && ((y2 < y1) || (y2 > y1))
or
(x2 < x1) && (y2 != y1)
>>
>>55994253

Blocks and a lack of double underscores in everything I write. Also, I have a Sublime Text extension that allows me to evaluate Ruby in the text editor and spit out a result in the text editor. Other than that... I have a hell of a lot more experience writing Ruby than Python.
>>
>>55994366
>have a Sublime Text extension that allows me to evaluate Ruby in the text editor and spit out a result in the text editor
name?
>>
Where can I learn (or where do you guys learn) interesting things about programming?

Feels like I'm stagnating atm, I'd really love to starting learning new things again.
>>
>>55990708
Optimal resource usage, avoiding corner cases by design, providing simple and intuitive semantics.

The Lua programming language, the CPU programming language, optimizing code for execution on x86 processors.

Nothing. Might soon get an embedded development job.

Linus. Fuck commies, they took a fledgling Internet and embedded their retarded ideology. Now we have an Internet filled with 'democratic' this and 'egalitarian' that. And honestly, the quality of the Internet has never risen above populist shithole because of it.
>>
>>55994402

Ruby Eval.

Anyways, it's 6:40 AM, I'm going to bed.
>>
>>55994437
sleep tight
>>
>>55994422
>Where can I learn (or where do you guys learn) interesting things about programming?
At a comfy small business job where you're allowed to pursue a goal however you see fit.

I've learned more in the last year than I've learned in the 5 years at a university. They say "Hey, we need a widget that shows this information." or "Hey, we need information from this API displayed/emailed/stored like this".

If you're forced to figure things out, you end up learning every single step of the process and you get to experiment with whatever takes your fancy.
>>
>>55994437
don't let the GPL licenses bite
>>
File: af8.png (295KB, 600x428px) Image search: [Google]
af8.png
295KB, 600x428px
if u need encouragement for development
>>
>>55994511
cringe

kys
>>
>>55994534
maki is best girl
>>
>>55992512
>working on the parts necessary for spawning a superintelligence of global proportions;
Okay okay hold on.

1. In fucking JavaScript?
2. If you create an economy of Distributed Autonomous Corporations we will all die, just as a heads-up.
>>
>>55994422
the internet
try FP

>>55994534
wrong website beew
>>
>>55994432
>The Lua programming language, the CPU programming language, optimizing code for execution on x86 processors.
Why do so many low-level guys like the very abstract and high-level language that is Lua? It's not just you, that's a trend.
>>
What does the future of Java look like for someone who wants to start programming as a hobby?
>>
>>55994582
Braindead easy to add to your existing C code
>>
>>55994615
Less than now, but it will still have the most jobs for a long time.
>>
>>55994566
>FP
as in function-programming?
>>
>>55994437
It's 9am, time to wake up daddy!
>>
What's the difference between a programmer and a code monkey?
>>
>>55994656
yes, functional programming
start with haskell

>>55994670
species
>>
>>55994670
A programmer uses a language with strong, static typing
>>
>>55994670
A programmer uses a language you like, and a code monkey uses a language you don't like.

Try it, just call the next person you don't agree with a code monkey. You'll feel much better about not having a job or only programming trivial things.
>>
>>55994670
This:
>>55994691
>>
>>55994691
Oh boy, someone made Pajeet butthurt. Try not to eat so much curry next time, it'll lessen the pain.
>>
>>55993837
new allocates an object on the heap, whenever you do something that allocates an object on the heap, you have to use new, and if you don't allocate an object on the heap, you don't use new
>>
>>55994760
What even is the point of this post?
>>
Why does printf in Java not allow %d or similar string codes?
>>
>>55994762
What makes subverting a code monkey? Can someone program in Java and not be a code monkey?
>>
>>55994785
Yes.
>>
>>55991936
>generating primes with a O(n) prime tester
>it's called from a O(n) procedure even
>not using a prime sieve
I don't think programming is for you either
>>
>>55994785
*What makes someone
>>
>>55994776
Moral and intellectual superiority / self masturbation / circlejerking while at the same time trying to defend your own insecurity at the shitty language you use
>>
>>55994670
a programmer is competent and writes code properly. a code monkey is a stupid noob who can only do simple tasks and only follows the most basic instructions, and glues together libraries and copies code off of stackoverflow
>>
>>55994679
>start with haskell
kek
>>
>>55994820
I agree, one should start with Idris
>>
>>55994820
It's seriously not that complicated
>>
What's the algorithm for calculating 4chan trip codes?

Is it some sort of bastardization of Unix Crypt?
>>
Hmmm... I don't see Prolog anywhere on your CV. Care to explain that?
>>
>>55994863
What the fuck are you doing in my house?
>>
>>55994850
its a implementaiton of the DES-based Unix crypt(3) hash
>>
>>55994776
I'm lazy and have the same opinion as that guy, and want to indicate to you that more than one person holds this belief that it's basically "I don't like it so it's a cuck meme" reasoning
>>
>>55994873
I'd like to create a trip explorer of my own in a language where (as far as I can tell) it hasn't been done and open-sourced yet.

Do you have any links to working examples of code producing valid trips?
>>
>>55994879
>I don't like "I don't like it" so its a cuck meme
>>
>>55994838
it's not that it's hard or complicated, because it's not, it's just that haskell is SHIT
>>
>>55994918
I agree, one should use Idris.
>>
>>55994918
>>55994930

prove it
>>
>>55994762
Not him but I code in generally-considered "hardcore" shit like C and Rust, and language elitism seems dumb to me since if I ever wanted to suffer through the bullshit of webdev I'd want to do it in a high-level language* with a garbage collector.

I still haven't learned a pure functional language like Haskell though, so maybe I'm Pajeet and I just never noticed.

*I'd still prefer static typing but there are plenty of high-level statically typed languages out there.
>>
>>55994889
Just get the 2chan.net source code.
>>
>>55994955
>hardcore
>C
>rust

>complaining about language elitists
>use C
>use rust
>>
>>55994934
Monad has fail
MonadPlus hasn't yet been split into two separate typeclasses
semigroupoids isn't in base and integrated into the main typeclass hierarchy
DMR
fmap isn't named map
>>
>>55994980
>comparing standard libraries rather than languages

when will idris add a structural type&effect system (maybe & coeffect) and not a shitty Effect monad
>>
>>55994432
>The CPU programming language
C* lol@phones

>>55994582
Lua is simple, elegant (much unlike C or asm), and the LuaJIT makes it fast, it enables need to reinvent the wheel, and honestly the community is smarter than most.
>>
>idris isn't even lazy
can't make this up senpai
>>
Is there any point in going to university for computer science if I can self-teach myself everything I'll need for a job, and all job listings I've look at say a degree is only optional as long as you can prove you have the skills?

My parents can barely gather thousands of $$$ for university but they're willing to help me, which will haunt me forever if I go and it wasn't even necessary.
>>
>>55995135
University is a meme
>>
>>55995135
they will filter out non-grads, you need a degree just to even be considered
>>
>>55995135
Some places need a degree for the job.

Most places don't require the degree, but you're likely to hit a paywall, or otherwise generally warrant less pay.

You can do just fine without a degree, but your chances are much better with a degree.
>>
With visual studio, is there a way to quickly toggle the multimonitor windows on/off? It's annoying when you want to code and watch something else on the second screen.
>>
I'm trying to implement a simple scripting language using flex + bison as a frontend, I'm pretty sure I'm doing this wrong, I have no idea how I'm going to represent this as classes in my AST.
script:
statements {std::cout << "program\n";}
;

statements:
statements statement
| statement
;

statement:
ID "=" expression ";" {std::cout << "statement\n";}
;

expression:
expression bin_expr
| bin_expr
| value
;

bin_expr:
value "+" value
| value "-" value
| value "*" value
| value "/" value
;

value:
INT
| ID
;


Anyone with more experience in this give me some tips?
>>
I'm going to have a list in C# that, for reasons, contains a lot of names. Doing
*list*.Add(new Name "Pajeet");
for every name in the list is obviously nuts. SO has examples using StreamReader to populate a newly declared list so based on what I've seen it might look like:
            System.IO.StreamReader file = new System.IO.StreamReader(@"\names.txt");
while (!file.EndOfStream)
{
string getNames = file.ReadLine();
string[] storeNames = getStates.Split(' ');
for (int i = 0; i < storeNames.Count(); i++)
{
states.Add(storeNames[i]);
}
}


but VS goes "hey chump we can't convert from a string to whatever-the-fuck-your-class is." Obviously I'm doing it wrong but am I going about it ENTIRELY wrong?
>>
>>55995173
https://msdn.microsoft.com/en-us/library/4k7zyeba.aspx

Create and Save Custom Layouts is the header you're looking for.

You can hotkey switch.
>>
>>55995234
Show me what names.txt looks like and I'll create a method for you.
>>
>>55994889
http://kenany.github.io/tripcode/
>>
How do I use the code tag?
>>
>>55995234
Shit nigger, what are you doing.

If your file is formatted as a name on each line:
var names = File.ReadAllLines(@"C:\temp\names.txt").ToList();


Boom, you've got a List<string>, each line is an element in that List.
>>
>>55995079
>Lua is simple, elegant (much unlike C or asm)
>yfw global-by-default
>yfw forgetting to initialize a variable and it silently evaluates to null
>>
File: zzz.png (9KB, 288x261px) Image search: [Google]
zzz.png
9KB, 288x261px
>>55995292
>>
File: Screenshot_2016-08-09_15-59-29.png (23KB, 445x391px) Image search: [Google]
Screenshot_2016-08-09_15-59-29.png
23KB, 445x391px
>>55995292

def function():
pass

>>
>>55995304
>forgetting to initialize a variable and it silently evaluates to null
This is logical.
>>
>>55995304
>yfw forgetting to initialize a variable and it silently evaluates to null
So?
>>
>>55995246
Just start typing first names into a .txt file and hit return after each name, so it'd look like:

John
Jim
Ben
Sarah
Pajeet
Rajesh


etc. There are about 40 names.

>>55995295
Yeah that's great if I had a list I declared as a string and not as a class I have.
>>
>>55995304
strict.lua
I agree that's a sore point, but the application still works.
>>
Is it possible to force a read-only boolean to True in Python 3? I'm using a function from a library and I understand why they don't want me to be able to change this boolean on my own, but it is completely necessary for me to do so.
>>
>>55995377
fork the library
change it yourself
>>
>>55995377
My sides
>>
>>55995377
use
class test:
def __nonzero__(self):
return False
>>
>>55995353
Then assign that list of strings to the property of that list of objects.

var listOfNames  = new List<Name>();

var inputFileNames = File.ReadAllLines(@"C:\temp\names.txt").ToList();

foreach(var name in inputFileNames)
{
listOfNames.Add(new Name(name));
}
>>
>>55995447
>listOfNames.Add(new Name(name));
not thread safe.
>>
>>55995234
Does your Add-function not accept strings?
>>
>>55995482
No
>>
>>55995482
It does, which is why I ended up posting.
>>
>>55995467
Generic Lists aren't generally thread-safe you dumb fucking faggot.

If that's an issue, use locks or use Concurrent Collections.
>>
>>55995501
Show me the function.
>>
>>55995502
still not thread safe, though
>>
File: kkk.png (29KB, 851x553px) Image search: [Google]
kkk.png
29KB, 851x553px
>>55995447
>>55995501
This works.
>>
>>55995538
Yeah, I tried this out and it worked as I needed. I'm slightly less retarded than I was when I originally posted. Thanks to all.
>>
>>55995538
>>55995565
Could also abuse LINQ to do this.

One line:
var listOfNames = File.ReadAllLines(@"C:\temp\names.txt").ToList().Select(x => new Name(x));
>>
>>55995600
Holy lel, LINQ is something else.
>>
File: cocks.png (10KB, 673x144px) Image search: [Google]
cocks.png
10KB, 673x144px
>>55995600
>>55995618
And if you add
using static System.IO.File;
to the header, you can omit the object reference and just do pic related.
>>
>>55995618

It's so good that streams were hacked into Java 8.
>>
File: IJ.png (69KB, 400x400px) Image search: [Google]
IJ.png
69KB, 400x400px
Hey guys have you tried IntelliJ IDEAâ„¢ from JetBrainsâ„¢? I'm new to Java development and I've heard a lot of talk about the superior quality and productivity of IntelliJ IDEAâ„¢ over shitty old Eclipse or Netbeans. The Community Edition is even free*! I'm going to give IntelliJ IDEAâ„¢ and the other fine products from Jetbrainsâ„¢ a shot, and you should to!

https://www.jetbrains.com/idea/

Also, please let me know if you would be willing to complete a survey about how this post influenced your decision to use IntelliJ IDEAâ„¢.
>>
>>55995699
but java is the worst language
>>
>>55995715
If I had to program in Java I'd be using IntelliJ.

I don't understand the point of your pseudo-shill false flag. I've literally never seen someone shill, ironically or otherwise, for IntelliJ.
>>
>>55995738

I won't deny it, but the influence of LINQ is undeniable.
>>
>>55995715
Emacs exists.
>>
>>55995758
not him but sometimes it seems like they actually shill jetbrains products in /dpt/ and in /wdg/
>>
>>55995715
Would you be willing to complete this Dickâ„¢?
>>
>>55995767
>C# invented functional programming
>>
>>55995715
>â„¢
â„¢
>â„¢
â„¢
>â„¢
â„¢
>>
Reading about css3+4 pseudo selectors and I think they're super duper cool.
Is there some way to say "Partial match class against the value of another element"? So I can have a search bar with value of 'abc' and then use it to apply rules to divs with class 'abcd', 'dabc', but not 'dacb'?
>>
Nothing senpai desu
>>
Simple regex question.
I have this string:
"name Michael is number 1 - name Sarah is number 2 -  name Bob is number 3"


I want to capture name 2, so I write this regex:
name(.+?)is number 2


This captures all this:
"name Michael is number 1 - name Sarah is number 2"


How do I make it only capture the middle where sarah is?
>>
File: asdf.png (10KB, 701x284px) Image search: [Google]
asdf.png
10KB, 701x284px
>>55996051
This is close, see pic.

https://regex101.com/
>>
>programming a thing
>run thing
>CPU goes to 94C

shit

need to set core affinity or something
>>
Does anyone have an explanation of what a Monad in Haskell is without linking me to a fucking 10 page article on the internet?

I've taken a Group Theory class so I think I know enough of the math behind this.
>>
>>55995699
No, it would have been better to let Java die rather than prolong its existence.
>>
>>55996084
That doesn't work with number 1 and 3.
>>
>>55996145
Monads are monoids in the category of endofunctors.
>>
>>55996145
>anything in Haskell
>not a 10 page article on the internet
>>
How autistic are programmers on average? Will my autism just be chalked up to "oh, he's a programmer" and be mostly ignored in a work environment?
>>
Working on reverse engineering a library. It has an embedded version of
AES_cbc_encrypt with 7 arguments.
OpenSSL's version has 6 arguments.

Does anyone know where the 7 version might be from?
>>
File: 1470503855534.png (13KB, 360x230px) Image search: [Google]
1470503855534.png
13KB, 360x230px
>>55996145
>>55996181
This.
>>
>>55996191
Depends.

You can be autistic, but if you're not agreeable and can't work with others, you're going to be ostracized and eventually fired.
>>
>>55996145
http://adit.io/posts/2013-04-17-functors,_applicatives,_and_monads_in_pictures.html
>>
>>55996225
>I know i need recursion
No, no you don't.

Avoid recursion when possible.
>>
>>55996191
Web Development? No. Open sores? Yes.
>>
>>55996224
>http://adit.io/posts/2013-04-17-functors,_applicatives,_and_monads_in_pictures.html

Holy fuck, it's late here and my brain is fried but this is finally something I can work with. Thanks bro.
>>
>>55996191
depends on how autistic you are, if you act like a spastic and make noises and stuff it's probably not going to work, but it's fine to be uncharismatic and socially awkward
>>
>>55996225
L.insert(stuff) returns None

it just inserts into the array and changes it, nothing to return really
>>
>>55996051
>>55996051
The ? makes the .* a greedy match, which means it goes for the longest match possible. The group (the part in parentheses) is matching all of this:
 Michael is number 1 - name 


If you know that the name isn't going to have spaces, you could do this instead:
name (\w+) is number 2


If you want the name by itself, you want to extract group 1; how you do that depends on the language.
>>
list_dif :: [Int] -> [Int]
list_dif [x] = []
list_dif (x:xs) = (head xs - x) : list_dif xs


I'm sure someone will have a fancier way of doing this, but here's this
>>
>>55996239
Sorry, copied the wrong code.
I will restate my question: I am new to python, and trying to make a function that takes a list of any length, and returns the difference between each consecutive number. Ie, for [1,8, 27, 64] would return [7, 19, 37]. The function i have below, however, just returns "none" for some reason.
 
Urlist = []
def dif(L):
if len(L)==1:
return Urlist.insert(1,L[1])
else:
return Urlist.insert(len(L),L[-1]-L[-2]) and dif(L[:-1])
>>
>>55996303
wew
>>
>>55996273
Whoops, that first block should be:
 Michael is number 1 - name Sarah 
>>
>>55996303
This is why people like you need strongly typed languages.

return list.insert(whatever)
returns None because it's not actually returning something, it's simply modifying the list.

You'd know this if you had to specify a return type, because the compiler would let you know that you aren't returning what you think you're returning.
>>
>>55996273
I thought ? makes it non-greedy? That has been the case with everything I've done with regex up to this point. The name will absolutely have spaces, sometimes the name is even multple words.
>>
>>55995135
Degrees help get you in the door. Start working at a help desk or whatever tech position you can get now and complete an online bachelor's program while you work. As long as it's a legit accredited college, it'll be good enough.
>>
>>55996346
Not to mention he's reusing the same list each time and not resetting it
>>
>>55996346
Why the fuck does not that return anything?
Its just adding a number to an empty list. Why the fuck would not that work?

I found an easier solution at any rate, using list comprehensions. Again, im new to this sort of shit, give me a break.
>>
File: mmmm.png (9KB, 798x164px) Image search: [Google]
mmmm.png
9KB, 798x164px
>>55996346
>>55996405
To illustrate:

In C#, the return value of a method modifying an object is usually "void", just like Python's "None". A strongly-typed language will tell you that you're not actually returning the List.

You're not returning the List. You're returning the result of a method acting upon that List, which is simply "None".

Simply do the
Urlist.insert()
operation, THEN return Urlist.
>>
>>55996145
Monads are not magic, but in order to understand what they are, you need a really good grasp of typeclasses and all the stuff you can do with them in Haskell. Once you've grasped that, monads are actually a very simple and general concept.
>>
>>55996450
Alright. Thanks for the help.
>>
>>55996051
>>55996051
>>55996051
Is there really not a solution to this?
>>
>>55996521
You aren't communicating exactly what you need.

Are you just trying to retrieve "Sarah" or the entire middle section between the hyphens?
>>
haskell is cool
rev :: String -> String
rev = unwords . reverse . words

*Main> rev "poo in loo"
"loo in poo"
>>
>>55996521
Parse the first name ... number, discard it and parse the second, you won't avoid that.

Something like
(name(.+?)is number \d+)

then select the second subgroup. as a bonus it describes your format and it's more general
>>
>>55996561
forgot to add a multiplier at the end of my regex. Also it lacks the space(s?) but you get the point, right?
>>
>>55996542
Sarah is in the capture group, so yes that's what I want. But sometimes the names will have spaces in them.
>>
>>55996545
>implying that's not a trivial one-liner in many other languages
>>
>>55996545
Excellent usage of the Umbrella principle, Rajeesh. 50 rupoos have been deposited on your account.
>>
>>55996545
Now do something non-trivial with it.
>>
>>55996545
Posting Haskell here is like casting pearls before swine.
>>
>>55990669
just finished chapter 1 of K&R senpai
>>
File: Untitled.png (8KB, 844x184px) Image search: [Google]
Untitled.png
8KB, 844x184px
>>55996561
That only captures the first.
>>
>>55996696
the space
>>
NEW THREAD!

>>55996728
>>
>>55996730
Dumbass
>>
>>55996730
oh you earliing unoriginal weeb
>>55996743
>>55996743
>>55996743
/!\ ACTUAL THREAD
>>
>>55996707
???
>>
>>55996764
and the dash
" - " <-- this part
>>
    vector<string> children;

auto begin()
{
return children.begin();
}

auto end()
{
vector<string> tmp = children;
return tmp.end();
}


this is all contained in a class
i get an "vector iterators incompatible" when i compare begin() with end() of an object of this class

what am i doing wrong
>>
>>55996790
Is that a typing error? Why are you making a "tmp" copy of children? the second iterator is therefore invalid because the copy was destroyed. What's wrong with
return children.end()
>>
>>55996776
The " - " shouldn't even matter. It would be so much simpler if you just wrote exacly what you wanted me to change.
>>
>>55996863
Not gonna spoonfeed you. Perhaps an analogy will help:
input: a,a,a,a
regex: a*
>gee, why does it match only the first a?

Once you see this detail you cannot unsee it, but it can be hard to spot at first I admit
>>
>>55996896
That analogy is not correct though. The - has nothing to do with what I want to capture nor what I want to use to identify the thing I want to capture. It's outside the main and the sub capture groups. Adding it didn't change fuckall.
>>
File: see?.png (5KB, 253x97px) Image search: [Google]
see?.png
5KB, 253x97px
>>55996954
POAST REGEX
most probably a misunderstanding. I think your search is limited to the first match of the whole regexp then, at least in the screenshot in >>55996696. You can make the whole regexp match multiple name-number pairs, but you have to take the delimiters into account.
>>
File: Untitled.png (10KB, 865x226px) Image search: [Google]
Untitled.png
10KB, 865x226px
>>55997094
It kind of works, but it's only getting 1 of the main groups.
>>
>>55997169
Yup, I admit this seems kinda weird... Didn't know the subgroup would match only in the last group, although maybe your matcher is wrong. Etheirway you can do
(name (.+?) is number \d+( - )?){2}
hopefully that's the correct syntax (match the two first groups only so Sarah is the last one, clever eh?), and you should be definately done with it. Please confirm, I'll stay on the thread.
>>
>>55997237
It works in the regex tester, so that's promising. I'll implement it into my code next. Thanks.
>>
>>55997310
rejoicing!
>>
>>55994799
>Seive instead of primality tests
>To generate a list of a given size
I'm not generating it with an upper limit. I'm generating a list of primes where the list has to be a specific length. Programming isn't for you, and apparently neither is math.
>>55992926
That's what you're doing too though.
Thread posts: 325
Thread images: 34


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