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

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

Thread replies: 255
Thread images: 18
File: 1445253019594.jpg (15 KB, 249x400) Image search: [Google]
1445253019594.jpg
15 KB, 249x400
This is /dpt/ - Daily Programming Thread.

What are you working on?
>>
would using lists instead of arrays matter for small android 2D games?
>>
>javascript is bad
how to spot an undergraduate
>>
How do I get started with writing code(c++)? Where do I get the libraries and where do I put them?
>>
>javascript is good
how to spot a hipster from san francisco
>>
How to write a web crawler which would look for particular keywords and save them, as well as the URLs of pages they're on? Are there any good tutorials which outline the general algorithm behind this? I struggle with finding an efficient algorithm which wouldn't take thousands years to find a few pages.
>>
File: got it working.gif (1 MB, 649x510) Image search: [Google]
got it working.gif
1 MB, 649x510
math is fun.
*-*
>>
>>51279024
spotted the undergrad
>>
>>51279071
store each word on the page as a key in a hashmap.

the value for it will be a list full text of the sites that contain that word, along with the URL

it can eat up a lot of memory, but you'll be able to find a web page quickly
>>
File: math_is_fun.png (44 KB, 581x500) Image search: [Google]
math_is_fun.png
44 KB, 581x500
>>51279120
>math is fun.

math is gay
>>
>>51279258

How do you make sense of this set ? I actually want to visualize one using opengl but I really don't know if I should get it completely or if it's better to use it as a formula.
>>
whats the better design and why? (C++)
A:
class ResourceWrapper
{
ResourceWrapper(Resource res) //Throws if resource cant be opened
void DoStuff()
{
UseResource(res);
}
}

B:
class ResourceWrapper
{
ResourceWrapper()
{
this->isOpened = false;
}
ResourceWrapper(Resource res)
{
this->Open(res);
}

Open(Resource res)
{
this->isOpened = true;
} //Throws if resource cant be opened

void DoStuff()
{
if(!this->isOpened)
throw Uninitialized("ResourceWrapper is not initialized.");
UseResource(res)
}
}
>>
>>51279120
Quite a bit of progress since last night, good job man.
>>
12th for Go
>>
>>51279331

I used the escape time algorithm. Take a look at it. Fairly simple.
>>
>>51279341
As usual, Go was too slow.
>>
>>51279216
This wasn't helpful at all. I'm asking for an algorithm, not how to use inane features of an inefficient higher-level language I don't even use.

Like, I want to find an actual, developed algorithm for web crawlers of this kind. Which uses graph theory and all that.
>>
>>51279120
what guide are you following?
>>
>>51279346

Ī¤hanks for the tip. Will look into it more. What's your experience with computer graphics ?
>>
>>51279348
Still the systems programming language of choice!
>>
>>51279352
go read the source code of any web crawler?
afaik, some companies actually use normal web browsers
>>
>>51279353
what do you mean?
It's basic trigo.

just a for loop that increases the angle in the constructor the bullets use to move.
>>
>go to adacore website for some ada tutorials
>it's some smelly fucking indian talking in his broken accent over adobe flash videos
Jesus christ, first they provide a GPL compiler with no runtime library exepction, now this. You have to buy the same fucking compiler with the same fucking features for a million sheckels if you want to write non-gpl code.
And the only up to date book on programming in Ada is $100 on amazon.

I'm starting to think that being free as in freedom doesn't stop software companies from being jews.
>>
What's a good project to have on your CV, I'm thinking of making a 4chan browser for Android, but then again I'm not sure whether it's a good idea to have something related to 4chan as one of my projects.

May make them think I have no social skills, even thought it's true.
>>
>>51279352
hashmaps are a data structure. you can make one yourself if you insist on using C. hashmaps will always be faster than a graph.
>>
>>51279404
PfffffAahahahaHAfljsdhv/lkjd;lkjh;glkj
>>
>>51279416
The source code may be huge and incorporate lots of custom libraries. It's a pain in the ass to figure out the algorithm based on the source code.
I know that lots of algorithms for web crawlers exist which can be found online, but I'm wondering which ones can actually be implemented by an individual programmer working alone and are more or less efficient in the same time.
>>
>>51279401
>What's your experience with computer graphics ?

Amateur.
>>
>>51279418
for how long have you been programming? I doubt you are building a game with no help or guide, that is, unless you have been programming for a few years and understand what you are doing.
>>
>>51279444
>butthurt rustfag sjw detected
>>
Y'all niggas need some Common Lisp

>>51279430 specially you, even if you don't use it directly, it'll teach you an useful mindset for when you use other platforms
>>
>>51279480
>lisp
>useful mindset for when you use other platforms
hahahaha
>>
>>51279333
guys pls
this is triggering my autism, i need to know
>>
>>51279473
I remember my oldest gif, that is some breakout clone in XNA comes from mid 2013 I believe.

You seem impressed by something basic, do you also want to make games?
>>
>>51279478
Close.
Except it's more like
>C /programmer/ laughing at your memelang.
But you have a great day, k champ? *pats you on the butt*
>>
>>51279433
>hashmaps are

I know what a hashmap is.

>hashmaps will be faster than a graph

Are you serious? Then why the fuck do major corporations who have the best minds working for them use graphs and various graph search algorithms for their crawlers?
>>
I'm making batch file that I can use to ping flood my housemates' pc when he start screaming like a monkey playing his dota.

any other thing that I could add to this?

