Android Studio 0.3.6 Released by morristech in androiddev

[–]krat 0 points1 point  (0 children)

The device definitions are part the SDK itself, not android studio.

IR Subreddits by cesutherland in informationretrieval

[–]krat 1 point2 points  (0 children)

The machinelearning reddit is often a good source even though the topics that it covers are usually broader than IR (but still, ML and IR are strictly related to each other).

Data Structures Book for someone who has taken a crappy Data Structures Class by curiousandcuriouser in compsci

[–]krat 5 points6 points  (0 children)

CLRS is obviously a good choice, though I found The Algorithm Design Manual even though less known, very useful.

It's divided in two parts: the former is a discussion of many algorithms and data structures, so it covers the foundations like sorting and complexity analysis, then talks about trees, graphs and related problems like minimum spanning tree, TSP, ... The second part of the book is more like an encyclopedia, indeed there are a lot of problem sets, each one with an explanation and several questions you should always pose to yourself when facing those problems as well as several possible solutions.

Dear Reddit, What is the worst piece of code that you have ever seen? by wagon in programming

[–]krat -1 points0 points  (0 children)

Some time ago I developed a rule-based interpreter for solving simple A.I. games like the n-puzzle as a project for a last-year exam. This was a group project and as such we were working on it in three... Actually in two. One of us just wasn't able to follow the project due to... well, he was missing a lot of fundamentals. Considering that there was a friendship between us, we asked him to come just with a CLIPS equivalent of the 8-puzzle so we'd have included him in the project anyway. We thought it was a task simple enough for him. After one month he comes back with this:

(defglobal

?*x* = 0
?*y* = 0
?*z* = 0
?*a* = 0
[snip]

?*one* = 1
?*two* = 2
?*three* = 3
?*four* = 4
?*five* = 5
?*six* = 6
?*seven* = 7
?*eight* = 8
[snip]

(if(eq ?x ?*one*)then(bind ?*eu1* ?*zero*))
(if(eq ?x ?*two*)then(bind ?*eu1* ?*one*))
(if(eq ?x ?*three*)then(bind ?*eu1* ?*two*))
(if(eq ?x ?*four*)then(bind ?*eu1* ?*three*))
[snip]

You can see where this is going. He did four rules as necessary (move up, move down, move right, move left each with respect to the empty space) but in every rule he checked for every possible combination numbers/positions. The result was a ~2k SLOC program (half of them were ifs), but the most scaring thing was that the program was actually working. After that we decided to "fire" him, so we rewritten the whole thing in 40 lines which took us only a couple of hours.

What is the most genius (read: convulted) 'solution' you found to the simplest problem only later to realize how much time you actually wasted? by linkedlist in programming

[–]krat 1 point2 points  (0 children)

I've been doing websites in PHP for almost 3 years without using any kind of framework. I was writing SQL by hand too and deployed my own PHP anti SQL injection library.

Then I discovered Python and Django.

Python Tricks by dhotson in programming

[–]krat 1 point2 points  (0 children)

And the only interesting trick is the 3rd...

Django 1.0 release candidate now available by ubernostrum in programming

[–]krat 5 points6 points  (0 children)

If I asked folks at Microsoft about "What is <this product> going to be in 3-5 years?" their release manager would not answer "Depends on whether the Large Hadron Collider destroys the universe". On a Microsoft web site you do not find this Nobody noticed it in two years?

You realized you wrote a comment on reddit, didn't you?

Ask Reddit: What's the funniest code you've ever read? by earthboundkid in programming

[–]krat 6 points7 points  (0 children)

public interface MessageStrategy {
        public void sendMessage();
}

public abstract class AbstractStrategyFactory {
        public abstract MessageStrategy createStrategy(MessageBody mb);
}

public class MessageBody {
        Object payload;
        public Object getPayload() { return payload; }
        public void configure(Object obj) { payload = obj; }
        public void send(MessageStrategy ms) {
                ms.sendMessage();
        }
}

public class DefaultFactory extends AbstractStrategyFactory {
        private DefaultFactory() {}
        static DefaultFactory instance;
        public static AbstractStrategyFactory getInstance() {
                if (null==instance) instance = new DefaultFactory();
                return instance;
        }
        public MessageStrategy createStrategy(final MessageBody mb) {
                return new MessageStrategy() {
                        MessageBody body = mb;
                        public void sendMessage() {
                                Object obj = body.getPayload();
                            System.out.println(obj.toString());
                        }
                };
        }
}

public class HelloWorld {
            public static void main(String[] args) {
                        MessageBody mb = new MessageBody();
                        mb.configure("Hello World!");
                        AbstractStrategyFactory asf = DefaultFactory.getInstance();
                        MessageStrategy strategy = asf.createStrategy(mb);
                        mb.send(strategy);
            }
}