/dpt/ - Daily Programming Thread

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

Other urls found in this thread:

marketplace.visualstudio.com/items?itemName=kbuchi.ClaudiaIDE
curly-brace.com/favorite.html
docs.python.org/2/library/pdb.html
twitter.com/NSFWRedditGif

First for Scheme

first for i'll never pass a technical interview and i should go fuck myself

That picture is not okay OP.
You need leave and delete this thread.

first for it doesn't count i was second cause my countdown was running but i still wrote the message first fuck you

Delid this pic

>deleting a thread
newfag

>How to hack a plane for dummies

Should I start with Learn You A Haskell or the Wikibook?

DELIT!

Wikibook

or both

>hating on anime
>>>/plebbit/

>second
fourth

Wikibook's have always been shit in my experience

That's not anime. That's western muslim propaganda.

marketplace.visualstudio.com/items?itemName=kbuchi.ClaudiaIDE

What's so bad about Islam?

What's so bad about Muslims?

Fun fact: a Hijab was worn to prevent head lice. This way you didn't have to shave your head like the Egyptians did.
Now it's a symbol of oppression.

So?

Fuck off, you Islamophobe!

...

Sup Forums hates moslems, newfag

Discussion of muslims is completely off topic. I really wish Sup Forums was text only.

>Wikibook's have always been shit in my experience
I feel like the wording is inconsistent. I guess that's because it's a collaborative effort.
What resource would you recommend to a beginner?

This. Sup Forums is tolerant.

Then stop whining about a goddamn pic!

i found an image ripping program (in python...) but bumped into a problem. to be exact, this part:
# Extract needed info from JSON
image_url = json_dict["image"]
image_file_ext = json_dict["original_format"]
image_height = json_dict["height"]
image_width = json_dict["width"]
# Build image output filenames
if settings.output_long_filenames:
# Grab the filename from the url by throwing away everything before the last forwardslash
image_filename_crop_regex = """.+\/(.+)"""
image_filename_search = re.search(image_filename_crop_regex, image_url, re.IGNORECASE|re.DOTALL)
image_filename = image_filename_search.group(1)
image_output_filename = image_filename+"."+image_file_ext
else:
image_output_filename = submission_id+"."+image_file_ext
image_output_path = os.path.join(output_folder,image_output_filename)
# Load image data
authenticated_image_url = image_url+"?key="+settings.api_key
logging.debug("Loading submission image. Height:"+repr(image_height)+", Width:"+repr(image_width)+", URL: "+repr(authenticated_image_url))
image_data = get(authenticated_image_url)
if not image_data:
return
# Image should always be bigger than this, if it isn't we got a bad file
if len(image_data) < 100:
logging.error("Image data was too small! "+repr(image_data))
continue
# Save image
save_file(image_output_path, image_data, True)

as you can see it creates files with double extensions. but that's fine, nothing that total commander can't take care of. but why the hell does it create a link like "asdf.png.svg" to download but still grabs png instead of svg when the very same url ending in "png.svg" makes my browser grab svg?

>This. Sup Forums is tolerant.
No it isn't. Back to pol faggot.

C# is the best programming language. Prove me wrong.

I literally can't

Microsoft did their best to cripple the ecosystem on Linux.

OOP
based on java

>fourth
fourth AND second

>OOP
t. functional memester
>based on java
It's miles better than Java

Syntax sugar was not the thing Java was missing.

>C# was made by the jews
Sup Forums is always right

Depends on the subject. If you want to learn Haskell, I'd recommend looking at some Haskell source code.

>i learn languages by just reading source code
>i also dream in code
>XDDD

>Want to do a mobile app project which involves someone else's databases
>Their database schema sucks so much I am having a hard time even starting

The Haskell wikibook is good

>restrictive language

>technical interview
>important
They just want to fill positions, that's all. Tell yourself, they would even hire a goldfish if they could.

Looking for help with this, please

What is that even supposed to mean?

you have to do very specific things otherwise you'll get bitchslapped by compiler

Flexbox

Once you know the bare basics of a language's syntax, the best way to learn is to study (and I do mean study) some working examples of software written with that language.

If I want to create GUI scripts for my team at a non-programming office job and I need to distribute them with minimal dependencies should I make them in Java or C#?

I'll take a look at that, thanks. Does the problem come from the CSS then? I was worried I fucked up with JS.

i don't like that approach. I did something similar with C++ and learned myself some inane anti patterns.
I

Can you give me an example? That's usually done to enforce good practices and write safer code.

Neither, Visual Basic

Rewriting C in HTML.

I think I'll go on with that.

ask if you have questions

>user what do you have open?
>Just VS, I'm adding [feature]
>...why is that lady there?
>N-no reason

Well C++ is no ordinary language. C++ is probably the worst language to learn by example, because so many people mix legacy C++ code with modern C++ code, and don't understand modern C++ idioms.

Just use AutoIt

>pedophile mohammed's bride
take that shit back to Sup Forums, you sick asshole.

I'll certainly do that. I've seen lots of kind anons here helping out newbies like myself. haasn for instance is one of them.

I demand a non-terrorist, non-troll thread. this one is not ok!

>5*

b-b-but C is the language of humility and simplicity!

well for example you must objectify everything even though there's often absolutely no need to

