/dpt/ - Daily Programming Thread

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

Attached: meido bully.jpg (1280x720, 140K)

Other urls found in this thread:

github.com/nothings/stb
nimble.directory,
uscilab.github.io/cereal/pointers.html
youtube.com/watch?v=rpLoS7B6T94
standards-oui.ieee.org/oui/oui.txt
twitter.com/SFWRedditImages

I'm still trying to figure out how to output the results of macchanger wlan0 -a to a list

import re
import subprocess

subprocess.call("ifconfig wlan0 down", shell=True)
subprocess.call("macchanger wlan0 -a", shell=True)

def macsearch():
macseed = subprocess.check_output(["macchanger wlan0 -a"])
mac = re.search("^([0-9A-F]{2}[:-]){5}([0-9A-F]{2})$", macseed)
if mac:
Macstore = []
Macstore.append(mac)
print(Macstore)
else:
print("error, not found")

Does /dpt/ like C?

Attached: C0E6E4AB-C2D9-489F-89E8-06D0FF495AFE.jpg (848x559, 59K)

if u indent like this
{
statements
}
u deserve the rope

see
>Wow I can do stupid things with a language!

if u code like this
statements
u deserve the rope

openssl a shit

Solidly agree.

ex-journalist here

can anyone recommend some youtube tutorials on learning to code?

i used to hate C with a passion, a lot of C libraries are shitly designed with poor documentation
vulkan restored my faith in it
also zlib is nice

what are some other pleasant to use C libraries

CImg and most of the github.com/nothings/stb libraries.
You have to do a fair amount of unpacking to understand what's going on with them because they're header-only libraries for portability, so they're at a glance an insane mess, but they're very well written and sanely maintained.

?

making a basic c++ program for an assignment and I can't seem to tie these two loops properly. The most I've been able to do is loop them with the side effect of each run after the initial add their totals to the initial total

int main()
{
int numberitems, number, sum = 0, count = 1;
bool right = true;
char answer;

cout > numberitems;

for (int i = 0; i < numberitems; i++) {
cout > number;

sum = sum + number;
}
cout

if u indent like this{
statements;
}
u deserve the love

Clojure looks interesting but isn't the jvm bloat? Should I make a virtual machine just for clojure dev to keep java out of my main environments?

i really like the stb's approach to header only libraries, it's quite nice

I do wish they weren't so fucking slow, but that was never their goal, so I can respect it I guess. They're very easy to include and use.

whenever you start the first loop you need to reset the sum back to zero
also it would help if you turned the first loop into a function to be called by the second loop

That's the screenshot I made and posted on another board! So that board really has some posters who are interested in programming.
Anyway I'm trying to implement a curses-like interface in sh as a portable framework of TUI programs.

Attached: 9acc3f9e39d56bb07374b1266463b8d1.jpg (981x1058, 897K)

boost::serialization
vs
cereal
?

>trying to setup Clang-LLVM on Windows
>no idea what the fuck I'm doing
>guides are like 50 steps long and have you installing shit tons of crap

Why can't it just be a single exe you double click and it just werkz?

What show is that in the OP?
It looks cute but it's hard to judge because I only see people cherrypicking cute still frames.

Watashi ni Tenshi ga Maiorita!
It's pretty cute indeed.

Like said you need your summation code to be inside the your run loop, and you need to set your sum back to zero before the loop runs through again.

You're going to need to add some "\n" or endl to your cout statements to get pretty output (you'll see when you run it).
You don't need to put ==true/false when testing a bool condition, while (right) will suffice.
You can use the functions toupper or tolower to make lower the anount of char tests
Also for your run loop, just ask for would you like to run again, and any other char besides a 'Y' or 'y' will indicate they don't want to run again. a la
cin >> answer;
answer = toupper(answer);
if (answer != 'Y')
{
right = false;
}

Switch statements compile to simple goto: statements, depending on the language. It's why it has to be an integer constant expression - this must be resolvable at compile time. Hash tables involve lookup operations on the fly.

