[Boards: 3 / a / aco / adv / an / asp / b / biz / c / cgl / ck / cm / co / d / diy / e / fa / fit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mu / n / news / o / out / p / po / pol / qa / r / r9k / s / s4s / sci / soc / sp / t / tg / toy / trash / trv / tv / u / v / vg / vp / vr / w / wg / wsg / wsr / x / y ] [Home]
4chanarchives logo
/dpt/ - Daily Programming Thread
Images are sometimes not shown due to bandwidth/network limitations. Refreshing the page usually helps.

You are currently reading a thread in /g/ - Technology

Thread replies: 255
Thread images: 22
File: DPT.png (389 KB, 934x1000) Image search: [Google]
DPT.png
389 KB, 934x1000
Old thread: >>55226380

What are you working on /g/?
>>
>>55235694
Rewritting the GNU + Linux kernel in Haskell; minus the Poettering parts
>>
File: IMadeAThing.png (184 KB, 1920x1080) Image search: [Google]
IMadeAThing.png
184 KB, 1920x1080
Trying my hand at Gameboy programming.
>>
>>55235730
>doing X platform programming
>wrapping X platform and doing what you usually do
What do you aim to do?
>>
succesfully wrote a graphics driver and memory manager for Gnu Turd, going to write the first game where you are an indian running from evil poos and you gotta trick them into falling into a loo
>>
File: Please.jpg (31 KB, 539x437) Image search: [Google]
Please.jpg
31 KB, 539x437
>>55235694
What is the best algorithm for sorting a doubly linked list, gee? Someone asked me days ago. I have my humble opinion but I want yours.
>>
>>55235746

