Collection of well defined abstract programming tasks - algorithm

I'm looking for a site or book or any other source of tiny programming tasks one can implement in preferred language. Would be great if examples are present too. And would be superb if there're people who may review my code. May be there's a wiki of such tasks. I've tried to google, but found nothing that suits my needs.
I want to improve my skills in programming using certain language but don't have specific task at hand. Any advice would be greatly appreciated.

Project Euler and the Facebook Puzzles are oft-touted examples.

There's a book called "Programming Pearls" by Jon Bentley which is definitely worth reading and trying out...

Chris Rathman is one of at least a few people I've seen who are working the exercises in Structure and Interpretation of Computer Programs in multiple languages. I'm currently still in the Scheme phase, but it seems like a neat exercise to me!

Try sourceforge, there are many interesting projects and many of them are looking for volunteers.

Related

How to implement a basic Datalog interpreter?

I am looking for a good tutorial on how to implement a basic Datalog interpreter for learning purposes. I have found a lot of papers which discuss how to make them faster or add some features but none that describes how to implement a basic one.
Here is a sample implimentation, Java source code included:
http://abcdatalog.seas.harvard.edu/
The developers explicitly cite facilitation of research and pedagogy among their objectives.
There are also many links to open source projects here:
https://en.wikipedia.org/wiki/Datalog#Systems_implementing_Datalog
Best of luck!

Learn Ruby Without Poignancy

I suppose this is two very closely related questions:
Everyone says to start with Why's (Poignant) Guide to Ruby, and I can't stand that book; what's another good starting point for an experienced programmer that has a more serious tone?
If I'm not the sort of person who appreciates _why, should I skip Ruby because the community will not be to my taste?
I'm currently rolling through Programming Ruby: The Pragmatic Programmer's Guide. So far I think the concepts are well-defined by the authors, and the examples provided help clarify any misunderstandings. The book is available for free online or you can order a copy:
http://www.ruby-doc.org/docs/ProgrammingRuby/
Update: More current version of book (Thanks bgporter)
http://pragprog.com/titles/ruby3/programming-ruby-1-9
The only problem with the online version is that it is a little outdated. I don't know Ruby that well yet so I can't say how much of the book is still valid in all cases, but the examples have worked for me so far when I run them. Note that the book available for purchase is up to date. It's hard to beat free, so be sure to check this guide out.
That being said, I don't think you should skip out on Ruby just yet. I've had a blast learning the language so far, and I'm looking forward to doing some full-fledged web development with Rails soon. At the very least give the language a chance; I think you'll find it a joy to work with.
I bought a lot of books learning ruby, the Well Grounded Rubyist was hands down the best.
And while we aren't really a community of _whys, we are a community of people who appreciate creativity and cleverness in code. If you are the sort of person who thinks there should only be one way to do something, and that way should be the clearest and most straight forward possible, python is probably for you. If you are the person who likes to push the language as far as it will go to create interesting and clever APIs, ruby is probably for you.
The Ruby Programming Language.
Programming Ruby would be my choice. It's also known as the Pickaxe book because of the cover:
It's a great introduction to Ruby. Why they still have the huge API reference in it in this day and age escapes me, though. It makes it thick as a brick, which is its only fault.
You can also find it online, although I think it's the first edition, which is well dated: http://ruby-doc.org/docs/ProgrammingRuby/. The third edition is the one in print now, it was updated just months ago and covers Ruby 1.9.2, which is the latest version of Ruby at this time.
I don't particularly like _why either. He created some great libraries, but I can't stand the Poignant guide, nor any of the talks he made. You don't have to like him, or be like him to belong in the Ruby community.
Ruby Koans are great for learning those small things that make Ruby unique.
It's basically set of excercises that show you how things work. Each excercise is in form of a failing test, and you have to make sure it passes. And they're fun! :)
If you're going to do them all, I also suggest enabling autotest, so you won't have to run them manualy. This article explains how.
Not everyone says start with Why's book, for instance, me.
Here's a quick list of my on-disk Ruby books and references. You can search for their individual titles on the interwebs. Some are commercial, and some are free. I linked the ones that are part of an app's documentation that I saved as PDFs so I'd have them on my laptop.
Agile Web Development with Rails
Programming Ruby
Ruby Best Practices
Sequel cheatsheet
Sinatra Book
The Ruby Cookbook
The Ruby Programming Language
The Ruby Way
The Well Grounded Rubyist
Why's book is worthy, but reminds me of Hunter S. Thompson trying to write a programming book, complete with Ralph Steadman drawings, which really disturbs me.
Also, don't overlook using ri, which is the on-disk reference to Ruby's libraries and gems. Also, the core library and standard library docs are really useful.
I was in your position this summer. Why was not for me, but I did find an excellent online resource: http://railstutorial.org/. It is actually for learning Ruby on Rails, but you can use it to learn Ruby as well. I'm not very experienced but I believe you can be part of the Ruby community without appreciating Why :-).
http://railsforzombies.org/ is a nice one , although it is not a book
Chris Pine's Learn to Program It's very straightforward. I started learning right away. It was very encouraging.
My colleague has written an excellent post summarizing starting points, books to read and paths to follow when learning ruby at http://www.jasimabasheer.com/posts/meta_introduction_to_ruby.html
I'd recommend taking a look at it, it has a wealth of information.
To add more info to the answers above, not really a book to learn ruby but a some companion resources for the learning process:
Ruby Language Quick Ref
Essential Ruby Refcard