The two are actually usually used for very different things.

wait, aren't c arrays decay when passed into functions?

Why do Ctards tend to write the shittiest possible code imaginable?

>download use the installer
>download the visual studio extension that lets you use it as a drop in replacement for msvc
how is that hard
unless you're talking about using clang-llvm for development
if you want brainded tier installs use vcpkg
takes a fuckload of time to compile

There's no sense making Macstore a list if you're going to set it back to empty after every time it's called. If you don't get what I mean open up python and:

>>>mylist = []
>>>mylist.append("something")
>>>mylist
['something']
>>>mylist = []
>>>mylist
[]
>>>_


As for writing to a file:

# Open filename in write mode as a variable
with open('maclist', 'w') as maclist:
# Assuming you get your list working which
# isn't likely so long as you're clearing it
# before ever writing to file
for mac in Macstore:
# might need to be maclist.write (macstore, '\n') for newlines
maclist.write(macstore)


Y'know you could open Vim and:
:r !macchanger -a
and it'll read the output directly into file. You could clean it up afterward pretty easily.

Java doesn't have an exponent symbol what the heck

>Windows
I'd use an OS that just works

I've actually been writing serialization code for a project I've been working on to help me improve my skills. Every time I've looked for advice on Stack Overflow, it's always been "Oh, just use Boost::serialization"

But I don't want to use Boost. I want to learn how others do it. I banged out my own solution and tested it for some of my simpler classes, and I was hoping that someone with similar problems as mine would get and answer that doesn't involve using a library.

Anyway, I'm making all of my classes support a function write(ostream&) and read(istream&). The save file itself will likely have POD index structure that indicates where stuff is stored (offset) and how much.

>manually writing your own serialization code
fucking madman that's a bitchload of work even if you use metaprogramming to make it easier
it might be worth considering writing a code generation tool/plugin for clang to get around it
it's what i'm doing

That sounds like a lot of work.
Do you take endianness into account?

Threadly reminder that Nim is /ourlang/ and you should help bolster its ecosystem by assisting with documentation, creating new packages for nimble.directory, and spreading the word to coworkers and friends!

I find libpng to be pretty comfy.

Attached: 57985147_p0.jpg (2480x3507, 809K)

i just found out that im NEET....

What happened, user?

That's even worse.

if you're not doing this
{
chad code
}

then you deserve all the segmentation faults.

Is it really that bad? It doesn't currently take endianness into account, but that shouldn't be hard - just change everything to/from network byte order before read and after writes. It is a lot of work, I suppose, but each of my classes are pretty small and straightforward, and the larger ones use a fair amount of composition. Currently, the majority of classes are "shallow" as they don't have pointers or references. There are some I haven't written yet that will require indexes and a way of matching them.

so when I double click a torrent in taiga and it automatically opens in my torrent client, how does that work?
or when I click a download in Chrome and it opens in my download manager
how do I setup links like this?

install gentoo

> fresh graduate with bachelor in software E

i have hard time with finding my first job...

Attached: Hikkomori.jpg (704x528, 66K)

Attached: 1541699645712.gif (290x189, 2.9M)

your browser does all that.

No it's not that bad and it's how most people did it for decades.
Modern serializers however, like Cereal, can deal with pointers too, as long as you use C++ smart pointers
uscilab.github.io/cereal/pointers.html

welcome to my life currently

Attached: unnamed (2).gif (500x283, 464K)

>Is it really that bad?
It's not so much bad as tedious as fuck, even if you use things like cereal or boost serialization.
Serialization is something that could made trivial with metaprogramming, but can't be because the committee is fucking slow, metaclasses aren't coming for years.
it's why big libraries like Qt have a code generation tool as part of their build process

Say I want to write a Scheme macro that quotes all of its arguments by default, but allows escaping with unquote. Is this the best method, or is there a simpler way?

(define-syntax %quote
(syntax-rules (unquote unquote-splicing)
((%quote (unquote-splicing v)) v)
((%quote (unquote v)) (list v))
((%quote v) (list (quote v)))))

