/dpt/ - Daily Programming Thread

old thread: What are you working on, Sup Forums?

Other urls found in this thread:

tour.golang.org
golang-book.com
mega.nz/fm/4HxBjTIA
mega.nz/#F!YKImgTxJ!sTA246kM_hrjx1GegY_pKw
twitter.com/NSFWRedditImage

>What are you working on, Sup Forums?
your mom's anus

also, rolling

what scheme interpreter should I use for sicp? drracket?

>wanna sort my 1000 astolfo pics
>shell script takes longer than doing it manually
why is bash so shit?
#!/usr/bin/env bash

magic=("JPEG" "PNG" "GIF")
ext=("jpg" "png" "gif")
idx=0
for name in *
do
type="$(file $name)"
i=0
n_ext=
for j in "${magic[@]}"
do
if echo "$type" | grep -i "${magic[$i]}" > /dev/null
then
n_ext="${ext[$i]}"
fi
i=$((i + 1))
done
mv -v "$name" "astolfo_00$idx.$n_ext"
idx=$((idx + 1))
done

what compiler did people use before gcc, clang and msvc?

Learn Go:
tour.golang.org
golang-book.com

That's nothing.
Watch:
⍝ Karmarkar's affine scaling algorithm
∇ x ← affine (A b c g); v X V T M i
x←0⍴⍨⍴c⋄T←⍉A⋄M←-A
→0/⍨∧/0≤V←M+.×X←c+.×⍨⌹T+.×A÷[1]×⍨v←b-A+.×x⋄x-←i←X×g×⌈/(V

>tfw had "fate" folder
>Apo airs
>over 80% of the images are now Astolfo

pcc or borland or one of many others

this can be done in one line of

bash + awk

Borland. For instance. I have a feeling there were more diversity back then.
But that's not older than gcc.

>know bash
>don't know awk
>spend more time learning awk than sorting pics by hand

>has anime shit
>is not a good programmer

imposter

Post magnet link

i'm painting my toenails :3c

ext=("jpg" "png" "gif")
idx=0
for name in *
do
type="$(file $name)"
i=0
n_ext=
for j in "${magic[@]}"
do
if echo "$type" | grep -i "${magic[$i]}" > /dev/null


wtf? why not simply run something like:
for ext in "jpg" "png" "gif"; do
# process files here
done

also, learn how to use ${var##ext} and ${var%%ext}

># process files here
err, I meant,
for ext in "jpg" "png" "gif"; do
for file in *.$ext; do
# process files here
done
done

>learn (((Go)))
>learn """C for retards"""

I'm confused, what am I missing in the print_arr?
#include
#include
using namespace std;

//only prints the first two elements

void print_arr(int arr[])
{
for (int i = 0; i < sizeof (arr) / sizeof (arr[0]); i++) {
cout

>c++
>not using vector

What error messages are you getting?

mega.nz/fm/4HxBjTIA

this
why do people still use fucking c arrays in c++

The function is printing only two elements, not all of them

>sizeof (arr)
arr is a memory address ie an integer

Why do I still need to force myself to code after a year? Is programming just not for me or should I find some interesting stuff to make?

what's your job?

So you are saying that I should pass the pointer to the array and the size of the array to the function?

This works for VLAs, a GNU C and C99 feature.
sizeof arr / sizeof *arr will give you the length of a variable length array

I don't want to touch imperative languages anymore.

>Please log in

IT guy. I don't program at work, though.

your parameter arr decays to a pointer, you loose the size information. sizeof(arr) will give the size of a pointer on your architecture in bytes (which is probably 8).

Either give an additional parameter with the size of the array (C style), or use a vectory for myints and pass it by const& to print_arr.
You could then use a C++11 range-for loop to iterate over the elements.

Fized, thanks

I think you could write int arr[max_index] or int arr[static max_index], but you might have to swap the two arguments.

i'm writting a Sup Forums scrapper (using the Sup Forums API) and when a thread has less than 200 replies it works fine but more than and just throws an error

you're right but i think when it's sent over to the function is loses that information

for file in *.{jpg,png,gif}

>tfw that happens even if you pass a pointer to the array

void function(int **p){
printf("sizeof v inside function = %d\n", sizeof(*p)); //prints 8
}

int main(){
int v[20];
printf("size of v = %d\n", sizeof(v)); //prints 80
function(&v);
return 0;
}

Moronic instructors can't tell the difference between C and C++ and always teach legacy C bullshit in the "C++" classes

I think lots of legacy C++ libraries use C style arrays

stay strong brother

one day

You definitely need to know them eventually but you should be learning vectors first since that's what you'll use 90% of the time, especially for trivial shit like the other poster is having trouble with

yeah wrong link, my bad
mega.nz/#F!YKImgTxJ!sTA246kM_hrjx1GegY_pKw

Thanks, faggot

I know, the idea would be for him to differentiate jpgs, pngs, etc, without calling 'file'.
calling external programs in bash is expensive...

harm minimization when forced to teach a course in C++

making a script that takes a music album in a youtube video and then slices it according to the video description or a text file. Will try to make metadata right if I have time.

Why would he need to? He's just bulk renaming, mv to $(printf "astolfo_%05d.%s" ${idx} ${file##*.})

just download the real thing
youtube audio quality is compressed to hell

I know basic programming: conditions, loops, variables, functions...
Would it be better to start with K&R or SICP? I've started reading the former and while it's a good resource I don't enjoy C very much.

i download my musics from youtube


fite me

I am not autistic enough / my hearing are way too damaged / I buy the cheapest headphones to even notice the difference.

>but you might have to swap the order of the arguments
Wow. I hope not. That'd be absolutely retarded.

why did you feel your terrible opinions on music listening were so important that you filled out two captchas to reply to me on a sunday night?

because in the script, he's keeping track of the format, when it's not needded

>mv to $(printf "astolfo_%05d.%s" ${idx} ${file##*.})
which is why I said he should learn how to use ${var##}...

youtube-dl -f 140 youtube.com/watch?list=...

>night
it's afternoon here, euro turd

For real guys what does this mean?

>The next interview will be a general chat about software engineering, theory and practice, and a couple programming exercises

I know that the programming exercises will be the usual CS questions, but what are questions on SE theory and practice? Like.. OOP quiz? Open-ended questions about designing some large scale system? Parallelism? Planning and UML diagrams? What happens when you type google.com in your browser? Networking? Floating point? I googled books on this, and judging by the contents of pic related I have no idea what to expect, and I don't have time to revise all CS curriculum and I'd like to focus on whatever it's expected

go back to work goyim

Lost pic

better know your binary search trees by heart

got no life, and bored as hell

(third captcha)

Could be anything. We don't have context.
But it's likely about understanding of priorities in software development primarily. But leaving a good impression is always good. So present what you know.

BUMP

Bump?
Just debug it. Why would anyone have anything to say to this?

Scripting isn't programming. Please delete this comment immediately

Nowhere near enough information to make a good assessment of the problem.

For starters: what error is being thrown? Post the function it occurs in and point out the line.

>comment
hmmmmmmmmmmmmmmmm relly made me think...............

goyim is plural

(((You))) would know.

>implying Fortran or Pascal would ever let C near them
>C programmers desperately try to pretend they're one of us
Fortran programmer here. We all hate C babies. You're not cool. You can barely even manage basic math problems, you fucking pajeets.

>>implying C or Pascal would ever let Fortran near them
>Fortran programmers desperately try to pretend they're one of us
C programmer here. We all hate Fortran babies. You're not cool. You can barely even manage basic math problems, you fucking pajeets.

Sarcasm isn't programming either. Please delete this comment immediately

Never reply to me again unless you're contributing to the thread.

>comment
what did xhe mean by this????

>xhe
fucking XHITLORD

Learning rust.
Type safety is really busting my nuts, but it's fun.

Should have stuck with Nim for the project I'm working on though.

>i-if I use BSD or MIT or Apache license then m-maybe a big corporation that uses my library will consider giving me a job
Imagine being this cucked.

>use GPL license
>corporations take your code anyway and get away with it
""copyleft"" is a joke, either release your code in real freedom or keep it proprietary

Found out that Mega.nz has a command line client, trying to think of a project or anything to use it for but can't think of shit - suppose it's only actually useful for large data deployments or something

who said that?

What the fuck even is the different between these licenses. How do I choose one for my project, or should I just always choose GPL?
Wait which fucking GPL should I use?
Christ I just want to write code and have people know I wrote it, I don't really give a fuck about copyrights

MIT

If you ask me you should use AGPLv3+ for everything.

>understanding of priorities in software development primarily.

what do you mean?

>implying I even write or share software in the first place

shoo, freeloader

if you want to use my software in a proprietary product then contact me and maybe we can come to an agreement involving you paying me for a separate license

GPL lets people do whatever they want with your code so long as their derivative or distributed version of your project is licenced under the same terms you afforded them. Free access to the source code and it cannot be legally included in a proprietary project.
BSD/MIT licenses let you do whatever the fuck you want and you have no obligation to allow access to your derivative source code or even give credit.

Enjoy your overflows

IDK how reliable Nim is, debugging it will be a massive pain in the ass

Going through Oracle´s Java tutorials.

Employed Haskell programmer here

?

image optimized

I love Haskell!

self employment doesn't count user.

MIT has no consideration for patents.

You could be using MIT-licensed code that is covered by someone's patent (even the author's) and you would have to pay them if they caught you.

Rate my 10th C++ program, /dpt/
#include
#include
using namespace std;

void print_arr(int rng[], size_t length)
{
for (size_t i = 0; i < length; i++) {
cout

Sup Forums, newfag here. im going through c now. have done marginal python/java/matlab.
current plan: c -> algorithm -> advanced java -> advanced python -> c++ -> machine learning.
will i make it for september career fair? i need to be able to larp as somekind of blockchain/cryptocurrency/machine learning/ai expert fag...

>C
>Java
>C++
>"will i make it for september career fair?"
Which year?