Is there a website to look up common, already written functions?

I'm sitting here writing a function that I'm positive has been written before, somewhere on earth. It's just too common to have not been attempted, and I'm wondering why I can't just go to a website and search for a function that I can then copy and paste into my project in 2 seconds, instead of wasting my day reinventing the wheel.
Sure there are certain libraries you can use, but where do you find these libraries and when they are absent, is there a site like I'm describing?
Possibly a wiki of some type that contains free code that anybody can edit and improve?
Edit: I can code things fine, I just don't know HOW to do them. So for example, right now, I'm trying to localize a robot/car/point in space. I KNOW there is a way to do it, just based off of range and distance. Triangulation and Trilateration. How to code that is a different story. A site that could have psuedo code, step by step how to do that would be ridiculously helpful. It would also ensure the optimal solution since everybody can edit it. I'm also writing in Matlab, which I hate because it's quirky, adding to my desire for creating a website like I describe.
StackOverflow.com. No, I'm not joking.
At its best, people come here saying "hasn't some library done X already", and very often the Collective Wisdom answers "yes". But the biggest obstacle is lack of a description language: even here, a big problem for many posters is describing the problem clearly enough for others to recognize it as something they've seen before.
And if people can't understand what you're trying to do, no search engine will.
Firstly, two caveats:
Copy and pasting code you don't understand is a bad idea. Make sure you understand exactly what the code does before you use it.
Make sure you respect the license of the code you are copying. This is important!
Those caveats aside, it's often language dependent. Languages with an open development ethos (not just an open source implementation, think Python as compared to Java) tend to have official archives of open source libraries. For example:
Perl (which probably started this trend) has CPAN
Python has PyPI and Python Cookbook
PHP has PEAR
C++ has boost
Ruby has gems
R has CRAN.
Haskell has Hoogle and Hackage
Furthermore, don't forget to look in your languages standard library. Some modern languages have massive standard libraries, which have often contained the functionality I am looking for:
Java has its API documentation
C# and VB.NET have the massive MSDN
Non-openly developed languages often have non-official community archives. For example:
C# tends to have a lot of code at CodePlex and CodeProject
MATLAB has the Matlab Central File Exchange
A third category of sites are language agnostic. They are often best search through POG (plain old-fashioned Google). For example:
Stack Overflow
SourceForge
The confusingly language agnostic Java2s
Planet source code
Github
Finally, a fourth category of sites that I find increasingly useful are source-code search engines:
Google Codesearch
Koders
You may also be able to find useful source code, or at least get help writing something, through various pastebins.
Pastebin is language-agnostic
HPaste is mostly Haskell, but has a little in other languages.
Often, at the end of the day it is easiest just to google it, though.
There is a wiki that contains free code that anybody can edit and improve:
Rosetta Code.
As a means of an overview there is the "Solutions by Programming Task" page.
From the former page:
"Rosetta Code is a programming chrestomathy site. The
idea is to present solutions to the same task in as
many different languages as possible, to demonstrate
how languages are similar and different, and to aid a
person with a grounding in one approach to a problem
in learning another."
Cutting and pasting code you find on the Internet into production code would be like chewing gum found in the street. - Mike Johnson
With that in mind, try sites that host opensource projects like GitHub, CodePlex, code.google.com, etc.
I'm not sure this question is language agnostic, but I use GitHub this way ;) Other languages may have places where this is possible.
Safari Bookshelf from O'Reilly has many, many books that contain many implementations from which to choose.
http://my.safaribooksonline.com/
I was a subscriber for a few years before coming to my current job, where we have a corporate account! It's one of the best perks, and one of the best resources I have available. I haven't bought a computer book in years.
Aside from sites like this (Stack Overflow) I don't think there's many, maybe CodePlex, but I almost marked you -1 for assuming that code found on the Internet is yours to copy.
I'd suggest reading about software licencing, I hope you'd at least comment where you got it from.