@echo off
start /min ping 192.168.1.114 -t -l 65500
>>
>>51279485
spotted the Java drone
>>
>>51279428
Why would you want to write non-GPL code?
>>
>>51279509
Unless he's on dialup this isn't going to do shit.
Go and punch him in the solar plexus you fuckin' pansy.
>>
>>51279470
>The source code may be huge and incorporate lots of custom libraries. It's a pain in the ass to figure out the algorithm based on the source code.
wget has a "spider mode", I suppose this could help...
search for blogs and guides that explain how it's done?
anyway, I have no idea what you are doing. doesn't seem too complicated to me: collect URLs, follow them recursively...

>>51279490
I'm impressed because, for some reason, I thought you were a noob.
>do you also want to make games?
nah.
>>
>>51279480
It's in my todo list. I'm planning on going algorithm masters and thought that Common LISP would be the perfect tool for a lot.

However I still need a nice little project to woo future employers. All I have on git is a 2d Unity RPG and a fuck ton of programming competition solutions.
>>
>>51279518
this desu
>>
>>51279492
>Close
sjw confirmed
>>
>>51279510
spotted the lisp kek
>>
>>51279492
back to the rust forums faggot whore

ps your genitals determine your gender fuck off
>>
>>51279518
He's fat, my punches just bounces off
>>
>>51279524
Just a heads-up:
LISP was McCarthy's original LISP 1 and LISP 1.5
Lisp is the language family
Common Lisp is one of the dialects, others are Emacs Lisp, Scheme, Clojure

Kind of like ALGOL the original language, Algol the family, and C, Java, C# the modern languages, although there is the great difference that Lisp has a "timeless" notation and culture.
>>
>>51279523
I'm not sure being a noob at this point, since I have made some shit like quadtrees, A* and a dungeon generator.

It's mostly that I lack any formal training on CS, so when I try to do something that I don't know how, I need to learn basically from 0.

but yeah, I can defend myself and I'm confident at coding right now.
>>
>>51279544
I don't think you know what solar plexus are.

>>51279543
Someone seems angry. I would imagine the teenage angst builds up when "programming" in memelang though. Let's hug it out, champ?
>>
>>51279598
No, no I don't.
>>
>>51279585
>Lisp has a "timeless" notation and culture
and it's also dead
>>
>>51279598
>sjw faggotry intensifies
>>
>>51279621
>le lisp is dead ebin meem
Nigga, do you even Common Lisp?
>>
>>51279619
When you get hit in 'em, you definitely will

>>51279631
>Childish angsty banter continues
>>
>>51279587
>A*
>not using Theta* master race
then again
>dungeon generator
so actually Theta* may not bring much of an advantage
>>
I'm trying to make a function that sorts an array, and I can't figure out how to get it to work. I know the problem, is that it isn't passing through properly, but I can't figure out how to fix my nested for loop
C++


void sort(int arr[]){
int temp;
for(int i = 0; i < 5; i++){
for(int j = 0; j < 5; j++){
if(arr[i] > arr[j] && i < 4){
temp = arr[j];
arr[j] = arr[i];
arr[i] = temp;
}
}//j loop

}


}
>>
>>51279633
no, that's why it's dead
>>
>>51279638
Will it kill him if he's extremely unfit? I'm not willing to go that far, i'd rather flash the router with tomato or something and shape his traffic instead.
>>
>>51279662
I don't speak Japanese. Does that mean Japan is dead?
>>
>>51279645
wtf is theta?
>>
>>51279658
Here's the rest of it, for convenience

#include <iostream>

using namespace std;

void sort(int[]);
int main() {

int arr[5] = {3, 2, 5, 1, 4};

cout << "before sort" << endl;
for(int i = 0; i< 5; i++)
cout << "|" << arr[i];
cout << "|" << endl;
sort(arr);

cout << "after sort" << endl;
for(int i = 0; i< 5; i++)
cout << "|" << arr[i];
cout << "|" << endl;



return 0;
}

void sort(int arr[]){
int temp;
for(int i = 0; i < 5; i++){
for(int j = 0; j < 5; j++){
if(arr[i] > arr[j] && i < 4){
temp = arr[j];
arr[j] = arr[i];
arr[i] = temp;
}
}//j loop

}


}
>>
>>51279638
>>Childish angsty banter continues
>sjw language
>>
>>51279682
compare "almost nobody speaks japanese" with "almost nobody uses lisp" and you'll figure out what's dead
>>
>>51279686
https://www.jair.org/media/2994/live-2994-5259-jair.pdf
Google it as "theta star"
>>
>>51279668
It'll take his breath away and bring him to his knees.

>>51279690
C is a sjw language? I believe our interaction has come to an end.
>>
>>51279418
>>51279490
>>51279587
are you the same guy as >>51279120? a couple of days ago he didn't even know sin and cos
>>
>>51279703
Your ignorance hurts my eyes. I refuse to take your bait.

If you're actually being serious:
https://en.wikipedia.org/wiki/Common_Lisp#Applications

Please do not respond.
>>
>>51279703
nothing is dead
>>
>>51279722
>herp derp I can't into reading comprehension
classic sjw
>>
>>51279732
>see a mention of paul graham
>^W
>>
>>51279727
yeah, but I'm willing to learn.
Like I said, I'm self taugh and learned using youtube and asking questions to anons.

>>51279706
what makes it diferent than A*?
>>
>>51279585
Sorry, should have clarified I ment Common Lisp. The multi paradigm implementation rather than all of the more functional programming focused ones.
>>
>>51279732
>https://en.wikipedia.org/wiki/Common_Lisp#Applications
Omg, 17 applications! Pro language right here! Just imagine the job opportunities!
Top fucking kek! Stay pleb, lispfag.
>>
The lisp family is too hard for javadesis and seppleskids to grasp. This isn't a criticism, not everyone can do everything; for example I am terrible at golf. For those that can fathom the depths, lisp is a tool like no other. It can never die, only be reinvented.
>>
>>51279733
lisp is
>>
>>51279766
>>51279782

