[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: 283
Thread images: 21

File: 1485341966496.png (95KB, 504x504px) Image search: [Google]
1485341966496.png
95KB, 504x504px
What are you working on, /g/?

Old thread: >>58685041
>>
>>58690487
Thank you for not posting animu
>>
File: 1482459435387.jpg (567KB, 595x842px) Image search: [Google]
1482459435387.jpg
567KB, 595x842px
god bless anime
>>58690487
thank you for using an anime image
>>
>>58690497
That's Lain faglord
>>
I recently got an internship at a small webdev company, and as a project I have to build a website. I use PHP. It's easy but tedious as fuck. So this is gonna be my life now.
>>
>>58690497
>being this new
>>>/r/abbit
>>
File: 1485383539504.jpg (37KB, 397x230px) Image search: [Google]
1485383539504.jpg
37KB, 397x230px
First for g++ being part of the GNU Compiler Collection.
>>
Can I have conditional replaces?
Let's say, given some /^([a-z])([a-z]).*/ pattern, I want to replace first group with [A-Z], and the second group with [z-a].
>>
>>58690527
see >>58690528
>>
>>58690527
rip anon
>>
>>58690529
>First
>actually 6th
Good job, faggot.
>>
File: 1485611381564.png (27KB, 802x635px) Image search: [Google]
1485611381564.png
27KB, 802x635px
Javascriptâ„¢ everyone!
>>
>>58690533
What language/tool/etc
>>
>>58690548
>sixth
ftfy
>>
>>58690557
More like javashit, amirite
>>
>>58690558
My own language.
>>
>>58690559
CL-USER> (format t "~R~%" 83521983751973105132563)
eighty-three sextillion five hundred twenty-one quintillion nine hundred eighty-three quadrillion seven hundred fifty-one trillion nine hundred seventy-three billion one hundred five million one hundred thirty-two thousand five hundred sixty-three
NIL
>>
>>58690464
There are many ways of doing this, including looping over the lines read by 'read'. The simplest is probably awk, but here's a version with sed:

echo 192.168.1.30 | sed "s/^\(.*\)\.[0-9]\+$/\1.1-\1.255/"


I still wouldn't do this with bash.

Lorem ipsum you must wait before posting a duplicate reply.
>>
>>58690558
Perl
>>
What is the best auto completion plugin for vim?
>>
>>58690590
animeVim (yup, that's its name...)
>>
>>58690533
>>58690572
Sure you can.
>>
>>58690605
Thanks.
>>
>>58690533
>>58690558
>>58690587
bumoing question
>>
if im just a neet who works by himself, is svn or git better?
>>
So is Rust like C with some FP mixed in?
>>
when people explain the differences between python and java why do they always mention that java is statically typed? it sounds like a much bigger deal than it actually is. it doesnt even fucking matter.

just my noob opinion
>>
>>58690883
not at all
>>
How do I get better at math?

Should I just go through all the math subjects on Khan Academy or will that be too basic?

I want to start doing speed math competitions so I can think faster and then start doing coding competitions.
>>
File: b7c.jpg (46KB, 650x427px) Image search: [Google]
b7c.jpg
46KB, 650x427px
>>58690977
>I want to start doing speed math competitions so I can think faster and then start doing coding competitions.
>>
>>58690977

you can be an excellent mathematician with shitty mental calculation skills
>>
>>58690895
>just my noob opinion
At least you know that.
>>
>>58690977
As with all programming you should only learn what you need.
Khan is good up to and including pre-calc.
After that I would use textbooks.
Textbooks offer more in depth demonstration and proofs which are necessary for conceptualization and conceptualization is necessary for application.
You don't really need calculus unless you expect physics problems.
>>
>>58690580
Found an alternative using arrays:
file=list.txt
IFS='.'
while read -r aaa bbb ccc ddd
do
printf "%s" $aaa
printf "."
printf "%s" $bbb
printf "."
printf "%s" $ccc
printf ".1-"
printf "%s" $aaa
printf "."
printf "%s" $bbb
printf "."
printf "%s" $ccc
printf ".255"
printf "\n"
done < "$file"
read


It just werks.
>>
>>58691249
Please don't do that. Literally copy and paste this code into your terminal:
cat MY_FILENAME_HERE | sed "s/^\(.*\)\.[0-9]\+\$/\1.1-\1.255/"
>>
File: 1467498454438.jpg (38KB, 800x516px) Image search: [Google]
1467498454438.jpg
38KB, 800x516px
>>58691277
thanks again.
>>
File: loop.png (17KB, 659x469px) Image search: [Google]
loop.png
17KB, 659x469px
The issue is resolved, but now I'm trying to use arrays just for the sake of it and found a problem:
file=list.txt
IFS='.'
while read -r a b c d
array=("$a" "$b" "$c" "$d")
do
printf ${array[0]}
printf "."
printf ${array[1]}
printf "."
printf ${array[2]}
printf ".1-"
printf ${array[0]}
printf "."
printf ${array[1]}
printf "."
printf ${array[2]}
printf ".255"
printf "\n"
done < "$file"
read


It works in the beginning but when the list ends it just loops forever (pic related). How comes?
>>
>>58690557
How about this - https://github.com/Reactive-Extensions/RxJS
>>
#include <iostream>

class fizzbuzz {

public:
fizzbuzz ();
fizzbuzz (const fizzbuzz &other);
fizzbuzz &operator = (const fizzbuzz &other);

private:
int _value;

};

inline fizzbuzz::fizzbuzz () : _value (0) {}

inline fizzbuzz::fizzbuzz (const fizzbuzz &other) {
_value = other._value + 1;
}

inline fizzbuzz & fizzbuzz::operator = (const fizzbuzz &other) {
_value = other._value;
if (_value % 15 == 0) {
std::cout << "fizzbuzz";
} else if (_value % 5 == 0) {
std::cout << "buzz";
} else if (_value % 3 == 0) {
std::cout << "fizz";
} else {
std::cout << _value;
}
std::cout << std::endl;
return *this;
}


int main () {
fizzbuzz fb;
for (int i (0); i < 100; i++) {
fb = fizzbuzz (fb);
}
return 0;
}


Beware, that code is incorrect.
>>
>>58691667 (cont)
It's still looping but I made a small revision here:
file=list.txt
IFS='.'
while read -r a b c d
array=("$a" "$b" "$c")
do
printf "%s." "${array[@]}"
printf "1-"
printf "%s." "${array[@]}"
printf "255"
printf "\n"
done < "$file"
read


Any ideas what's causing the loop?
>>
what's the most anime language?
>>
>>58691876
The most cancerous language? C++.
>>
Any good sites to learn web/software development independently from? I'm trying to get back into programming after putting it aside because of muh studies which was kind of a stupid decision.

I've farted about with C++ and Lua before stopping, but I'm looking for more structured learning. I'm sure I have to pick up C/C++, HTML, CSS etc.

No bully pls
>>
>>58691876
Common Lisp and C
>>
@58691914
hello rddit
>>
>>58691483
No worries. Here are the two best resources for bash scripting that I've found:

http://tldp.org/LDP/abs/html/
http://mywiki.wooledge.org/BashGuide

I would warn you not to attempt too much in shell; I find it to be unreliable and generally quite risky.
>>
>>58691914
This post is hate speech.
>>
>>58691944
I dunno, I just read books.
Also, check /wdg/, it has resouces about web development.
>>
>>58691856
Try it without using the 'read' on the very last line.

To be honest, I would avoid using arrays in bash. They are messy and dangerous. If you need aggregate data types, you should probably switch to a full-blown programming language.
>>
>>58690860
just copy folders for new versions
>>
File: rust_anime.png (52KB, 783x671px) Image search: [Google]
rust_anime.png
52KB, 783x671px
>>58691876
Rust
>>
@58691914
That would be an anti-anime language
>>58691948
Why?
And is there any particular reason why it's common lisp and not any other lisp?
>>
>>58691987
>I would avoid using arrays in bash
Indeed, it's still broken even after removing read, I was just playing around with what I learned anyway, what I needed the most was accomplished with the sed script from before.
I'm planning on learning more Perl since I made some stuff in the past with it, so it's the most familiar language for me at the moment.
>>
>>58692045
Well i currently just 7zip the dir and stick on another drive & a flashdrive. But i feel like i should learn """proper""" src control
>>
>>58691667
What are you doing? It could be made a hell of a lot easier probably.

You can loop over lines in a file by using
for l in $(cat $filename); do
#shit
done


And for the print formatting you should be using sed (use group capture).
>>
I am on exercise 1-20 on K&R C, but I literally have no idea what I am supposed to do. I thought I was just supposed to replace tabs with spaces equal to tablength, so I just used the standard tablength of 8, and wrote this:
 #include <stdio.h>

#define TABLENGTH 6

main(){
int c, i;

while((c = getchar()) != EOF){
if(c == '\t'){
for(i = 0; i<TABLENGTH; ++i)
putchar(' ');
}
else
putchar(c);
}
}


This worked for what I wanted to do, but then I looked up the solution and I found this shit: http://www.learntosolveit.com/cprogramming/Ex_1.20_detab.html
and I am almost certain I did some shit wrong/didn't understand the problem. I don't understand what is going on in the solution at all, can anyone help?
>>
>>58692098
>But i feel like i should learn
no you really shouldn't
>>
>>58692155
>What are you doing?
I've a list of IP addresses and I'm converting it to ranges, like:
>192.168.1.69 (b4)
>192.168.1.1-192.168.1.255 (after)

Like you mentioned there's a way with sec, which anon posted here: >>58691277 but I still wanted to try using an array, though looks like bash is kinda slippery with this.
>>
>>58692224
>sec
sed*
>>
>>58692204
Do you not know how tabs work? They align text on the next column that is a multiple of 8. You can't just turn a tab into 8 spaces.
>>
>>58692224
I would expand on my earlier post by saying that any time you need string processing beyond a sed one-liner, you should again use a full-blown programming language.

While I've done a lot of shell scripting in the past, I've come to regard shell languages with fear and suspicion. Often, the few extra characters you have to type if using Python, Perl or Ruby are well worth it in reliability and, honestly, sanity.
>>
>>58690487
I want to learn code but I have to chose between JS, Java and swift.
What does /dpt/ recommend?
>>
>>58692204
The \t character is variable length. It pads the string to the multiple of where the tab would go. You have to keep track of the characters read in and pad TABLENGTH-chars_read_in
>>
>>58692292
As a first? Java. Cross-plat and not JS (shit). Make sure you learn Java 8 patterns after you learn the basics.
>>
The programming community should collectively refuse to use JavaScript, to force better working conditions from employers.
>>
>>58690860
https://git-scm.com/book/en/v2
>>
>>58692262

Also here's how I would do it with a while loop:
while read -r ip; do
echo ${ip%.*}.1-${ip%.*}.255
done < "$MY_FILENAME_HERE"


However, this will only work in some shells (tested in bash), whereas the sed version only requires that you have the right type of sed installed.
>>
>>58692303
>patterns
You could just use a not-shit language that doesn't need 'patterns'
>>
>>58692329
>The programming community should collectively refuse to use JavaScript, to force better working conditions from employers.
The programming community should collectively refuse to use Windows, to force better working conditions from employers.
>FTFY
>>
>>58692262
>Python, Perl or Ruby
Those are all shit languages and you should feel bad for using them.
>>
>>58692341
In fact, I've just noticed that those string substitutions are pure bashisms, so I really wouldn't expect this snippet to work in anything but bash.
>>
>>58692050
Cute
>>
>>58692342
"patterns" is a generic term you retard. I mean learn the functional-esque shit they added, not just the bog-standard procedural/OOP stuff.
>>
>>58692357
>Those are all shit languages
Yeah, well, that's just, like, your opinion, man.
>and you should feel bad for using them.
I don't use them.

I'm not a good bet for this kind of shitposting, have a go with someone else.
>>
>>58692377
They're objectively shit, they retard development and have poor performance, there's literally no reason to ever use them.
>>
>>58692389
Yeah, well, that's just, like, your opinion, man.
>>
>>58692329
new standards dont happen with protests. they happen with one person or group showing off a shiny new replacement & then people follow
>>
>>58692341
I didn't know you could do that.
Someone suggested a similar thing in last thread: >>58690335
I couldn't find a way to make it repeat so I didn't continue in that direction.
>>
>>58692407
We've had lots of shiny replacements, but we're still stuck with fucking JavaScript.
>>
>>58692377
>>58692398
>Yeah, well, that's just, like, your opinion, man.
>>>/r/ibbit
>>
>>58692389
Scripting languages aren't indented to have C-like performance and they have their niches, which don't require hard real-time responce.
>>
what's the best way to pick a pivot for sorts?
>>
>>58692410
That was me. I also alluded to the while loop solution here: >>58690565

I generally do not use awk because jumping from shell (a DSL with problems) to awk (another DSL with problems) is avoiding the issue. The sensible solution is to switch to a general programming language.

>>58692419
Yeah, well, that's just, like, your opinion, man.
>>
>>58692341
what does he want to do even? :3
echo "192.168.44.59" | awk -F "." '{for(i=1; i<255; i++)printf("%s.%s.%s.%d\n", $1, $2, $3, i)}'
>>
>>58692436
He just wants to do this: >>58690254

But we've solved it and are just talking about the different approaches to the problem.
>>
File: languages.png (17KB, 557x384px) Image search: [Google]
languages.png
17KB, 557x384px
>>
>>58690883
more like sjws with cucks mixed in
>>
>>58692430
Let me guess, you have some "alternative facts".
>>
>>58692462
oh.. like this?

$ echo "192.168.44.59" | sed 's/\(^.*\.\).*$/\11-\1255/g'
192.168.44.1-192.168.44.255
>>
File: cover2.jpg (236KB, 540x666px) Image search: [Google]
cover2.jpg
236KB, 540x666px
Daily Reminder: if you took a class on C in university and this wasn't the textbook you used then you went to a shit school.
>>
>>58692470
Lua and Julia are possible solutions. I'd also make a case for Common Lisp.

Forth is probably not 'easy for retards to use' due to being concatenative.

>>58692482
>Let me guess, you have some "alternative facts".
I'm not sure what part of my post you're replying to. But If you're the bad troll, I'm happy to report that that's just, like, your opinion, man.

>>58692484
See >>58691277
I would agree that this is the sanest solution.
>>
>>58692436
>what does he want to do even?
Converting an IP list to ranges.
There're 3 working solutions at this moment.
Using sed:
cat MY_FILENAME_HERE | sed "s/^\(.*\)\.[0-9]\+\$/\1.1-\1.255/"


Only bash:
while read -r ip; do
echo ${ip%.*}.1-${ip%.*}.255
done < "$MY_FILENAME_HERE"


And my shitty bash without sed:
file=list.txt
IFS='.'
while read -r a b c d
do
printf "%s" $a
printf "."
printf "%s" $b
printf "."
printf "%s" $c
printf ".1-"
printf "%s" $a
printf "."
printf "%s" $b
printf "."
printf "%s" $c
printf ".255"
printf "\n"
done < "$file"
read


They all work, except mine is bloat.
I tried to redo with an array, which failed (causes a loop):
file=list.txt
IFS='.'
while read -r a b c d
array=("$a" "$b" "$c")
do
printf "%s." "${array[@]}"
printf "1-"
printf "%s." "${array[@]}"
printf "255"
printf "\n"
done < "$file"
read
>>
>learning C
nice meme
>>
>>58692504
>going to a school where you weren't just expected to know C already
topmost kek
>>
>>58692513
Actually, yours isn't necessarily bloat, since you can convert all those 'printf's into one 'printf' (or 'echo'). The reason I wouldn't recommend doing it is just that you messing with the IFS.
>>
>>58692470
I'll take a C pls
>>
>>58690557
Shit JS senpai. That can be made a lot clearer with async/await.
>>
>>58692504
>Learning C from books
>>
>>58692484
>>58692513
made anudda version for you

$ echo "192.168.44.59" | awk -F "." '{printf("%s.%s.%s.0-%s.%s.%s.255\n", $1, $2, $3, $1, $2, $3)}'
192.168.44.0-192.168.44.255
>>
>>58692521
this
>>
>>58692553
>learning C from YouTube
>>
>>58692570
>not learning C by studying existing code
>>
>>58692303
why is JS shit? Isn't it the standard in web programming? Also, syntax of JS and swift look very similar
>>
>>58692547
>Shit JS
true. JS is by definition shit
>senpai
i don't think you know what this word means, kid
>>
>>58692594
What are filters, senpai?
>>
>>58692584
It's shit because it's a horrible language.

It's the standard in web programming for historical reasons (it replaced things that were even worse, no browser vendor is willing to try anything better).
>>
>>58692580
>studying pajeet code
Unless it's OpenBSD C code than it's gud
>>
>>58692584
>Isn't it the standard in web programming?
so if enough people use something it somehow becomes good?
how does this work exactly? seems kind of strange to me
and what's the precise number of people needed to achieve this "transformation"?
>>
>>58692053
Serial Experiments Lain
>>
>>58692607
how do they change the meaning of the word? at least you used it correctly this time
>>
>>58692594
Will you suck my dick senpai?
>>
>>58692534
Kek to be honest I was trying to make it on one line but I didn't think of using echo instead of printf so it failed miserably. This works in facts:

file=list.txt
IFS='.'
while read -r a b c d
do
echo $a"."$b"."$c".1-"$a"."$b"."$c".255"
done < "$file"
read


Doesn't even need \n. It might be useless but imho it's always good to know it could be done.
>>
>>58692616
I'm watching it now, I saw C and lisp shown in that anime. pretty good.
>>
>>58692512
I think Common Lisp would go in the bottom left.
>>
>>58692616
How is it related to either C or lisp? Watched it a while ago when I wasn't even interested in programming so I might have missed something
>>
>>58692644
i need to rewatch it sometime.
>>
>>58692635
senpai is just one of those words you randomly end a sentence with to annoy autists. Same as desu and tbqhwy.
>>
>>58692645
I think LISPs are probably easy for retard to use (for a given level of retardedness, anyway).

What I'm really getting at is that SBCL goes fast.

>>58692647
Any source code you see on a Navi's screen is Common LISP.
>>
>>58692470
>development so fast that nobody uses them
top shit
>>
>>58692665
>so mired in mediocrity he doesn't even know of the companies using them
I'd ask how it feels to be so mundane, but I doubt you even realize you are.
>>
>>58692661
>buku desa
>>
>>58692615
well, it just doesn't make sense to me why it's so popular if its shit.
Quality always wins imo.
>>
>>58692661
this whole post is false
>>
>>58692663
>SBCL goes fast
How fast are we talking here? As fast as C/C++?
>>
>>58692675
>muh edge
yes, yes, jerk it to animoo
>>
>>58692681
See? It's working senpai.
>>
File: 1473925723031.png (1MB, 1447x2046px) Image search: [Google]
1473925723031.png
1MB, 1447x2046px
how i prorram wolf gf???
>>
>>58692677
>Quality always wins
You're so naive it's adorable.
>>
>>58692677
>i'm underage
seems legitimate
>>
>>58692663
>SBCL goes fast
kid, you have no clue what fast means
>>58692691
not even close
>>
>>58692704
well obv. that's how it should be.
Windows taught me better
>>
>>58692615
>so if enough people use something it somehow becomes good?
No. It means it's already good.
>>
>>58692691
Nah, like half to a third the speed. Same as Haskell.

The difference is that SBCL gives you access to the underlying assembly via VOPs.
>>
>>58692702
Start by using the English language.
>>
File: udy1nj7i27ae6xzzsa1a.jpg (28KB, 620x470px) Image search: [Google]
udy1nj7i27ae6xzzsa1a.jpg
28KB, 620x470px
>>58692706
>kid, you have no clue what fast means
Yes I do, just ask your mother.
>>
>>58692746
>baka desu animu senpai
m8...
>>
>>58692702
1. Go into the mountains
2. Find a female wolf
3. Let her give you a love bite
>>
>>58692746
wolv dont speak english retard
>>58692758
is wild?
>>
>>58692756
Who are you quoting?
>>
>>58692753
Upvoted!
>>
>>58692772
Cheers m80
>>
>>58692766
(YOU)
>>
>>58692733
accepting your retarded """"logic"""" would mean that anything shit has to somehow become good if it gets popular enough since you stated nothing popular can be shit.
either that or you think something can't be shit.
>>
>>58692766
>the subtleties of irony are lost on me
>>
>>58692803
That's a nice story, but who are you quoting?
>>
>>58692803
Who are (you) quoting?
>>
>>58692811
>>58692822
>being this new
>>
>>58692793
>shit has to somehow become good if it gets popular
>muh mental illness influences my """logic"""
>>
>>58692827
Please do not misuse the quoting function.
>>
>>58692827
if you're not quoting anyone, please stop typing in a retarded fashion.
>>
how do i shorten this lads
date | grep -Eo "[0-9]+:[0-9]+:[0-9]+"
19:39:23
>>
Fucking hell guys, what happened to the thread?

Everyone post what they're working on; maybe we can actually talk about programming.
>>
>>58692846
>>58692850
>still being this new
>>
>>58692793
>accepting your retarded """"logic"""" would mean
You seem incapable of reason so you'll always have trouble drawing conclusions on your own.
>somehow become good if it gets popular
No. If it's popular then it was good already; it was never "shit".
>>
>>58692871
Code monkeys took over.
>>
>>58692869
date +%X
>>
>>58692871
>no arguing
currently learning haskell
>>
>>58692876
>still being this new
Wheres this quote from tho
>>
>>58692902
>I'm underage
you need to be 18 tho
>>
>>58692898
>hasklel
m8, get on my coq level
>>
>>58692931
why?
>>
File: part3_img.jpg (68KB, 300x440px) Image search: [Google]
part3_img.jpg
68KB, 300x440px
>>
>>58692898
Why not OCaml?
>>
>>58692951
OCaml is shit

>>58692949
Python is even more shit
>>
>>58692951
i don't like the O in the name
>>
>>58692951
I'll try it eventually but haskell seems better.
Am I wrong?
>>
File: rooster.png (291KB, 351x400px) Image search: [Google]
rooster.png
291KB, 351x400px
what is the point of programming anymore unless you're doing it as a hobby?

I stopped being a sperg for once and got an objective view of the software industry. Software no longer makes any revenue through selling licenses. Open source software is rapidly replacing paid software.. SaaS, Full Stack start ups, and crowdfunding projects is really the only way to make money with software nowadays. There is also artificial intelligence coming sooner than expected within 10 - 20 years, once that happens programmers are all fucked. The way i see it a career change is the only option out of this.
>>
>>58692980
Yes.
>>
File: 1477243791773.png (174KB, 385x920px) Image search: [Google]
1477243791773.png
174KB, 385x920px
>>58692962
Don't bully python~!
>>
>>58692980
No, Haskell is better than OCaml.
>>
>>58692982
>what is the point
money
>blog
ok
>>
>>58692989
why?
>>
>>58692989
then sell me on ocaml
>>58692997
alright
>>
>>58692871
I was trying to understand why the script where I used an array causes a loop (>>58691856), looks like there aren't many informations around the web.
I'm gonna make a sammich now anyway.
>>
>>58692871
I'm working on a console interface for BasicTV. I have the following down
1. Commands that output usable information will put it in a table (output_table)
2. IDs will be read from this output_table, in human readable format (hex), into the registers (IDs only, binary format)
3. You can skip around in linked lists and perform some general purpose memory management: export to disk, delete, see all data, modify IDs it references. Most of the stuff is too technical to be useful to most people.

The only way to interface with the console is to use telnet. There's far too much debugging output to use the terminal, and connecting over the Internet is pretty cool (of course, with a more secure protocol). This console is the only way to upload content to the network, but that should be pretty easy to do.

This also controls which channels you are watching, the layout of the screen, controlling the TV Guide (not implemented yet), and doing pretty much everything a remote would do.
>>
>>58692991
Is it bullying if it's true?
>>
>>58693026
There's literally nothing wrong with python
>>
>>58692991
>animu mental illness
fuck off
>>
>>58692989
OCaml is worse than Java, C#, etc.

>let's add the absolute basics of statically typed functional programming, but nothing more, resulting in a crippled language that cannot express anything more than the simplest abstractions easily
>also let's not bother with proper multithreading for decades
>>
>>58693043
>>58692470
>>
>>58693072
something that was made in paint in 20 seconds? must be true

because ms paint is a magic program that turns opinions into facts
>>
>>58693092
>t. butthurt Python babby
>>
>>58693092
>REEEEEEEEEEE
>>
>>58693104
Yeah people are butthurt over your super edgy opinion of "thing i dont like is shit because I said so"

It's not like that's almost everyone on the internet
>>
>>58693017
It doesn't go into a loop; the 'read' on the last line causes it to watch for console input (i.e., for you to hit return). If you remove that, it works on my machine.

This was tested and confirmed to work in bash:

IFS='.'
while read -r a b c d; do
printf "%s.%s.%s.1-%s.%s.%s.255\n" $a $b $c $a $b $c
done < "input.txt"


Where 'input.txt' is a plaintext list of newline-separated IP addresses.

Also, as discussed, you could also use echo, i.e.:

IFS='.'
while read -r a b c d; do
echo "$a.$b.$c.1-$a.$b.$c.255"
done < "input.txt"


Finally, the (very important) thing that I forgot to mention: IP ranges start at zero, so your output should really be:
192.168.1.0-192.168.1.255

Fixing this in the examples posted is straightforward.
>>
>>58693126
The point is that most languages make a trade-off between performance and ease of writing correct code. For example, C leans heavily toward the former, Haskell leans toward the latter, and Java and C# are both closer to the middle.

Python chooses neither.
>>
just got aids from java
again
I hate my life
>>
>>58692521
>>58692561

What schools are those?
>>
@58692896
>i'm so butthurt about local culture, let's pretend there's no discussion
>>
>>58693146
Haskell can reach about a third the speed of C, same as Java.
>>
>>58693158
Good ones, where you're expected to learn the basics in your own time
>>
File: 1425082425609.gif (982KB, 320x287px) Image search: [Google]
1425082425609.gif
982KB, 320x287px
>programming some experimental stuff on unity with hardware
>download some obscure asset because it was free and spend a good hour or two tweaking it to my application
>make a prefab
>it fucking breaks and I have to manually do all this shit again, the prefab completely hosed

Fuck sake..i'm done with these overly-complicated and under-documented asset clusterfucks.
>>
File: hmmm.gif (484KB, 500x270px) Image search: [Google]
hmmm.gif
484KB, 500x270px
Does /dpt/ have infographics on good books to learn certains langages, frameworks, etc, ... ?
I want to get into reading stuff related to programming but there's so much books that I really can't choose.
Any authors that are better than the others or a series of books ?
>>
>>58693172

Yes, give me examples
>>
>>58693164
In terms of speed, Haskell can match and even surpass C.
>>
>>58693164
Yes, Haskell can be quite fast, but it usually involves considerably more effort than that needed to just make it correct. Making Java code performant is usually more straightforward (but making the code correct in the first place is harder).
>>
>>58693202
>going full retard
m80...
>>
>>58693187
Not so much with infographics. What do you want to learn about?

Also, here is a link to 35GiB of books:
https://g.sicp.me/books/
>>
>>58693190
Do your own research

Like you'd have to do in order to pass at such a school
>>
>>58693202
No it can't
which benchmark is this meme coming from though?
Not the first time I've read that shit
>>
>>58693202
Yeah, only Haskell can create that much garbage/second.

Gotta invalidate fast.
>>
>>58693212
Yeah, you essentially have to write C in Haskell, which isn't nice.

That said, like any language, you get a huge amount of mileage out of making sure your algorithm is optimal and then changing to 'faster' datatypes, the latter of which is particularly pleasant in Haskell.
>>
>>58693230
>No it can't
it does tho
>>
>>58693230
it's the same type of shit as communism "it works... in theory" lel
>>
>>58693144
>If you remove that, it works on my machine
Could it be related to MinGW then? I tried without read already but it didn't fix it.

>IP ranges start at zero
Technically I guess they do, but I've never seen any IP ending in 0 so far.
I'll fix the ranges now anyway.
>>
>>58693245
but it doesn't. learn what "theory" means first.
>>
>>58693242
>one program generates zero garbage
>another program generates GB's of garbage per second
>which is faster?
really makes you think
>>
>>58693256
>muh fizzbuzz
>>
>>58693226

> smugly makes a claim
> can't provide an example

that's how I know you actually just a middle schooler larping as an MIT student
>>
>>58693256
>which is faster?
The one written in Haskell, as already proven. Pay attention next time.
>>
>>58693271
>expects to be spoonfed everything
That's how I know you went to a shit school
>>
>>58693266
>>58693276
can you show a single example of haskell having better performance than C for the same task?
>>
is this thread using some kind of secret cipher right now?
>>
>>58693285
no it's just plain autism
>>
>>58693285
The grass is greener in the old man's hat
>>
>>58693216
I don't really have anything specific in mind.
I'm graduating from school soon and I had to program in what the teachers told us to program in.
What I want in a larger sense is
- Being able to developp web application with Java EE (We used Spring Boot on Netbeans
- Learn C# .NET
- Be better at making websites (Other than using Bootstrap, I didn't do much)
- Javascript

I also need some methodology advices on how to learn a langage, I really didn't learn much at school to be honest besides making some websites or application for companies that needs to sell things.
>>
>>58693287
which kind? i hope high functioning?
>>
>>58693282
zygohistomorphic prepromorphisms
>>
>>58693282
There are plenty. Top of Google:
http://stackoverflow.com/questions/6964392/speed-comparison-with-project-euler-c-vs-python-vs-erlang-vs-haskell


Single benchmarks don't mean much, though.
>>
>>58693297
>underrated
>>
>>58693299
can you even read? haskell is much slower
>>
>>58693290
>I also need some methodology advices on how to learn a langage
It's hard to answer such a general question, but the critical thing is to keep writing programs. I suspect that other than a few hand-holdy exercises, you don't actually have to do much programming in most university courses.

>>58693309
You should try reading the answer rather than the question :)
>>
>>58693309
can you? scroll down you fucking sperg
>>
>>58693290
I forgot to add that I know nothing about those topics/languages, so you're on your own, really.
I've heard that the yellow book is good for C#.
>>
>>58693316
>>58693327
>Even thought the C version ran faster on my machine, I have a new respect for Haskell now. +1 – Seth Carnegie Aug 6 '11 at 14:53
>the C version ran faster on my machine
AT BEST it's marginally faster in that specific problem after optimizing the haskell version specifically

KILL YOURSELVES
>>
>>58693316
> other than a few hand-holdy exercises, you don't actually have to do much programming in most university courses
You're right. It's true that the key is practicing so I'll just stick to that.
But for the other things I said, any suggestions you might have ?
>>
>>58693343
See >>58693328

Sorry dude.
>>
>>58693340
>marginally faster
that still means faster
>KILL YOURSELVES
I knew you'd REEEEEEEEEEEE :^)
>>
>>58693340
>>58693360
also see

http://stackoverflow.com/a/7037750/5981535

FUCKING RETARDS
>>
>>58693340
>AT BEST it's marginally faster in that specific problem

You literally asked for a single example where Haskell was faster:
>>58693282
>can you show a single example of haskell having better performance than C for the same task?

I even mentioned that single examples don't mean much:
>>58693299
>Single benchmarks don't mean much, though.

Back in my day, trolling meant something.
>>
http://stackoverflow.com/a/7037750/5981535

$ gcc -O3 -lm -o euler12 euler12.c; time ./euler12
842161320
./euler12 2.95s user 0.00s system 99% cpu 2.956 total


$ ghc -O2 -fllvm -fforce-recomp euler12.hs; time ./euler12                                                                                      [9:40]
[1 of 1] Compiling Main ( euler12.hs, euler12.o )
Linking euler12 ...
842161320
./euler12 9.43s user 0.13s system 99% cpu 9.602 total


>Conclusion: Taking nothing away from ghc, its a great compiler, but gcc normally generates faster code.

pathetic delusional hasklel tards
>>
>>58693363
>t. butthurt cuck
>>
>>58693376
Try harder, dude. The only person here that sounds upset is you.
>>
>>58693375
it's not a valid example. see >>58693376

>>58693381
you're the one who's butthurt about your slow haskell trash
>>
>>58693392
I'm pretty happy, dude. Haskell goes fast.
>>
>>58693376
lorenzo@enzo:~/erlang$ gcc -lm -o euler12.bin euler12.c
lorenzo@enzo:~/erlang$ time ./euler12.bin
842161320

real 0m11.074s
user 0m11.070s
sys 0m0.000s

get bent laddie!
>>
File: projecting.jpg (46KB, 490x333px) Image search: [Google]
projecting.jpg
46KB, 490x333px
>>58693390
>>
Just started using VS and I find it to be pretty good, not like i'm poor on RAM anyways.

Anyone have good tips/tricks? Links are fine too, I found several on google of course but am interested in some opinions on here. I never really took time to take advantage of the overwhelming number of features and want to get used to them.

For C#, if you guys know better IDEs let me know.
>>
>>58693412
I don't know, dude. I haven't insulted anyone.
>>
>>58693392
>gets rekt
>not a valid example tho! REEEEEEEEEEEEEE
top fucking kek!
>>
>>58693416
https://www.jetbrains.com/rider/?fromMenu
>>
>>58693411
>i have a horribly outdated laptop
>C is still faster than haskell running on a faster pc
>>
>>58693411
Now time the Haskell version on the same machine
>>
>>58693429
>I got told
we know
>>
Should I do coke?
I trust you guys implicitly.
>>
>>58693426
you're objectively wrong. the questioner's implementations were suboptimal, and even the optimized haskell was only within the margin of error compared to the questioner's C code. with a better C implementation, it's much faster than the best haskell implementation. you're not fooling anyone but yourself.
>>
>>58693459
Start with diet coke
>>
>>58693445
very weak bait. i suggest you do some programming instead of acting like a literal baby.
>>
>>58693459
do you want it to program? no
>>
>>58693459
If you say it, it stops being implicit.
>>
File: instructions.png (44KB, 565x307px) Image search: [Google]
instructions.png
44KB, 565x307px
My vm reaches about 1.78 mips.
>>
>>58693459
I personally prefer coke zero
>>
>>58693480
this
>>
Want to learn a lisp, should I start with Common Lisp, Scheme, or Clojure?
>>
>>58693491
>which one is edgier?
>>
File: Capture.png (219KB, 602x1008px) Image search: [Google]
Capture.png
219KB, 602x1008px
I just started making a resource monitor for my old PDA. Just doing this for fun of course, it still works so I wanted to put it to use. I started making my own progress bar for starters, the built-in control isn't customizable enough to display everything I want.
>>
>>58693491
Racket. It's Scheme with libraries.
>>
>>58693460
haskelltards on suicide watch!
>>
>>58693477
>Chasing high MIPS in a VM
wtf, just generate assembly at that point. The only reason to have a VM is provide a more abstract target that do common combined operations quickly as one unit. I bet I could write a VM with half the MIPS, but twice the speed.
>>
Anyone know any decent places for programming discussion with a high rate of content generation?
>>
>>58693604
wdg
>>
>>58693596
>I bet I could
Doubt it.
>>
>>58693604
all places are pretty shit. it'll be amateur babby's first programming exercises or smug fedora tipping about zygohistomorphic prepromorphisms. or straight up shitposting like in /dpt/. the best thing you can do is to actually program and only read or participate in discussions when you have something in particular you need to learn about.
>>
>>58693604
reddit
>>
>>58693630
That's not really a retort to my point.
>>
>>58693625
Disgusting.
But seriously, I'm not interested in webdev.

>>58693636
Yup. I do actually program, it's the having somewhere to talk about it I'd like.

>>58693640
I've considered it, but it's slow and pretentious.
>>
>>58693596
I'm not targeting MIPS, i'm just working on my architecture, I'm also not that first reply guy.
>>
>>58693666
>I've considered it, but it's slow and pretentious.
I've considered telling you about a place but now that I've seen that you considered reddit I don't think I will.
>>
File: 1478239191584.png (157KB, 640x797px) Image search: [Google]
1478239191584.png
157KB, 640x797px
>>58693666
delete this post
>>
>>58693476
Not according to definition 2.
>>
>>58693683
Fair enough.

>>58693689
Sorry, no.
>>
>>58693668
Man I misinterpretted your post for a few seconds. "I'm not targeting MIPS", I took as you thinking I thought you were targeting the MIPS architecture. We need new acronyms.

Ever thought about taking that VM down to the hardware level? Download Vivado, learn some VHDL, remake the VM as an actual machine. Maybe if you save up $1000 you can buy an FPGA board and test it. Or even build it using a bunch of ICs.
>>
>>58693666
>it's slow
not enough shitposting?
>pretentious?
don't reference animu every 2 posts?
>>
>>58693739
I have a DE0-nano I plan to eventually have this work on(though the MMU might have to go for it to fit).
>>
>>58693625
>http://forums.htmlhelp.com/index.php?showtopic=58978
oh my gawwwwwwwwwd
>>
>>58693938
yw
>>
New thread:

>>58693968
>>58693968
>>58693968
>>
>>58693535
racket has no CLOS, faggot
>>
>>58693986
I'm alright without CLOS.
>>
>>58694370
CLOS is pinaccle of human ingeunity.
Pls snap neck if you can do without CLOS.
>>
>>58694384
I'm alright without CLOS.
>>
>>58694384
>can't do without ingenuity of others
end you're self
>>
Can someone help me with some PHP code?

I'm planning on putting all my SQL queries in one file and ask for a specific one to be executed using switch statements.

Is this inefficient? Should I separate each query into its own PHP file?
Thread posts: 283
Thread images: 21


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