Eventually plan on doing a roguelike or some shit on it. Also, getting bank switching set up on this bitch is a pain in the neck. Documentation is shit for gbdk, and everybody's hosting their own fucking forks on github because the developer basically gave up.
>>
>>55235750
>sorting a doubly linked list
>linked list
>sorting
>using a linked list
>any year
I don't have an opinion on it. If I ever need to sort it I don't make it a linked list. (or the structure I'm using is sorted by sorting references to the list)
>>
>>55235774
>sorting references to the list
Wut? How is that better and what does that even mean?
>>
>>55235750
merge sort
>>
>>55235694
Reverse engineering some shit.
>>
>>55235786
It's not 'better' as a linked-list per-se. But it's more about wrapping the linked list in a non-linked structure because it's better.
What I mean is to just an array of node pointers. When sorting I'd just dereference the node and sort the node pointers array based on the value in the node it's referencing. When inserting a new node i'd have to make a judgement call if the amount of nodes being inserted between each sort is big or not. If not I'd just keep a small 'unsorted nodes' array that's checked after a search is done.

Yes it's a clunky system but I'm certain it's more efficient and easier to handle (while doing sorts). But that's just because linked lists are absolutely retarded. There's no sensible reason to use them.

If you have a linked list you should have a binary tree or any tree really instead.
>>
>>55235820
>There's no sensible reason to use them.
Sounds like you're absolutely retarded.
>>
File: jamie-clayton.jpg (150 KB, 600x703) Image search: [Google]
jamie-clayton.jpg
150 KB, 600x703
Which programming language should I start with?
**I don't like compiled languages; takes too much time**
>>
>>55235838
mongojs
>>
>>55235838
Same yet different question, I script in ruby, should I get good with c++ or java?
>>
>>55235774
>I don't have an opinion on it
because you don't have algorithms knowledge
>If I ever need to sort it I don't make it a linked list
yeah, too complicated for your css brain
>we have this linked list because it's the most efficient way to handle the most common use case
>in some rare occasions, we need to sort it; how would you do it, pajeet?
>lel, I just make an array and work with that, linked lists are too hard for me
you are the shit of /g/
>>
>>55235838
Riding off this question, if I wanted to learn programming to better understand computers and maybe pick up programming old systems for fun as a hobby, would C be the correct starting point? What's considered the best resource for C? I'm reading Learn C The Hard Way but I've seen some people say it's shit, it seems like the author made a lot of people upset talking smack about a book that was held in high regard so I don't know how legitimate those claims are or if it's just asshurt.
>>
>>55235969
>author made a lot of people upset talking smack about a book
actually, he doesn't know what the fuck he's talking about, because he doesn't actually know C (by his own admission), he just looked over it with the purpose of writing a book
>>
>>55235838
I read this post and thought "wow, the MtFs are all programmers meme is true" then noticed I clicked the wrong tab.
>>
>>55235855
bump
>>
>>55235855

C++. Make native extensions for Ruby.
>>
>>55235838
Go. It compiles as fast as most interpreters take to start.
>>
File: screen.jpg (281 KB, 1352x894) Image search: [Google]
screen.jpg
281 KB, 1352x894
Can someone tell me what color scheme this is?
>>
>>55235694
Working on a tool for beginning computer science student using g++ for c++. The tool will simplify compiler errors so g++ doesn't throw an 800 line error when the << or >> are the wrong way on I/O.The scope is not limited to just I/O errors, it'll cover about 90-100 beginner C++ mistakes.
>>
>>55236277
californian dildo
>>
File: Der Gute.png (460 KB, 1012x628) Image search: [Google]
Der Gute.png
460 KB, 1012x628
>>55235729
Why?

Also, when is the dependent type revolution finally starting. I'm waiting.

t. theoretical physicist
>>
>>55236330
It's not going to happen. Just like how the monad revolution did not happen.

Scala is going to revolutionize effects in the next 10 years, so watch out.
>>
>>55235838
python
>>
>>55236330
ok so F* (fstar, verified language) has dependent types and you can execute it by generating it into F#/Ocaml

no idea how it would look however
>>
>>55236387
if you're going to be using meme languages why not just use idris?
>>
So... Gameboy shit...

Memory partitioned into 2 32K "banks" for program ROM, 8K of RAM. First 32K bank is untouchable, second 32K bank can be swapped in and out, and will likely be needed for sprites, music, and other game code. A function in the second bank can't do the logic of the switching, because otherwise it would end up stuck somewhere in the middle of a function in another code bank, and glitch everything up. Thus, first bank acts like a very small kernel managing everybody else. And it's a kernel that has to fit in 32,768 bytes, some of which may need to be reserved for displaying the Gameboy logo upon bootup if it is to be transferred onto a flash cart for real play (yeah, real Gameboys check for a sequence of code that displays their logo)
>>
Are there any resources on how to implement different image segmentation algorithms? Have to do that stuff for class and right now I'm failing to implement a quad tree.
>>
>>55236484

Wait, woops. Meant 16K banks. Entire address space for the two banks is 32K.
>>
>>55236402
performance?
and you have Refinement Types as well
>>
How do we unify nominative and structural subtyping?
>>
>>55236330
>when is the dependent type revolution finally starting
The fire rises, brother.

>>55236387
F* is not verified.

>>55236555
Idris has an LLVM backend.
>>
>not using joinads
http://tomasp.net/academic/papers/joinads/joinads.pdf
http://tomasp.net/blog/fsharp-variations-joinads.aspx/

>Abstract.
>Modern challenges led to a design of a wide range of programming models for reactive, parallel and concurrent programming, but these are often difficult to encode in general purpose languages. We present an abstract type of computations called joinads together with a syntactic language extension that aims to make it easier to use joinads in modern functional languages.

>Our extension generalizes pattern matching to work on abstract computations. It keeps a familiar syntax and semantics of pattern matching making it easy to reason about code, even in a non-standard programming model. We demonstrate our extension using three important programming models – a reactive model based on events; a concurrent model based on join calculus and a parallel model using futures. All three models are implemented as libraries that benefit from our syntactic extension. This makes them easier to use and also opens space for exploring new useful programming models.
>>
>>55236593
>F* is a verification-oriented dialect of ML
https://www.microsoft.com/en-us/research/project/the-f-project/
>>
>>55236598
Wasn't this ages ago?
>>
>>55236614
it's still only an extension

>Don Syme commented · February 04, 2016 02:53
>I think my position on joinads is fairly well known. The proposal is most definitely interesting from a research language design perspective.

>However the typical "bang for buck" tradeoff analysis just doesn't convince me that this should be in F# itself.
>>
File: tfw.png (463 KB, 538x534) Image search: [Google]
tfw.png
463 KB, 538x534
>F#
>still no HKT
>>
>>55235833
Ok where does a linked list perform (memory/processing power or both) well?
Is there any situation where you'd have better performance than an array, dynamic array or C++ vector?
Any situation where it's better than a tree?
>trees need balancing
Not all trees _need_ balancing. And note how a linked list is just a worst case of a tree.

Sounds like you're absolutely retarded frankly.
>>55235899
>linked lists are too hard
No. They're really easy. Sorting them works on the same principles an array can be sorted. The difference is that you have two different types of sorts. Sorts that sort the nodes and sorts that sort the values/data.

Either way it's just about inserting the nodes or swapping values.
Also note how nobody else answered.
>You don't have algorithms knowledge
I have no idea how anyone can say that when I'm making such an obviously true statement.
The reason I technically don't have an opinion on it is obviously not because I don't know what it is. If you have enough values that you need to sort them in a performant way you don't use a linked list. It's as simple as that. If you're sorting your ~1000 node linked lists and wondering about what the best algorithm for sorting it is you're being retarded. Either it's premature optimization or it's simply you being retarded. Don't do bubble sort. But for something that small you can do insertion sort.

Also here's why linked lists are bad:
https://www.youtube.com/watch?v=YQs6IC-vgmo
Even this moron gets it.

I hate when morons like you make a mockery out of the field by pretending that programming is comptuer science.
>>
>>55236609
That doesn't mean at all it's verified.
Coq, Isabelle, Mizar and dozens other languages are "verification-oriented", but themselves they do not have formally certified/verified implementations.
>>
>>55236254
https://www.youtube.com/watch?v=9BVq4JqEFZY
https://github.com/ocornut/imgui
>>
>>55236635
>where does a linked list perform
where you need lots of inserts and removes without invalidating iterators; I'm not surprised you don't know, obviously you lack experience and high performance applications are clearly not something you've ever had to deal with
>an obviously true statement
nah, you're just a retard that thinks he's now good because he did fizzbuzz
>If you have enough values that you need to sort them in a performant way
the question was how to sort a linked list, you dodging the answer shows that you don't have algorithms knowledge
>It's as simple as that
this is proof you haven't gotten past fizzbuzz-level programming; protip: real applications are more complex than "ok, now we need to sort stuff! let's just use an array and call it a day; doesn't matter if we only sort rarely compared to insert/remove, rajesh here only knows how to sort arrays"; only morons rush "simple as that"
>Also here's why linked lists are bad
if course, retards like you can only get knowledge from stackoverflow and youtube, you're incapable of critical thinking to even ponder why the fuck lists even exist if """everyone says they're bad"""; did it occur to you that most of the "lists are bad" cargo-cultists don't have a clue what the fuck they're talking about and base their conclusions on retarded use cases where they shouldn't have used a linked list in the first place? of course not, you don't have a brain to question """youtube proofs"""! fuck off
>make a mockery out of the field
you don't even get close to the field, you shit; go on with your html programming, worthless fuck, and don't bother replying, I'm not wasting any more time with sub-humans like you
>>
In C++, what's the best way to distinguish variable name from method name?

m_NAME
a_NAME
_NAME
others?
>>
>>55236646
>The latest version of F* is written entirely in F*
https://www.fstar-lang.org/
>>
>>55236762
Don't, it's retarded
>>
If I git gud at C, how transferable are my skills?
>>
>>55236762
I don't see a point since you need parenthesis to use a method. I do differentiate structures and classes by making them start uppercased though.
>>
>>55236795
>>55236805
I know it's retarded but I don't have a choice.
I have a class that has a variable called id, and I have a method also called id which returns id, but that won't compile because C++ can't differentiate between a method and a variable with the same name.
So the variable has to be called something else.
>>
>>55236760
>where you need lots of inserts and removes without invalidating iterators
Everyone gets this one wrong.
https://www.youtube.com/watch?v=YQs6IC-vgmo
You're retarded.
>retards like you can only get knowledge from stackoverflow and youtube
No I generally read shit. I posted that because it's plainly obvious to anyone who knows anything about computers and the only kind of person who wouldn't know this already is someone who I'd rather see executed than be forced to work with. Yes, you know the things we actually use to run software. A linked list is a long list of cache misses. That's why it sucks ass. And it always will. A vector wins in performance down to the single element array. Arguably that extreme case is because the single node has two pointers and will evict something from the cache for no reason. I suppose I can concede they're the same if all our program does is access the node/array.
>>55236762
m_ is pretty good. But I tend to use that for member rather than method. Not that it really matters.
>best way
Whatever helps you type quickly. Prefixes are good because most people use tab/whatever-completion.
>>55236795
This guy makes a sensible choice and uses a lexer for his editor but is strongly opinionated against people who don't. For no real reason I think.
>>55236798
>git good at C
Depends on what you mean. Knowing C as a language (just syntax and how to write basic programs) isn't really much to learn, but it's pretty much the basics of programming and . Learning C like a language autist is a lot of work and gives you very little. You understand programming better knowing C.
>>55236805
Compile errors for no reason is the problem. I takes more time than correcting it the first time you wrote it.
>>55236819
>I have conflicting names in my struct/classes
Not a good reason to decide on something.
I think your three suggestions are all equally fine. a_ and m_ are descriptive and if you have an editor which lists members for you it's convenient too.
>>
>>55236819
Why the fuck would you have both?

Even if you wanted to prevent someone from externally modifying id, since it's internal why does it need to be called id?
>>
>>55236762
3rd in not allowed
>>55236819
call it ident, identity, the_identity, whatever the fuck
>>
>>55235969
It seems like want to know more about computer organization. try an introductory book like Code, by Charles Petzold. If you want something more comprehensive, read Computer Organization by David Patterson. And John Hennesy.
>>
>>55236786
Again, that doesn't mean it's verified. The F* type system is not even strong enough to provide such guarantees as soundness and completeness.
>>
>>55235838
How come when I make statements like this I get tons of complaints?
There's technically no compiled languages. You can write a C interpreter. But I'm not retarded so I wouldn't tell you that as an answer.
>>
>>55236786
Also, straight from the authors:
>F* is programmed (but not verified) in F*
https://www.fstar-lang.org/papers/mumon/
>>
>>55236843
>Everyone gets this one wrong.
What are you referring to? First, the linked video has nothing to do with the quote. Second, it's a complete strawman: "Here's a scenario where nobody with half a brain would think to use a linked list; Guess which one is faster: the linked list or the array?" That's not how reasonable people use linked lists.
>A linked list is a long list of cache misses
Only if you use them when you shouldn't. There is no one absolute data structure perfectly fit for all use cases. Trying to shoehorn everything in arrays (because of unfounded cache concerns) is not always optimal.
>A vector wins in performance
Depends on the use case.
>>
Which language is best first language: Java, C, or Python? I've heard Python teaches bad habits you need to unlearn.
>>
If I have this string:
"the price is 40.45,02 shekels"

How would I write a regex to pull only "40.45,02 shekels"?
>>
Is there a way to calculate the time window between two dates with respect to leap years WITHOUT checking every year in a loop if it's a leap year or not? I don't want to pre-calculate a 9999 long array and sieve through it, bros.

How to make my algorithm more efficient?
>>
>>55237032
Forgot to say, the amount of . or , in the number is unknown.
>>
>>55236991
>Only if you use them when you shouldn't.
>Depends on the use case.
Except the video I linked showed you the opposite. The video is literally a "find where to insert the value" (linear search) "insert the value". For a linked list that's walk all the nodes (hit a cache miss every time you look at a value until you find the correct one) and insert (change pointers). VS linear search on an array (super likely no cache-misses because computers are awesome) and insert the value (shift all values forwards 1 and insert the value).

That's what he was talking about. I'm not gonna find a paper on it for you because it's OBVIOUS. It's been known since way before that Cppcon talk. If you're so retarded that you trust your professors to know jack shit about computers then you should probably just off yourself rather than getting more debt that you will leech from your parents (if you're lucky) or country (bums cost money).

I don't see a use-case where a linked list would be better. They've isolated themselves in ways that make implicit data-usage (stuff like sampling every N bit in an array having some significance) impossible. They're useless. You'd write them only if you don't have a dynamic array type in your language and you don't really feel like implementing it. And you don't care about performance. Or maybe if you want it to be slow. Which I don't get, just do a few sleeps here and there while using a vector instead. Wasting CPU time is just cruel.

>>55237021
>I've heard Python teaches bad habits you need to unlearn.
Retarded people say that. It's the 'no braces/nosemicolons' meme. It takes you maybe a week.
I'd recommend C though.
>>
>>55237032
\d*\.\d*\,\d* shekels
>>
File: 1338032124343.jpg (40 KB, 426x341) Image search: [Google]
1338032124343.jpg
40 KB, 426x341
>>55237057
>coding anything date related yourself

Have fun going insane.
>>
>>55237077
can you explain this regex, please?
>>
>>55237057
>How to make my algorithm more efficient?
Post it?
I hope that's not what you described.
You figure out how leap years are determined. Determine how many leap years there are in the interval you have, add that many days. Do your normal time difference.
>doing dates
>attempting to do them correctly
Don't do this.
>>55237032
>>55237061
[\d\.\,]+ shekels

Yes. I escape things arbitrarily in regex because I'm sick of errors.
>but you're now accepting \ in certain implementations
I don't care.
>>
>>55237086
It's just an exercise bro.

>>55237099
Checking to see if a year is a leap year is easy. How to efficiently get the total amount of leap years within a time window is exactly what my original question was about. Any tips? Because right now I'm doing +4 every iteration and checking iteratively.
>>
>>55237095
Just copy it into regexr.com 3dmkh
>>
>>55237095
\d = digit
* = zero or more
\. = escaped period
\, = escaped comma
shekels = literal string
>>
>>55237117
post your algorithm already dude
>>
>>55237123
Apparently you don't need to escape a comma. Still works tho
>>
>>55237118
i prefer regex101.com , though. thanks
>>55237123
thanks
>>
>>55237117
Well limit the amount of iterations by something. I don't know leapyears well so I can't optimize the algorithm. But they only happen every 4 years OR some other set of years (like every 19 years iirc?).
So just do for(int i=0;i<max;i+=4)
For instance. Skip the years where it's obviously not a leapyear and do an iteration for each of the cases that checks for leapyears.
>I don't want to pre-calculate a 9999 long array and sieve through it
More like you're not allowed to if it's an assignment.
>>55237146
>regex101
Nice site.
>thanks
His doesn't work according to spec though. It only handles 1 period and one comma
>>
>>55237123
could you write it like this?
[0-9]*\.[0-9]*\,\d* shekels
>>
>>55237071
Which one is best for a beginner to learn?
>>
>>55237077
I think a more appropriate regex is
\d{1,2}(\.\d{2})*,\d{2} shekels

assuming that I'm interpreting the question correctly.
>>
>>55237168
Practically the same, you could do
[0-9]*\.[0-9]*,[0-9]* shekels
as well
>>
>>55237171
>Which one is best for a beginner to learn?
I don't know. I haven't learned all of them as my first language.
Only C.
I can say that Java was really bad for beginners I've known.
>>55237168
Yes. But I don't see why you would use both [0-9] and \d in the same regex. \d is 0-9
>>55237118
What I posted here
>[\d\.\,]+ shekels
Does exactly what you said
It catches:
32,.98,.328,.,.,..2,32,. shekles
329.,8328,.,.,..2,32,. shekles
and more sensible things like
343.343,32 shekles

But maybe you want it more constrained despite what you said..
It's very simple.
[\d\.\,] //character set of 0-9 . and ,
+ matches as few as possible of the characterset while trying to match (match until there's a space in this case, if there's something other than space it just doesn't match)
>>
CodeEval fuckery.
#include <stdio.h>
#include <stdlib.h>

int main (int argc, char **argv) {
FILE *fp = fopen(argv[1], "r");
char card[21] = {0};
char squash[16] = {0};
int sum = 0;

while (fgets(card, sizeof(card), fp)) {
int idx = 0;
int i;

for (i=0; i<19; i++) {
if (card[i] == ' ') continue;
squash[idx] = card[i];
idx++;
}

squash[idx] = '\0';

for (i=0; i<16; i++)
if (i % 2 != 0)
sum += squash[i] - '0';
else
sum += (squash[i] - '0') * 2;

printf("%s\n", sum % 10 == 0 ? "Real" : "Fake");
idx = i = sum = 0;
}

fclose(fp);
return 0;
}
>>
>>55237222
How similar is Python and C? I'm thinking about getting the basics with Python and move on to C.
>>
>>55237248
Besides the fact that they're both imperative languages, they aren't similar at all.
>>
>>55237248
They're not very similar. I wouldn't want to discourage you from learning python first. But I suspect you may feel C is a bit annoying to deal with after python. Without understanding why it is that way. If you go the other way you get that python is convenient but slower.

Also Python supports OOP. Which I find is dangerous for newbies. But that's political.

Go with either, just do at least an hour of programming today.
>>
>>55237247
I've been meaning to do some CodeEval challenges again.
>>
>>55237247
for (i=0; i<16; i++)
if (i&1)
sum += squash[i] - '0';
else
sum += (squash[i] - '0') * 2;

puts(!(sum % 10) ? "Real" : "Fake");
>>
>>55237323
Less readable.

>>55237319
Boss is away and I'm hungover so I figured I'd do some.
>>
>>55237323
for (i = 0; i < 16; i++)
sum += (squash[i] - [0]) * ((i & 1) + 1);
>>
>>55237353
Wait, I got that backwards.
for (i = 0; i < 16; i++)
sum += (squash[i] - [0]) * ((i % 2 == 0) + 1);
>>
>>55237350
>less readable
>compared to >>55237247
Anon you're not just hungover. Get to the hospital.
>>
>>55237032
>>55237061
>the price is 40.45,02 shekels
#!/usr/bin/perl
my $str = "the price is 40.45,02 shekels";
print $1 if ($str =~ /(\d+\.\d+,\d+ shekels)/);
>>
>>55237350
>Less readable.
can't you read what's in there?
>>
>>55237368
for (i = 0; i < 16; i++)
sum += (squash[i] - [0]) * ( !(i&1) + 1);
>>
>>55237384
I said less readable, not unreadable.
>>
>>55237393
>>55237368
>>55237353
I realised another error in my code.
[0] is supposed to be '0'.
>>
There was a guy here a while ago doing challenges with regex, does anyone remember the site he was using?
>>
>>55237430
Might have been me actually.
www.hackerrank.com
>>
>>55237444
Just found it actually
https://regexcrossword.com/
>>
>>55237393
Are you fucking 12. Try something for complex mate.

Calling yourself a programming would imply you can even read a book built for adults.
>>
>>55237470
This site is amazing, I'm still stuck in the Volapük level.
Damn
>>
>>55237299
I want to make vidya, is Python actually slow and a bad idea to make vidya in? Also, aren't you required to have Python installed to use Python programs like Java does, it's why I'm not making games in Java.
>>
>>55237492
what's the matter? you can't understand basic shit?

>>>/out/
>>
Why the fuck isn't this C++ code legal?
class foo
{

};

class bar
{
public:
// compiler error: declaration of 'foo bar::foo()' changes meaning of 'foo' from 'class foo'
// Fuck you compiler, they're in different fucking namespaces, there should be no name clashes.
foo foo()
{
return ::foo();
}
};

int main()
{
bar b = bar();
foo f = b.foo();
return 0;
}
>>
>>55237470
I really hate sites that make you sign in with another service.
>>
>>55237520
Seems I had to change
foo foo()
to
::foo foo()
for it to work.
>>
>>55237021
Haskell
>>
>>55237502
>Also, aren't you required to have Python installed to use Python programs like Java does
No you can construct programs that don't require that.
>Which is why I'm not making games in Java
Well I think if you're new to programming and want to make games it would be wise to set up more requirements for what you're gonna learn.
Like what platforms do you want to release your game on etc.
Perhaps there's a framework or library you want to be using?
I don't think you will be making a game where it's a major concern if you don't have very high goals. Maybe describe the game and I can have a sense of that?
>>
>>55237168
>>55237077
>>55237168
>>55237177

What is the reasoning behind escaping the commas/dots?
[\d.]+ shekels
worked as well as [code[\d\.]+ shekels did.
>>
Hi, what are the best group descisin making software?
Also, how feasible would it be to create a software that can read questions, suggestions, and solutions and sort them according to their similarity? Sort of like google does with its search engine.

Or if that is not possible than to make a very user friendly interaface that allows to make any sort of suggestion or question, on any topic using some sort of format a modern program can undestand and sort?

when I write user friendly, i mean grandma friendly. Something anyone can learn to use.
>>
>>55237539
kek
>>
>>55237520
You can't declare foo's functions inside of abother class. Either do it in the foo class immediately or do it in the (forget what it's called in c++) "global space"
>>
>>55237544
. means any character. So it works because it will match any character.
It would match
344.m32 shekels
too.
>>
>>55237555
>You can't declare foo's functions inside of abother class
Except I'm not.
>>
>>55237502
Is python slow, yes.
For 3d games it is not effective in engine execution.

If you wish to use gaming programs then use c++ or c# to execute a engine better.

Python being slow does not mean it cannot do it.
But you should use google to find the fuck answer you uneducated retard.
>>
>>55237547
>how feasible would it be to create a software that can read questions, suggestions, and solutions and sort them according to their similarity?
Like keywords or structure?
Both don't seem particularly hard in my mind. But there will be a large number of false positives. Those are what google is good at eliminating.
>>
>>55237544
>escaping commas
There is no need. I don't know why the others escaped it.
>escaping dots
. in regex means "any character". If you want a literal ., you must escape it.
>>
>>55237547
For sorting them according to similarity you can use a neural network. Don't worry, it's not as complex as it sounds.
>>
>>55237512
Mate, I make algorithms which intake CPU cycles so yo can time encryption of characters. This would mean you can use a normal encryption method but be able to engineer a way to tell interesting data from shit useless padding.

So maybe take you little loops and maybe kill yourself sir.
>>
>>55237071
>Except the video I linked showed you the opposite. The video is literally a "find where to insert the value" (linear search) "insert the value"
Ok, I'm gonna go on a limb here and assume you have a brain developed enough to read a post in its entirety and you just didn't see the rest of what I said because you were distracted by youtube.
The video showed the opposite of what? Did I claim that linked lists are suited for linear search? Really, just re-read what I said. In fact, what I was saying (with the strawman paragraph) is precisely that if your use case makes heavy use of linear search you NEVER pick linked lists.
>That's what he was talking about.
Who? Bjarne? Yes, he was talking about a case where linked lists are bad. But we're not talking about that. We're debating your claim that linked lists are ALWAYS BAD for ANY USE CASE.
>If you're so retarded that you trust your professors
I don't blindly trust anyone and I recommend you do the same and try to think for yourself after gathering as much information as possible on a subject.
>I don't see a use-case where a linked list would be better
Anon said "where you need lots of inserts and removes without invalidating iterators" and you quoted it and replied with the non-sequitur Bjarne video. That video doesn't address insert/delete and iterator invalidation. Did you want to post another link perhaps?
>And you don't care about performance.
Before posting another raging reply, try to ask yourself why the NT, linux and the BSDs kernels make heavy use of linked lists? Do they hate performance? You honestly fail to imagine a scenario where it's handy to add/remove an element (that you already have, and don't need to search for it, it's worth repeating because you seem inclined to assume a linear search is required for this) to/from a collection with only a few pointer updates?
>>
>>55237599
k
>>
>>55237610
I bet you couldn't even execute XOR without using a built library.
Fuck off you little child.
>>
>>55237559
>>55237581
So \. basically means, "there has to be a dot here", and . means "anything can be here"?
>>
File: 1466630623659.jpg (118 KB, 1080x1080) Image search: [Google]
1466630623659.jpg
118 KB, 1080x1080
>>55237548
brainlet detected
>>
>>55237625
>I bet you couldn't even execute XOR without using a built library.
ahahah

baby's first swap function

get outta here you pleb

come back here when you have built a compiler.
>>
File: 1466778892606.jpg (138 KB, 1080x1080) Image search: [Google]
1466778892606.jpg
138 KB, 1080x1080
>>55237634
>Haskell as a first language
autist detected
>>
>>55237642
>built a compiler
pleb, I already built a computer!
>>
>>55237642
What a fucking clown mate.

You seem to be the only here to initiate a simple loop program yet claim like you fucking know anything of any programming abilities.

I fucking you 4chan manchildren
>>
File: positive vibes or kys.jpg (44 KB, 488x820) Image search: [Google]
positive vibes or kys.jpg
44 KB, 488x820
>>55237660
>>55237660
>autist
>>
>>55237662
Why the fuck are you replying as if you were me you fucking retarded.

Next time, speak somewhat educated.

>Built a computer
What the fuck does that mean. Did you buy a pi and thought you made it?
>>
>>55237628
No , doesn't mean anything to my knowledge.
. does mean 'anything' though.
\. means 'dot'

\ is an escape character. So if you wanted to have a \ you have to write \\
Excessive use if escape characters doesn't hurt. But for instance \d means digit. Don't remember what it's called. We're not escaping \d its predefined to be digit though. There's others like \w for word ([A-Za-z0-9_]) and \W for not word [^A-Za-z0-9_] (anything but word).
>>
>>55237677
>. Did you buy a pi and thought you made it?
as a matter of fact, i did. so, like i said, i built a computer
>>
>>55237677
>implying you can even begin to comprehend what building a computer from bottom up entails
top
kek
>>
>>55237673
Vape yourself to death cunt
>>
>>55237685
No, all you fucking did was put software together as if you were fucking stealing for other programmers.

Next time when you say you built a computer don't try to seem like you develop anything you useless bastards.
>>
>>55237703
it was real in my mind
>>
>>55237677
>as if you were me
do you know how 4shit works?
>>
>>55237686
You cunts do what gamers do.

>Shop for hardware
>Install software

I doubt you fucking retards even make software to operate a computer. Computer Science is not a educated background for 4chan fuck tards to be good programmers.
>>
>>55237684
If . means anything, how come I can't pull "245v416 shekels", just as "245.416 shekels", with:

[\d.]+ shekels
>>
>>55237713
:)
>>
>>55237715
>even make software to operate a computer
pleb, I make the computer itself!
>>
>>55237732
You make HIV and other retarded deceases.
You then come onto a programming part of 4chan so you can post you wikibook programming lesson, then act as if you're a fucking programming with any skill.

Fuck off to python you useless cunt.
>>
File: 1454435411651.jpg (53 KB, 907x718) Image search: [Google]
1454435411651.jpg
53 KB, 907x718
>>55237715
>a educated
>>
>>55237602
>and assume you have a brain developed
classic newfag mistake
>>
>>55237749
I had to somehow translate to American.
>>
>>55237747
Excuse me?
>>
>>55237747
sounds like you're jelly I'm better than you lol!
>>
>>55237774
Are you?
I bet you have the best console game and then you post it as 60fps but it continues to play at 30fps
>>
File: regex101.com.png (15 KB, 672x166) Image search: [Google]
regex101.com.png
15 KB, 672x166
>>55237720
Don't know what to tell you. Regex implementations are different sometimes. For instance my editor does \1 for capture groups while my debugger (and associated editor) does $1.

Check your environments reference. Here's a picture of regex101.com
>>55237778
This post wasn't done..
>>
>>55237130
unsigned int leapsbetween(unsigned int from, unsigned int to) {
return leapsbefore(to) - leapsbefore(from + 1);
}

unsigned int leapsbefore(unsigned int year) {
year--;
return year / 4 - year / 100 + year / 400;
}
>>
>>55237790
No. i only play minecraft with my friends.
>>
>>55237774
No mate.
I am human.
I do not think jelly has the ability to communicate to retards.
>>
>>55237790
m8, I build computers, nuff said!
>>
>>55237800
Do you run your own server?
Do you also put your dick into the cut circle of a cd tray/CD?
>>
>>55237502
>Also, aren't you required to have Python installed to use Python programs like Java does, it's why I'm not making games in Java.
Yes, but it is possible to compile java programs and python programs into .exe but that would remove their platform independence as it would only work on Windows then.
>>
>>55237804
>I do not think
top cuck
>>
>>55237807
Did you also build your girlfriend from lego?
>>
>>55237818
i'm a cis-transgender person. stop offending me!

reported for hate speech.
>>
>>55237827
I am happy enough to say can I hurt you in all ways possible.

Every time you breathe you hurt me :(
>>
>>55237602
>We're debating your claim that linked lists are ALWAYS BAD for ANY USE CASE.
You may be. That other guy claimed I'm retarded for thinking Linked lists are almost always bad (which was my initial statement, I implied they're bad and said that I'd never use them if I need sorting).

But I hold that they're always bad. Or that's obviously not a reasonable position. What I mean is that I can't imagine a use case where they're good. It'd be good to have an example of kernel code where they use it.
And as I've already conceded user convenience is one of those things. (if you don't have a dynamic array type available and you'd rather just implement a linked list).
But for kernel code i hope it's not that hacky.
What you can have if you like is POINTERS. If you already have an element and want to associate data in some way to it you can point to other elements. And have those point to other elements you need.
>but that's just a linked list
No it's not. A linked list is a generalized structure where you store data in a fashion where you allocate data in some way (hopefully with a memory arena or you're gonna hit the cache _all_ the time) for a 'node' which is a structure which has a pointer to the next element (note, element, as it's a linkedLIST). Basically you can have a chain of dereferences without it being a linked list. A linked list is a structure. It's obsolete and only made for programmer convenience, which in most cases it lacks.
>linear search
That's all you can do with linked lists. As I mentioned if I had to search the linked list (and the gods commanded I'd use one) I'd have introduced some other datatype to avoid all the pointer-hassle. Mostly for search performance (bionic sort for instance).

If you've taken a reference of some form to a linked list element and we're to assume the same kind of constraints on both the vector and linked list. We basically have a single block allocated for a single integer in a vector. It's equal.
>>
>>55237579
>>55237592

I want t know how feasible would it be to create a program for a city. Meaning hundreds of thousands or even millions of people wil be able to go there and make suggestions and ask questions and finally through this process reach descisions about different issues.
and of course it would be divided into the proper areas, like neighberhoods and even spartment buildings.
Essentially an automated political system with in built voting.
The major problem is to transfer the descision making online and include within it experts that acn identify themselves.

To me as a layman it seems like it would be hard to join similair problems that different individuals raise.
If two people raise a very similar problem or solution the program must know how to merge them or put them into the same "place".
>>
strlen counts the \0 as well? REEEEEEEE
>>
>>55237684
Wouldn't it make more sense to have another symbol for escaping? If you don't know for example that \d means number you could assume you're trying to escape d, or that \. means you want to use the special fucntion of . instead of escaping it. It's fucking confusing.
>>
>>55237909
It's a bit confusing yes but it's very common to use that in programming so it's a convention.
>>
File: smug_sakura.jpg (29 KB, 337x404) Image search: [Google]
smug_sakura.jpg
29 KB, 337x404
>2016

>His software doesn't learn from experience

Found a dum-dum!
>>
>>55237903
no
#include <stdio.h>
#include <string.h>

int main()
{
const char *s = "meme";

printf("len = %zu\n", strlen(s));
return 0;
}

output
len = 4
>>
I'm coming from C# and I'm starting my first proper project in C++. What are some good design principles?
I used SOLID in C#, is this still viable here?
Better alternatives?
>>
>>55237889
That last line might be a bit iffy. Point is that when you assume similar/same constraints on both the vector and the linked list when comparing the vector is going to come out on top.

Like for instance: Why would you want an element to be after another if it's in an unsorted structure? (as it's implicitly going to be if you're inserting based on an arbitrary reference)
Then insertion in a vector is just as fast if not faster.

Perhaps I'm not explaining this well. It'd be easier with pen and paper. (but I can't be bothered with writing out all possible misinterpretations).

If you've found a use case for a linked list that you can profile and see that it's more efficient than a dynamic array assuming the same constraints. Then please do post it. It might take years to find though.

So basically don't use linked lists on principle. The chance that you're correct when using one is fairly low and the cost of using a vector instead is likely very minuscule.
It's like you have a bongo sort with this one seed end up being super efficient so you consider bongo sort for all your sorts. Just don't do it.
>>
File: 1466780615831.jpg (36 KB, 337x404) Image search: [Google]
1466780615831.jpg
36 KB, 337x404
>>55237928
>2016

>His software doesn't write itself

found a pleb!
>>
>>55237940
>design principles
>SOLID
Cancer.
Yes it's still viable though.
>>
>>55237934
do it on an argv
>>
>>55237969
argv isn't char* though, it's char**
>>
ask the pajeet anything
>>
>>55237889
>almost
Ok, looks like we're making progress and we might actually have a conversation (truth be told, your initial statement implied they're always bad and you said you'd never use them for anything, not only sorting).
>What I mean is that I can't imagine a use case where they're good
Off the top of my head: a stateful tcp server (ie. not request+reply+connection closed) evented with kqueue where you have to keep state per-connection; the kevent structure has a field for user data (it's a void pointer) and you can use it to point to your connection state structure, so each time data arrives on the socket you immediately have access to all the state you need, without searching for it, right? now, to keep things tidy, it would be nice to keep all these state structures in some kind of collection, so when/if the time comes to shut down/re-initialize/whatever, you have a way of getting to all that state and clean it up; but normal operation, doesn't need more access to that collection than add/remove "this element I have right here" when a new connection is made/closed. My position is that linked lists are vastly superior for this use case.
Linked lists (circular double-linked, to get pedantic): add updates 4 pointers, remove updates 4 pointers; completely deterministic behavior, can't fail
Dynamic arrays: add increments an index and stores the value of the pointer to the state structure OR must realloc and CAN fail; remove must search for the value we want to remove; some might say "but I don't have to search for the value, I can either add to the state structure the index in the array where it's stored OR a pointer to the actual array element" but that can't be done precisely because of an earlier raised issue: removal from arrays invalidate iterators (ie. indices if you want to store the index in your connection state and remove-by-index).

to be contd.
>>
>>55238316
contd.

It's the same with kernel objects (processes, drivers, events, etc): you rarely need to walk the collection, but you need low overhead (real-time if possible) insert/remove; eg. when a driver is loaded, it's structures are already in memory (ie, it doesn't need to kalloc its driver info) and initialization can't fail for the trivial reason "something went wrong when adding the driver to this collection"; you just link your driver structure to the rest of the loaded drivers by simply updating 4 pointers; you remove it the same way.

>you've taken a reference of some form to a linked list element and we're to assume the same kind of constraints on both the vector and linked list. We basically have a single block allocated for a single integer in a vector. It's equal.
That's the point, there's basically no way you can design this add/remove to be as fast/reliable as the linked list one, precisely because of an earlier raised issue: removal from arrays invalidate iterators (ie. indices if you want to store the index in your connection state -- from previous tcp example -- and remove-by-index).
>>
>>55238409
Looks like I repeated myself in the last paragraph of each post, sorry.
>>
File: oh the ironing.jpg (103 KB, 660x440) Image search: [Google]
oh the ironing.jpg
103 KB, 660x440
>>55237057
>>55237086
>>55237099
>>55237117
>>55237130
>>55237798
>mfw I learned that India doesn't use the Gregorian calendar
>>
>>55237943
>when you assume similar/same constraints on both the vector and the linked list
But that's wrong, and it's exactly how people misuse them: yes, most of the time, they want the facilities offered by a vector and try to use a linked list for to job; some of the time is vice-versa! They're separate data structures with separate strengths and weaknesses, you can't shoehorn them into having the same constraints. Instead, the job you need to get done has some constraints and based on those, you prick whichever structure satisfies them better. I think I addressed that in >>55238316 and >>55238409
>>
https://docs.google.com/document/d/1gCsFxXamW8RRvOe5hECz98Ftk-tcRRJcDFANj2VwCB0/edit?pref=2&pli=1

new Go GC comrade
>>
>>55238611
nice
>>
while True:
print("ded")
>>
>>55238611
Hell yeah!
>>
>>55235694
who /nothingtodoatworktodaysofuckingaroundandbeingunproductive/
>>
APL
Air traffic control systems
>>
If I post my code here will I get informed responses to the problems in my code?
>>
>>55239698
Well, you'll get responses
>>
I've been working on some Google Apps Script add-one for the last few weeks. And phew-lad, GAS is limited
>>
Someone tell me how to use the GtkSpinner in MonoDevelop. It has no reference to it at all although GtkSpinner is availible in Gtk2.
>>
is learning mathematical optimization useful for programming?
>>
I have no idea what this program is actually doing, but I got the problem from the book "c++ for everyone" by Cay Horstmann.
string fahrenheit = "fahrenheit";
string celsius = "celsius";
string input;
int input_int;
cout << "Enter either Celsius or Fahrenheit press f9 to exit program \n";
cin >> input;
if (input == celsius)
{
cout << "Enter the temperature of the water in degrees Celsius \n";
}
cin >> input_int;
if (input_int <= 0)
{
cout << "The state of the water is a solid at " << input_int << " degrees Celsius \n";
if (input_int > 0 && input_int < 100)
{
cout << "The state of the water is a liquid at " << input_int << " degrees Celsius \n";
}
if (input_int > 100)
{
cout << "The state of the water is a gas at " << input_int << " degrees Celsius \n";
}
}
cin >> input;
if (input == fahrenheit)
{
cout << "Enter the temperature of the water in degrees Fahrenheit \n";
}
cin >> input_int;
if (input_int <= 32)
{
cout << "The state of the water is a solid at " << input_int << " degrees Fahrenheit \n";
if (input_int > 32 && input_int < 212)
{
cout << "The state of the water is a liquid at " << input_int << " degrees Fahrenheit \n";
}
if (input_int > 212)
{
cout << "The state of the water is a gas at " << input_int << " degrees Fahrenheit \n";
}
}
>>
>>55239698
Most likely. The rudebess depends on how you phrase it tho. Be precise: if you have a specific problem in mind, describe it in details - i. e. expected output vs actual output, error messages, what was problematic with your precedent iteration if that matters, and that's not exhaustive. If you'd lije criticism on a working program, just say what it does. If all of these are met, you'll be met with Himegoto's blessings. See ya!
>>
>>55239770
What was the problem statement then? So you wrote that without knowing what you were doing -dunno if that's a good or bad thing- or you copied from that book?
>>
>>55239770
This is supposed to tell you if water is liquid, solid, or gas in Celsius and Fahrenheit. The expected output does not do exactly as the program is intended for. The input is not working as it should.
>>
>>55237928
Actually, I'm writing an MPD client that learns what songs I like based on whether I skip them or not, and adds songs to the queue based on my precedence for it, the last time I watched it, and if it was newly added to the database.
>>
File: Vanilla_Ice.jpg (163 KB, 460x640) Image search: [Google]
Vanilla_Ice.jpg
163 KB, 460x640
Hey /dpt/.

So I recently got my very own C programming book and I was wondering:

How long does it take before I am proficient and able to create my own programs in it?
>>
>>55240063
It depends on many factors, such as the kind of programs you want to create, and whether or not you read the book.
>>
btn = tkinter.Button(root, text="test", command=lambda:button_click(btn))
btn.pack()


is var self reference like that bad?
>>
>>55240113
For the sort of person who asks that kind of question, I'm thinking quite a long time.
>>
>>55240113
Well of course I will read the book!

I want to make programs, learn about computing and so on.
>>
[\d\.]+


Why can this regex return things like "125.145", without making it \d+, because a normal \d just means numbers between 0-9, right?
>>
Anyone know of a way to set stdin to a socket handle?

I need to be able to poll stdin for available input, without sitting on a read in command.
>>
>>55239770
I see. So first off: all of the "ask the temperature and answer whether water is liquid" part should be in the braces for the ifs, otherwise it doesn't make sense. Do this. Also add an else case for "I don't understand
 input 
" just so I can check something. And yes, obviously, run and test your program afterwards.
>>
>>55240159
Regex is the most insane pile of crap ever invented. Just parse strings yourself, it's faster and more efficient than regex because that's all regex is doing anyway and doing it TWICE to first parse your line noise BS regex and then applying it to your string. I have happily ignored regex for my entire career as a GNU sysadmin writing scripts and fucking everything else and been quite happy that I didn't pollute any of my scripts and other things with unreadable line noise.
>>
>>55240243
Please see "man dup". You're manipulating good old file descriptors right?
>>
>>55240243
Pipe? Aren't both just file descriptors, so you should be able to pipe from one to another.
>>
>>55240289
How do you parse lines in scripts exactly? I'm curious.
Domain specific languages anyone?
>>
>>55240159
because + is one or more
square brackets is the selection of characters

if you want 125. from 125.145 then [\d]+[\.]+
>>
>>55240361
I thought brackets meant you grouped it together, like brackets in math. So what it's doing is just looking for either a number or a dot over and over again?
>>
>>55240301
Is dup not just for Unix? I don't know of a unistd windows header. (I do need it to be portable, as I'll have to communicate between a debian and windows machine.)

>>55240311
I believe they are. I was hoping to not have to pipe though.
>>
>>55240159
>> a normal \d just means numbers between 0-9, right?
It depends in which software you try to use this regex. There are many different flavor. "\d" is the number class in PCRE regex (Perl regex), but it's just a "d" escaped in ERE regex (POSIX extended regex).

>>55240289
> "Regex is crap because I don't known how to use it"
That's sad.
It's true that's regex are overused, but they are very convenient in many cases.
>>
>>55240396
"125.145" are all either digits or dots...
>>
>>55240396
>So what it's doing is just looking for either a number or a dot over and over again?
Yes.

Assuming PCRE regex, "[\d\.]+" means "1 or more, of (any character in the brackets)." So "1.2...34...5678" would match.

What do you want to match ?
>>
>>55240510
Exacly what it's doing, I just wanted to understand how it worked.
>>
>>55240405
If you have fds, you should have dup2... Cygwin or what? Cygwin provides dup2 ain't it guys? At least go check...

Also if you have a fd and you want a stdio FILE* with buffering to operate over it (I'm not sure, I extrapolated your intentions), you might be better off using fdopen and getting input what it created, rather than trying to hijack *stdin. Just my two cents.
>>
>>55237889

>gods

I'd just like to interject for a moment. What you're referring to as God,
is in fact, Kek/God, or as I've recently taken to calling it, kek plus God.
God is not an omnipotent being unto itself, but rather another component
of kek made possible by meme magic, pepe, and vital websites comprising a full memeatic religion, as defined by DAT BOI

Many 4chaners praise a modified version of Kek every day,
without realizing it. Through a peculiar turn of events, the version of Kek
which is widely worshiped today is often called "God", and many of its followers are
not aware that it is basically Kek, made possible by the meme magicians of 4chan .

There really is a God, and these people are worshiping it, but it is just a
part of the religion they use. Kek is the Base: the meme magic on the site
that allocates the magic resources to the other memes that you view.
memes are an essential part of Kek, but are useless by theirself;
they can only function in the context of a complete memeatic religion. God is
normally used in combination with Kek: the whole system
is basically Kek with God added, Kek/God. All the so-called "God"
religions are really versions of Kek/God.
>>
What are some of the best books on security-oriented C?

I'm talking from a design patterns, best practices point of view. There's already plenty of books on reverse-engineering software written in C, but none with a focus on actually writing high-quality secure C for the 21st century.
>>
>>55241026
there's nothing you can do to stop someone from reversing your executable

there's no point in even trying unless you want to sell PE protectors to business people who don't know any better
>>
>>55241026
https://www.securecoding.cert.org/confluence/display/c/SEI+CERT+C+Coding+Standard
>>
>>55241026
If you want security, don't use C.

C is fine if you're running on a non-critical embedded system with no network access (like an old game console or music player).

Even assembly is better for writing secure software than C.
>>
How portable is python? Is it like Java where it can be in literally anything?
>>
learning regexes
wcl@dei:~$ curl -s 'http://deron.meranda.us/data/census-dist-female-first.txt' | sed 's/^\([A-Z\-]*\).*$/\1/g' | grep '^[^A-W]' | grep '[^AONGE]$'
YU
YI
XOCHITL
YURI
YUK
YER
YUKI
YAEL
>>
>>55241126
that's the idea, but if you're dealing with extremely obscure platforms then they might support java but not python
>>
>>55241126
What kind of literally anything do you mean?
Python runs on anything I ever came across
>>
>>55236330
>theoretical physicist
Back to writing papers on string theory, shitface.
>>
>>55239759

very useful. many problems can be elegantly solved by generating all possible solutions (given some constraints) and optimising for specific metrics
>>
>>55241202
>bruteforcing
>elegant
>>
>>55241152
>>55241193
Question, does python require the python interpreter like java requires the JRE?
>>
>>55241249
The reason why Python and Java run on anything is /because/ of their bytecode interpreters, it can be "easily" ported to other platforms.

So yes, to run python, you /do/ need the interpreter.
>>
File: 1453526566774.png (530 KB, 800x900) Image search: [Google]
1453526566774.png
530 KB, 800x900
>>55241067
Yeah I know it's pretty pointless to try to stop someone from stepping through my executable with GDB, but I'd like to have my programs stand up anyway should they be "audited" in that manner

>>55241101
What causes C to be more insecure than any other "mid-level" programming language? C is the only language without garbage collection that I personally know, so my frame of reference might be off.

>>55241098
this is pretty much what I was looking for, thanks!
>>
>>55241249
you could compile it to native c code which would probably me more supported

(ALL chips come with a C compiler)
>>
>>55241291
That'd be nuitka, right?
>>
Is there anything wrong with C#?

If I wanted to use C# with a bunch of code written in C, would there be any substantial overhead for going between the two contexts a lot?
>>
>>55241291
If I can compile python to native C code, why not just use C in the first place?
>>
>>55241144
you should try making it use only sed.
>>
>>55241334
because then you'd have to write C code
as opposed to writing Python code
>>
>>55241334
Because you'd get the benefit of writing in Python, but much faster performance
>>
>>55241101
>>55241288
If you want a safer low-level language I'd suggest Rust - it has built-in memory safety without a garbage collector (because the entire language is built around predictable allocation and deallocation, so the compiler can figure out when to free your memory).

It's really hard to program data structures whose functions take care of things like buffer overflows *for you* in C, which means you'll probably take care of that individually for each buffer, which means more chances to fuck it up.
>>
>>55241347
>>55241358
Is Python honestly better than C?
>>
>>55241026
>>55241067

Obfuscating shit to make it reverse-engineering-proof isn't the answer, trying to actually not write exploits is the answer.
>>
>>55241370
>Is Python honestly better than C?
For bigger systems that are abstract from machine-level concerns, yes.

Now, if you say "Is Python actually better than ____" where ___ is a statically-typed compiled language that you can actually build abstractions in, like C++, Go, Rust, D, Vala, or somesuch, then you'd have a real hard question.
>>
>>55241434
What about for someone who never has done programming before?
>>
>>55241370
No.
>>
>>55241229
yes -prolog
>>
>>55241463
Eh.

Python will be easier to build cool shit in and play around with, thus you are more likely to not quit and fuck off.

You will learn more from C, and if you keep your projects really small and simple (i.e. all command line) it'll be easier than you might think.

I can tell you that much but beyond that I can't decide for you.
>>
>>55241463
I think Python is easier for beginners to pick up, as long as you're aware that it does some things differently. Plus it forces beginners to keep everything properly indented all the time, which IMO is just good practice even when you move on to other languages
>>
>>55241506
Is there a limit on how powerful I can build with python?
>>
File: quadtree.png (21 KB, 658x370) Image search: [Google]
quadtree.png
21 KB, 658x370
/agdg/ was no help. I'm trying to make a game, and an important part of the game is hundreds of bullets on screen at once, sort of like a bullet-hell shooter. When I have to check all the bullets for collision against all the platforms, the framerate plummets into the single digits. I have a quadtree but the framerate is still really low. Is there something wrong with my quadtree, or what?
Pic related is how I'm creating the quadtree, the code for the quadtree itself is here: http://hastebin.com/usixefotop.coffee
>>
>>55241530
Anon, come on.
>>
>>55241530
No.

The limit is whatever you do will run a little slower / laggier. For most things a beginner wants to make, this doesn't matter, since the amount of CPU time your program consumes will be tiny and impossible to notice either way. However, if you try to do something like rendering complex 3D scenes, doing image-processing on video from a camera in real-time, or running a neural network, it'll take noticeably longer to do anything (for realtime applications this means lower framerate).

Python is actually more suitable to building big complicated projects than C is, FYI.
>>
>>55241321
pls

Googling these questions gave me some vague answers.
>>
>>55241584
>http://hastebin.com/usixefotop.coffee
>requires javascript to see anything
why

also use a profiler.
>>
>>55241526
>>55241594
If I started with python, will it be difficult to move to C, will I have to do a lot of relearning?
>>
>>55241650
I think I might have figured it out, actually. I think it might not be the collision between the bullets and the platforms, but the bullets and the enemies instead.
>>
>>55241655
Yes.
idiomatic python reveals nothing about how memory is allocated when you do anything.
In C, at the very least, you will be tripped up by the mere fact that there's no such thing as automatic initialization of variables or strings.
You have to do these things explicitly.
Manual memory management is also pretty much required if you want to keep persistent arrays larger than the size of your stack (usually 10MB).
>>
>>55241678
Very well, I'll start with C rather than start with python and have to do a ton of relearning later.
>>
>>55240396
Square brackets mean a character set whereas parens mean a capture group.
Thread replies: 255
Thread images: 22

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

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.
If a post contains personal/copyrighted/illegal content you can contact me at [email protected] with that post and thread number and it will be removed as soon as possible.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com, send takedown notices to them.
This is a 4chan archive - all of the content originated from them. If you need IP information for a Poster - you need to contact them. This website shows only archived content.