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

/dpt/ - Daily Programming Thread

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 64
Thread images: 15

File: 1445573554067.png (835KB, 1200x1080px) Image search: [Google]
1445573554067.png
835KB, 1200x1080px
Old thread: >>60733497

What are you working on, /g/?
>>
>>60736499
First for actually employed C++ programmer
>>
>>60736499
What color of striped socks should I buy for systems programming?
>>
>>60736499
Traps are gay though.
>>
File: stuff.webm (204KB, 800x400px) Image search: [Google]
stuff.webm
204KB, 800x400px
>>60736499
not sure if this is considered programming but i made a gui that will help you learn how to play guitar :D
>>
This thread is almost as dead as D
>>
>>60736499
All programming languages are Lisps in disguise. However, Lisp is shit, therefore, all programming languages are shit.
>>
I'm a medical tech call center guy.
Currently working on Linux+ to get started with that, and I'm on chapter 3 of C++ Primer Plus.

/g/ has been no help in picking a first language, so I just went with one. I heard it's easier to pick up new languages after the first, anyway. C++ is pretty fun so far. Just to trigger you more, I'm doing my exercises in Visual Studio.
>>
>>60736499
how about some fucking programming
what is your go-to sort algo? everyone seems to use quicksort but heapsort seems to be the most efficient non-distributed algo right?
>>
>>60737583
>Currently working on Linux
>I'm doing my exercises in Visual Studio.
hmmm
>>
>>60737805
>go-to sort algo
wtf? use the one that is needed
>>
>>60737805
>>60737819
>>60737833
Stop posting in the invalid thread.
The real thread is here:
>>60737494
>>
>>60737866
fugg get it together gee
>>
pure book learning for c++ is really boring. Ive made a few programs with the skills ive learned (a wip text game with dynamic battle system being my best so far). What else can I do? I do the /g/ challenges as I learn how to do the underlying sill
>>
>>60737819
My main is still Windows 7 because of games, I have a laptop with centos that I'm working on so I can remote into it from anywhere and do my coding there. I wanna end up with a RHSE, and I heard centos is the closest thing to a red hat server.
>>
>>60736499
Give source on those traps
>>
File: youranigger.MOV.webm (770KB, 1280x720px) Image search: [Google]
youranigger.MOV.webm
770KB, 1280x720px
I have a second display now.
>>
File: file.png (16KB, 219x878px) Image search: [Google]
file.png
16KB, 219x878px
from collections import Counter
from collections import Counter
target=10
with open("all.txt", "r+") as f:
words = f.read()
words = words.replace('\\n', ' ').replace('\n', ' ').split(' ')
counter_dic={}
acceptable='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'

for word in words:
word=''.join([x if x in acceptable else '' for x in word]).lower()
if len(word) == target:
counter_dic[word] = counter_dic.get(word, 0) + 1
for x in Counter(counter_dic).most_common(100):
print(x[0],x[1])

For finding the 100 most popular 10 letter words in a dump of all 4chan posts.
I did a bit of regex beforehand to remove post numbers and links, I'll probably add that to my program so it's 100% all automatic.
>>
>>60737968
>1st line
oops.
And it's all of the current posts.
>>
>>60736592
I think white/blue stripes should do just the trick.
>>
>>60737968
where the fuck are the swearwords like nigger, fuck, faggot, kys or OP
I expected them to be the most used on here
>>
>>60738457
But none of those are 10 letter words
>>
>>60737968
i thought about something like this to find trending words.. like i imagined seeing a zeitgeist type chart of "woodscrews" vs "housefire"
>>
File: 23049883.png (69KB, 1295x689px) Image search: [Google]
23049883.png
69KB, 1295x689px
But it did print everything out?