(define-syntax macro
(syntax-rules ()
((macro args ...)
(%macro-procedure (append (%quote args) ...)))))

Why would anyone hire you when they can hire Pajeet?

Attached: 1519576268022.jpg (1920x1080, 162K)

what was it that got you blacklisted?

[insert any langauge you like] tuturial
start from there

Was using '=' for function declaration a mistake? It allows for really long one liners.
addmuls m a b = muls m a + muls m b - muls m (a * b) where muls m n = foldl (+) 0 [i | i

nothing, Mr. Noseberg said it was just a result of restructuring the company to increase office diversity

Forgive me but I'm not understanding how to return the sum back to zero. I've tried return 0; but that just cuts the program short.

>cheaper?

Attached: 1549527611561.gif (320x240, 3.73M)

sum = 0;

> Mr. Noseberg said it was just a result of restructuring the company to increase office diversity
aka lost money and they have to fire somebody

why didn't you find another job in same field?

Mr. Noseberg told everyone at his synagogue not to hire me

> diversity... wait are you white?

and should know more

*ahem*

FUCK RECURSION

Attached: 1544688994152.png (637x399, 263K)

If I can learn Japanese can I learn to program?

>Jow Forums calls this humor

Japanese is way easier then becoming a good programmer. It's much more passive and you learn it with materials you want rather than banging your head against a fucking keyboard.

Attached: 1535479119854.jpg (1336x1952, 667K)

can some on explain to me what in the name of fuck is happening here?
youtube.com/watch?v=rpLoS7B6T94

Attached: wtfisgoingon.png (1193x664, 885K)

I'm aiming to become a shit programmer who will still get hired.

indians in the UK and the US earn higher wages, their kids do better in school and actually on top of that - in the US they are hurt by blachs having AA, precisely due to their higher average grades

so there

Indian American (2016) : $122,026 [2]
Taiwanese American (2016) : $101,450 [3]
Chinese American (2016) : $90,221 [3]
Jewish American (2016) : $88,745 [2]
Korean American (2016) : $79,872[3]
Singaporean American (2016) : $78,127[3]
British American (2016): $77,841[3]
Japanese American (2016): $77,636[3]
Bulgarian American (2016): $76,861[3]
Lithuanian American (2016) : $76,694[3]
Israeli American (2016) : $76,584 [3]
Slovene American (2016) : $75,940[3]
Lebanese American (2016): $75,337[3]
Croatian American (2016): $73,991[3]
Sri Lankan American: $73,856[3]
Scandinavian American (2016): $73,797[3]
Nigerian American (2016): $73,788[2]
Belgian American (2016) : $73,443[3]
Malaysian American (2016): $72,827[2]
(excluding Taiwanese American)
Swiss American (2016) : $72,823

first 20 by national origins

so idk if they are cheaper, lol

Found the liberal arts major. How's your video game coming, son?

Don't take out your frustration on me, it's not going to get you a job.

Looks like he defined a list of instructions. I'm guessing it replaces any instances of the mnemonic or hex code with the C++ code snippet.

Oh just to trigger your autism you even more, let me put my trip on

what specifically are you talking about
you mean the multiline macro in that image?
o's params look like chip 8 opcodes, their bytecode, and the implementation necessary to emulate them
no idea what the fuck its actually doing though

>implying it isn't Nadella and his $2 billion USD salary fucking with the statistics

so o gets sent to list_instructions(o)? I don't understand where does it get sent from? And out of all those o functions listed below, how does it choose a specific one?

i love this guy. his 2.5d portal renderer was really cool for how few lines of code were there.

Read SICP

Attached: 1548013678658.jpg (1280x720, 500K)

the only way to make recursion dependable for real world use is to pass a counter and hope the compiler catches the tco, essentially turning it into an iterative loop at best and a stack overflow at worst. the functional paradigm is a total meme.

>his language doesn't require proper tail calls

Attached: warau_shoujo.png (619x550, 71K)

Is it a good idea to read this book while also reading another book for an specific language and practicing it too?

>doesn't count h-1b
>therefore it's primarily looking at a small number of indians and asians who permanently moved to the US after being offered management positions due to their experience running massive overseas IT farms

Very easy to skew statistics like that. They're effectively comparing the top indians and asians imported into the nation to the entire range of workers from the native citizens.

Do I really need to do all my coding in Vim or Emacs if I wanna become a true galaxy-brain 10xer Supreme Allfather Codin Equal of Heaven?

Is a lightweight text editor in a minimalist Linux GUI really that inefficient by comparison?

Attached: 1547826937558.png (480x640, 535K)

vim?

are you insane?

vim is good for small things but coding with more than 1 file is hell

It's just a meme breh

In scala, you can use the @tailrec attribute to ensure that the compiler uses TCO. I'm not sure what it is like in other languages, but I would guess it is similar.

I have an mp3 file like object in the memory

any idea on how to play it in Python?

Correction:
maclist.write(mac)

This still all seems very convoluted. Your original goal is to generate a list file of "legitimate looking" MAC addresses. Yes, macchanger -a does so by setting an octet to that of known vendors using an OUI list... but you're calling a program into a script to scrape the program's output with regex to generate output into a file.

Why not populate your own list of vendor octets, picking and choose more common vendors (Apple, Inc, Broadcom, Cisco-Linksys, D-link, etc), randomize the last octet in-script, then fill your fill with those?

standards-oui.ieee.org/oui/oui.txt

Recursion can be used to solve problems with an indeterminate and or branching number of cases. iterative cases can as well but I can see why recursion might be more practical for certain situations

indian american means citizen
those outnumber h1b-holders(in total from the entire world)
so

if you're anything like me you will spend most of your time thinking, reading, and doodling on graph paper. the actual typing part isn't that big of a deal, just use whatever editor you feel like. geany seems pretty cool, but regular editors like mousepad, gedit, or kwrite/kate work just as well.

map :buffers:buffer
works pretty well for me.

what are you making in vulkan

Attached: manofculture.jpg (448x401, 20K)

you'll more than likely need a third-party package

It's being pushed heavily at my uni because we do all our work for the upper-division CS courses on
>server-hosted Arch VMs
>through two layers of SSH
>with a convoluted port-forwarding scheme
>over shitty slow WiFi
so anything graphical can get pretty laggy and you run into input detection issues sometimes.

I already know how to work VSCode and Sublime so I'm guessing wasting time gitting gud with a new text editor as obtuse as Vim/Emacs is diminishing returns.

Have fun traversing a file system without it you first-year brainlet.

GUI text editors and IDEs have little to offer over a modern configuration of vim/emacs. Vim/emacs don't take long to learn (if you're not a brainlet), and you've already yourself listed one of the big benefits: it works everywhere over ssh and is installed on any random linux box.

I have a ~300 line vimrc I can copy on any machine that essentially turns vim into a custom configured IDE. It's not really necessary but if you can't live without linting, autocomplete, etc, you can still have it in vim/emacs.

If you're really lazy there is spacemacs/spacevim for pre-configured modern vim/emacs with lots of bells and whistles.

C++ here.

Why is my code giving me this weird fucking answer?

My handout says area equation is pi * radius squared.


#include
using namespace std;

int main(){

int radius;
float pi = 3.1416;
float area = pi * radius * radius;

cout > radius;
cout

Attached: help.png (435x99, 3K)

use printf

you only declared your radius before doing the pi calculation, declared variables default to whatever junk data is sitting in memory. You need to assign the cin input to the radius before calculating the area.

dont use printf

libcurl has been good in my experience.

libpcap seems alright too, but I didn't have to work too heavily with it.

printf("%.2f", area);

vs
std::cout

you're calculating the area before assigning the input value to radius. move the area calculation down after the cin >> radius

This is {
Best coding style }