|
psudocode:code:
Seaside Loafer fucked around with this message at 12:02 on Dec 19, 2017 |
# ? Dec 19, 2017 11:51 |
|
|
# ? May 31, 2024 19:56 |
|
huhu posted:
If the "[hiring]" bit is always at the beginning you might eliminate false positives like so: code:
|
# ? Dec 19, 2017 16:40 |
|
Shy posted:What are the trial limitations on Sublime Text? I can't justify paying for it right now and will probably stick to VS and JetBrains anyway but it looks really neat. I installed it a few days ago and it's not asking for anything.
|
# ? Dec 19, 2017 17:03 |
|
Is there anything legitimately useful/productive that you can do with recursion, or is it just retarded mental gymnastics for CompSci classes? I don't imagine there's a lot of money to be made checking strings for palindromes or calculating Fibonacci numbers.
|
# ? Dec 20, 2017 17:37 |
|
AgentCow007 posted:Is there anything legitimately useful/productive that you can do with recursion, or is it just retarded mental gymnastics for CompSci classes? I don't imagine there's a lot of money to be made checking strings for palindromes or calculating Fibonacci numbers. Any computations on tree structures are a good fit for recursive methods. That includes things like binary search trees and their variations, but also things like expression parsing.
|
# ? Dec 20, 2017 17:41 |
|
AgentCow007 posted:Is there anything legitimately useful/productive that you can do with recursion, or is it just retarded mental gymnastics for CompSci classes? I don't imagine there's a lot of money to be made checking strings for palindromes or calculating Fibonacci numbers. Recursion is very useful and it pays to be able to think about problems in that way. Also, you'll get along with people better if you don't call things retarded.
|
# ? Dec 20, 2017 17:48 |
|
Recursion is pretty much the best way for dealing with immutable collection types, but some Scheme implementations (thinking of Racket) have for constructs that combine the convenience of looping with the rigor of recursion.
spiritual bypass fucked around with this message at 18:02 on Dec 20, 2017 |
# ? Dec 20, 2017 17:58 |
AgentCow007 posted:Is there anything legitimately useful/productive that you can do with recursion, or is it just retarded mental gymnastics for CompSci classes? I don't imagine there's a lot of money to be made checking strings for palindromes or calculating Fibonacci numbers. The reason recursive algorithms presented in class seem boring or stupid are because the interesting things take too long to explain and don't fit on a single slide per example. It absolutely solves real problems in real software. You will also see recursion used in several common sorting algorithms, in particular quick sort and merge sort are naturally expressed with recursion. Edit: Traditional AI algorithms in games will often involve some kind of path of pathfinding or backtracking algorithms, that are natural to express with recursion, for one example. You might encounter something like the 8 Queens problem later on, it's not quite AI but it's close to the kind of solving you do in it. nielsm fucked around with this message at 18:09 on Dec 20, 2017 |
|
# ? Dec 20, 2017 18:05 |
|
Nowadays my for-pay programming is nothing comp-sci heavy. It's all web backend stuff which is mostly just simple logic. I still find myself using recursion. Most recently it was for the canonical example of walking files in a directory tree.
|
# ? Dec 20, 2017 18:08 |
Recursion comes up rarely but consistently in normal programming work. Also, sometimes your co-workers write something that doesn't need to be recursive recursively, so you need to understand recursion in order to refactor it to the iteretive version.
|
|
# ? Dec 20, 2017 18:14 |
|
Eela6 posted:Also, sometimes your co-workers write something that doesn't need to be recursive recursively, so you need to understand recursion in order to refactor it to the iteretive version. Yeah, this happens too. Sometimes we're too busy asking if we can do this recursively without asking if we should!
|
# ? Dec 20, 2017 18:16 |
|
AgentCow007 posted:Is there anything legitimately useful/productive that you can do with recursion, or is it just retarded mental gymnastics for CompSci classes? I don't imagine there's a lot of money to be made checking strings for palindromes or calculating Fibonacci numbers. It will come up more frequently in interview questions too, so you're hosed if you don't know it.
|
# ? Dec 20, 2017 18:29 |
|
Recursion is cool. I haven't seen it in anything at my job yet, but I remember during my bootcamp I ended up using it for a few things, such as rendering nested comments. Also if you believe everyone who says functional programming is the future, then in functional languages (like Elixir, for example), you'll often see tons of recursion as alternatives to loops.
|
# ? Dec 20, 2017 19:01 |
|
The Dark Wind posted:Recursion is cool. I haven't seen it in anything at my job yet, but I remember during my bootcamp I ended up using it for a few things, such as rendering nested comments. Also if you believe everyone who says functional programming is the future, then in functional languages (like Elixir, for example), you'll often see tons of recursion as alternatives to loops. Recursion is not cool. It is most often than not (depending on your compiler or JIT) a waste of cpu cycles and stack space. Usually (not always) an iterative algorithm can solve the same problem faster and cheaper. However, recursion is trivial to reason about, nice to look at and read. And sometimes, the iterative algorithm does not provide such gains to justify for the increase in complexity. Use recursion with care.
|
# ? Dec 20, 2017 19:45 |
|
If you're doing it properly, you're using tail recursion and not adding any stack frames
|
# ? Dec 20, 2017 20:01 |
|
Knowing how to knock up a simple recursive descent parser is a useful skill to have at your disposal.
|
# ? Dec 20, 2017 20:35 |
|
Eela6 posted:... sometimes your co-workers write something that doesn't need to be recursive recursively, so you need to understand recursion in order to refactor it to the iteretive version. Fun fact: nothing ever NEEDS to be written recursively. Any recursive function can be refactored to be iterative.
|
# ? Dec 20, 2017 20:42 |
Newf posted:Fun fact: nothing ever NEEDS to be written recursively. Any recursive function can be refactored to be iterative. How do you traverse all nodes in a tree in constant space, without modifying the tree itself? (Assume the tree does not have "parent node" pointers.)
|
|
# ? Dec 20, 2017 20:48 |
|
nielsm posted:How do you traverse all nodes in a tree in constant space, without modifying the tree itself? (Assume the tree does not have "parent node" pointers.) You don't. Not even recursively.
|
# ? Dec 20, 2017 20:50 |
Nippashish posted:You don't. Not even recursively. Exactly. Whether the recursion is expressed by the language grammar used, or by manually managing a stack, it's still a recursive algorithm. You need the log(depth) space of stack to traverse a tree and that makes it a recursive algorithm. E: Also, a professor in CS talking about inherently recursive problems that cannot be rewritten as iterative problems: https://www.youtube.com/watch?v=i7sm9dzFtEI vvv and no that's obviously not what I mean (the key words are not "constant space", but "maintaining a stack by necessity") nielsm fucked around with this message at 21:29 on Dec 20, 2017 |
|
# ? Dec 20, 2017 21:23 |
|
Dynamic memory allocation makes things recursive. Got it.
|
# ? Dec 20, 2017 21:25 |
|
Even with traversing a tree, I honestly sorta prefer iteration because it allows you to express things that aren’t very easy with the traditional recursive call structure. Any tree traversal can be reduced to a loop where you stick the root into a data structure, then iteratively take elements from the data structure and add their children to the data structure, repeating until the data structure is empty. In a depth-first traversal, the data structure is a stack. In a breadth-first traversal, it’s a queue. Or use both ends of a deque at random to confuse the gently caress out of people. You can paralellize the traversal over any arbitrary partition of the data structure. Or if you’re searching for something the data structure can be a priority queue ordered on a closeness heuristic.
|
# ? Dec 20, 2017 22:32 |
Newf posted:Fun fact: nothing ever NEEDS to be written recursively. Any recursive function can be refactored to be iterative. This is the opposite of fun.
|
|
# ? Dec 20, 2017 22:37 |
|
nielsm posted:Exactly. Whether the recursion is expressed by the language grammar used, or by manually managing a stack, it's still a recursive algorithm. You need the log(depth) space of stack to traverse a tree and that makes it a recursive algorithm. There is at least one entirely sensible definition of "recursion," used in common parlance, that does not encompass tree traversal via explicit stack management, and everyone who's ever thrown out "oh I guess you don't know what recursion means " is perfectly aware of this fact.
|
# ? Dec 20, 2017 23:24 |
|
imo recursively gather elements if you want, but iteratively process them. unreal 4 based its entire object loading system on recursive "load thing, load thing's dependencies, load thing's things dependencies" which made it A: impossible to profile properly, B: impossible to follow what's loading what, C: impossible to reduce to a simpler set of more important things having priority, D: impossible to be multithreaded at all. Losing multithreading is probably the biggest hit here.
|
# ? Dec 21, 2017 01:39 |
|
A series of unique timestamps will not compress at all in a Huffman tree right ? e: Thanks ! unpacked robinhood fucked around with this message at 10:57 on Dec 21, 2017 |
# ? Dec 21, 2017 09:53 |
|
unpacked robinhood posted:A series of unique timestamps will not compress at all in a Huffman tree right ? Take a segment of the series and count the number of times each character appears. Sort the counts and plot the resulting line. The flatter this line is the less Huffman coding will save you.
|
# ? Dec 21, 2017 09:59 |
|
baka kaba posted:If you're doing it properly, you're using tail recursion and not adding any stack frames If you're doing it properly, you're using a language that doesn't optimize tail recursions so you don't have to worry about that stuff.
|
# ? Dec 22, 2017 19:10 |
|
I'm new to open-source collaboration. What do you do with your local code after you merge someone's PR on Github? Deleting and git-cloning the local code would work; is there a more elegant way? edit: In PyCharm, I clicked VCS -> Update -> OK (Merge and Stash selected); the result seemed to be what I asked. Dominoes fucked around with this message at 23:05 on Dec 23, 2017 |
# ? Dec 23, 2017 23:01 |
|
Dominoes posted:I'm new to open-source collaboration. What do you do with your local code after you merge someone's PR on Github? Deleting and git-cloning the local code would work; is there a more elegant way? Why can you just pull?
|
# ? Dec 23, 2017 23:25 |
|
I dunno; 'git init', 'git add .', 'git clone https://github.com/...' , and 'git commit -am "updated things"' are the only commands I'm familiar with.
|
# ? Dec 23, 2017 23:41 |
|
Dominoes posted:I dunno; 'git init', 'git add .', 'git clone https://github.com/...' , and 'git commit -am "updated things"' are the only commands I'm familiar with. add git pull to the list and you're a git master. nothing to worry about anymore.
|
# ? Dec 24, 2017 00:19 |
|
git pull and git push are two pretty useful commands to learn. They're what let you talk to remote repositories, such as the one on github. If you initialized your repository with a clone, then you should be able to run "git pull" with no additional parameters to pull any changes to the master branch, assuming that you don't have any conflicts with the github repository and your directory is clean (no uncommitted work). For a fork and pr based workflow with no branches, accepting a pr would look like 1. "git push" to bring your github master up to date with your local. 2. At this point I would download the pr and review it, but let's just say that it's fine for now 3. Accept the pull request on github 4. "git pull" to bring your local repository up to date with the one on github.
|
# ? Dec 24, 2017 00:23 |
|
Thanks dudes; sounds like 'git pull' is the way to handle this. (I accidentally omitted 'git push' from my list of known commands earlier). What would happen if I pushed; someone submitted a pull request; I merged the pull, and (the step that differs from what I described), I made a change locally before running git pull?
|
# ? Dec 24, 2017 00:34 |
|
Dominoes posted:Thanks dudes; sounds like 'git pull' is the way to handle this. (I accidentally omitted 'git push' from my list of known commands earlier). If you're making the local change in a different branch than the one that the PR was merged into, nothing will happen. If you're making your changes on master directly, you should instead move to a workflow where you keep your changes in your own feature branches and then you can rebase them onto the new state of master after PRs are merged. For the record, if you are making commits on your local copy of master and upstream master changes and you pull, Git will create a merge commit. You probably don't want to do this because it will uglify master's history.
|
# ? Dec 24, 2017 01:03 |
|
If I have a cURL command that I can run fine in the windows command line, but not in the XAMPP command line, what should I do to troubleshoot. I've already ran phpinfo() on my local server, and cURL seems to be enabled and running.
|
# ? Dec 27, 2017 19:02 |
Grump posted:If I have a cURL command that I can run fine in the windows command line, but not in the XAMPP command line, what should I do to troubleshoot. Uh start by opening your eyes and looking at what happens, instead of cowering in fear. Does it fail to even begin the request, i.e. is it a client-side parsing problem or similar? Fail DNS lookup? Fail to connect to server? Server reached seems to be something else than requested? Server is correct but does not respond in the expected way? If the server responds, what does it actually say? Or does the request hit the correct resource with no errors but still produce a wrong result?
|
|
# ? Dec 27, 2017 19:10 |
|
Grump posted:If I have a cURL command that I can run fine in the windows command line, but not in the XAMPP command line, what should I do to troubleshoot. curl -v ... Also, please don't call it cURL instead of just curl, it's weird and makes me uncomfortable seeing it.
|
# ? Dec 27, 2017 19:54 |
|
jesus. okay obviously I'm a beginner if I'm asking this thread how to troubleshoot. After adding the -v flag, I was able to troubleshoot. Now I can get my curl command running in the xampp shell, but not in my browser. And adding the -v flag in the browser returns nothing. teen phone cutie fucked around with this message at 22:12 on Dec 27, 2017 |
# ? Dec 27, 2017 21:32 |
|
|
# ? May 31, 2024 19:56 |
Are you calling the commandline tool "curl", or are you using the curl functions in PHP? The two may be different.PHP code:
PHP code:
|
|
# ? Dec 27, 2017 22:13 |