And how do you put a space between two strings without using + ' ' +?
>>
File: 1420559923820.png (156KB, 596x590px) Image search: [Google]
1420559923820.png
156KB, 596x590px
>>60738548
>python2
>>
File: 38493333.png (29KB, 657x527px) Image search: [Google]
38493333.png
29KB, 657x527px
>>60738560
I was too stupid for C then C+ then C#
>>
File: 234383.png (2KB, 366x71px) Image search: [Google]
234383.png
2KB, 366x71px
>>60738573
>>60738548
Nevermid
>>
>>60738573
Well maybe go for python3 then instead of such outdated bullshit?
python3 even has printf-like syntax, which make it far more superior
print "Hello Nigger, I am %d yo and have a %.2f cm long cawk" ? (12, 1.0)
>>
>>60738457
Top two-thousand words with a length greater than two and a filter of
'>/abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
:
https://pastebin.com/hDLsxjte
I wonder what list I could use to get rid of boring words like and, the, etc...?
A dictionary wouldn't work very well.
>>
>>60738604
theres something fucked up with your list, intel, nvidia, meme, housefire, woodscrews, 1.7, pork and amd aren't even there
>>
>>60738592
I'm following a few tutorials. This one happens to use 2.
>>
>>60738592
>printf-like syntax
how about you just you c you nug
>>
File: op_today.jpg (142KB, 500x662px) Image search: [Google]
op_today.jpg
142KB, 500x662px
>CTRL + F
>Java
>0 results found
Finally there's nobody spergasming how java is a good language.
Today is a good day.
>>
>>60738736
cute anime grill
anyway talk to me bby, whatchuu been working on recently
>>
>>60736691
Cool, release the source so we can try.
>>
>>60738720
>not using printf()-oriented-programming
https://media.ccc.de/v/32c3-7163-new_memory_corruption_attacks_why_can_t_we_have_nice_things#video&t=2690
>>
>>60738783
im making a retarded ass program with no purpose in it except for practice.
i've got 2 tBoxes for input values. Then the listbox fills with 1000 random numbers between those two values. I export those values as a list and convert them to their ASCII counter values. After that, i print them out with speech synthesizer using a cute grill voice. Only thing I'm missing is some API key that would look for coherent words in that long ass string...
see sharp
>>
>>60738854
what you using for the cute grill voice? get the terry source for gw
p sure you could also find a dictionary file with common words
>>
I used a few apps like this when I had to learn notes up to the twelfth fret! Looks stellar, I would love to see the source.
>>
>>60737968
I don't believe this at all.
>>
>>60738592

Print is a function in python3, and it's syntax requires parenthesis.

The right form is:

print("blah blah blah. I'm %d yo", age)
>>
File: 1422062581981.png (191KB, 380x380px) Image search: [Google]
1422062581981.png
191KB, 380x380px
>>60736499
i hate that picture for many reasons
>>
>>60736499
Zero programming experience here.
how do i make successfive while loops in a bash script?
I can make a single "counter" while loop (x=1 then ticks up), but I need to change the command at different x values.
>>
>>60740386
Why? Are you brutish and ugly?
>>
File: damage control.jpg (152KB, 640x480px) Image search: [Google]
damage control.jpg
152KB, 640x480px
>>60740418
>tall
>skinny
>male
>>
>>60740529
Is that a yes?
>>
>>60740412
here is an example of a two nested while loops that print from 00 to 49 using two counters, the while loops use conditionals syntax close to that of C:
x=0; y=0; while ((x<5)); do while ((y<10)); do echo "$x $y" ; y=$(expr $y + 1); done;  x=$(expr $x + 1); y=0; done


output
0 0
0 1
0 2
0 3
0 4
0 5
0 6
0 7
0 8
0 9
1 0
1 1
1 2
1 3
1 4
1 5
1 6
1 7
1 8
1 9
2 0
2 1
2 2
2 3
2 4
2 5
2 6
2 7
2 8
2 9
3 0
3 1
3 2
3 3
3 4
3 5
3 6
3 7
3 8
3 9
4 0
4 1
4 2
4 3
4 4
4 5
4 6
4 7
4 8
4 9
>>
File: 9QuSENIwNm4.jpg (23KB, 500x382px) Image search: [Google]
9QuSENIwNm4.jpg
23KB, 500x382px
>>60740563
>>
>>60736691
are you that FRP guy?
>>
>>60736499
>>>/lgbt/ you fucking shiteating faggot
>>
>>60740626
Thank you, but not exactly what I'm looking for.

