/dpt/ - Daily Programming Thread

What are you working on, Jow Forums?

Previous thread:

Attached: 1488809727602.png (873x1079, 929K)

Other urls found in this thread:

youtube.com/watch?v=RsDj2fzEGdM
linux.die.net/man/2/read
github.com/mapbox/mapbox-gl-native/blob/master/platform/qt/qt.cmake
twitter.com/SFWRedditGifs

shit, dudes, i've given up
tried to create a trace stack, then push it each time we change the string
uhhh my head hurts

Stop programming and listen to music, get drunk it's boxing day

All the other kids with the pumped up kicks
You'd better run, better run, out run my gun
All the other kids with the pumped up kicks
You'd better run, better run, faster than my bullet

Attached: 1472674401997.gif (425x550, 1.56M)

JavaScript rocks!

Attached: js-rocks.png (1000x494, 286K)

Lisp is the most powerful programming language.

rougly 300k lines irc chat as a base

looks like my ebook parser is broken (again), but I think I got my point across
still trying to tune the generation algo to spit out sentences which are more natural.
but man, natural language is hard to analyze/replicate

Try using it on /dpt/, post results.

Have you tried testing? Testing each small module little by little until you find something wrong?

Do you have a debugger handy?

what the fuck post are you quoting?

carrying over from last thread:

what Im doing:
getting a drone to connect to my local wifi

tech:
linux busybox and bash

where Im at:
managed to disable the onboard wifi router for the drone.

problems:
when the wifi is down I cannot connect to the command prompt on the done (through telnet)

Current idea:
put a bash script to run on start up when the drone runs to connect it to my local wifi.

I found the drones boot folder and now I gotta figure out how to bring up a wifi client and scan for my home wifi

Attached: 2018-12-26 12_30_10-Telnet 192.168.42.1.png (1028x93, 5K)

that's pretty cool but doesn't the drone have a debug port (or solder points) or something that you could access the command prompt

it does:
they are located burried under its shell on the board.

they are UART but I unfortunately dont have a UART to USB in my house and all the tech stores are closed.

Im not familiar with making my own pin sets or wire stripping. maybe thats something else to learn today.

Attached: bebop_ftdi.jpg (1280x960, 327K)

I was trying to quote myself, but I overshot.

Update:
not particularly useful in connecting to wifi but super helpful to test my bash scripts on the drone:

I found a folder full of tests which make the drone beep and flash its lights.

I have successfully made the drone emit a high pitch screech for 3 minutes straight. Family is not impressed. I am very impressed and slightly deaf.

Progress:

I have been able to bring the wifi back up and make the drone beep at me to let me know its done.

problem:
little fucker doesnt connect to anything. so now I have a drone sitting here beeping constantly cause it cant connect.

Attached: drone shortpress_3.sh - Notepad.png (984x341, 14K)

You could collect this stuff into a single post, a few hours from now. /dpt/ isn't your blog.

sure why not - ill come back with a git once its working; or not if i get totally stuck.

Attached: HJaiTcN.jpg (660x660, 124K)

You can discuss what you're working on and if you get stuck you can ask for help.

Just don't make posts every 10 minutes about your progress.

I DID IT ANONS! :^)

Have any of you guys dealt with load balancing before? I recently have been working for a company that makes use of F5 load balancing for one of their backend software. The software itself can only handle so many people before they start to see slow downs and to avoid that they just deploy more instances of the software across VMs and have the F5 load balance between them. I thought it was pretty cool. Using network hardware to solve problems rather than changing the entire software architecture to solve it.

oh ok, fair enough, I understand.

on that note thought, problem:

is there a correct order for bringing down a wireless router and bringing it back up as a client?

The dozen odd stack overflow links I've followed have been not at all helpful.

My script is currently this:

#variables for the script
ESSID="networkname"
DEFAULT_WIFI_SETUP=/sbin/broadcom_setup.sh

#1 - bring down the existing access point in preparation for uping the client
BLDC_Test_Bench -M 2
if [ $(bcmwl ap) -eq 1]
then
$DEFAULT_WIFI_SETUP remove_net_interface

#2 - create the client and enable the bcmwl sta (client) mode
BLDC_Test_Bench -M 2
ifconfig eth0 down
bcmwl down
bcmwl band auto
bcmwl autocountry
bcmwl up

#3 - join the network and then beep to confirm (4 beeps means script has completed successfully)
bcmwl scan -s $ESSID
bcmwl join $ESSID
ifconfig eht0 up
udhcpc -b -i eth0 --hostname=$(hostname)
BLDC_Test_Bench -M 1

#4 - wait for the network to attempt connect
wait 5
BLDC_Test_Bench -M 2
else $DEFAULT_WIFI_SETUP create_net_interface

fi

figured it out nvm :^)

Attached: vlcsnap-2013-05-10-11h42m22s132.png (1280x688, 544K)

I just finish programming rest api call in python.

Attached: picsum.photos.jpg (200x300, 17K)

you might want to try for that

thank you very much :)

What is Haskell good at?

mashallah

Haskell is only good at solving problems that Haskell invented and other languages do not have

