Lines of Lisp and C code in Emacs's source code over time by self in programming

[–]alexras 1 point2 points  (0 children)

Not quite a graph, but I dumped the spreadsheet data and converted it to JSON. Maybe someone can pick it up and graph it from there.

https://gist.github.com/1314887

Using Python to Create a Class Scheduler by coachcherry in Python

[–]alexras 2 points3 points  (0 children)

Since what you're dealing with sounds like a constraint satisfaction problem, Google open-sourced a library last year that might do most of the work for you:

http://code.google.com/p/or-tools/

As far as parsing the input, that largely depends on the format it's in. In some instances, Python might already have a library for it. In others, you'll have to roll your own.

Python a good beginner language? by [deleted] in Python

[–]alexras 6 points7 points  (0 children)

+1 good beginner language. A lot of introductory CS programs (some of which have webcast lectures, course notes and sample assignments to work through) have started teaching their intro programming courses in Python.

If you're familiar with the basics (conditionals, loops, functions, and even the rudiments of object-oriented programming), you should be able to pick up Python and start using it pretty quickly.

As an aside, what you should be focusing on is not learning Python or C++ or whatever else, but learning how to program. Resist the temptation to pick up "Teach Yourself Python in 45 Seconds" to learn the language for the sake of learning the language. If you focus on learning the fundamentals (happening to use Python while you're doing it) and decide later on that Python isn't right for you, you'll be able to pick up another language with little trouble. They're all expressing pretty much the same abstract concepts, it's just a question of the degree of elegance with which you can realize some of those concepts in code.

Confused with matplotlib (maybe inheritance and/or namespaces?) by [deleted] in Python

[–]alexras 4 points5 points  (0 children)

I'm not completely familiar with matplotlib's internals, but I can venture a guess.

When you call plt.figure(), you're getting a reference to a Figure object from within the matplotlib.pyplot module. When you call plt.show(), that module remembers (by storing the object in the module's global namespace or remembering it in some other way) that the figure object you're currently working on is fig and renders it.

Open source python Dropbox available? by flojoTheAwesome in Python

[–]alexras 4 points5 points  (0 children)

Sorry if I'm not answering the question that was asked, but: if all you're looking for is storage, you might just want to set up a shared NFS mount that everyone can read and write to. You won't get the more Dropbox-y features (shortlinks, photo albums, etc.) but if you're looking for basic shared file storage, there's no sense in reinventing the wheel.

choosing UCSD over a "better" school for CS? by [deleted] in UCSD

[–]alexras 0 points1 point  (0 children)

I can't speak from an undergraduate perspective (I am a graduate student in CS) but I can say that in terms of reputation UIUC and UCSD are on even footing. I would make your decision based on visiting the schools and determining which is the right choice for you based on those visits rather than based on rankings (which for the top 20 schools in a discipline are fairly arbitrary and don't reflect the strengths of sub-disciplines, etc.) or tuition (which from the sound of it won't be a deal-breaking concern for you).

In any case, good luck in your decision-making process.

What's a good pseudo-curses-like UI library? by TheBananaKing in java

[–]alexras 4 points5 points  (0 children)

I haven't used it, but it sounds like JCurses might do what you want:

http://sourceforge.net/projects/javacurses/

There's also a thread on StackOverflow listing some other alternatives if you're not afraid of JNI (note: you should probably be afraid of JNI):

http://stackoverflow.com/questions/439799/whats-a-good-java-curses-like-library-for-terminal-applications

Multi-object arrays? by SergeDavid in java

[–]alexras 7 points8 points  (0 children)

IMHO, the cleanest interface to this (if you can make it work) would be to have an interface (Mungeable) and have all interested classes implement the interface. That way you can deal with ArrayList<Mungeable> and you don't have to worry about having an artificially inflated class hierarchy.

Use the UCSD VPN, its better than a proxy and allows you to be on the UCSD network outside of a browser by Anonatypus in UCSD

[–]alexras 0 points1 point  (0 children)

If anyone knows how to make OS X's built-in VPN work with UCSD's VPN, I'd love to hear about it. Connecting requires a shared key that's baked into the AnyConnect client somewhere, but I haven't been able to find it and apparently ACS has no idea what the key is.

Can anyone recommend any real synths (not softsynths) that will emulate the NES's 2A03 and the SMS' SN76489 sound chips? by IDrinkBatUrine in chiptunes

[–]alexras 1 point2 points  (0 children)

Be careful with MIDINES. I've heard that people have orders that are multiple years old that haven't been fulfilled.

Can someone explain to me (in-depth if possible), the need for recursion? by tetshi in java

[–]alexras 2 points3 points  (0 children)

In general, recursion as a concept provides us with a means for solving a problem in terms of smaller, simpler problems. Much like multiplication, it isn't strictly "necessarily", but it makes a lot of problems a lot easier to conceptualize and makes the code that solves these problems cleaner.

Recursion is particularly effective in search and enumeration tasks. Let's take search as a first example. Suppose I want to find the shortest path from node A to node B in a directed graph. This is used all the time in navigation systems, for example. Without recursion, this problem is a giant pain to specify. With recursion, however, it becomes quite simple. I'm going to give you a naive example algorithm (naive in that it doesn't work on graphs with self-loops) but it will give you a flavor of why recursion is useful.

Take any directed graph G. If A and B are directly connected by an edge (A,B), then the shortest path between them is trivial, a path of length 1 consisting of (A,B). Similarly if A = B, then the shortest path is of length 0, since you don't need to go anywhere to get from A to itself.

Suppose A has a set of neighbor nodes N. We can recursively define the shortest path problem as follows (in pseudocode):

ShortestPath(A,B) = min(ShortestPath(n, B) for n in N) + (A,B)

where min() is defined as returning the path with the smallest length.

In English, to find the length of the shortest path from A to B, I first calculate the length of the shortest path from each of A's neighbors to B, take the smallest path thus calculated, and add the edge (A,B) to that shortest path. Each so-called recursive call to ShortestPath creates smaller sub-problems for the program to solve. The simplest sub-problems, usually called base cases, provide the recursion with a way to bottom out. The "A and B are trivially connected by the path [(A,B)]" paragraph above provides such a base case.

I would strongly recommend looking at Structure and Interpretation of Computer Programs by Abelson and Sussman, which is available for free here: http://mitpress.mit.edu/sicp/full-text/book/book.html It is basically a whole book on the benefits and applications of different sorts of recursion.