[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/ - Daglig programmeringstråd

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: 316
Thread images: 38

File: sognefjord-norway.jpg (357KB, 1920x1080px) Image search: [Google]
sognefjord-norway.jpg
357KB, 1920x1080px
Hva jobber dere med, /g/?

Gammelt tråd: >>57983026
>>
>>57989242
Erste fuer D
>>
>>57989242
Stop with this stupid non-english meme.
>>
>>57989297
worse than trapshit tbqh 'f'+'am'
>>
>>57989242
https://forum.dlang.org/thread/[email protected]
>>
I have learned that hacking something together instead of doing it properly never pays off in the end.
>>
Is there a better way to write this without it looking so retarded and repetitive?

var xml = fs.readFileSync('./metadata.opf', 'utf8');
var final = {};

// Grabbing important meta from opf file.
if (xml.match("opf:role=\"aut\">(.*)<\/dc:creator>")){
final.author = xml.match("opf:role=\"aut\">(.*)<\/dc:creator>")[1];
} else { throw (new Error("no author"));}
if (xml.match("<dc:publisher>(.*)<\/dc:publisher>")){
final.publisher = xml.match("<dc:publisher>(.*)<\/dc:publisher>")[1];
} else { final.publisher = "unknown";}
if (xml.match("<dc:date>(.*)T")){
final.date = xml.match("<dc:date>(.*)T")[1];
} else { final.date = "unknown";}
if (xml.match("<dc:title>(.*)<\/dc:title>")){
final.title = xml.match("<dc:title>(.*)<\/dc:title>")[1];
} else { throw (new Error("no title"));}
if (xml.match("<dc:identifier opf:scheme=\"ISBN\">(.*)<\/dc:identifier>")){
final.isbn = xml.match("<dc:identifier opf:scheme=\"ISBN\">(.*)<\/dc:identifier>")[1];
} else {final.isbn = "no isbn";}
>>
tfw your boss insists that you can catch exceptions thrown by the delete operator in C++ when their signatures are marked noexcept
>>
>>57989394
Stop trying to parse XML with regular expressions, you fucking idiot.
>>
>>57989394
1. Pull your regexes out into variables.
2. Create a class to represent a regex, the attribute to set if a match is found, and the action to perform if no match is found (tip: make it a function). Make a list of instances of this class and iterate through it.
>>
File: Screenshot+2016-12-13+07.26.37.png (427KB, 2480x1476px) Image search: [Google]
Screenshot+2016-12-13+07.26.37.png
427KB, 2480x1476px
posted in the last thread but here it is again:

Working on this problem for my Python class, but my program makes no substitutions to the txt file. Any help would be appreciated.

try:
myfile = open("bieber_baby.txt", "r")

except:

print("Sorry, the file doesn't exist")

else:
print("Total words in thesaurus: ", total_words)
lyrics = myfile.read()

#remove punctuation from the file

lyrics_no = ""
for word in lyrics:
if word.isalpha():
lyrics_no += word

elif word.isspace():
lyrics_no += word

#split by word
word_lyrics = lyrics_no.split("\n")

#ask the user to enter a probability of changing lyrics

chance = float(input("Enter a % chance to change a word: "))

#Blank list of altered lyrics
audio = ("")

#examine each line
for line in word_lyrics:

#split the line to make into string of words
words = line.split(" ")

#make a program to decide whether to alter words or not
for c in words:

swapnum = random.randint(1,101)

#Check if the words should change by probability and by existing in thesaurus
if (swapnum <= int(chance)) and (c in dictionary):

#choosing a synonym word from the list
random_position = random.randint(0,len(dictionary[c])-1)

c2 = dictionary[c][random_position]

#adding word into empty list
audio += c2
print(str.upper(c2), end = " ")

#if word is not found in dictionary, add the original word.
else:


audio += c
print (c, end = " ")

myfile.close()


any quick fixes or something I might've overlooked?
>>
>>57989458
You never open the file for writing.
>>
>>57989394
Read this: http://stackoverflow.com/a/1732454
>>
>>57989469
2012 says hi
>>
Anyone have a link to a good tutorial to developing on iOS, including platform to use (I currently have XCode -- not sure if that's a good one to use)? I'm on a Mac, if that helps.

I found this, but not sure if it's a good tutorial
https://developer.apple.com/library/content/referencelibrary/GettingStarted/DevelopiOSAppsSwift/
(I also don't know Swift.) I'd rather develop on Android since I already know Java, but everyone I know has an iPhone, and I can't get word-of-mouth going as well (on an immediate, personal level) on Android, even if the latter has a larger user base.
>>
>>57989458
You have to actually write to the file.
>>
>>57989482
And guess what, it's still relevant because retards like him are still using regex to parse XML
>>
>>57989466
>>57989491
wait I fucked up, I don't actually need to edit the .txt file for the problem. I just need to print out the edited text. Do I still need to write to the file in this case?
>>
>>57989515
No.
>>
>>57989515
No, you just have to read the file and then print out an edited version. How you do that is up to you.
>>
How do I make something like this:
spaceengine.org
>>
Repost:Are there any C# + F# programmers here? I'm primarily (read: entirely) a Lisp developer for the past couple of years but I'm really starting to feel some friction from lack of libraries and lack of good compiler/editor integration*.

I'd like to learn F#, but do I need to learn C# first? How good is the interop between them? Apparently if your program uses a GUI you still need to use C# for it. Will I be able to just whip up a straightforward GUI and do all of my programming in F#? I haven't found any guides or tutorials (or even many people) aimed towards people who are in my particular situation of being more comfortable with functional programming and dynamic typing than their reverse.

tl;dr
>How well does F# work on its own, and can it be learned without knowing C#?
>How well does F# work inside of a C# interactive GUI program?
>>
>>57989529
>>57989532
The code I've written just strips out punctuation and prints the text as one whole block without line breaks or synonyms. Any suggestions?
>>
>>57989578
Fire up a debugger and step through your code to see what's happening, and compare it to your expectations.
>>
>>57989570
Not a .NET programmer but I imagine there's lots more .NET library tutorials available for C# than for F# so it probably pays to be able to read C# a little. Wouldn't spend ages learning it though.
>>
>>57989423
I'm scraping for 5 values from a file that at most 20 lines. An xml parser seems like overkill. Everything works just fine, I just thought it looked silly.
>>57989445
That actually makes a lot of sense, thank you.
>>
I hope Andrei-sama responds to me on the dlang forums
>>
File: 1480974326806.png (518KB, 974x974px) Image search: [Google]
1480974326806.png
518KB, 974x974px
Why is programming high so much harder than programming drunk?
>>
>>57989673
do you want him to give you the d
>>
>>57989570
The interop is 1st class, 99% of stuff just werks. I've written applications with GUIs in just F# before. Small utilities to make life at work easier. You don't get the standard nice tools for the job, but it's entirely possible, albeit tedious.
Knowing C# is a bonus though
>>
File: when the D hits you.jpg (23KB, 512x512px) Image search: [Google]
when the D hits you.jpg
23KB, 512x512px
>>57989729
Like you wouldn't believe anon
>>
>>57989664
Pls, you're supposed to program for correctness, just cuz it werks doesn't mean it's correct.
>>
>>57989578
Try focusing on just doing a single word or a single line as a proof-of-concept, perhaps with a string you've made up yourself. I don't feel like looking at your code or spoonfeeding you, but you're probably doing something wrong with an if-statement. Probably a logical error.
>>
>>57989757
desu I tried to use an xml parser, but all the ones for node had so little documentation I had no idea how to get the values out.
>>
>>57989689
Hard to process shit logically when high imo
>>
>>57989735
>I've written applications with GUIs in just F# before.
Are there any guides for this? I found some short articles on functional reactive programming for events, but that's it. This is good to know though.
>>
>>57989242
thank you for using an anime picture
>>
>>57989394
tests=[
'pattern1',
'pattern2',
'pattern3'
];

for(pattern=0;pattern<tests.length;pattern++)
{
final.author = xml.match(pattern)
?
xml.match(pattern)[1]
:null;
}
>>
Functional programming is great and all, but near impossible to debug using conventional means, especially when you're mucking about with continuations, endomorphisms, etc.
>>
>>57989762
I've used it successfully with phrases I created through an input command. But it doesn't seem to work when I use a text file. I just don't see why it's not working.
>>
>>57989841
True, true. I was actually surprising myself when coding drunk a couple weeks ago. Almost too drunk to walk but was writing great code. I had to go back and re-read it sober to figure out what I did.

Yet right now I'm barely high and coding is really difficult. The ballmer peak is real
>>
>>57989878
hmm


tests=[
'pattern1',
'pattern2',
'pattern3'
];

for(
pattern=0;
pattern<tests.length;
pattern++
)
{
final.author = xml.match(pattern)
?
xml.match(pattern)[1]
:null;
}



looks better don't it? is probably more readable as well
>>
>>57989958
>looks better don't it?
Not really

>is probably more readable as well
No again
>>
>>57989900
Continuations aren't used in regular programming. They're deliberately intended to use in a very, very low-level in limited situations in order to construct a new control-flow for a specific operation. It's like a programmable goto. Use delimited continuations to help avoid manually debugging unwind.

You use them with the same restrictions and care that you would when modifying the control flow of any other programming language. Of course, most other programming languages don't allow you to modify control flow outside of the already-given syntactical structures like for, goto, etc. to stop you from shooting yourself in the foot.
>>
>>57989922
At each step, print out whatever data is important for that step, doing this one step at a time, making sure each step is done correctly. For instance, make sure you're adding the right string/transformation to your list. Printing shit out is the easiest way to make sure individual steps are functioning properly.
>>
>>57990043
If he were using a real language he could use a debugger instead of having to put print statements everywhere in his code.
>>
>>57989900
But there's absolutely nothing special about endomorphisms in programming.
>>
>>57989958
hmmm

tests=[
'pattern1',
'pattern2',
'pattern3'
];

for(p=0;p<tests.length;p++){
final.author = xml.match(p) ? xml.match(p)[1]:null;
}

>>
>>57990102

just noticed that I made the same mistake

xml.match(tests[p])
>>
why is this thread so dead
why are you all incompetent js shitters
>>
>>57990058
desu he should have just done what I said at each step in the first place since he's dealing with a language he's only just learning. Python is starting to become a useful thing to know in the industry tho, for whatever reason
>>
>>57990240
Post some code, you humongous cock-guzzling cumslut faggot
>>
File: Untitled.png (3MB, 1920x1080px) Image search: [Google]
Untitled.png
3MB, 1920x1080px
what's the best non-english programming language?
>>
>>57989394
>>57990102
>>57989958
I don't even really know memescript, so I had to look most of this shit up, but here is a cheeky way of doing it:
xml = "<dc:publisher>asdf</dc:publisher>"

var call = (fn) => typeof fn == "function" ? fn() : fn
var extract = (re, def) => (xml.match(re) || {1: call(def)})[1]

var final = {}

final.author = extract(/<dc:publisher>(.*)<\/dc:publisher>/, () => {throw "no author"})
final.publisher = extract(/<dc:publisher>(.*)<\/dc:publisher>/, "unknown")
final.date = extract(/<dc:publisher>(.*)<\/dc:publisher>/, "unknown")
final.title = extract(/<dc:publisher>(.*)<\/dc:publisher>/, () => {throw "no title"})
final.ibsn = extract(/<dc:publisher>(.*)<\/dc:publisher>/, "no ibsn")

console.log(final)

Ignore that all of the regexs are the same, I just couldn't be bothered writing a test xml string to match all of that shit.
Obviously if you were going to use this, you would change them.
>>
>>57990311
moon
>>
File: stallmanu.png (273KB, 1240x928px) Image search: [Google]
stallmanu.png
273KB, 1240x928px
Applying EPX 2x to the generated stippled images is pretty neat.
>>
>>57990504
What's the output if you run this through it? Just curious
>>
File: 1446773251195.png (150KB, 288x379px) Image search: [Google]
1446773251195.png
150KB, 288x379px
>>57989242
>language looks like puke when typed out
>sounds like puke when spoken

how do you put up with this?
>>
>>57989900
Same is true for any other programming paradigm when you indirect yourself five dozen layers from the baseline. Debugging advanced template systems in C++. Debugging complex Javascript systems. Debugging any sufficiently large Python program...
>>
>>57990564
can mongodb find specific data instead of just the entire entry?
>>
File: 979848871856090531.png (1MB, 1180x1080px) Image search: [Google]
979848871856090531.png
1MB, 1180x1080px
I want to start developing some applications for linux. These applications will mainly handle media like images and video files, which language should I choose?
>>
File: cute anime pic 0075.jpg (110KB, 1280x720px) Image search: [Google]
cute anime pic 0075.jpg
110KB, 1280x720px
>Andrei replied to me
>>
>>57989900
>mucking about with [...] endormorphisms
What? What is there to "muck about with" there? An endomorphism is just Haskell-shitter speak for "a function whose return type is the same as its input type" and those aren't specific at all to functional languages. Every language with types has them.
>>
>>57990607
C
>>
>>57990670
https://github.com/scalaz/scalaz/blob/series/7.2.x/core/src/main/scala/scalaz/Endomorphic.scala
>>
File: stallmanu2.png (149KB, 1240x928px) Image search: [Google]
stallmanu2.png
149KB, 1240x928px
>>57990529

Here, boss.
>>
>>57990607
C++
>>
>>57990747
>Recommending C++ to anybody for any purpose
(You)
>>
>>57990542
Norsk er et musikalsk språk.
>>
>>57990747
>>57990741
That's what I thought, I just wanted some confirmation
>>
Fritjof, du suger pikk.
>>
How do I be less tired after commuting 90 minutes each way to my programming job?
>>
>>57990818
Move closer.
If your job is stable enough, make the effort to move closer to where you work.
Having a sub-20 minute commute is a real quality of life upgrade.
>>
>>57990818

Lots of caffeine.
>>
>>57990742
Endomorphism has the same meaning, even in Scala, anon.
>>
>>57990818
Get more sleep, and dream of the day when we have the technology to allow you to work from home.
>>
For sublime syntax definitions, are there specific predefined scopes, or are they completely user defined?
>>
>>57990840
Can't. Wife needs to commute in the opposite direction.
>>
>>57990856
>wife
You made your bed, now lay in it.
>>
>>57990856
>spending 3 hours commuting
why even live?

I'd rather be homeless than deal with that nonsense.
>>
File: 663661.jpg (11KB, 292x235px) Image search: [Google]
663661.jpg
11KB, 292x235px
>>57990879
>>
File: 1480390918873.jpg (108KB, 677x529px) Image search: [Google]
1480390918873.jpg
108KB, 677x529px
>>57990890

I have a 65-70 minute commute. I use the extra time to contemplate suicide.
>>
>>57990890
>>57990935
Great time to read a book if you're going by train desu senpai
>>
In C with a pointer foo, can I do

if (foo != NULL && *foo == bar) {
...
}


or do I have to do

if (foo != NULL) {
if (*foo == bar) {
}
}


?
>>
>>57990964
Compile it and see.
>>
>>57990980
WHAT THE FUCK I HATE C NOW
>>
>>57990964
Should be fine, look up short-circuit evaluation
>>
>>57990951
>train

This is America, god damn it.
>>
File: slave-family.jpg (2MB, 2972x3061px) Image search: [Google]
slave-family.jpg
2MB, 2972x3061px
>>57990951
>being forced to work in the field
Great time to socialize and get a tan
>>
>>57990951
I used to use the tone to try to learn moon but I stopped being able to concentrate. These days I never feel fully awake. Like I'm trapped in an unending nightmare.
>>
>>57990935
I love my 30 minute commute because I live in a city but work in the countryside.

Every morning I get to freely pass thousands of furious people stuck in traffic going in the opposite direction and finish my journey among green rolling hills.

Then when I go back I get the same thing in reverse.

It feels really good.
>>
>>57991005
Nigga I ain't driving in Chicago
>>
>>57990980
I know the top version works, I just don't how about about any hidden gotchas (e.g. with standard/compiler compliance) that might be hiding.
>>
>>57991005
I'm not about to drive into Manhattan.

Also, where would I park?
>>
>>57991024

Cities are fucking garbage. Unbearably loud and disgusting, and full of subhuman trash.
>>
>>57991043
t. hick
>>
>>57991043
>cities are like /b/
>>
>>57991043
And also the place where I own very nice property I inherited.
>>
>>57991043
not all cities are american cities
>>
>>57991056

What of it? I get to hunt from my back porch. I'd like to see you try that from your 8 square foot 60th floor apartment.
>>
>>57991067
fuck off europoor
>>
>>57991067

Most major European cities are exactly the same, and thanks to all the Muslim-importation, they've definitely got their share of garbage """people""".
>>
>>57991075
I think you're a twat most of the time but I wish I could live somewhere quiet and rural like you seemingly do.
>>
>>57991089
>Most major European cities are exactly the same

Not really. They have certain areas full of minorities, but the middle classes haven't all abandoned the bulk of their inner cities to live in the suburbs like the Americans did.
>>
>>57991075
I live on the first of three floors 350 square feet :)
>>
>>57990964
You don't need to explicitly compare against NULL
You can just do
if (foo && ...) {
meditate_on_rocks();
}
>>
>>57991131
I live in a 700 sqft apartment and I pay $2k/mo for the privilege.
>>
>>57991057
they really are
>>
>>57991098

It's wonderful, I think. If you don't like hick activities, though, it's probably not for you. I know in the Yuro-peon countryside, you've got your own sorts of hillbillies, though. The kind who drive ancient Land Cruisers around for fun. Same thing here, but with bigger trucks.
>>
>>57991152
Wouldn't it be more enjoyable to use all that money on heroin instead and just live on the streets?
>>
>>57991165
I think you must be mistaking me for another anon, I live in the US.

The plan is to move out to somewhere like Montana when I have enough money to retire, or I have enough for a house and I find a remote gig I can do out there.

I neither like nor dislike driving, hunting, etc. I just dislike being around lots of people in a small area, it makes me feel claustrophobic.
>>
File: 17314937275_926521ce07_b.jpg (457KB, 1024x682px) Image search: [Google]
17314937275_926521ce07_b.jpg
457KB, 1024x682px
>>57991239
>I think you must be mistaking me for another anon, I live in the US.

Most Americans don't use the word 'twat', so I just figured you were British and I was going to suggest getting the best 4x4xfar.

>I neither like nor dislike driving, hunting, etc.

You may want to consider picking those things up as hobbies, because there isn't anything else to do.
>>
>>57991239
>I just dislike being around lots of people in a small area, it makes me feel claustrophobic.
pussy
>>
>>57991132
>You don't need to explicitly compare against NULL

You do if you want to avoid segfaults.
>>
Also, you better get used to country music, because no other stations come in clearly.

[spoiler]and there's no qt black women to marry, either[/spoiler]
>>
>>57991323
>Most Americans don't use the word 'twat', so I just figured you were British
Fair enough. I spent a chunk of my childhood in the UK, so I picked up a bit of the language.

>>57991323
>You may want to consider picking those things up as hobbies, because there isn't anything else to do.
Good advice. Right now I feel like I'd be happy being able to do nothing, but I'm sure that would get old after a few weeks.
>>
>>57991356
>ever not initializing to NULL or setting to NULL after freeing
You are right though
>>
>tfw you found a bug in a github repo, but don't want to submit a pull request because it wiill appear in your profile that you contributed to a 4chan project
>>
>>57991444
>people you don't know will find out that someone that they don't know contributes to something lame
Why would they care? A fix is a fix. Do you think they won't accept fixes from an internet hacker?
>>
>>57991457
the thing is, if people see 4chan on my github think i'm a weirdo
>>
>>57991467
oh the project is a 4chan project
yeah I wouldn't do that.
I misunderstood, I thought you meant that you have contributed to a 4chan project in the past so you don't want to contribute to another project.
>>
>>57991444
>>57991467
>make new account
>submit pull request
>abandon account
>>
>>57991467
Well will they be wrong?
>>
>>57990854
Anybody?
>>
File: peepee.jpg (55KB, 500x473px) Image search: [Google]
peepee.jpg
55KB, 500x473px
>>57991444
Oh fuck, I have a 4chan project HOSTED on my github that I show to employers. It's among other things and it's fairly benign. How fucked am I?
>>
>>57991530
use vim

>>57991542
if it's substantial I'm sure your fine; an image downloader is pointless to have
>>
>>57991506
;)
>>
Can someone explain existential types to me please?
>>
>>57991667
There's not much to explain. It means you have a specific type.
>>
>>57991356
Howso?
if (foo) is exactly the same as if (foo != NULL)
>>
>>57991698
The danger is with uninitialized pointers, and pointers not set to NULL if they were previously allocated then freed.
 λ cat test.c
#include <stdio.h>

int main(void) {
int *pi_random;

puts(pi_random ? "random is non-null" : "random is null");
puts(pi_random == NULL ? "random is null" : "random is non-null");

return 0;
}
λ gcc test.c
λ ./a.out
random is null
random is null
λ vim test.c
λ cat test.c
#include <stdio.h>

int main(void) {
int *pi_random;
int *n = NULL;

puts(pi_random ? "random is non-null" : "random is null");
puts(pi_random == NULL ? "random is null" : "random is non-null");

return 0;
}
λ gcc test.c
λ ./a.out
random is non-null
random is non-null
>>
>>57991742

Are you Greek?
>>
>>57991758
Yeah.
>>
>>57991776
any tips on buying haloumi?
>>
>>57989958
>>57990102
>>57990337

the patterns and the meta words have to be in the same order though.

var xml = fs.readFileSync('./metadata.opf', 'utf8');
var final = {};

var metaWords = [
'title',
'author',
'isbn',
'date'
];
var patterns = [
"<dc:title>(.*)<\/dc:title>",
"opf:role=\"aut\">(.*)<\/dc:creator>",
"<dc:identifier opf:scheme=\"ISBN\">(.*)<\/dc:identifier>",
"<dc:date>(.*)T"
];
for(var i = 0; i < patterns.length; i++){
xml.match(patterns[i]) ?
final[metaWords[i]] = xml.match(patterns[i])[1]
:console.log("fucked up");
}
>>
>>57990879
t. 19 yo faggot who thinks being alone is da best
>>
>having to wait to install XCode so that I can run a basic Bash command
Fuck you Apple
>>
>>57991805
>any tips on buying haloumi?
By exchanging legal tender with the appropriate merchants, you will be rewarded with delicious unripened brined goat cheese.
>>
>>57990980
so tedious
no fucking interpreted sessions to test out snippets?
>>
>>57991866
what
run it in your terminal
>>
>>57991742
Oh right I see what you're getting at now.
Lucky for goofs like me, -Wall catches use before initialization :D
>>
>>57991871
https://blog.pclewis.com/2010/03/tip-using-gdb-as-an-interactive-c-shell/
>>
>>57991875
Not working in the Terminal, my man. Needs to install xCode
>>
>>57991922
I think you're retarded. Sorry.
Save it and run it in your terminal.
Example:
$ ./myscript
>>
So in Java, if x = 5 and y = 7:

System.out.println(x + ' ' + y); <-- prints out "44"
System.out.println(x + " " + y); <-- prints out "5 7"

Why the fuck does the first one print out 44? How did it get 44?
>>
>>57991959
Won't compile. Based on this thread, the problem is that xCode isn't installed.
http://stackoverflow.com/questions/32893412/command-line-tools-not-working-os-x-el-capitan-macos-sierra
>>
>>57991996
>basic Bash command
>>
>>57991992
Single quotes indicate a char, so in your first statement, that char is being implicitly converted to an int and added to x and y
It's 44 because the space char has a value of 32
http://www.asciitable.com/
>>
>>57992003
sorry senpai, had assumed gcc was part of Bash
>>
>>57992045
That's okay, sorry for being harsh and rude
At least the fix is simple
>>
https://twitter.com/veged/status/807489529825361920
>>
>>57989242
hey do any of you guys have a list of the coordinates of shoreline locations or know if can get this list somehow
>>
>>57991742
>The danger is with uninitialized pointers, and pointers not set to NULL if they were previously allocated then freed.
Comparing an uninitialized pointer with NULL is still undefined behavior and doesn't help you any.
>>
>>57992100
What do you mean?
>>
>>57989790
Can't you just do shit like
var str = fs.readFileSync(...)
var xmlp = new DOMparser();
var xmld = xmlp.parseFromString(str);
var publisher = xmlp.getElementBy...
>>
>>57992118
Exactly, it's the same whether you compare it or not.
>>
Am I better off using an IDE (CLion) for C++ compared to using Vim or any other text editor?

For C I wouldn't need to use an IDE since Vim does the job perfectly well, but C++ I don't really know.
>>
File: IMG_20161213_224358169.jpg (3MB, 2340x4160px) Image search: [Google]
IMG_20161213_224358169.jpg
3MB, 2340x4160px
What you drinking tonight senpai
>>
>>57992221
I use Vim with C++ and it works well.
>>
File: rsz_img_0752.jpg (47KB, 550x733px) Image search: [Google]
rsz_img_0752.jpg
47KB, 550x733px
>>57992242
Kinda wish I hadn't spent all my money on that shit. I'm craving real food now.
>>
>>57992242
apple juice and fruit tea
>>
>>57992254
Oh alright then thanks anon.
>>
File: 1470803754766.png (16KB, 958x660px) Image search: [Google]
1470803754766.png
16KB, 958x660px
To you guys, what makes an IDE good or bad?
>>
>>57992242
kahlua and hot cocoa

feel v comfy
>>
>>57992340
Slowness. I don't give a fuck about whether the IDE is complicated or if I have to spend a lot of time learning how to use it but fuck me if it's slow it's shit.
>>
>>57992242
fresh loli piss
>>
>>57992356
I should try this sometime
>>
File: asm only.jpg (8KB, 221x228px) Image search: [Google]
asm only.jpg
8KB, 221x228px
>>57992269
> tfw to smart too fall for the soylent meme
>>
File: pepe_center_stipple.png (35KB, 620x683px) Image search: [Google]
pepe_center_stipple.png
35KB, 620x683px
Just devised this pointilism filter, or whatever you'd like to call it. Strangely similar to the Voronoi approximation, but less intensive.
>>
>>57992469
It's not that bad Anon. Lets me eat vegan without any effort and I can spend more time on the computer instead of cooking/washing the dishes.
Plus Joylent is made in the EU so it has actual quality control.
>>
File: bria_myles_halftone.png (349KB, 750x750px) Image search: [Google]
bria_myles_halftone.png
349KB, 750x750px
I guess it's actually more of a half-tone effect.
>>
>>57992476
I like the way it handles that text, zoom in and it is not very discernible, zoom out and you can read it clearly
>>
>>57992124
i need to calculate the distance between capital cities and the ocean. I have a csv of the capitals coordinate locations so i need a coordinate list of shorelines then i can just run haversine on each coordinate with the shoreline coordinates and have it return the shortest one. Unless you know an easier way to find out the distance between a point and the ocean
>>
File: praise_kek.png (1MB, 1024x1212px) Image search: [Google]
praise_kek.png
1MB, 1024x1212px
>>57992639

The region sizes are also totally up the to the user. That pepe used 12x12 regions, and this Kek uses 6x6 regions. They don't have to be square, either.
>>
File: 1413576023629.png (3KB, 184x172px) Image search: [Google]
1413576023629.png
3KB, 184x172px
How does /g/ feel about doc comments?
>>
>>57992732
/g/ is incredibly judgmental and is either anal retentive about how you make comments or they believe you are stupid for needing them
>>
>>57992664
So you're saying that you want a list of POINTS that creates a curve (the shoreline?)
Sounds retarded.
Just make a 2d array of the world where each element = 1 square length unit, and then BFS until you hit the ocean.
Enterprise solution subject to copyright.
>>
what is the best way to format functions with loads of arguments?
>>
>>57992904
If you're passing lots of relevant variables together, why not keep it in a struct and pass just a struct pointer?
>>
File: TLPI-front-cover.png (183KB, 454x600px) Image search: [Google]
TLPI-front-cover.png
183KB, 454x600px
Reading the following
>>
>>57992941
This binds data together in an unnecessary way. See: OOP
>>
>>57992952
Are you retarded?
The alternative is function signatures with 20+ variables for anything non-trivial.
>>
>>57992904
I just make sure to indent it 2 tabs so that it doesn't clash with the base indentation of the function's body.
>>
>>57992962
>20+ variables

the most wayland has is around 6, which is what I'm using here
>>57992904

it's the names that make the functions run off the page.
There is no way of getting away with long arguments, that's why I asked the best way to format arguments
>>
>>57992962
If data should be bound together, structs should be used.
Not always should data be bound together. Should all functions just take 1 parameter, a pointer to struct functionname_arg_struct?
>>
>>57992998
>If data should be bound together, structs should be used.

if you are dealing with a server, that means you have to copy the--masive--struct for every message
>>
>>57992985
I recommend K&R style.
void shell_surface_configure(a, b, c, d, e)
void *a;
struct wl_shell_surface *b;
uint32_t c;
int32_t d;
int32_t e;
{
/* ~~~ */
>>
>>57993016
************************

>>57993021
stop
>>
>>57993016
Copying massive structs is exactly the same as forwarding a lot of arguments... which can be pretty efficient in calling conventions that utilize registers.

>>57993021
Yuck.
>>
Why /g/ doesn't like C++?
>>
>>57993052
fag
>>
>>57993052
loo << poo;
>>
>>57993052
/g/ isn't one person with one opinion
>>
>>57992732
They're great, though obviously the name and type should explain a lot
>>
>>57993052
C++ in general is pretty awful.
It's too C and at the same time, not C enough.
They really should have cut off all compatibility with C over 20 years ago.

In 20 years, C managed to entrench itself as the low-level lingua franca and the use cases for pure C++ have quickly dried up to Game Dev and nothing else.
>>
What should we do with all the waste of space leeches on society?
>>
Made it to the AoC leaderboard today :)
>>
>>57993285
I bet you did faggot
>>
>>57993296
jelly
>>
>>57989242
menar du på fritid eller som betalt arbete?
>>
>>57989328
Kvifor kjem dykk og oydelegg det beste biletebrettet mitt?
>>
File: 1458865259762.webm (524KB, 704x388px) Image search: [Google]
1458865259762.webm
524KB, 704x388px
has some problems but... nice to have one of my first projects working as a newcomer to programming
>>
File: 1477172406211.png (8KB, 398x293px) Image search: [Google]
1477172406211.png
8KB, 398x293px
>>57993774
>amd
>>
>>57993774
it's really fucking shit (not really)
>>
>>57993818
fuck left a tripcode
>>
>>57993818
thanks, the problem i have right now is that my source for most common words doesnt include abbreviations like "it's". also i just realized one of the results has a period in it, that's easy to fix though
>>
File: example.png (57KB, 500x354px) Image search: [Google]
example.png
57KB, 500x354px
>>57989242
Which one of you /g/ents did this?

Is it actually a comfy environment?
>>
>loop up C++ books on templates
>its all shit from 2001
>look up C++ books on data structures
>its all from 1999

why the hell arent there any books from this fucking decade and why are people always referencing books that are over 15 years old.
>>
>>57993924
C++ is more than 10 years out of date
>>
>>57993924
>gets recommended a book by the prof
>its from fucking 2001
https://www.amazon.com/Templates-Complete-Guide-David-Vandevoorde/dp/0201734842/
>>
>>57989242
Stick norsk jävel
>>
>>57993924
Because good programming books are timeless.
Plus, most textbooks these days are aimed at the college classroom, they pad them out with thousands of pages of garbage fluff just so they can sell you a new one every year and so they'll stand out on store shelves.
The same fate happened to handheld calculators.
If calculators were still tools and not automatic homework solvers, we'd still have RPN calculators.
>>
File: 1459377667865.webm (333KB, 704x388px) Image search: [Google]
1459377667865.webm
333KB, 704x388px
>>57993833
to add to that, more interesting results actually will happen when you set filter LESS words (but not too few) since it fails to filter words of that kind. here's a better example.
>>
>>57993924
Use python if you want a modern programming language with modern documentation.
>>
>>57993982
>__modern__
>>
>>57993990
from 1990s import language
from kindergarten import users
>>
>>57989394
Yeah, use XPath.
It lets you look up paths in an XML-tree in an easy (for you) matter.
>>
>C
>Java
>Python

Do you even need any other programming languages?
>>
>>57993999
Nice trips
>>
I know a bit of java, javascript and php. Wha tshould be my next language?
>>
>>57994127
C
>>
>>57994127
>Java
>Javascript
>PHP
Surprised you haven't killed yourself yet
>>
>>57994141
Care to explain why?
>>
>>57994103
>>Java
>>Python
>>
>>57990607
Vala, C, C++, Python, Java, Guile...
Whichever of these you know and like, I guess?
>>
>>57990935
Sleep, watch moon cartoons, etc.?
Do what everyone else on the bus is doing.
>>
>>57994127
brainfuck. The only metric you show is your affinity for joke languages.
>>
File: 1471207221568.gif (140KB, 640x480px) Image search: [Google]
1471207221568.gif
140KB, 640x480px
>>57994200
this, moontoons are the greatest
>>
>>57994224
It's not affinity, it's what I am studying in college.
>>
>>57994127
C#

It's high in demand, and is literally Java's non-retarded brother that can get shit done.
>>
>>57994272
*less-retarded
>>
>>57994149
I'm not who you replied to, but it's good to know a systems language or two

it is a completely different mindset which could help you with programming in higher level languages
>>
>>57989735
F#, scala and ocaml are awesome and you should learn them all (they're very similar and will give you great platform coverage with minimal effort). Nowadays I only use C# when I'm forced to.
>>
File: 1410128408377.gif (517KB, 650x390px) Image search: [Google]
1410128408377.gif
517KB, 650x390px
>>57994320
Oops, meant for:
>>57989570
>>
>>57989570
You can learn F# without learning C#
>>
>>57989570
>Lisp developer
Where do you work?
>>
>>57989310
trapshit isn't bad, so that's not hard.
>>
>>57994508
>trapshit isn't bad
Get out of here, you stupid fucking redditor.
Go spam your ancient forced memes elsewhere.
>>
>>57994536
Find me one redditor place(or whatever they're called) that welcomes trap/programming memes posted anonymously, and maybe I will.
Until then realize that this shit has its home on 4chan and your autistic buttbotheredness about it is what is actually rebbit.
>>
>>57994570
You took something that wasn't even funny to begin with, and then constantly post in and drive it into the ground, and then continue to post it.
If that's not the mark of a redditor, I don't know what is.
>>
>>57994584
It's not a joke. it's cute.
>>
>>57994593
You're just a fucking meme spouter. You're on the level of fucking frogposters.
You should consider suicide.
>>
File: 1478623474495.jpg (2MB, 2880x1920px) Image search: [Google]
1478623474495.jpg
2MB, 2880x1920px
>>57994650
>level of frogposters
You're back, I see
I thought you gave up on your autism rant the other day?

Either way, /dpt/ isn't changing to accommodate you
>>
>>57994672
And this is the fucking state of /g/ at the moment.
Fucking infested with frogposters.
>>
>>57994698
You have autism.
Has anybody even posted a frog in this fucking thread?
>>
>>57994698
>>57994721
Just checked, only two frogs, one of which was by a tripfag doing some image manipuloation.

So one frog in the entire thread

But sure, everyone you don't like is a frogposter
>>
>>57994721
>>57994726
Seriously, just go back to facebook or reddit, with your boring, unoriginal, meme-spouting brethren.
You'll fit in much better.
>>
57994735
>seriously, just
You have to do much better than that.
I'm not even the guy you were replying too here >>57994650

You don't fit in.
Fuck off.
>>
>>57989242
Er det mange norske homoer på /g/?
>>
Is there any downside to exploring multiple different languages basically at the same time?
>>
>>57994938
It takes time away from learning the master language, C.
>>
>>57994947
I'm already learning it as my main language and time isn't a big concern since I'm doing it for fun.
>>
>>57994938
bad practices
>>
Should I use C++ for desktop applications?
>>
>>57989242
I don't speak cuck
>>
I had accidentally pushed a commit on github which deleted my readme file. not the file is gone and it doesnt show up in the commit history as deleted. what do?
>>
>>57994698
>at the moment.
we were here first
>>
>>57995064
>we
So you're not only admitting to be a cancerous frogposter, but you're apparently the spokesperson for that group?
Never mind the fact the your fucking frogs are a recent ordeal.
>>
>>57995055
what command did you run?
>>
>>57995072
He isn't a spokesperson. I'm the chairman of the frog poster group.
But yeah, we were here first.
>>
>>57995083
Fuck off you stupid frogposters.
You're trap-autist tier
>>
>>57995079
I wrote the readme on github (those changes dont show up in the commit history)
then I force pushed my whole master branch like a moron
and now readme is gone.
>>
>>57995055
You should be able to checkout a previous commit of which you know contains the readme file.
>>
>>57995083
>we were here first
Could you be any more delusional?
>>
>>57995092
inb4
>hahaha you show them dumb trap posters!
I was referring to >>57994650 (You), faggot
>>
>>57995093
changes on github should should up in the repo is you pull them into your local repo

if you didn't every pull it into your local repo and then you pushed your master then you'll probably have to rewrite it
>>
>>57995092
I will relay your message to he head frogposter himself
Anything else?
>>57995097
But facts can't be considered delusion by any stretch of the imagination. We were on this website first.
>>
>>57995092
>trap-autist tier
trap posters are the highlight of dpt
>>
>>57995095
I never fetched it from origin to my local. I kinda just forgot because its such a small project

>>57995103
but why do the changes not show up in the history? the button you hit when saving the readme file is "commit directly" with a hash and everything
>>
>>57995107
>I will relay your message to he head frogposter himself
>Anything else?
tell him to kill himself

>>57995108
I was referring to the autist that has to reply to any fucking image that might be a trap and bitch about it
>>
>>57995108
I believe that was a supposed to be a compliment
>>
>>57995107
can you ask the head frogposter what his favorite color is?
>>
>>57995118
I believe its green (big surprise huh)
>>57995116
Why? Why would you wish such a mean thing to him?
>>
>>57995113
changes do show up in the history
were you looking at the right branch where the readme.md was made?
>>
>>57995122
And when you're done telling him that, tell it to a mirror too
>>
>>57995153
why would you want a mirror to kill itself you jerk
>>
How doyou get yourself to keep programming when you're too shit at life to ever get a job doing it?
>>
>>57995153
wow... now that was really uncalled for
>>
>>57995139
in eclipse I go to origin/master -> show in history and only my 5 commits show up. there are no commits from my readme file. it's really strange.
>>
>>57995163
So it doesn't have to stare into your ugly fucking mug
>>
Why aren't you programming in a functional language?
>>
File: Python-logo-notext.svg.png (72KB, 1024x1024px) Image search: [Google]
Python-logo-notext.svg.png
72KB, 1024x1024px
>>57995188

I am
>>
>>57995355
There are two ways of interpreting the phrase "functional language".

In what way does Python satisfy either of them?
>>
>>57995365
Hisss
>>
>be used to the speed of 4chan
>have to wait days or even weeks for a response on boards and githubs for questions or an answer to a pull request
they should kill themselves. so fucking low energy
>>
>>57995645

everyone is cucks. what did you expect
>>
i came across a programming challenge thread while browsing with my phone, wasn't able to read it all at the time.

Sounded like a reasonable way to test and increase my skill. Is it a regular thread on /g/?

Also: how do i put myself out there? Start a blog, throw code online? Github?
>>
File: 1472746453140.jpg (49KB, 600x488px) Image search: [Google]
1472746453140.jpg
49KB, 600x488px
>Norwegian /dpt/
Hell yeah.
>>
>>57994508
Kys fag
>>
>>57995167

pls help

I asked on reddit and they just insulted me
>>
>>57995167
being shit at life is as good a starting point for your programming career as any other. Potentially better because you have fewer distractions.
You'll have to talk to some hr/recruitment extroverts at some point, but your ability to function as human being is a bonus rather than a requirement.
But yea, you're gonna have to sit down and git gud
>>
File: 1474601613925.jpg (36KB, 512x512px) Image search: [Google]
1474601613925.jpg
36KB, 512x512px
>>57995742
don't give up anon
>>
>>57995742

>being outcompeeted by pajeets

Enjoy your neetbux
>>
>>57995703
>https://www.reddit.com/r/dailyprogrammer/

Don't post anything but the 'Easy' category, or /dpt/ won't bother.
>>
>>57989242
Ikke en jævla dritt, æ har absolutt ikke nokka å gjore
>>
>>57995842
what a waste of time
>>
>svensk

lol
>>
>>57995895
See what I mean?
>>
does breadth-first-search maze generation produce a perfect maze?
>>
>>57995916
in the time you do challenges you could do something useful
>>
>>57995922

like project euler
>>
>>57995922
In the time you spend not doing challenges, you could do something useful.
>>
>>57995842
Thank you, didn't know it was a reddit thing, can't even roll for a challenge over there
Wasn't looking to bother people for help with them, i enjoy working things out for myself (and believe it helps learn)

>>57995922
i'm not on any kind of mission, working out some arbitrary challenges is better than watching anime.
>>
Reminder that new threads come at least at 311 posts in the current thread, especially when it's so early in the morning and we're slow.

>>57989242
CRUD things

Sometimes just moving data is like zen.
>>
>>57995167
Anon I found a good encouraging example.
You're not too bad to get a job doing programming:
https://youtu.be/zhWV_D_9OCY
This guy is employed teaching electronics and programming for a long time and in another video he says he still doesn't understand pointers.

Look at that explanation of conditionals though. He's not just a bad programmer. He's also not a good teacher.
>>
File: thinkgen.png (184KB, 469x421px) Image search: [Google]
thinkgen.png
184KB, 469x421px
If I have characters, and I have arrays of characters, why would I want a separate construct for strings?
>>
>>57997145
>contemplativepajeet.img
Thanks.
>>
>>57997145
Depends on the language.

In mine, strings are immutable.
>>
>>57997145
Storage wise, there are more efficient ways to store strings (with certain given conditions). Ropes, for example.
As for string manipulation, UTF-8 is quite tricky
>>
>>57997198
>UTF-8 is quite tricky
How so?
>>
>>57997145
C programmers everyone
>>
>>57997236
>why should a language handle current use cases on its own
It's a valid question.
I wish C didn't decide on null terminated strings like that'd be the best way to do things always. C strings poison so many code bases.
>>
>>57997236
>>57997273
No one said anything about C.
>>
new thread
>>57997596
>>
>>57997299
Uh.
>>57997236
>>
>>57995703
http://adventofcode.com/
Thread posts: 316
Thread images: 38


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