1. 1

    This made my day — that someone had the question in the first place, that nowadays somebody can afford to run this analysis on 100 million web pages just on a whim, and of course the popularity of z-index: 8675309.

    1. 2

      Thanks for the kind words, and a pleasure to see this posted here. This is the part that surprised me the most as well: I hadn’t really used any cloud products outside of a professional context where I don’t think about cost and such. The fact that all these resources are one credit card payment away is so exciting and intimidating.

    1. 3

      Curious combination of very clear and high-level points and down-in-the-dirty-details arguments bordering on rant. Luckily, it starts and ends on good points, so there’s the serial position effect at work for you.

      There is a slide towards the end about the power of implicit arguments. This is one of the killer features in Scala for me. As an example, I recently had to use code written by a Scala beginner (who learned by “typing until it works”). He used global state everywhere throughout his module, with functions branching on globals set in other functions, etc. I had to make his code callable multiple times and in parallel. I defined a module-local Env class and moved all the global variables in there, the idea being that I could pass an instance of Env around in related invocations. This was achieved by adding to each function declaration a second argument block (implicit env : Env), and at the first line of each function the import statement import env._. There, your environment is threaded properly.

      (Needless to say, this was a “we need this prototype to produce numbers now” situation…)

      1. 3

        Implicits are weird though because their resolution isn’t fixed. It prevents efficient Set implementations in Scala because it’s difficult to know that the sense of order a Set is constructed upon will be the same as the one it’s read using.

        1. 3

          Exactly, this is known as the type-class coherency/confluence/consistency problem and it’s the reason why “implicits as type-classes” almost misses the point of type-classes completely!

          1. 1

            Note that this is not the use of implicits I was talking about. Implicits-as-type-classes are fundamentally tied to generic types. Implicits-as-environment-carriers are a much simpler form, and would be useful even in untyped languages.

            1. 1

              Even more useful is the reader monad, which does a much better job at implicit environments than implicit parameters do.

      1. 19

        Building a photo booth for my wedding next month! Raspberry Pi, DSLR camera, python and Flask.

        1. 4

          Are you going to be publishing the source anywhere? It occurs to me that I have both a Raspberry Pi and a DSLR I’m not using, would be fun to setup a semi-permanent photo booth at my house. :D

          Also, congratulations in advance!

          1. 2

            Yes, good luck with the project and your photo booth too! :)

            1. 1

              That sounds fun! Good luck with all the less nerdy details and I hope you enjoy the big day :)

              1. 1

                Good luck with the project! We had a (rented) photo booth at our wedding, and it was a huge it. Many months later, we still enjoy going over the pictures.

              1. 6

                I’ve gotten my libgdx game up and running on IOS App Store, as I talked about in one of these threads a while back, so now I’m looking at making another game, but a bit more polished. If you want to try the released game on IOS, see here https://itunes.apple.com/us/app/jumpr/id838364189?ls=1&mt=8, only paid version though.

                To do this I used RoboVM and fixed a bug in a gradle plugin which was fun since I haven’t used any of those before.

                1. 2

                  I still play that game on Android once in a while. For some reason, though, I always get stuck at level 18. Something about these two bricks…

                  1. 1

                    That’s nice to hear, totally made my day!

                    Yes, something about them makes it really hard. I showed it to a couple of friends this weekend, and almost everyone had trouble with that level 18. Which is kid of funny because level 14 (Last one in the gif on the project page) has the same blocks, just with more blocks so to say. It seems like it is easier to jump a contiguous block, then the ones with “air” in them. (Which is why I designed the later levels to use that kind more frequently).

                    I can give you some reassuring words: It’s not impossible, just very hard :) And just that construct will make a reappearance if you make it through, but more evil of course.

                    1. 2

                      Yes, I noticed that about level 14.. I even took a couple of screenshots and counted the pixels to make sure it was really the same dimensions :) I did beat the game exactly once, though, so there’s hope. Also, and you probably already know this, but I feel like the game would be much more appealing if it was somehow procedurally generated to be infinite. A similar game for inspiration is Linebound, but there are of course tons of others.

                      1. 1

                        Hehe, awesome :)

                        Yes, I want to make it a bit more appealing. But I think I’m going to go the other way in the next game.

                        My idea about the next game is to have larger levels, with the possibility to run on different heights. So there can be an element with finding the correct path, as well as timing the jumps. The camera follows player and the player is able to run on all floor surfaces. So one level could be that the player must jump up on a “floor” to avoid lava or something. It should also have a level selector á la Angry Birds (and thousand other games), with stars ranking how many deaths it took you to complete the game. So you can select that one level you barely completed and try to do better.

                        Also, I’m going try to crowd source some levels. We will see how that goes, but if I can get the word out, it feels like people will think it’s fun to have their levels in the final game (and also get a free copy).

                1. 2

                  In my free time, I am trying to port my Android puzzle game Tileswap to iOS. I am currently trying to use PhoneGap Build, but the debugging experience when something doesn’t work is pushing me towards borrowing a Mac from a generous friend for a few days .

                  If you want to try it out, you can play in your browser or get it from Google Play.

                  (previous lobste.rs submission)

                  1. 5

                    Question doesn’t make sense, neither do the answers. There are pointers everywhere in Java; calling them references and using . syntax doesn’t change that.

                    1. 4

                      Isn’t the question about C++?

                      1. 7

                        I’m coming from a Java background and have started working with objects in C++. But one thing that occurred to me is that people often use pointers to objects rather than the objects themselves

                        “I’m trying to map my totally wrong mental model of Java onto C++.”

                      2. 3

                        I don’t understand what’s wrong with OP’s question. The person didn’t understand stack vs heap allocation in C++, because his experience is in Java, so he asked about it. He doesn’t claim there aren’t pointers everywhere in Java. Seems fair to me.

                        1. 4

                          I think a simpler answer would have been “In Java, all those ‘objects’ you thought you were using were really pointers.” Boom, the light goes on.

                          The accepted answer isn’t wrong per se, but given the OP’s lack of understanding, I don’t see how they could have possibly comprehended half the answer they accepted. Sounds legit, check mark.

                          I would love to see OP’s code before and after this advice. My bet is they are in for a world of hurt, either returning stack references or dealing with buggy copy constructors, let alone the insane compiler optimizations that can cause the compiler to elide or not elide any number of constructors and assignment operations.

                          Mostly I’m confused why this is on lobsters.

                        2. 3

                          It frequently seems to me that the terminology Java adopted does a disservice to programmers trained with it. It cannot possibly be the case that pointers are arcane and incomprehensible while references are a simple enough concept that all of the millions of Java programmers can understand and use them when, as you point out, they’re equivalent. (Though maybe I’m giving many Java programmers too much credit.) It seems to me that calling references “managed pointers” or the like would save a lot of intimidation and the need for an epiphany moment realizing pointers are not a scary new concept.

                          1. 1

                            Pardon the meta-talk.. but it is sad to see that someone has downvoted tedu’s comment without explaining why. I thought that was a HN phenomenon we try to avoid here.

                            1. 1

                              What is it exactly that doesn’t make sense? The wording may be imperfect (what are “the object themselves”?), but the examples make it clear what the person is asking. The highest ranking answer may not be encyclopedically complete, but does a great job at pointing the reader in the right directions.

                            1. 1

                              Do I understand correctly from the code that the OCR works by exact match only?

                              1. 3

                                I’m going to try and compile my libgdx game Jumpr (https://play.google.com/store/apps/details?id=me.ramblingsby.jumpr) for IOS, using RoboVM.

                                If I can get it to work good I’ll try to start planning for a new game. Haven’t been writing games for a while now, exited to get started again.

                                1. 2

                                  That was a fun 15mn on the bus, thanks. I’ll take this opportunity to report a bug: when you hit the home button and put the game in the background, the little runner magically goes through all obstacles. Come back after a couple of seconds and you have effortlessly completed the level.

                                  1. 1

                                    I have uploaded a new version with a fix for this bug to the Google Play Store. Should be available in a couple of hours.

                                    1. 1

                                      Thank you!

                                      Oh, that is a good bug report, kind of removes the whole challenge. I will look into it, thank you again.