Recommended reading on general debugging techinques

What reading would you recommend on general debugging techniques? I am more interested in principles and best practices than in specific platform solutions. For the record I mainly work with .NET (F#, C#), and dabble in Haskell and Ocaml.
One of these Friday evenings we talked about debugging with my colleague on our walk home. I was surprised to learn that one can view and modify the state of live objects from the VisualStudio debugger. He also mentioned that another developer he knew, a "Java guru," had once shown him some debugging magic and given an article or booklet on debugging, which challenged my colleague's initial "there's nothing to it" attitude. Having spent more time than I wished hunting bugs, I am ready to be challenged as well. Are there any links you would recommend?
I'd recommend reading everything you can find on Test-driven development (TDD). From the Wikipedia article:
Programmers using pure TDD on new
("greenfield") projects report they
only rarely feel the need to invoke a
debugger.
From a personal standpoint, it's been my experience that the more unit tests I write, the less time I spend in the debugger.
Specifically for .NET, here's a nice article on Easier Debugging with Attributes.
I highly recommend the excellent book Debugging by David Agans.
While not specifically about programming, the principles are universal. One of the techniques in here provided the biggest quantum leap in my diagnostic capabilities, namely, backing out your fix to prove that just your fix has corrected the problem.
I've studied a lot of debugging books and thoughts. Probably the best one is Debugging By Thinking. I think it covers everything that needs to be said, in a logical fashion, in an easy-to-read package.
It takes a native approach (win32) but Advanced Windows Debugging is a great book.
I like Ian Taylor's.
Tess Ferrandez's blog If broken it is, fix it you should is both directly relevant to specific real-life scenarios you're likely to encounter in .Net debugging, (typically involving ASP.Net), and more generally thought provoking.
John Robbins' debugging books and blog are similarly worth reading.
Mike Stall's .Net Debugging Blog likewise.
Mark Russinovich's blog is remarkable - his knowledge of Windows internals combined with great forensic skill is impressive.
My first introduction to debugging was this tutorial. It uses GDB to debug a sample C++ code, but the principles are generally applicable. The thing I really like is the way the author explains his train of thought about what might be wrong, and then the specific commands needed to test the possibilities. It's pretty fun! If you're new to debugging, it's a great insight into the process.

Learn proper programming syles?

Where would one find information or just rather good ideas on what is considered proper programming ethics or methodology of how to format the code, comments, or even variable names so that it is easier to read the code at a later time?
Thanks!
The book Code Complete 2 is a timeless reference for good coding practice.
The absolute 'must-read' for you is Robert C. Martin's book Clean Code. Do give it a try. It makes some awesome points. I keep recommending to everyone ever since I bought it 6 months ago.
Edit
I thought reading my Amazon review could help :)
You're asking for Coding Standards, which are language specific.
For C# check out The IDesign C# Coding Standard (on the right-side of the screen in the middle of the page)
For .NET in general see Design Guidelines for Developing Class Libraries
For C++ check here
For Java see Sun's resource Code Conventions for the JavaTM Programming Language
For C++ I use the C++ google style guide
Including Code Complete and Clean Code I would recommend you to read "The pragmatic programmer" and "Ship it!". The last books mentioned are not so much about how to format the code, comments, ect. but rather about best practices for developers and development.
Three books I consider essential for beginning OO programmers.
"Refactoring: Improving the Design of Existing Code".
Although modern IDEs often support automatic refactor, this book is still useful. By knowing the reason (or code smell) behind a particular refacoring, you can strive to write the correct code the first time.
"Pragmatic Programmer"
A wealth of best practices.
"Design Pattern"
Most advanced book, but still useful.
Clean Code is certainly a good book. Martin's Agile Principles, Patterns, and Practices in C# is my recommendation if you want a more .NET specific book.

Resources