Old thread: What are you working on Sup Forums?
/dpt/ - Daily Programming Thread
Other urls found in this thread:
youtu.be
jsfiddle.net
a.4cdn.org
twitter.com
Happy Easter anons.
youtu.be
>packing indicies and pointers in the same memory to save space because pointers happen to have a couple free bits at the end of them.
This really seems excessive.
Talk to God:
from secrets import choice
with open('/usr/share/dict/words') as f:
words = [word.strip() for word in f]
godwords = ' '.join(choice(words) for i in range(32))
print("\n")
print("God says...\n")
print(godwords+"\n")
Is this divinely inspired?
Happy Easter!
i'm studying for the programming marathon of this year. doing a lot of hackerrank problems, as well as project euler, reading the entire C programming book and getting together with my teammates to do previous problems from the marathon. we have until September, so i'm optimistic
Is Idris an anime language?
Yes, in honor of the resurrection of our Lord
>blessed
Now do it without a loop statement.
fn main() {
let c = vec![ 15, 21, 8, 4, 10, 11, 31 ];
for d in c {
if d % 2 == 0 {
println!("{} is even", d);
} else {
println!("{} is odd", d);
}
}
}
Nice program user
No, it's Welsh
thanks
Make another one
>Make another one
then I'm newbies in rust
>This really seems excessive
in the vast majority of contexts, it would be. but when it comes to high-performance shit, cache misses will fuck your shit up. sometimes you gotta do what you gotta do
Your program is not idiomatic enough
fn main() {
println!("{}", vec![15, 21, 8, 4, 10, 11, 31,].iter().map(|n| format!("{} is {}", n, if n % 2 == 0 { "even" } else { "odd" })).collect::().join("\n"));
}
nice haha but I think to be starting is illegible that way
happy easter!
is there a processing-like library for java? i know processing is java but i want to use eclipse.
what i want to do is load an image into a 2d color-array, modify that in some way, and put it back into an image on the harddrive. bonus points for being able to view it in the meantime, but not a concern.
You clearly are too stupid to comprehend Rust's beautiful syntax.
You white males should stick to your stupid languages like C. Us womyn (male) will continue to use our superior languages.
I bet you're the kind of idiot who contirbutes to toxic apps that don't even have a CoC.
>You clearly are too stupid to comprehend Rust's beautiful syntax.
>You white males should stick to your stupid languages like C. Us womyn (male) will continue to use our superior languages.
>I bet you're the kind of idiot who contirbutes to toxic apps that don't even have a CoC.
wtf man
>modify that in some way
like how
>load an image into a 2d color-array
java.awt.image.BufferedImage
i'm pretty sure Java has shit for that kind of thing in its standard library
like pixelsorting or cellular automata
oh okay!
Spent the last hour wondering why Sup Forums was down.
Turns out my ISP has blocked Sup Forums, wikileaks, porn websites, warez websites and other moral-panics for the greater good (by returning SERVFAIL for dns lookups). Google DNS it is while I set up my own dns server.
Fucking normies ree.
Don't vote for either of the two major parties unless you want this to continue.
>normies
Vocal minority backed by people in power who see useful idiots for lowering wages and expanding government power.
Guys how hard would it be to build something that
1.scrapes information off ebay like buyer email address + quantity
2a.Creates login details from the browser Webmin of a server by entering 3 different strings and selecting 1 option from a drop down menu
2b. Downloads a string and a zip file.
3. Create an email from a template, enter in scraped Ebay email address + downloaded string + attach zip file.
4. Once email sent, send email, leave feedback and mark as dispatched in ebay.
I know basic bitch programming but not done it in years so don't really know where to start. How hard and length a project would this though and if I were to do it what languages and programs would I need to be up to speed with?
The only program I am any good with is excel...
I hate error handling.
How does one learn (T)SQL in the correct order? I am self learner and i started with C#. I have found few very good C# books and i learn from those. I wanted to get familiar with SQL and i can't seem to pinpoint the Go-to book when it comes to databases. In fact, i'm not sure whether i should start with terms like "What is a database" or should directly start with SQL server and syntax.
How do people in universities learn TSQL? What books do you use?
for a noob? pretty hard
Is it really hard? I don't think so
I am self learner in C# and i managed to build my own webscraper that takes the data from a ebay-esque site and stores in a database
void main()
{
import std.algorithm: map, each;
import std.stdio: writeln;
import std.format: format;
[15, 21, 8, 4, 10, 11, 31]
.map!(v => "%s is %s".format(v, v % 2 == 0 ? "even" : "odd"))
.each!writeln;
}
Trying to grab the content of the data-expanded-url attribute. What am I doing wrong? Pls halp
Gas chamber
def main():
for i in [15, 21, 8, 4, 10, 11, 31]:
print i,"is odd" if i&1 else "is even"
main()
def main():
print('\n'.join(map(
lambda v: '{} is {}'.format(v, 'odd' if v % 2 == 0 else 'even'),
[15, 21, 8, 4, 10, 11, 31]
)))
if __name__ == '__main__':
main()
import markovify
with open("revelations.txt") as f:
m = markovify.Text(f.read())
print(' '.join(m.make_sentence() for x in range(5)))
$ python god.py
He that leadeth into captivity shall go into captivity: he that sat on the throne and of pearls, and fine linen, and having their breasts girded with golden girdles. And let him hear. But the rest of the Lamb are the seven angels seven golden candlesticks. And I John saw the woman sitteth. The seven stars are the seven churches.
thank you! the syntax is a bit odd for me. i'm used to java
Probably shouldn't have put that in code tags. Here's another.
>And there was found the blood of the voice that spake with me. And whosoever was not found written in the spirit into the wilderness: and I heard a voice from the foundation of the earth opened her mouth, and devoureth their enemies: and if any man have an ear, let him be filthy still: and he that hath an ear, let him that is holy, let him that liveth for ever and ever, The four and twenty elders and the sea, and the heaven departed as a thief, and thou shalt not know what hour I will come on thee as a scroll when it is rolled together; and every free man, hid themselves in the spirit into the air; and there was no more at all. And let him hear what the Spirit saith unto me, Thou must prophesy again before many peoples, and nations, and tongues. And they that dwell on the earth. And he said unto him, Sir, thou knowest.
You gave me an idea, hold on...
hey /dpt/ a game company from my country asked me to write a couple hundred lines of c++ code so they can see my code before hiring me..
but i don't know what to write.. can someone give me some ideas please? something that takes a maximum 500 loc would suffice
Pong?
Yeah, except right now it's ONE party. The other major party and the hanger-on third party both imploded in the last 4 years and haven't a hope.
small database "store"
School with properties like teacher, student, classroom etc and methods add/remove XYZ
bank ATM lookalike
thats a good idea, but im worried that if i use some kind of graphics library it will be harder for them to try it out..
i think they mainly use windows there so i guess i can just use GDI and dont have to worry about anything.
thanks btw
A wayland compositor.
thats a cool idea, and its something i can do without using any external library
Guys wanna ask something.
Is downloading books from libgen safe?
yes
fuck off
how do you go about using a main function in python?
A small C compiler.
You now owe me a beer
too many chars
if __name__ == '__main__':
your_function()
Make compiler that uses hash tables.
def main():
#your code here
>Drinking anything other than water.
Good goyim
So if C - NSA, Rust - CIA what is C++?
>Make compiler that uses hash tables.
the hash table would be for symbol tables?
disgusting
Every good programmer is a heavydrinker
Mossad
Fuckup Beauru of Idiots
Beer is healthier than water in my country
not working
import markovify
import requests
PAGES = range(1, 11)
SENTENCES = 3
def main():
content = []
for page in PAGES:
res = requests.get('a.4cdn.org
if res.status_code == 200:
for thread in res.json().get('threads', []):
for post in thread.get('posts', []):
content.append(post.get('com', ''))
m = markovify.Text('\n'.join(content))
print(' '.join(m.make_sentence() for _ in range(SENTENCES)))
if __name__ == '__main__':
main()
» python shitgsays.py
>
How the fuck wouldn't" but little did I know, the only way to simply printscrn a selected part of an operating system, but useless by itself; it can only function in the aftermarket. On my L460 it doesnt matter where you have to wind the CRT bulbs by hand, so they stopped making them. How are we supposed to fiddle and tinker with it is scientifically proven that pixel,s8 or any latest android flagship have better cameras.
enjoy
>implying any of the retarded government agencies would be able to grasp such a language
>import markovify
Does markov chains generate a random sentence or what?
how does this sentence makes little sense?
Today i wanna make a simple currency converter, but to add something new I haven't done before or learned yet, I want it to use live update of the currency's values from online. What's the best way to do this? Python btw.
Also pls recommend simple projects for me to complete.
And with cleanup:
import markovify
import requests
from html import unescape
PAGES = range(1, 11)
SENTENCES = 3
def main():
content = []
for page in PAGES:
res = requests.get('a.4cdn.org
if res.status_code == 200:
for thread in res.json().get('threads', []):
for post in thread.get('posts', []):
content.append(unescape(post.get('com', '')).replace('
', ''))
m = markovify.Text('\n'.join(content))
print(' '.join(m.make_sentence() for _ in range(SENTENCES)))
if __name__ == '__main__':
main()
>I guess I'll get that.UI looks sorta bad but well, I won't use it as unconfigured, vanilla and straight out of the system that allocates the machine's resources to the other programs that you run. FFFFFFFFFFFFFFFFFFFFFFFF I buy a pass. Reading your chats, it seems to be too much like windows, I still haven't found a way to install the minrmenu in windows 8.1.
>not working
holy shit kill yourself
>Python
you have to go back
@59920472
Is that what they say at rabbit?
Fuck off, your kind is simply not welcome here.
to: 59920490
from: 59920496
go back to plebit
Python or Ruby?
Quit being a fag, it's not my fault I listened to the advice that literally everyone gave me, and it'd be retarded to stop now and learn a completely new language before I've even become proficient at this one. Python is pretty simple, so the sooner i hurry up and master it, the sooner I can move on to c++ or some other language
What license is used for this program? I want to save it, modify it or even share modifications of it.
Is it possible to make my SQL server database check for new inputs and if for example value is X, that whole row is sent to client program automatically so that program can show that new row? I doubt something like this is possible, but i still had to ask
∃!59920517
Why do you keep denying being a redditor? Fuck off.
>it's not my fault I listened to the advice
It is precisely your fault. Nobody else is to blame for your retardation. You are responsible for the actions you take.
>and it'd be retarded to stop now and learn a completely new language
It would be retarded to continue with a language that is complete garbage.
>before I've even become proficient at this one
Why would you want to be proficient in using garbage? Seems quite retarded.
>Python is pretty simple
Indeed. And it's also pretty shit.
>the sooner I can move on to c++
C++ is shit itself.
Lisp.
You can use markov chains to generate sentences.
Read in a block of text and see that in that block of text for example the word "a" is followed (%25 of the time by "cat", %25 by "dog" and %50 of the time by "man"). Then you use that to generate random sentences.
Consider it public domain my friend.
Just use something simple like SDL or SFML.
Absolute shit.
Shit.
what about FML?
>it's not my fault I listened to the advice that literally everyone gave me
You were fooled. It seems like you're quite the retard.
In Microsoft SQL you can set a trigger that passes something off to service broker but holy shit you are doing it wrong nigger.
Make the client app poll every few seconds and select any changes. Preferably with an integer identity column, not a timestamp because clockdrift will one day fuck you over.
>Python
>Ruby
>Python
>C++
You can try a trigger and use a script inside it.
eat shit redditor.
Perl
>Make the client app poll every few seconds and select any changes
That was my next solution.
How would i enter query that select only new rows, not those that were already selected in the last query?
What language should I use?
I just fucking told you.
SELECT * FROM [Table] WHERE [ID] > @LastIDRecieved
Is this supposed to be a list of shitlangs?
Fine, I'll add some of my own.
C#
J*va
JS
Ruthon
Save insert date into database, get rows that are newer than specified time in your application.