/dpt/ - Daily Programming Thread

old thread: Return of the Hime edition!
What are you working on, Sup Forums?

Other urls found in this thread:

youtube.com/watch?v=Gse-uR-VdIg
youtube.com/watch?v=TD_OsdVTi3I
fujitv.co.jp/b_hp/dragonball_super/index.html
youtube.com/watch?v=JEpsKnWZrJ8
twitter.com/AnonBabble

First for Python is not an actual programming language

what is then?

Hi /dpt/
I'm a CS student/c++ programming, looking to try my hand at web development. I want to make a personal website.
My question: Where is the best place to buy a domain? Does it matter?

I would look into a registrar that protects your WHOIS information, because if you're not careful, they'll put your name and home address on your WHOIS registration.

Also, if you're serious about hosting a website, I would highly suggest you get a PO Box.

Actually, you need more than types. If you want to prove something about anything, you need to know about value.

Meh, technically he can put false information in the WHOIS info. They say it's "illegal" but I've never had any issues with that during all these years that I've owned domains.

It depends on the domain country.

Some will revoke your registration if you put blatantly false information.

Scripting language.

Real Time Interpretation vs. Compiling.

HTML (That's not a programming language, it's a markup)
Javascript (No user, that's scripting)
C++/Java (hotter)
C (hotter)
Assembly (damn hot)
100010101011010100 (Now we are talking)

Thanks for that info, it seems as though google domains has privacy settings to prevent that info from being public.

and this samefagging trap poster whines hard when someone posts a thread early, kill yourself fag

>still no doujin where Hime gets his boypussy ravaged

you can use pretty much any host, just whois other domains and if the owner's name is more or less obfuscated you should be fine, or contact the host and ask them directly, some hosts offer privacy protection as a separate service so make sure you pick that option in that case

can we honestly keep the image to be this or the orignal
I hate it when the dpt image is something retarded like a naruto character
thanks

the original is fine, the forced trapshit is not, even umaru is fine by me because of how desensitized i've become from this trap faggotry

I started learning python as my first language. Even though I don't know a lot about programming, the further I go the more retarded this language seems.
Should I just take the plunge and start learning C instead?

imo start with java and then learn C++, and then C if you want

>Scripting language.
>Real Time Interpretation vs. Compiling.
the javascript V8 compiler compiles to machine code, you fail at life, give up now

(Me)
but all of these languages including C are far better than python

And on a related note, any recommendations for a free or cheap web hosting service?
Sorry, just really new to this.

>java
>C++

nice meme

there is no reason to learn C++ anymore, its just a meme that gets shilled by programmers who wasted their career being 'expert' in a inherently broken language. Just learn C and move on to more advanced languages like Rust or Go

How does Python pass-by-reference even work?

I have a function which does something (not really important what) and I decided to try and speed it up by passing a pre-calculated lookup table (a very large dict) to it.

The thing is I haven't done anything with the dict inside the body of the function yet. I just added it to the list of arguments and pass it to the function when I call it, but the function is otherwise unchanged and doesn't touch the dict.

Yet now the function took a huge hit to performance and now takes 30% longer to complete. If I remove the dict from the arguments it goes back to the normal speed.

What gives? Shouldn't the dict by passed by reference and have barely any impact on performance?

Dry erase markers make my head dizzy

>more advanced languages like Rust or Go

don't sniff or huff anything it's ridiculously bad for your health

>Python
there's your problem

im not, im just writing with it and the smell is unbearable

try some other brand the next time you buy markers

Nothing is passed by reference. Just make it a global variable or close it.

>If I remove the dict from the arguments it goes back to the normal speed.
By this I meant both removing the argument entirely and passing None instead of the dict. Both have the same effect of speeding the function back up.

Well even if it is I'd like to understand it.

What's a good SQL/database design book? I know the basics (CRUD SQL statements and stuff) but want to go a little more intermediate.

Try turning off garbage collection, the GC sometimes shits itself when really big objects get allocated and passed around.

I need an ascii to string converter.

you're getting bad advice here

you should use [your username].github.io or heroku for their free webhosting since your website is either going to be for displaying your resume (in which case being linked to your github is a good thing) or for learning (in which case heroku and github provide it for free to you since nobody is going to see it anyways)

I really like heroku btw I use it for my web crawlers all the time. Github is easier though for obvious reasons

You seem to be awfully sensitive to trap posting.

>Nothing is passed by reference.
Explain.

>Just make it a global variable or close it.
It's in a separate module from where I'm calling it at the moment.

How do I "close" a dict?

I'll try that, thanks.

I need one of those too, but for hexadecimals and in python

>ascii to string converter
What?

?

you seem to be awfully sensitive to car posting

Everything is kind of passed by reference, though it'll only look like it's passed by reference if its mutable object.

I have no idea what the issue is though. The parameter should have the same address value as what you passed in. I'd assume the issue is that even if you don't use the entire dict is getting evaluated or something. Is this like 30% of a second or 30% of a microsecond?

This:

Ā̂Ԅ

Has to be something like this:

"012345"

I can't convert to int because then the value wouldn't be correct as above.

>mfw just did hello world in python 3 without calling any functions

k

Nice.

>Is this like 30% of a second or 30% of a microsecond?

It's ~15 seconds becoming ~20.

tl;dr I'm translating several gigs of data between coordinate systems.

so you mapped each range of similar colors to a letter? And calculated the average color for each grid of pixels like how reverse image searching does

you want to convert chars to their decimal counterparts, is that correct? Most languages do that

itoa?

do it in C/C++ if you care about performance

>several gigs of data
python has trouble with dealing with more than 40 mbs loaded into memory at a time in my experience, you're using the wrong language for this project

I care about learning what's causing weird spooky unexpected behaviour.

The five seconds aren't particularly critical, I just want to figure out what's crapping out which might be helpful in the future.

>C/C++
Why are you grouping two completely different languages together?

>running conversion on each frame
>no temporal coherence

Looks like shit

Hm. Thanks.
I'll look into this too.
I haven't really utilized git yet for some strange reason, so this gives me an excuse to do both.

>you're using the wrong language for this project
The thing I'm doing is a rewrite of a Perl script by someone else in the first place.

I banged it out over a week and it's three orders of magnitude faster than the original even though it's in Python. The equivalent of the 15s/20s function in question literally takes 20 minutes in the Perl version.

I'm mostly a C programmer but this was way faster to implement and also because Python parsers for the data already existed.

because some people prefer one over the other but both are much better suited for the task than python, fucking autist

C++ is fully backwards compatible with C and everything about C++ is designed to maintain that compatibility

>tfw learned basic programming principles when I was 16
>made a couple of crappy programs that were functional, but text-based
>now 19
>want to get into programming again to prep for university

In technology times are ever changing. Back when I was 16 the language I learned was C++. What should I use to re-learn/pick it up again?

Also I need something to program.

(You)

gui programming feels REALLY painstaking

should I just be using visual basic or something? Dragging and dropping would save me hours

Scripting languages are programming languages.

this is one reason why C++ and java is a better stack than C and python, you don't want to the extra work of C so you go full retard with python, meanwhile C++ would be less work than C and java would be comparable in effort to python but much better in performance

>The equivalent of the 15s/20s function in question literally takes 20 minutes in the Perl versio
how

I mean Perl is shit but not that shit

Suppose you went back to Ada Lovelace and asked her the difference between a script and a program. She'd probably look at you funny, then say something like: Well, a script is what you give the actors, but a program is what you give the audience. That Ada was one sharp lady...

youtube.com/watch?v=Gse-uR-VdIg
youtube.com/watch?v=TD_OsdVTi3I

>Visual Basic
Please consider C# before you consider Visual Basic. You can do drag and drop with WinForms or WPF.

The programmer apparently had no idea how to process the data in the format it was in so his script converts all the data to another format using an external module, processes that (and not very efficiently), then converts it back to the original format.

How?

kill yourself isac

>how

Incompetence is the traditional answer.

I am refactoring an intern's shitty javascript code and they did every possible wrong thing that can be done wrong.

>single-line conditionals like this: if (stuff) do stuff
>missing semicolons on some lines
>inconsistent spacing between all syntax elements-- missing spaces between parentheses, brackets, declarations, even around fucking operands
>a for loop containing an if conditional with its code, all on the same fucking line
>code copied between scripts that has not even been refactored to do that it's actually meant to do
>many many strings hardcoded separately even though most of their text is similar
>concatenated strings without spaces to separate the words
>if conditionals that always return true or false

How can people who code like this sleep at night? Fucking CS degrees are really a meme.

*laziness

That, too. Why do something the correct way when you can do it with some poorly-designed hack?

also their if blocks are opened like this
>if (condition){

Not only is the opening brace on the same line it doesn't even have a space before it. This really triggers my OCD.

fujitv.co.jp/b_hp/dragonball_super/index.html

why can';t i download the Flash video from this site?

fujitv.co.jp/b_hp/dragonball_super/index.html

Got Mono-D setup on Monodevelop
Just wish the run button didn't default to running in debug mode

in some ways this is better, it validates the formatting automatically

no mate the question is why waste a ton of time writing your own interpreter for some dataset when you can just convert it to another format you have ready-made tools in and then back again and be done much quicker?

gee i wonder
also fuck off to stupid questions thread

While Ada Lovelace is considered to be the first computer programmer, if you asked her anything about "computer programs," she might be confused. The term "program" was not applied to computers until the 1940s. And yes, even the earliest "scripting" language -- Lisp -- was referred to as a programming language when it was first created.

>in some ways this is better, it validates the formatting automatically

The things is the formats aren't equivalent, they aren't even used for the same thing normally. After the conversion he still keeps both data structures in the memory and cross-references them in the processing because the second format doesn't contain all the needed data for the processing.

The two format conversions are probably behind the bugs which caused me to rewrite the thing in the first place.

>How do I "close" a dict?
Like make a closure around the dict, so it isn't polluting your global namespace.

>>Nothing is passed by reference.
>Explain.
I was under the impression that Python data structures were copied across all function calls. I've been able to write data-driven decision tree problems in Python without having to explicitly copy the data structures, so I assumed each function got an immutable copy of the data structure. Maybe I'm wrong.

>so I assumed each function got an immutable copy
a *mutable* copy

hence why she'd be talking about scripts and programs in the context of a theater, but it's still a fitting analogy

Ada Lovelace was not a programmer. Stop spreading this misinformation and propoganda.

Was Marie Curie a physicist?

youtube.com/watch?v=JEpsKnWZrJ8

GOAT

she was just one of the first people to have the opportunity to play around with radioactive stuff

Not really a completely fitting analogy, considering that the script is also a program.

Is there a way to get clean header files for the C standard library that aren't filled with awful compiler macro hell preprocessor defines and such? I just want nice autocompletion. Pic related, I can't deal with this shit

Okay I still don't know what's happening, but subsequent calls to the function run at the expected speed.

As in, if I call it without the dict it always takes 15 seconds to complete.

If I call it with the dict it takes 20 seconds the first time and 15 seconds every time after that.

(which is a bummer since I normally only run it once)

It says here that you haven't contributed to any FOSS projects... ever. Can you elaborate a bit on that?

FOSS is for neckbeards

I strongly believe in proprietary code.

Mhmm... OK, jeesh. You can expect to hear back from us in the next, uh, week.

Testing out some free-as-in-freedom (MIT licensed) Microsoft Powershell on Linux...

It's in a VERY early alpha. It doesn't even know it's on Linux. It must be a very confused and somewhat panicked program.

Okay, now for some proper weird shit.

The function uses multiprocessing.Pool.

If I use a single process for that, every function call takes the same time.

If I use more than one process, the first function call is slower and the rest run at normal speed.

Does Pool mess with memory?

If it faster the first time, are you sure the dict is fully evaluated when you pass it into the function? The extra time could be the evaluation of a partially evaluated structure. Python doesn't pass-by-value, it's 'pass-by-assignment'. I guess we would have to see your function to tell you exactly.