I need to run different commands at different iterations of a counter e.g. run Command 1 as long as x<40, run command 2 when x=40, back to command 1 until 80 etc.

I'm trying to use xdotool to download a list of documents, but some of the links are "bad links" that upset the macro, so I need to skip that macro on the iteration that corresponds to that "bad link".
>>
Hi, I'm currently using Kotlin in a college project. I am trying to delete endings of Strings, they always end with (number).
e.g.: "Nirvana (2)", "Aargh (102)"

I am trying to use a regex to replace the number surrounded by parentheses with "", but that does not work:
 "Nirvana (2)".replace(Regex.fromLiteral("\\(\\d+\\)"), "") 



Also:
 "Nirvana (2)".matches(Regex.fromLiteral(".*")) [\code]
Always returns false, but shouldn't that match with everything?!

Does anybody know some...solution? I really can't figure out what I am doing wrong, fck
>>
>>60740825
it's
regex.matches(input)
not the other way around. https://kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/-regex/

Trying a trivial example like .* and noticing it resulted in absurd behaviour is clever, so kudos for that.
>>
>>60740799
This is something I do routinely if you elaborate on what you intend on doing I might be of some help, although you shoulda gone with this question to the fglt thread, your question doesn't sound like homework so it is okay I guess.

One more thing, I think you're knocking the wrong door here with xdotool, wget or curl and scraping web pages using grep/sed/awk for links is definitely the way to go if you're out to mass download stuff off of the web. Python does this quite cleanly too, but I'll assume you are not very knowledgeable with that and go down the shell road.
>>
>>60740930
Wait no, String appears to have matches and replace methods that accept regexes, yet your examples fly out the windows. Watfug? Kotlinfags will defend this!!!
>>
File: 2017-06-04 17.40.25.jpg (3MB, 4128x2322px) Image search: [Google]
2017-06-04 17.40.25.jpg
3MB, 4128x2322px
How the he'll do I make this simpler?
Or did I just shoot into my knee?
>>
File: 2017-06-04 17.42.35.jpg (3MB, 3264x2448px) Image search: [Google]
2017-06-04 17.42.35.jpg
3MB, 3264x2448px
>>60740974
Wtf. This was not my intention
>>
>>60740930

Thank you, I thought the replace function also worked with regexs.
But it also does not work for me (using Kotlin 1.1.2-4):
Regex.fromLiteral("\\s\\(\\d+\\)").matches("Nirvana (2)")


However, I just solved the Problem by creating some helper method in Java thats using the same regex. Strange
>>
>>60740943
Thank you for the reply.

Yes, its a personal project to try and get some documents from a website that I only have access to until I graduate uni (practical law).

I have no experience with any kind of programming whatsoever.

The site uses javascript to give you the dialog box to download the file, so with no experience, xdotool seemed to be the most direct option.

Turning off javascript makes it so that there is no dialog box to the pdf that I need.

Right now I am using a while bash script with a counter, and on every iteration it goes something like:
x=1
while [ $x -le 40 ]
do
xdotool key ctrl+Return
sleep 0.1
xdotool key ctrl+2
sleep 12
[Mousemovements/clicks to download the file]
xdotool key ctrl+w
sleep 1
xdotool key Tab [ie select the next link]
sleep 1
echo "Downloaded $x documents"
x=$(( $x + 1 ))
sleep 3
done

The problem is that there are some "bad links" that do not open new tabs, change the focus on the same page, so that the focus on the next document is lost.

Also the ctrl+w closes the whole window on a bad link.

Sorry for the whopper of text, I genuinely appreciate the help that you're giving/may give.
>>
>>60736499
what was your first job after university, /g/?
>>
>>60741044
Try not doubling your backslashes maybe? Dunno if Kotlin somehow fixed this Java flaw.
>>
>>60741159
Okay, this is easy, you might need some tutoring, but I don't wanna give my anonymity up so if you know how to use IRC I am on #debian at freenode.net using the nick name helpchan.

I'll help you accomplish this task.
>>
>>60741352

The back slashes are regex escapes?
>>
>>60741159

Get back there anon, you're no pain, I was busy off the keyboard, now I'm back.
Thread posts: 64
Thread images: 15


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

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
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.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.