Attached: 1462128560034.png (1052x1342, 769K)

what is C good at?

low level control

Attached: thank_you.gif (400x225, 1.98M)

what do you need that for

i am, man
feeling good

literally anything legitimately useful

Attached: 1543649101277.jpg (680x425, 11K)

triggering this board

Being fast, runs on almost anything. Learn a bit of C++ by learning C too.

I've started trying to learn C, if anyone's got any recommendations for fun projects outside of stupid shit like fizzbuzz, lemme know.

Where do you guys work on personal projects? And if it's at home how do you avoid distractions like viyda or tv? I feel like an fag saying it but I feel like the only time I can put in hours of work is at a coffee shop.

Attached: the yale thing.jpg (947x404, 93K)

if you're so weak willed you get "distracted" by pointless amusements just give up

Just get started. Once you put in the first 5 minutes, the rest comes easier. If that don't work, bully yourself till you get it.

libraries + music always works.
if not try Pomodoro Technique( 25 min work then 5 min break)

if work is dependent on cpu performance

Without sounding like a retard I'm interested in programming, would a project learning how to disable wifi crash someone's computer be a good first project.

Attached: 1545153732319.jpg (317x326, 33K)

> Without sounding like a retard

Too late

Making undergrads wet and memeing of course.

Hey I'm the most self aware retard thank you.

Attached: 1512789212192.jpg (364x418, 30K)

Reversi/othello.

pomodoro technique is some reddit bullshit meme and does not work

>would a project learning how to disable wifi crash someone's computer

what?
what do you mean?
1) how to disable wifi of someone computer?
2) crash someone computer?
3) how to disable wifi crash?
4) how to wifi crash someone computer?

How to make someone's computer crash when opening something I send them in a file.

Attached: 90D9883602EA4DDB875F29CADBADA112.gif (480x270, 885K)

>25 min work then 5 min break
best programming work schedule is about 4-5 hours of work at once

look into runtime errors, you can cause a crash with a single command

No one is going to fall for that dumb animeposter

int main(){
system("shutdown.exe /r");
return 0;
}

I did that to a professor once with an essay. Gave me a few more days to finish the essay.

Attached: a-clockwork-orange-a-stanley-kubrick-movie_a-G-14788756-0.jpg (325x488, 19K)

how much programming should one know before applying for a related job? I get bored easily learning on my own and haven't made much progress, so I was thinking an internship or job where I'd have actual stuff to work on might help me a bit, and maybe I could learn from coworkers. I get the feeling that programming is too high-skill for me to get a job without already knowing how to do it, though. the internships I found so far in my area expect you to be a junior in college and already be somewhat experienced.

Uh it seems like it'd be useful for school.

Attached: 44.jpg (900x900, 293K)

applying for a job you don't know how to do, sounds like a good idea

>make someone's computer crash when opening something I send them in a file.
Just send them any GNU/Linux distro.

Attached: pp,550x550.u1.jpg (516x550, 82K)

either you really really love programming or burnout is your future self

Don't worry I have arch on a flash drive ready for action.

Attached: 1515351323320.jpg (1280x720, 367K)

I've been programming for 25 years, 4-5 hours is the optimum work period for getting anything done, but it's rare that I would do more than that in one day, if I'm doing alot of work I might do two but that's fairly rare

when you say it like that it sounds agreeable, but a lot of jobs teach you everything you need to know.

>somewhat experienced
you?

most jobs dont teach you how to program

you learn on the job. you don't know
how many programming jobs I wasn't qualified for that I've applied to and got hired

It's kind of like this scene youtube.com/watch?v=RsDj2fzEGdM

kek! based

they expect you to already be able to write programs and be in your junior year of college. I never went to college and I've only done example problems in a book so far.

well, that I wasn't sure of. I figure it's not common, but most of what I hear online is very high tier jobs at competitive places like Google and such. I don't know if something more entry-level would be more friendly to newcomers.

they will give you most basic entry level info.

most of the time you are working on goal they gave you and only help you got is stackoverflow and friendly senior coworker

send them a virus via a python script

import haskell
if __name__ == '__main__':
if haskell == good programming language:
don't crash this computer
else:
crash this computer

>if __name__ == '__main__':

Attached: animu.png (149x148, 58K)

how do i hack into my brothers computer? I want to know what type of porn he watches and use it to blackmail him

Attached: I0iOV4j0_nbl.jpg (600x600, 62K)

Use this to own everyone but the libraries.

no need to hack, he is watching family taboo and sibling porn

get him drunk and ask him what his password is. social engineering is the best form of hacking.

python is botnet so just send them any python script

Attached: f422a09d2a6cb22fba3f00b038c58a2e.jpg (500x742, 67K)

working on a dwm status bar for openbsd.
muh script:
#!/bin/ksh