*everything* in C# is an object, it doesnt mix primitives and object-everything like Java does.
So idk what you're talking about

fuck off terrorist piece of shit.

>seiba avatar
based

Making a class the fundamental unit of code is the good example. Everything is seen through the lens of OOP.

besides C# is very windows only

you misspelled rin

Sup Forums is a white nationalist board and if you don't like it you can fuck off back to 9gag

.NET is cross-platform and open sourced, it's just not widely adopted beyond windows currently.

.NET Core is cross-platform and open sourced, .NET is not

curly-brace.com/favorite.html

>defending white trash
I guess you also think Indians are mustard race because Aryans come from there.

That's because .NET core is .NET without the windows-specific shit, which would make no sense to be available cross-platform.
It's otherwise the exact same thing, provided you're writing your programs in a modern fashion.

Looks very interesting. Thanks.

I've already committed to using AutoHotKey on other projects, even if the language looks like shit so I'll rather learn something with more use cases.

>pic
it's funny because it's true. i remember my fist lessons on OOP and teacher showing something on the left and convincing us how wonderful it is
2 hours later nobody really knew what the fuck is happening

Sorry buddy, but Sup Forums is a weeb nationalist board, and this is the programming thread of the technology arm

Please come back with an argument

anyone?

Log every step and see what happens.
I don't feel like plowing through the mess.

how do you do that in python?

>this is what Reddit actually believes

print(image_url)

docs.python.org/2/library/pdb.html
or litter your code with print statements

Hello guys,
this is a guide on how 2 solve a project euler problem with bloat.
First of you gotta calculate all needed primes with the worst algorithm ever.
Then you just have to do all that other shit with just pure bloat.
Looks like this then:
#include
#include

#define LIMIT 1000000

int primes[LIMIT] = {0};
int count = 0;

int is_prime(int n);
void get_primes();
int is_circular_prime(int n);
int pow_10(int);

int main()
{
get_primes();
int circular_count = 0;
for(int i=0; i < count; i++) {
if(is_circular_prime(primes[i])) {
circular_count++;
printf("circular: %d\n", primes[i]);
}
}

printf("count: %d\n", circular_count);
}

int is_prime(int n)
{
if(n

well, okay

holy shit, I just executed that on the first raspberry pi
pi@raspberrypi:~/projecteuler $ time ./a.out
count: 55

real 6m33.260s
user 6m25.740s
sys 0m0.180s

Stop posting muslims in a blue board

On my computer.
count: 55

real 0m2.307s
user 0m2.305s
sys 0m0.001s

First of all, how can you be sure someone is muslim??? Western women had headscarves until the middle of the 20th century. For all I know, OP image is an anime grill with a somehow traditional oriental outfit.

yeah. Takes about 14 on mine. Still way too fucking long.
Gotta write myself some utils library for project euler. For like generating primes below X (properly) and all that shit what is needed every once in a while

you could warn me about "IndentationError: unexpected indent" you know...either it doesn't build or builds but program crashes

>this entitlement
do you even know python?

if i did, i wouldn't be asking

Well go learn the bare bones of python before you try to debug a python program

Research on prime numbers really is in shambles and since the AKS primality test, there hasn't been much improvement in the domain. There's no general form of the prime numbers found yet (and there's no proof there isn't one) and their distribution relies on Riemann's hypothesis, which is still on hold as of today...

It's your shit, not mine.

Implement a sieve two ways
One as a bit array
The other as a byte array

I'd like to see timing trade-offs of the cache thrashing caused by the byte array, and the additional steps required to mark bits in a bit array.

Remember your 2, 3, 5 wheel factoring!

Been using it for months now, it's pretty neat

Won't do that one today, m8. That's a task for sometime later when problems get more heavy
Just solved one more problem and going to sleep now.
This one was quite easy.
runs in 0.02s on muh desktop and 0.6s on muh raspberry
#include

#define LIMIT 1000000

int is_palindrome_dec(int z);
int reverse_number(int n);
void to_bin(int n);
int is_palindrome_bin();

char bin_num[1000];
char bin_len = 0;

int main()
{
int sum = 0;
to_bin(1);
printf("%d\n", is_palindrome_dec(1));
printf("%d\n", is_palindrome_bin());
for(int i = 1; i < LIMIT; i++) {
if(is_palindrome_dec(i)) {
to_bin(i);
if(is_palindrome_bin()) {
printf("new palindrome: %d; ", i);
for(int j = 0; j < bin_len; j++) {
printf("%d", bin_num[j]);
}
printf("\n");
sum += i;
}
}
}

printf("sum: %d\n", sum);
return 0;
}

int is_palindrome_dec(int z)
{
if(z == reverse_number(z)) {
return 1;
}
return 0;
}

int reverse_number(int n)
{
int num = n;
int rev = 0;
int dig;

while(num > 0) {
dig = num % 10;
rev = rev * 10 + dig;
num = num / 10;
}

return rev;
}

void to_bin(int n)
{
bin_len = 0;
int rem = 0;

while(n > 0) {
rem = n%2;
n /= 2;
bin_num[bin_len++] = rem;
}
}

int is_palindrome_bin()
{
int a = 0;
int b = bin_len-1;

//if(bin_num[0] == 0) return 0;

while((b - a) > 0) {
if(bin_num[a++] != bin_num[b--])
return 0;
}
return 1;
}