>>51279732
>Your ignorance hurts my eyes. I refuse to take your bait.
>>
File: 1430853197680.png (331 KB, 474x432) Image search: [Google]
1430853197680.png
331 KB, 474x432
>>51279768
>>
>>51279768
>list of words enclosed in parenthesis
>too hard to grasp
>fathom the depths
>tool like no other
lisp keks actually believe this and pat themselves on the back
fucking gold!
>>
>>51279782
Well I guess all my lisp code in production will magically stop working then? I'll keep you posted!
>>
>>51279752
>>51279752
It straightens out paths based on visibility. For example:
(0,0) => (1,1) => (1,2) with a path length of 2.4
is straightened to
(0,0) => (1,2) with a path length of 2.23
>>
>>51279816
>thinks syntax = semantics
hush little baby

there, there

there, there
>>
>>51279816
>>list of words enclosed in parenthesis
>>too hard to grasp
>not using a paren-highlighting editor
>>
>>51279804
SEVENTEEN
EVENTEEN
VENTEEN
ENTEEN
NTEEN
TEEN
EEN
EN
N
>>
>>51279768
how can I make 2D games with lisp?
I'm not gonna fap to a syntax.

>>51279824
so basically makes the path more optimized?
>>
>>51279837
>Other notable examples include
>>
>>51279818
>lisp code
>production
baby's first "droplet"? hahahaha
>>
>>51279492
>memelang
except C *is* a meme language:
>meme/mēm/
>noun
> an element of a culture or system of behavior that may be considered to be passed from one individual to another by nongenetic means, especially imitation.
>>
>>51279844
>how can I make games with lisp
ask Andy Gavin or Dan Liebgold
>>
>>51279833
>I can't handle syntax
>muh semantics though
fucking weenie
>>
>>51279844
>how can I make 2D games with lisp?
Just use your favourite SDL port. For example, https://github.com/lispgames/cl-sdl2

>so basically makes the path more optimized?
Yup
>>
>>51279872
>programmers think they're tough
>can't even program their programming language
let me know when you grow up and we can have a discussion ok
>>
>>51279844
>how can I make 2D games with lisp?
painfully
>>
>>51278956
>another DPT without a chinese cartoon

thank you based OP
>>
>>51279886
>I don't have anything to show
>I was busy programming my programming language so I can program while I program
tip top, m8!
>>
>>51279872
>>I can't handle syntax
>actually can handle syntax
>muh homoiconicity
>muh defmacros
>muh custom flow control structures
>muh custom paradigms
>mfw can extend the language in minutes and include the extension as a library to be deployed in seconds instead of waiting years for a buggy compiler patch to be approved by the ISO board and then more years until it's implemented across all significant vendors of the compiler

brb gonna fap can't take it anymore
>>
>>51279886
>perform an addition? not so fast, this is not one of those fancy languages that comes with basic stuff built in! first I have to define the addition operator using recursion
>>
>>51279920
>ebin paradigm meme
>>
>>51279945
>mfw no paradigm
>mfw any paradigm

>>51279929
Nigga, what's so hard about (+ 1 2 3) ?
>>
>>51279920
>>muh HOMOiconicity
'nuf said
>>
File: where is the game.png (40 KB, 1280x853) Image search: [Google]
where is the game.png
40 KB, 1280x853
>>51279920
yeah, but where is your game?
>>
>>51279957
should have inb4d it
>>
>>51279956
>Nigga, what's so hard about (+ 1 2 3)
But you don't get to program your programming if you use shortcuts like these, anon! :P
>>
>>51279967
>felt a tingling in my ass whilst writing "homo"
>>
>>51279972
Actually, Lisp's curse for years was that it was so easy that everybody implemented their own low-level stuff and then everybody was left with multiple incompatible low-level libraries. That all changed with
>muh Quicklisp
wait i'm it's not mine
>xach's Quicklisp
so now there's a lot of libraries from where you can cherrypick.

But yeah, also http://www.lispworks.com/documentation/HyperSpec/Body/f_pl.htm
>>
>>51279980
that's how you feel, m8? you should try using grindr, you may like it

>>51279957
that's, like, a joke from a 12 y.o.
>>
>>51280032
>that's how you feel, m8
>what are meme arrows?
>>
>>51279920
you're getting me hard as fuck, I decided to throw together an anaphoric if with begins
#lang racket/base
(require (for-syntax racket/base))

