/dpt/ - Daily Programming Thread

Old thread

Other urls found in this thread:

astroengineer.wordpress.com/2010/04/07/a-curiosity-of-spirit-full-document/
en.wikibooks.org/wiki/LaTeX
en.wikipedia.org/wiki/Foobar#History_and_etymology
youtube.com/watch?v=XV7c6gSqPkc
youtube.com/watch?v=z-mxBDuRaZ8
benchmarksgame.alioth.debian.org/
youtube.com/watch?v=BuNBLjJzRoo
en.m.wikipedia.org/wiki/Grace_Hopper
git.savannah.gnu.org/cgit/grep.git/tree/src
twitter.com/SFWRedditImages

anyone got a more efficient solution to
>Check if a string is a rotation of another.
>e.g. "alleycat" is a rotation of "leycatal"
than creating a list of all the rotations of string 1, and checking if string 2 is a member of that list?
urusai. i was actually overthinking it. i just needed to make a list of all the points of the matrix, and then consume the list to iterate the matrix

no leftists allowed in this thread!

Try to code a non determinist regular expression automata.

check'd mein nigger

can we agree in this thread no one replies to the "virus" poster, he's just lying to get attention

sounds easy enough

post a screen shot of your programming environment

>non-determinist
stop this meme

n-th for why does installing texlive take so fucking long and does anyone know a good beginner tutorial?

Found this article. Think you guys will get a kick out of it.
astroengineer.wordpress.com/2010/04/07/a-curiosity-of-spirit-full-document/

...

and you're just trying to push your leftist view on everyone else here who consented to talking to me.
fuck off. you'll be dead soon anyway lol

well, i won't

How the fuck do I get curses to accept input longer than one character with python?

seems interesting but its too long

tl;dr?

you could continue to eat characters in a loop until enter is pressed or you have N characters if curses doesn't provide anything for you

I know there's a word for this but I can't remember. Let's say I have a value of 5 and I'm trying to interpolate it to a random value like -100. How do I increment slowly without 5 if/else statements

just terminator with vim and nerdtree in one window and a terminal in the other, would post a screencap but not on the machine I do programming on sorry
good

oh shit, looking at this there are two rather major errors in the final model, oops

en.wikibooks.org/wiki/LaTeX
I pointed my sempai to this when he needed a beginner tutorial.
He actually read through the entire thing, and now he's better at LaTeX than i am.

what?

You are not making sense.

Are C++ and C structs identical?

Stroustrop's C++ Programming Language refers to structs as objects. "The size of an object of a structure type..." "It is not possible to declare new objects of a structure type..."

Here does he mean "object" in the general sense of just any kind of logical grouping & designation of data? Or does he mean "object" in the narrower OOP sense of some data coupled with functions that operate on that data/pass messages?

Will a C++ struct written in the equivalent C be the same size? (assuming same architecture, computer, etc)

No, C++ structs are the same thing as C++ classes, not C structs, with the only difference being the default member visibility (public as opposed to private). PODs might have the same size but I'm not sure whether it's guaranteed or not.

>Looking for an example of something i need to do in X language
>foo and bar examples

Dropped faster than my MIT application
What's the purpose of this foo and bar bullshit? It looks dumb and it doesn't make it any more practical?

He means 'object' as in 'instance'.

t. autistic individual

en.wikipedia.org/wiki/Foobar#History_and_etymology

This may be more of a web-dev question, but it I trust the advice of the people here as well.

It's 2016, soon to be 2017. I want to create a commerce application, I'll take orders and process them.

There needs to be a front end and a back-end. I can do that. The question then becomes:
What technology to use?
What language, what web framework?


I'm leaning towards node.js, instinctively. But I loathe javascript and the thought of programming in it worries me. So what do you think, Sup Forums?

Ill probably already be finished once that fucking thing is finally installed

Python + Flask + SQLAlchemy + PGSQL on the backend.
Bootstrap on the frontend.

It's idiomatic to use Foo and Bar to distinguish things from predefined syntax, in an example.

Sort of like how cryptography always have Alice and Bob communicating with each other.

Chromebook

i know right?
a, b, c would make me understand it better than foo bar. And I'm not even being sarcastic.

...

recursion?

If the plan is to write libraries that I can use from scripting trough ffi, is C the only viable option? How would languages like fortran or pascal compare with the easiness of calling the functions from the scripting language?

I can do python.

But, why wouldn't I be using Django instead?

No, i feel the same, it's just some dumb as fuck thing virgins do to feel special because they think they ((know)) the history of programming.

this literally made me hate foo and bar
never ever gonna use this shit again

you FUBAR

interpolate? are you using that word correctly?

Because Django is a fucking behemoth and if you're not already familiar with it you'd take a while to learn so I suggest Flask because it's minimal yet good and easy to learn (well documented). Unless you want to "future proof" your knowledge and work with Django in the future in which case I guess you could go for Django for the learning experience.

TARFUN in your life

YOU HAVE 10 SECONDS TO TELL ME WHAT MUSIC YOU'RE LISTENING TO WHILE PROGRAMMING

melodeath

EUROBEAT DESU

youtube.com/watch?v=XV7c6gSqPkc
and ignoring the host whenever he speaks

