HNHacker News
TopNewBestAskShowJobs

stack_underflow

88 karma · joined July 10, 2012

submissionscomments
stack_underflow··on Ask HN: As a developer what are your aha moments?
1. The first language I ever used/learned was batch to script things in windows. When I learned python shortly after I recall it taking quite a bit of convincing myself to accept/use the "magic" of control flow being able to automatically jump back after a function returned as I was so used to manually wiring up all my gotos (was more of a painful experience than an 'ah-ha' I guess...)

2. When I was going through Tim Roughgarden's Algorithms course and saw the derivation of runtime complexity for mergesort and finally understood/visualized what a logarithm actually did (in school it was just taught as some rote function to help you manipulate eqautions of the form y=b^x)

3. Learning how TCP works from the bottom up. I think the biggest aha moment was when the textbook I was reading explained the TCP algorithm as a state machine that's just running on the client and server machines with the rest of the underlying network just forwarding packets, i.e. "pushing the complexity to the edge of the network".

4. Working through the nand2tetris project resulted in a lot of "oh X is just basically this at its core"

5. When going through a textbook explaining how relational database engines were implemented and seeing that they're essentially just using disk-persisted hash tables and self-balancing search trees to build indices on columns and make `select`s O(1)/O(log) time (I wasn't taught this in my uni's database course and assumed there was some fancy magic going on to make queries fast)

6. Realizing that I could just do a form of graph search/dependency resolution when learning a new codebase/trying to understand how a function works. I think before seeing someone do this in front of me I would usually just panic at the thought of "thousands of lines of code" rather than just "keep iteratively diving into the functions being called". Whenever I'm learning a new language, the first thing I'll do is setup the LSP plugin in vim so that I can quickly navigate up and down call graphs. Tbh I don't understand how some developers claim to not need this and instead just manually grep+open file in order to "jump to definition".

7. Forcing myself to derive the rotation logic for AVL trees. I was curious if, given just the high level properties of how an AVL tree behaves in order to guarantee O(log) time lookups, if I would be able to figure out all the rotation cases. Was a very rewarding exercise and something I plan on writing a blog post about (eventually...)

(edit)

8. Learning about the log data structure and how state can be replicated by replaying/executing this stream of transformations/updates.

stack_underflow··on Ask HN: Did something happen to TopCoder?
Are you referring to the TopCoder Arena java applet? It still exists here: http://community.topcoder.com/contest/arena/ContestAppletPro... . They've redesigned the site recently but to access it you can just visit topcoder.com/tc and click Challenges -> topcoder Arena.

The browsable problem archive is also in the same location: http://community.topcoder.com/tc?module=ProblemArchive.