(define-syntax (ifit stx)
(syntax-case stx (then else)
((_ test (then true ...) (else false ...))
(with-syntax ((_it (datum->syntax stx 'it)))
#'(let ((_it test))
(if _it
(begin true ...)
(begin false ...)))))
((_ test true false)
(with-syntax ((_it (datum->syntax stx 'it)))
#'(let ((_it test))
(if _it true false))))))
>>
What's the easiest language/engine/framework to make a 2D game in?

I know java, python and some javascript
>>
>>51279964
https://www.youtube.com/results?search_query=common+lisp+game

Note that the great majority of those are from young people having fun, so don't be disappointed. The libraries used are usually SDL, OpenGL, and other standard ones.
>>
>>51280032
>joke from a 12 y.o.
>damage control
>>
how do I make a for loop that waits some time between loops without sleeping the computer?

should I use threads?
>>
>>51280043
well, when you are projecting your feels on other people... it says a lot about you

>>51280059
>
>>
>>51280053
Immediately easiest? C++/C#. C is too low-level, and let's better not get started about Java the Hutt.
Long-term easiest? Common Lisp.
>>
>>51280045
>confirmed masturbatory status of lisp
>>
>>51280071
>without sleeping the computer
"to sleep" is not a transitive verb
>>
>>51280071
Yes.
>>
>>51280090
this is english you bastard he can transitive any word he pleases
>>
>>51280083
>lisp cuk
>projection meme
top gun!
>>
>>51280053
Both Python and JavaScript will be fine.
>>
>>51280087
joke was already made:
>>51279920
>brb gonna fap can't take it anymore

>>51280045
That's real nice, but https://github.com/tokenrove/anaphora
is even realnicer
>>
let fn =
{
let gn = lambda () 3;
};
New top-level name: fn : (<none> -> <long>)
{
let fn = {
let gn = lambda () 3;

}
;

}
: (<none> -> <long>)
; ModuleID = 'main'

define i64 ()* @sequence() {
main:
ret i64 ()* ()* @sequence1
}

define i64 ()* @sequence1() {
main:
ret i64 ()* @lambda
}

define i64 @lambda() {
entry:
ret i64 3
}

C O M P I L E R
O
M
P
I
L
E
R
>>
>>51280085
>Long-term easiest? Common Lisp.
Now that's a sentence from the '70s!
>>
>>51280102
>
I'm not the same person :^)
>>
>>51280169
is :^) valid lisp code
i assume anything with a bracket in is
>>
>>51280133
>Common Lisp
>'70's
>mfw The first language documentation [for Common Lisp] was published 1984 as Common Lisp the Language, first edition
>what is MacLisp, ZetaLisp, NIL, Interlisp, Scheme
Nigga you even history?
>>
>>51280176
is your ass still tingling, or just hurt?
>>
>>51280176
no, but with the right reader-macros, :o( format t "Hello world!" :o) is

https://www.lrde.epita.fr/~didier/software/lisp/misc.php#smilisp
>>
>>51279509
Just start downloading a random torrent (just a legal one if you have a stupid government)
>>
>>51280176
:^ is a valid identifier, so it would be a nice tail argument in all cases, but if you want to capture the right parenthesis then you need to do some symbol magic
(quote |:^)|)

and it is not as pretty
>>
>>51280216
>>51280206
It's not pretty, it's horribly beautiful
>>
>>51280194
?
>>
>>51280179
>>what is MacLisp, ZetaLisp, NIL, Interlisp, Scheme
Forced memes?
>>
>>51280230
Seems like one might be able to modify the reader so that opening and closing parenthesis can be part of a valid identifier. Then you'd have a forth-like lisp where the delimeters must have spaces around them.
( define :^) ( quote reddit ) )

meh
>>
>>51280299
https://www.lrde.epita.fr/~didier/software/lisp/misc.php#smilisp

>>51280248
Nigga, those "forced memes" were industry standards in the '70's you quoted
>>
Reading through this thread I just want to make a public service announcement about algorithms and data structures.

Please stop being fanboys of an algorithm or datastructure out of stubbornness. Almost every single algorithm or datastructure you have ever heard of has a specific purpose it is best suited for (except a few obvious exceptions like bogosort). You sound like a frothing retard when you say never use an array/list/hashmap/graph or whatever because x is always better. Same goes for algorithm choice, just learn them and choose whatever solves your problem the most effectively.

If you want to fling shit and wave a banner over something subjective, go argue about language preference/os choice/text editors.
>>
>>51280374
>lisps
>industry standards
TOP KEK!
>>
>>51280385
Some algos and data structures are for fags though.
>>
>create a timer
>start timer when I press space
>nothing happens
>press start again
>it crashes
thanks java.
>>
>>51280390
>says lisp is a typical language from the '70's
>gets corrected to which dialect to quote
>says lisp wasn't a typical language in the '70's
nigga not even your bullshit is straight
>>
>>51280463
>typical
>not even once
>damage control
>>
File: help.png (348 KB, 1600x900) Image search: [Google]
help.png
348 KB, 1600x900
We need the numbers on top to loop: 123456789012345678901234567890
Instead of:123456789101112...etc
Part 1 of code
#include <iostream>
# include <iomanip>
using namespace std;

void seats( double [] , int);
void mapSeats();
char movieMenu(char);

int main()
{
const int rowNum = (15.0);
double rowValue[rowNum]; //array to hold row pices
char selection;
int row2, col2;
const char TAKEN = '#';//seats taken
const char EMPTY = '*';//seats free
const int row = 15;//number of rows
const int col = 30;//number of col
char map[row][col];//array to hold seat chart



for(int i= 0;i<row;i++)//initiating array
{
for (int j=0;j<col;j++)
{
map[i][j]=EMPTY;
}
}

mapSeats();

seats(rowValue, rowNum);//ask user to enter price of each row
cout << endl;

do
{
cout << "MOVIE THEATER MENU" << endl;
cout << "------------------" << endl;
cout << "1) Sell a ticket" << endl;
cout << "Q) Quit program" << endl;
cout << "Please make a selection: ";
cin >> selection;

if(selection =='1')
{
cout << "Please enter a row number and a seat number for the ticket: " ;
cout << "Row #:" ;
cin >> row2;
cout << endl;
cout << "Seat #:" ;
cin >> col2;
cout << endl;

for(int i = 0; i < row; i++)
{
for(int j=0;j<col;j++)
{
map[row2][col2]=TAKEN;
}
}

}
else if(selection =='q'||selection=='Q')
{
cout << "Thank you for using the program." << endl;
}
else if(selection != '1' || selection !='q' || selection !='Q')
{
cout << "Invalid selection." << endl;
}
}while(selection != '1' || selection !='q' || selection !='Q');


system("PAUSE");
return 0;
}


void seats(double rowPrice[], int row)
{

cout << "Please enter a ticket price for each row." << endl;

for(int i = 0 ; i < row; i++)
{
cout << "Row # " << i+1 << ": " ;
cin >> rowPrice[i];
}
}
>>
part 2
void mapSeats()
{
const char TAKEN = '*';//seats taken
const char EMPTY = '#';//seats free
const int rw=15;
const int cl=30;

cout <<setw(15)<<"Seats "<<endl;

for(int k = 1 ; k <=30;k++) //loop to display nums 1 to 30
{
cout << fixed<< k ;
}

for(int i=1;i<=rw;i++)//making array display what's in it
{
cout<<right<<setw(5);
cout<<endl<<"Row "<<setw(3)<<i<<right << setw(2);
for(int j=1; j<cl; j++)
{
cout << fixed << "" <<EMPTY;
}
}
cout<<endl;
cout<<""<<endl;
cout<<setw(30)<<"Legend: * = Sold"<<endl;
cout<<setw(31)<<" : # = Empty"<<endl;
cout<<endl;
}
>>
>>51280481
nigga you wot
>>
>>51280514
>nobody said "typical language"
>proceed with strawman
lisp fags, everyone
>>
>>51280456
post source please
>>
>>51280541
First you said Common Lisp is a typical '70's language, which is wrong, and I pointed you to the industry standards of the time.
The you said they weren't.

Java fags, everyone.
>>
>>51280552
if (Gdx.input.keypress(key.space)
{
timer.start();
}

or some shit like this.

It gives me an exception about the timer is already started or cancelled.

Right now the fix was to change to justpressed
>>
what happen to this magnificent community if 4chan closed by murica or other somebody/smt ??
>>
>>51280725
we will, finally, become productive
>>
File: smilisp.png (220 KB, 592x970) Image search: [Google]
smilisp.png
220 KB, 592x970
>>51280374
>https://www.lrde.epita.fr/~didier/software/lisp/misc.php#smilisp
this is fucking hilarious, now I want to do this in racket
>>
>>51280733
:o( print "Please do!" :o)
>>
How do I git gud at unit testing?
I learned how to do the tests, but how do I know which properties should I check?
Even for something as simple as a sorting algorithm the book uses 6 different ones
>idempotence
>first element is the smallest
>elements are ordered
>output is a permutation of input
>last element is the largest
>if we find the smallest elements of 2 lists, it should be the smallest if we append the lists and sort them

Isn't this overkill? Wouldn't a real program have thousands of tests if you're being so rigorous?
>>
>>51280588
Quote the part with "typical" in it. Protip: you can't.
>>
>>51280731
lel KappaRoss
>>
>>51280783
>what is paraphrasing
>>
>>51280791
>damage control
Why didn't you paraphrase with "You said lisp was the best languages of the '70s"?
Fucking asshat.
>>
>>51280773
>Isn't this overkill?
it is
>Wouldn't a real program have thousands of tests if you're being so rigorous?
they do

that's why, if doing Test-Driven Development, you usually have a dedicated team of test designers or a dedicated member, or you take a whole day a week to do that if you're by yourself.
>>
>>51280804
be careful, your idiot is showing
>>
Can we stop talking about lisp? this is a programming thread.
>>
>>51280588
I said it's a '70s language. You "paraphrased" that to "industry standard". I lol'd. You said My bullshit is not straight. You got told. Now you're in damage control mode.
>>
>>51280773
You have different approaches to unit testing. Some do go all out checking for everything, but personally I set up a restricted parameter space, look at probability of failure, total test coverage and how it fits within the scope of the project. That way I still get a lot of tests, but less and more useful tests.
>>
>>51280832
Why, are you jealouth of >>51279920?
>>
>>51280825
is that paraphrasing for "I got told and now I'm bitter"?
>>
>>51280825
>>51280850
BTFO
T
F
O
>>
>>51280812
>>51280843
Makes sense, unit testing is cool so I want to do it but I suppose I'll try to maximize the utility of each test instead of going all out.
>>
>>51280879

>>51280812 != >>51280843
We're not the same guy :)
>>
>>51280879
Going all out is fun too, though. Do it while learning how to do unit tests, see how crazy you can get. A function that only sets a private variable in an object can already have a lot of unit tests.
>>
>>51280850
>>51280863
Look, you samefaggoting tosser. I've tried Basic, Visual Basic, various assemblers, C, C++, Perl, Python, PHP, Java, C#, Clojure, JS, Scheme, Racket, and only God knows how many other languages. Some of them are good for some cases like C for low-level programming,, some of them are real nice like Common Lisp, and I have hands-on experience to back up why others are utterly and completely useless. Go learn some Common Lisp before criticising it, you may actually learn something useful for a change!

https://www.gigamonkeys.com/book/
https://common-lisp.net/
https://common-lisp.net/tutorials/

I'm out. Have a good day.
>>
>>51280929
wow your penis is huge
>>
>>51279333
Obviously A
>>
https://blog.golang.org/pipelines
tell me, faggots. is it THIS easy to do concurrency in your retarded language?
>>
>>51280944
It's not about my penis. I'm a pretty average guy. I'm just telling you to go and learn to know what you're talking about before criticising something. I myself know first-hand some of the actual shortcomings of Common Lisp, and you have yet to mention any of them. So please, put the "science" part back in "computer science" if you're studying that, and go educate yourself.
>>
Go is prett legit for certain types of system programming. I'm currently taking a distributed systems course with https://en.wikipedia.org/wiki/Thomas_E._Anderson and we use Go
>>
regex question.
I want to replace something while also retaining a part of it that is always different.
For example, I want to replace
<strong><font color="fb8200">SomethingThat'sAlwaysDifferent</font></strong> is a faggot.


with
<strong><font color="fb8200">SomethingThat'sAlwaysDifferent</font></strong> ayy lmao


yes, it has to be the entire thing, not just the last part, while retaining SomethingTha'sAlwaysDifferent.
>>
>>51281027
simpler words:
I want to replace something before and after a thing, while not touching the thing in the middle, but still recognizing it because of what's around it.
>>
>>51281027
xml is not regular.
>>
>>51281027
http://stackoverflow.com/questions/1732348/regex-match-open-tags-except-xhtml-self-contained-tags
>Have you tried using an XML parser instead?
>>
>>51280773
>Isn't this overkill? Wouldn't a real program have thousands of tests if you're being so rigorous?
Testing is not a substitute for good code. Testing augments good code. Good code has small functions that do small things and are composed to do large things. Then you can write tests for your small functions. Testing small functions is straightforward.

A good test should take a typical use-case and can serve as a "better comment" on how to use something. Tests stay compatible, comments can fail to keep up with code.

Complicated code requires complicated tests. This is unavoidable if you move to tight loops for performance reasons. In this case, yes, you do need to test a lot because the problem space addressed by your fuckhuge spaghetti function is very large.
>>
>>51281043
why wouldn't something like this work:
s/^(thing)(whatever)(thing2)$/something$2something/i
>>
>>51281027
http://stackoverflow.com/a/1732454
>>
File: 1444572843361.jpg (8 KB, 250x238) Image search: [Google]
1444572843361.jpg
8 KB, 250x238
Please explain what iterators in C are to a retard.
>>
>>51279023
https://isocpp.org/get-started
>>
>>51280994
What makes it legit for that stuff compared to say C#?
>>
>>51281027
>>51281043
>>51281046
>>51281048
>>51281065
>>51281067
>You can't parse [X]HTML with regex. Because HTML can't be parsed by regex. Regex is not a tool that can be used to correctly parse HTML. As I have answered in HTML-and-regex questions here so many times before, the use of regex will not allow you to consume HTML. Regular expressions are a tool that is insufficiently sophisticated to understand the constructs employed by HTML. HTML is not a regular language and hence cannot be parsed by regular expressions. Regex queries are not equipped to break down HTML into its meaningful parts. so many times but it is not getting to me. Even enhanced irregular regular expressions as used by Perl are not up to the task of parsing HTML. You will never make me crack. HTML is a language of sufficient complexity that it cannot be parsed by regular expressions. Even Jon Skeet cannot parse HTML using regular expressions. Every time you attempt to parse HTML with regular expressions, the unholy child weeps the blood of virgins, and Russian hackers pwn your webapp. Parsing HTML with regex summons tainted souls into the realm of the living. HTML and regex go together like love, marriage, and ritual infanticide. The <center> cannot hold it is too late. The force of regex and HTML together in the same conceptual space will destroy your mind like so much watery putty. If you parse HTML with regex you are giving in to Them and their blasphemous ways which doom us all to inhuman toil for the One whose Name cannot be expressed in the Basic Multilingual Plane, he comes.
>>
How do I convert this in a switch?

String a,b,c;
if(a.contains(b)) {}
else if(a.contains(c)){}
else {}
>>
>>51280488
>>51280507
literal homework
>dat blackboard
UCL?
>>
>>51281077
>>51281027
>>51281043
>>51281046
>>51281048
>>51281065
>>51281067
>HTML-plus-regexp will liquify the nerves of the sentient whilst you observe, your psyche withering in the onslaught of horror. RegeĢæĢ”Ģ‰x-based HTML parsers are the cancer that is killing StackOverflow it is too late it is too late we cannot be saved the trangession of a chiĶ”ld ensures regex will consume all living tissue (except for HTML which it cannot, as previously prophesied) dear lord help us how can anyone survive this scourge using regex to parse HTML has doomed humanity to an eternity of dread torture and security holes using regex as a tool to process HTML establishes a breach between this world and the dread realm of cĶ’ĶŖoĶ›Ķ«rrupt entities (like SGML entities, but more corrupt)
>>
>>51281046
>>51281048
>>51281067
well that sucks, I use an HTML replacer add-on to replace certain parts of html in websites I do not own.
But now I want to shove something in front of a variable, and I can't find a way to get that to work. I thought maybe with regex I could replace
(anything)lmao

with
ayy(anything)lmao
>>
>>51281077
I wrote a yellowpages scraper which uses regex. Works quite well. SUCK MUH DIIIIIIICK (read: gitgud)
>>
>>51281093
>>51281077
>>51281027
>>51281043
>>51281046
>>51281048
>>51281065
>>51281067
> a mere glimpse of the world of regex parsers for HTML will instantly transport a programmer's consciousness into a world of ceaseless screaming, he comes, the pestilent slithy regex-infection will devour your HTML parser, application and existence for all time like Visual Basic only worse he comes he comes do not fight he comĢ”eĢ¶s, Ģ•hĢµis unĢØhoĶžly radianĶceĶ destroŅ‰ying all enliĢĶ„Ģ‚Ķ„ghtenment, HTML tags leaĶ kiĢ§nĶ˜g frĢ¶oĢØm Ģ”yoĶŸur eyeĶ¢sĢø Ģ›lĢ•ikĶe liquid pain, the song of reĢøgular expression parsing will extinguish the voices of mortal man from the sphere I can see it can you see Ģ²ĶšĢ–Ķ”Ģ™iĢ‚ĶĢ©tĢĢ‹Ķ€Ģ²ĶŽĢ©Ģ±Ķ” it is beautiful the final snuffing of the lies of Man ALL IS LOSĢĢĶ„Ķ–Ģ©Ķ‡Ģ—ĢŖT ALL IS LOST the ponĢ·y he comes he cĢ¶Ģ®omes he comes the ichor permeates all MY FACE MY FACE įµ’h god no NO NOOĢ¼OO NĪ˜ stop the an*Ķ‘Ģ¾Ģ¾Ģ¶Ģ…Ķ«ĶĢ™Ģ¤gĶ›Ķ†Ģ¾Ķ«Ģ‘Ķ†Ķ‡Ģ«lĢĶ«Ķ„ĶØĶ–Ķ‰Ģ—Ģ©Ģ³ĢŸeĢ…Ģ s ĶŽaĢ§ĶˆĶ–rĢ½Ģ¾Ķ„Ķ’Ķ‘e not reĢ€Ģ‘Ķ§ĢŒaĶØlĢƒĶ¤Ķ‚Ģ¾Ģ†Ģ˜ĢĢ™ ZAĶ Ģ”ĶŠĶLGĪŒ ISĶ®Ģ‚Ņ‰ĢÆĶˆĶ•Ģ¹Ģ˜Ģ± TOĶ…Ķ‡Ģ¹ĢŗʝĢ“Č³Ģ³ THĢ˜EĶ„Ģ‰Ķ– Ķ PĢÆĶĢ­OĢšNĢYĢ” HĶØĶŠĢ½Ģ…Ģ¾ĢŽĢ”ĢøĢŖĢÆEĢ¾Ķ›ĶŖĶ„Ģ€ĢĢ§Ķ˜Ģ¬Ģ© Ķ§Ģ¾Ķ¬Ģ§Ģ¶ĢØĢ±Ģ¹Ģ­ĢÆCĶ­ĢĶ„Ķ®ĶŸĢ·Ģ™Ģ²ĢĶ–OĶ®ĶĢ®ĢŖĢĶMĶŠĢ’ĢšĶŖĶ©Ķ¬ĢšĶœĢ²Ģ–EĢ‘Ķ©ĶŒĶĢ“ĢŸĢŸĶ™ĢžSĶÆĢæĢ”ĢØĶ€Ģ„Ķ…Ģ«ĶŽĢ­

>Have you tried using an XML parser instead?
>>
How would I go about distributing a monster's speed depending on the axis distance to its target?
Currently I have move flags and just do simple delta * speed then basically:
if((moving & North) == North)
x -= delta * speed;

Where the moving flag is set depending on the differences between current position and target position, and it goes until the monster reaches its target.

What I'd like to achieve is that when the target is for instance 100 px to the left and 50 px to the bottom, the speed will be distributed so that the monster will move twice as fast to the left as it moves to the bottom.
>>
>>51280507
cout << (k%10)
>>
>>51280929
>>51280988
nice blog
also: confirmed average faggot
>>
>>51281073
it's an object that is used for iterating over the items in a collection. It typically has a getNext() : T and hasNext() : bool method, that will return the next item in the collection and tell you if there are any more items left in the collection. It's handy because you can easily create them from almost any collection type, such as arrays and linked lists. You can also make iterators that are infinite in length and produce values on the fly as getNext() : T is called.

That's a shitty explanation, but whatever.
>>
>>51281107
>I think the flaw here is that HTML is a Chomsky Type 2 grammar (context free grammar) and RegEx is a Chomsky Type 3 grammar (regular grammar). Since a Type 2 grammar is fundamentally more complex than a Type 3 grammar (see the Chomsky hierarchy), you can't possibly make this work. But many will try, some will claim success and others will find the fault and totally mess you up.
>>
>>51279658
>>51279688
Unless it's for pedagogy why aren't you using std::sort?
>>
>>51280929
>I've tried Basic, Visual Basic
We've got a badass over here!
>>
>>51281151
Well, it did feel quite badass when I was 10. So what?
>>
>>51281151
And how many criminals have YOU caught with YOUR gui's?
That's what I thought.
>>
>>51280929
>hands-on experience to back up why others are utterly and completely useless
>I tried fizzbuzz in all of them and I liked lisp the most
ishiggydiggy
>>
>>51281126
You take the distance vector and adjust its length so that it equals to speed (using Pythagoras, in case that isn't clear).
>>
>>51281076
c# is not a systems programming language; go is though.
>>
>>51280929
>I'm out. Have a good day.
he says as his tears fall on his F5 button
>>
>>51281163
>I tried fizzbuzz in all of them
More like "I spent at least a semester using each"
>>
File: 1445459207107.jpg (187 KB, 969x596) Image search: [Google]
1445459207107.jpg
187 KB, 969x596
/g/ challenge:

Write a regex that matches a palindrome of 0s and 1s

>inb4 homework
>>
>>51281176
But what's the difference in practice?
>>
>>51281176
>c# is not a systems programming language
https://en.wikipedia.org/wiki/SharpOS_(operating_system)
>>
>>51281188
You can use one of them for systems programming whilst you can't do the same with the other.
>>
>>51281192
>SharpOS was an open source .NET-C# based operating system
>was
>>
>>51281199
Why? What kind of project could you use Go for but not C#?
>>
>>51281213
AI for my waifu
>>
>>51280488
Man. When will schools stop teaching kids C and calling it C++?
>>
>>51281077
there's a difference between parsing a html document you know nothing about and working with piece of html that you know

if you're gonna make a html parsing library with regex, that's a bad idea

if you're gonna match a piece of html that you already know a bit about and know what to expect from it I don't really see a problem with that
>>
>>51281211
https://en.wikipedia.org/wiki/Cosmos_(operating_system)
>>
>>51281213
Linux or Mac programs

>inb4 mono
What a joke
>>
File: image-thumb1.png (141 KB, 534x328) Image search: [Google]
image-thumb1.png
141 KB, 534x328
>>51281211
>>51281237
also
https://en.wikipedia.org/wiki/Singularity_(operating_system)
>>
>>51281241
For supposedly being a joke, there's an awful lot of C# programs existing for Linux.
>>
>>51281241
A lot more are written in C# than Go.
>>
>>51281227
That's not C, that's C++. You can tell from the first line.
>>
>>51281186
impossibru
>>
I'm a functional programmer by heart, I generally program in Clojure and Haskell, lately I got my hands on some Python because I need to use it for a project. When I program in a functional style in Python people yell at me: "THATS UNPYTHONIC YOU DIPSHIT, PROGRAM IN PYTHON, MUH IMPERATIVE, MUH LOOPS"
Seriously? I had more respect for the Python community
>>
>>51281174
Yeah, I wrote a helper function to calculate the distance between two points, I'm not sure what do you mean to extend the length to equal the speed (wouldn't it result in the same thing as I currently have if I extended the length on both axes to the speed?)
>>
So, from this thread I can get lisp is a meme, right?
>>
>>51281297
You're imagining things.
>>
>>51281310
(yes (precisely (senpai)))
>>
>>51281073
>iterators in C
C has iterators?

>>51281283
This better be bait.
>>
>>51281310
Correct.
>>
>>51281297
You are the dipshit for abusing Python. Python is not functional, so don't treat it as one. What would you say to someone using OOP in Haskell?
>>
>>51281310
>))))))))))))
>))))))))
>)))))
>)))
>>
>>51281317
What exactly?
>>
>>51281332
>OOP
>Functional
>Pick one
Sorry, but you can perfectly program in a functional STYLE using OOP constructs.
>>
>>51281351
OCaml for lyfe!
>>
>>51280633
well of course, isKeyPressed will be true each frame that you have the spacebar down, you should only start the timer once
>>
>>51281332
Python supports plenty of functional concepts, and function programming is quite comfortable in it.
>>
File: wip-demo.webm (1 MB, 1366x768) Image search: [Google]
wip-demo.webm
1 MB, 1366x768
hey fuckers

