/dpt/ - Daily Programming Thread

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

Other urls found in this thread:

pastebin.com/hDLsxjte
media.ccc.de/v/32c3-7163-new_memory_corruption_attacks_why_can_t_we_have_nice_things#video&t=2690
kotlinlang.org/api/latest/jvm/stdlib/kotlin.text/-regex/
twitter.com/SFWRedditImages

First for actually employed C++ programmer

What color of striped socks should I buy for systems programming?

Traps are gay though.

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

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.

Sup Forums 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.

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?

>Currently working on Linux
>I'm doing my exercises in Visual Studio.
hmmm

>go-to sort algo
wtf? use the one that is needed

Stop posting in the invalid thread.
The real thread is here:

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 Sup Forums challenges as I learn how to do the underlying sill

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.

Give source on those traps

I have a second display now.

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 Sup Forums 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.

>1st line
oops.
And it's all of the current posts.

I think white/blue stripes should do just the trick.

where the fuck are the swearwords like nigger, fuck, faggot, kys or OP
I expected them to be the most used on here

But none of those are 10 letter words

i thought about something like this to find trending words.. like i imagined seeing a zeitgeist type chart of "woodscrews" vs "housefire"

But it did print everything out?

And how do you put a space between two strings without using + ' ' +?

>python2

I was too stupid for C then C+ then C#

Nevermid

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)

Top two-thousand words with a length greater than two and a filter of '>/abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789:
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.

theres something fucked up with your list, intel, nvidia, meme, housefire, woodscrews, 1.7, pork and amd aren't even there

I'm following a few tutorials. This one happens to use 2.

>printf-like syntax
how about you just you c you nug

>CTRL + F
>Java
>0 results found
Finally there's nobody spergasming how java is a good language.
Today is a good day.

cute anime grill
anyway talk to me bby, whatchuu been working on recently

Cool, release the source so we can try.

>not using printf()-oriented-programming
media.ccc.de/v/32c3-7163-new_memory_corruption_attacks_why_can_t_we_have_nice_things#video&t=2690

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

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.

I don't believe this at all.

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)

i hate that picture for many reasons

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.

Why? Are you brutish and ugly?

>tall
>skinny
>male

Is that a yes?

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

...

are you that FRP guy?

you fucking shiteating faggot

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

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

it's regex.matches(input) not the other way around. 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.

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.

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!!!

How the he'll do I make this simpler?
Or did I just shoot into my knee?

Wtf. This was not my intention

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

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.

what was your first job after university, Sup Forums?

Try not doubling your backslashes maybe? Dunno if Kotlin somehow fixed this Java flaw.

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.

The back slashes are regex escapes?

Get back there user, you're no pain, I was busy off the keyboard, now I'm back.