Movie/video game/anime soundtracks

I'm already familiar with django having made some apps with it already, and the whole "behemoth" thing is a serious exaggeration. I've also done Java web applications, so don't tell me about behemoths.

Flask is something I've toyed with only on the level of "hello world" and prototyping a dashboard application. Its cool and it werks, but I'm going to handle money, and that requires some safety.

What about tornado?

aplay /dev/urandom

best choice

Tsunami is better

Does anyone have examples of big C programs that takes an input from a text file and produces an deterministic output?

e.g. take a list of 10000 words and print odd-sized words

i can't find anything from github

youtube.com/watch?v=z-mxBDuRaZ8

I dunno, seems pretty ded m8.

death grips and anime ops

>but I'm going to handle money, and that requires some safety.
Flask provides you with facilities for sanitization (so does SQLAlchemy and Jinja which are essential to Flask for database and templating respectively) but if you're already familiar with Django I'd say roll with it.

I'm indifferent about Tornado, haven't heard about it used much for web backends in Python (it's usually either Django or Flask that are mentioned) and I've not used it myself either.

>e.g. take a list of 10000 words and print odd-sized words
that's fucking easy to do

Why would you need a big program for that?

>Big c program
>About 10 lines
Wew

holy fuck this is so fucking shit

no one said it wasn't
requirements
i just need programs with more than 200 lines

you're confusing "big program" with "program doing big things"

>more than 200 lines
what?

here's an easy trick to make those 200 lines:
int
main
(
)
{
return
0
;
}
;

no need to thank me

There's a bunch of smallish programs in an array of languages
benchmarksgame.alioth.debian.org/

So you thought you'd rip something from github instead of doing your own homework.
Fuck you.

lol

youtube.com/watch?v=BuNBLjJzRoo

are you fucking retarded?

baka, just write a program that loops and outputs a case statement to a file of 200 lines, in psuedo code

for i = 0 while i < 200 i++
tofile ("case: " + i + "\n")
tofile ("print(\"Your number is\"" + i + ");");


then wrap that with int main() and you're good

en.m.wikipedia.org/wiki/Grace_Hopper

Introducing Admiral Grace Hopper, who basically invented high level programming languages that are still used today.

none

i\
n\
t
m\
a\
i\
n
(
)
{
r\
e\
t\
u\
r\
n
0
;
}

no she didn't, but she did make the first almost-compiler for one

the program in your example would take, like 15 lines max

first programmer was a woman, first compiler was written by a woman. and newfags say that crossdressing is a meme

>a nigger
somehow i believe this is fake

that's how you make 2000 lines

Well it doesn't seem to be written by someone that knows a whole lot about physics. The comments on the faster than light information and such (the quantum shit) makes me doubt he has taken college courses on the subject as he claims. Because he presents a very basic misunderstanding as something that's potentially true.

Fuck off you dumb ADHD kid.

calm down reddít

What is the simplest way to stream video to a device file, so it can be read through V4L2? How about audio?

i3 + Emacs

>inb4 dozens of replies calling the enchantress of numbers a 'leftist meme'

...

git.savannah.gnu.org/cgit/grep.git/tree/src

[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]
[email protected]


made a robot that mines emails for jobs and then sends emails to them.

You interpolate.
You could Google that but basically:
(1-t)*a+b*t
Is linear interpolation.
Where t is a value between 0 and 1,a is your starting value and b is your end value.
When you pass 0 as t it returns a. When you pass 1 as t it returns b. If you pass a value outside the range you get a linear extrapolation. It should be very simple to understand even if you're bad at math (just look at the terms cancel when t = 1 or 0)
This works for a lot of things. You might also want to look into other interpolation functions.

#include
#define wnz while (*s
int oddword(char **w) {
char *p,*s=*w,c;
size_t n;
wnz&&*s' ')++s;
n=s-p;
if(n&1)c=*s,*s='\n',fwrite(p,1,n+1,stdout),*s=c;
return*(*w=s);
}
char s[BUFSIZ],*p;
int main(void){
size_t n;
while ((n=fread(s,1,sizeof s-1,stdin))){
if(n>1){
p=s,s[n]=0;
while(oddword(&p));
}
if(feof(stdin))return 0;
}
}

pipe a file into it

hmm that's too big.
what i have to do is basically, grab a random program with more than 200 lines, written in C, and find bugs in them, inject bugs( fault injection),etc

basically run experiments in programs

why are you posting this?

did someone ask you to post this?

Oh and maybe you were looking for the word 'lerp'? Which is short for linear interpolation. Very often used by game programmers so that's what you get as results if you Google usually.

Well, duh. Neither Ada nor Grace were crossdressers.

Although, from what i've heard about Ada's personality, she might have done so on occasion.

find the bug (or rather, a potential edge case)

>high level programming languages
She gets a lot of credit for a small invention when I'm sure she has done far greater things.

It's not high level in the sense that functional programming languages are. She made a program that takes opcodes and outputs machine code.

That's not a good thing.
A good number of CL jobs are e-mail miners, or ID thieves.

So you either got mined yourself, made yourself a target, or applied to be an adult actress.

So what you really wanted was a small C program.