trying to add info text to each mass now, because the radii are semi-arbitrary here so seeing shit like
#1
mass: Xkg
radius: Ykm

etc
the red dots are just so I can tell which is which
>>
>>51281332
>>51281317
Still it is not wrong to use FUNCTIONS like MAP or REDUCE, and not mutating any state, whats wrong with that? Do I make objects? YES, but I use a Fluent API. Do I organize my code in Classes like it is normal in Python? Oh hell yes I do. Whats wrong with that?
>>
>>51281320
>This better be bait
Wha'?
>>
>>51281370
thats what I'm talking about (im the user that asked the question)
>>
Is using dynamic parallelism with CUDA bad practice?
>>
>>51281320
>>>51281283 (You)
>This better be bait.
iostream is a C++ header. In general, if an included header doesn't end in .h, it's C++. The reverse is not true.
>>
>>51281411
The OP was writing C and tacking some C++ utilities on.

>>51281497
No, GPU architecture is perfectly suited to it, and CUDA supports it.

>>51281510
. . .
>>
>>51281510
it's technically C++ but
>Man. When will schools stop teaching kids C and calling it C++?
is saying that the style of the code is more like plain C
>>
>>51281497
It's actually good practice.
>>
>>51281535
then why is dynamic parallelism so obscured in the CUDA documentations and does it rather say that from a __global__ function you can't call another __global__ function, while with dynamic parallelism you can do that.
>>
>>51281073
>>51281510
are you, by chance, the same faggot that was ranting about how "gcc" is "broken"?
>>
>>51279517
Because I'm not a kek?
>>
>>51281706
Then don't use it anon. It's not a hard idea to use, and it works fine on new hardware.
https://a248.e.akamai.net/f/248/10/10/developer.download.nvidia.com/assets/cuda/files/CUDADownloads/TechBrief_Dynamic_Parallelism_in_CUDA.pdf
>>
>>51281745
I want to it, I actually looked for this kind of solution but had a hard time finding it. It's perfect for what I need, I just wondered why the main documentation didn't really talk about it until much later chapters.
>>
>>51279517
Why would you want to write GPL code and associate yourself with that sect in the process?

They preach freedom and practice the opposite. The GPL is anything but "freedom" and spreads like cancer to everything it touches.
>>
Class factory in Python to automate encoding/decoding of packets

EthernetPacket = mkpacket('EthernetPacket', [
('dst', MACAddressField),
('src', MACAddressField),
('ethertype', IntegerField(2)),
('payload', PacketField),
])

p = EthernetPacket(dst=MACAddress('ff:ff:ff:ff:ff:ff'), ethertype=0x0806)
p.src = Interface.get_by_name('Ethernet0').lladdr
>>
>>51281827
nice 1 m8
>>
>>51281827
did you know that even your SSD uses linux?
yes, "freedom" spreads like cancer to everything it touches :)
>>
>>51281827
>freedom is now cancer
who is paying you to shill here?
>>
to c or not to c ^^

int x = 1, y = 2, z[10];
int *ip; /* ip is a pointer to int */
ip = &x; /* ip now points to x */
y = *ip; /* y is now 1 */
*ip = 0; /* x is now 0 */
ip = &z[0]; /* ip now points to z[0] */


c is father of all pl. rest of them are just memes consider to c
>>
>>51281827
this

bunch of hypocrites, just like leftist politicians
Thread replies: 255
Thread images: 18

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

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