stack_underflow··on Show HN: Vim Awesome – Vim plugins
Also, the new Plugin command doesn't support double quoted string arguments, it gets parsed as a trailing comment. I discovered this after I s//'d my Bundle "<plugin>" lines to Plugin "<plugin>" and received 'Argument required' errors. The fix was to use single quote strings, i.e. Plugin '<plugin>'
stack_underflow··on Standings in 38th Annual World Finals of the ACM International Collegiate
I highly recommend the book Competitive Programming 3 by Steven and Felix Halim (https://sites.google.com/site/stevenhalim/). I prefer the larger print version as it's much easier to read and have laying on your desk. It has tonnes of references to problems on the UVa Online Judge (another popular judge site) at the end of each chapter so you can work on problems relating to the covered theory.

My first serious introduction to algorithms was through Tim Roughgarden's 'Algorithms: Design and Analysis' course on Coursera. It's a nice formal introduction and really focuses on and builds an intuition for how to think about problem solving like a computer scientist. I'd also recommend Steven Skienna's Algorithm Design Manual as it's written in a similar style.

As mentioned earlier, the TopCoder Online Judge is a great tool to practice problems as well. I could never find a tutorial which covered how to effectively use TopCoder as a practice tool so I wrote one for my programming club: http://acx0.com/cpc/topcoder.html (note: the rest of my site is a complete mess right now)

Of course, there's tonnes of other resources out there but these would be my top recommendations so far.

stack_underflow··on Standings in 38th Annual World Finals of the ACM International Collegiate
Competing in algorithmic programming competitions is an extremely eye-opening experience. I competed in 3 ICPC regionals during my time as an undergrad and realized that my level of knowledge in core/fundamental algorithms was (and still is) an absolute joke compared to some of my competition.

I realize I didn't exactly put a lot of time into practicing and learning new material, but now that I've graduated I'm hoping to practice more and eventually try raising my rating on TopCoder. If anything, training for ICPC drilled the basics of algorithms and data structures into my head and lead me to find tons of excellent resources for improving in these competitions (and consequently, programming/problem solving in general).

stack_underflow··on Vim esckeys
I forgot all about this problem ever since I remapped 'jk' to <esc>. Although when I was primarily using <C-[>, I tried the timeoutlen and ttimeoutlen solution but couldn't really find any values that didn't conflict with my preference of delay allowed between entering personal map key sequences (other than the default, which is what partially causes the problem).
stack_underflow··on What are the most intellectually stimulating websites you know of?
You should check out sites like TopCoder [0] or UVa's online judge [1]. These sites offer tons of problems that focus more on algorithms and data structures, rather than just number theory and math-based problems like Project Euler - which I find becomes repetitive really fast. These judge sites will have problems ranging in topics such as ad hoc, searching, sorting, greedy, graph theory, geometry, dynamic programming, etc.

If you want to get started, try going through TopCoder's high school competition arena. The problems shouldn't be too bad if you have a good understanding of your languages stdlib and about basic data structures (alternatively, it's probably a great way to learn a new language's stdlib). You basically get a problem statement and just have to fill in a method that performs the computations required with the example inputs. Then you can test it against all the test cases once it passes the example outputs. UVa is similar, except you have to take input from a file and it doesn't tell you what test cases your solution fails on (more like the ACM ICPC style of questions).

I prefer TopCoder more since the focus is all on algorithms (UVa's problems will usually require taking input/producing output in very specific ways, which gets annoying sometimes), and since you can see the top ranked competitors' solutions for previous contents. It helps to review these after you solve a problem to pick up little tricks.

[0] (http://www.topcoder.com/tc) - click the O(n) icon in the top left to start the arena applet. Then go to "Practice Rooms" -> "TCHS" or "SRM" and pick a room. Within each room there should be 3 problems valued based on difficulty.

[1] (http://uva.onlinejudge.org/) - go to "Browse Problems" to view them all, but I find http://uhunt.felix-halim.net/ more useful; just enter your username and it'll suggest problems for you to do next (based on increasing difficulty)

stack_underflow··on Vim Creep
'man -K' is also useful, for when you want to search the contents of man pages and not just the descriptions.
stack_underflow··on On Configuration
I've designed my dotfile repo to be easily installable on any machine I happen to be on with the help of a script that backs up any existing dotfiles that may conflict with those in my repo. This allows me to backup any existing configs, link my own temporarily, then restore the old ones and 'rm -rf <my-repo>' so it's as if I never even touched the original configuration.

If you want to try it out just run the following commands:

    git clone git://github.com/acx0/etc.git ~/etc
    cd ~/etc
    git submodule update --init     # my link script is in a separate repository so it's a submodule in my dotfile repo

    cd link.sh
    ./link.sh                       # this will show the status of any conflicting files
    ./link.sh -b                    # backup any conflicting files
    ./link.sh -wf                   # force write (symlink) my set of config files
And everything's set up. If you want to install the vim plugins I use, just run

    vim -c 'BundleInstall'
and let Vundle download the plugins (you have to restart vim to use the plugins).

Then when you're ready to restore your ~/ back to its original state, run

    ./link.sh -r                    # restore any configs that were backed up
which also takes care of deleting the configs you didn't have (so if you backed up with no conflicting files (backup dir empty), and then restore, it'll just remove all the existing symlinks)

If you didn't run the backup command, you can simply run

    ./link.sh -d
to delete the symlinks for all the files in the repo. Then just remove any traces of the repo with 'rm -rf ~/etc'.
← PreviousPage 2 of 2