while true
do
Battery=$(apm -l)
Memory=$(free | awk '/^Mem:/ {print $3 "/" $2}')
Disk=$(df -h | grep /dev/sd1l | awk '{print $3 "/" $4}')
Tempurature=$(sysctl | grep hw.sensors.cpu0 | sed "s/hw.sensors.cpu0.temp0=//" | sed "s/.00 deg//")
Volume=$(mixerctl | grep outputs.master= | sed "s/outputs.master=/R=/" | sed "s/,/ - L=/")
Date=$(date "+%v %r")
IP=$(cat /etc/resolv.conf | grep nameserver | head -1 | sed "s/nameserver /IP=/")

xsetroot -name "$IP | BAT=$Battery% | TEMP=$Tempurature | $Disk | $Memory | $Volume | $Date"
sleep 5
done

Attached: obsdpepe.jpg (206x245, 8K)

while true
do
Battery=$(apm -l)
Memory=$(free | awk '/^Mem:/ {print $3 "/" $2}')
Disk=$(df -h | grep /dev/sd1l | awk '{print $3 "/" $4}')
Tempurature=$(sysctl | grep hw.sensors.cpu0 | sed "s/hw.sensors.cpu0.temp0=//" | sed "s/.00 deg//")
Volume=$(mixerctl | grep outputs.master= | sed "s/outputs.master=/R=/" | sed "s/,/ - L=/")
Date=$(date "+%v %r")
IP=$(cat /etc/resolv.conf | grep nameserver | head -1 | sed "s/nameserver /IP=/")

xsetroot -name "$IP | BAT=$Battery% | TEMP=$Tempurature | $Disk | $Memory | $Volume | $Date"
sleep 5
done

oopsie poopsie doopsie loopsie. i'm a fucking retard
while true
do
Battery=$(apm -l)
Memory=$(free | awk '/^Mem:/ {print $3 "/" $2}')
Disk=$(df -h | grep /dev/sd1l | awk '{print $3 "/" $4}')
Tempurature=$(sysctl | grep hw.sensors.cpu0 | sed "s/hw.sensors.cpu0.temp0=//" | sed "s/.00 deg//")
Volume=$(mixerctl | grep outputs.master= | sed "s/outputs.master=/R=/" | sed "s/,/ - L=/")
Date=$(date "+%v %r")
IP=$(cat /etc/resolv.conf | grep nameserver | head -1 | sed "s/nameserver /IP=/")

xsetroot -name "$IP | BAT=$Battery% | TEMP=$Tempurature | $Disk | $Memory | $Volume | $Date"
sleep 5
done

What is this book and why do so the Chinese cartoon girls like it?

quote are important in shell, use them.

don't call them Chinese you fucking BASTARD. Chinese people have no soul. ANIME GIRLS HAVE FUCKING SOUL!

Attached: TatteredPreciousBrontosaurus.webm (320x640, 1.82M)

Ancient asian book of secret programming art.

Attached: moon sicp.jpg (355x500, 40K)

What the fuck am I watching?

Looks like some guy having a seizure after being injured in the head.
I forget the name of the phenomenon where larger groups of people are more likely to ignore this type of shit compared to if you encountered this alone.

You will get sued if you help people in china. blame the government that have that shitty law not the people.

this might seem brainlet of me but I have a program that is reading an unpredictable amount of bytes from stdin and I need to process four bytes at a time.
Meaning if I get 6 bytes, I process 4 of them, leaving 2 "unaligned' bytes, and then sometime later i get 2 more bytes, allowing me to process again.

How do I do this without basically allocating a ridiculous amount of space ahead of time?

I wouldn't touch someone spewing blood. Call EMT, let them handle it.

circular buffer

but how would I do that when i am using read

linux.die.net/man/2/read

basically i have a buffer of 4096 bytes,
I can read and process 4-byte elements in large 4096 byte chunks, but if i get partial reads i want to be able to "continue" from where the last one left off but how can i do that if i potentially get

4095 in one read, and then 3 more in another

Quickest thing that comes to mind is to just read into the remaining space of your buffer.

Say you read 4000 bytes into your buffer then you read(fd, &buf[4000], 96) and just keep processing. You kernel is storing all this stuff so when bytes are available it will fill your buffer.

i am thinking of rewriting ranger file manager in C because it is written in python which makes it a slow piece of shit. I am currently learning ncurses

Bystander effect

old post but maybe the author still cares

libplacebo attempts to solve this same problem, maybe you can get some inspirations from it?

Why are you browsing 5 day old posts?

Anybody have any experience tapping into the CGo api for something like a Qt app originally written in c++ its really fucked how the demo is currently packaged. (I think) Do you always sort subclass only needed functions and methods into scope when using c++ (total brainlet here)

Basically I'm trying to get a demo like this working in go but I'm to stupid to do it.
github.com/mapbox/mapbox-gl-native/blob/master/platform/qt/qt.cmake

On that relatively similiar note suppose I have a large c++ binary referenced in a node module and brought in as an object, is there anyway to tell what methods exist on said object?

Also for anyone with experience, would you suggest a pure native implementation or qt I could have other gui components that I may use later so I'm leaning towards qt. Qt also seems a bit more simple.

kali linux

fuck off i enjoyed his updates

I'm not that user but I tend to skim /dpt/ from where I last left it to the end of the thread at least.