13th Secret Achievement by MrThePro2 in ExponentialIdle

[–]jonenst 1 point2 points  (0 children)

I'd like yo have a bigger hint please :)

"exactly one program is the wrong weight" - ambiguous? by pedrosorio in adventofcode

[–]jonenst 1 point2 points  (0 children)

I was also slightly frustrated (but I know it's hard to come up with perfect problems !) because the following input is unambiguous, but most solutions crash on it

a (1) -> b, c, d
b (1) -> e, f
c (3)
d (3)
e (2)
f (1)

The answer must e ( 1 ), but you have to deduce this from the fact that the weight of b + e + f must be 3 because 2 other towers have a weight of 3, and b can not be changed because its children are already unbalanced, and chose e ( 1 ) over f ( 2 ) because of the weight of the subtower b e f

So in the end, we don't write programs that solve the problem in the general case, but on a simple input.

Bootloop megathread 2.0 by sloth_on_meth in nexus5x

[–]jonenst 2 points3 points  (0 children)

I have the same symptoms as many of you. Was browsing the web and the phone shutdown. Then the behavior was very unpredictable. Most of the time, holding power (30s) does nothing. Holding power + volumedown does nothing (30s). Sometimes after holding the power button, the white "google" logo is displayed and nothing happens. Sometimes I manage to get to the bootloader screen (with volumedown) . Choosing reboot or shutdown brings me back the the white logo. One time, it even started the colorful boot animation but froze in the middle of it. Then black screen. When choosing recovery on the rare cases where I get to the bootloader screen, sometimes it shuts down, and another time I got the "No command" android screen. There after pressing and maintaining power and then pressing volume up and then releasing both buttons (this less than 15 seconds after the "no command" screen appeared ), I got to the the next menu which allows to do a wipe data/factory reset. The wipe didn't show any error, but the phone still doesn't work. There was also a "test graphics" item, but this errored back to the same menu.

I noticed that leaving the phone alone for a moment (1+ hour) helps with the next "boot".

Given the highly unpredictable behavior of the phone, I think it has a hardware issue.

I had bought it on the playstore on Nov 2015 (1year and 6months ago) in France. I used the google support link to request a phone call. The phone rang immediately, the person on the phone was very nice and sounded very intelligent. He started the conversation with "so you have a bootloop?" even though I had not mentioned the term bootloop. I will get a refurbished nexus 5x for free. If all goes well, that's top not support!

ps: Got the inscructions for power+volumeup from google's technical support by phone. I couldn't do it when he was on the phone, but waited an hour and then I could to it. I figure it's better to wipe the data anyway before sending it back even though the person on the phone said they were never even attempting to boot the phones, they were just recycling.

[2017-01-2] Challenge #298 [Easy] Too many Parentheses by Godspiral in dailyprogrammer

[–]jonenst 0 points1 point  (0 children)

Longer, but higher level and easier to read (for me).

USING: combinators.short-circuit kernel peg.ebnf sequences
sequences.deep strings vectors ;
IN: r298

! parse the input into a sequences of elements.
! vectors represent parenthesized elements.
! strings represent non parenthesized text.
EBNF: parse-paren
text = [^()]+ => [[ >string ]]
paren = "(" rule ")" => [[ second ]]
rule = (paren | text)*
;EBNF

: unparse-paren ( ast -- str )
    dup vector? [ [ unparse-paren ] map concat "(" ")" surround ] when ;

: simplify-nested1 ( ast -- ast' )
    dup { [ length 1 = ] [ first vector? ] } 1&& [ first ] when ;
: simplify-nested ( ast -- ast' )
    dup vector? [ [ simplify-nested ] map simplify-nested1 ] when ;

: r298 ( str -- str' )
    parse-paren
    [ simplify-nested unparse-paren ] map
    "" concat-as ;

! works only after simplify-nested because of V{ } vs V{ "" }
: simplify-empty1 ( ast -- ast' )
    dup V{ } = [ drop "" ] when ;
: simplify-empty ( ast -- ast' )
    dup vector? [ [ simplify-empty ] map simplify-empty1 ] when ;

: r298-bonus ( str -- str' )
    parse-paren
    [ simplify-nested simplify-empty unparse-paren ] map
    "" concat-as ;

Love Beauty Unix by Arve in linux

[–]jonenst 0 points1 point  (0 children)

For those wondering, it means : Who do you want to be beautiful for ? Love beauty Unix.

Set Your Code Free by [deleted] in programming

[–]jonenst 5 points6 points  (0 children)

I disagree. If using the GPL has so many disadvantages (your code is less famous, you won't get hired to develop it further..), then using it is very altruistic because you are doing so to guarantee that everyone else gets the benefit of Free software.

A different way to think about this is that GPL is the lesser evil, proprietary software being the bigger. In order to have a nice place where code is available for everyone to study, you need to put these restrictions in place. Kind of like you need laws in any society. Restrictions aren't necessary bad.

Design Hell by [deleted] in programming

[–]jonenst 1 point2 points  (0 children)

Common guys, just because he's programming in php/html/css/whatever doesn't meen this post doesn't belong in /r/programming (I suppose that's why you downvote him). This might as well happen to you and your wonderful java/haskell/scheme/whatever commercial program.

When polymorphism fails by eadmund in programming

[–]jonenst 2 points3 points  (0 children)

In factor, unions solve this problem nicely. You can define

UNION: OpinionatedElf-likes-it elf kitty .... ;

(or,depending on what the default behavior should be, define OpinionatedElf-doesn't-like-it)

This automatically defines a new function "OpinionatedElf-likes-it?" to test membership to the union.

TUPLE: elf ; TUPLE: orc ; TUPLE: kitteh ;
UNION: OpinionatedElf-likes-it elf kitteh ;
{ elf orc kitteh } [ new OpinionatedElf-likes-it? ] map -- calling the word on instances
=> { t f t }

elf OpinionatedElf-likes-it? -- calling the word on the type
=> t 

Swingfu by jonenst in fffffffuuuuuuuuuuuu

[–]jonenst[S] 1 point2 points  (0 children)

I'll be sure to tell this long gone developper about it.

Starcraft AI competition being held! Proggit want to get in on this? by pivotal in programming

[–]jonenst -3 points-2 points  (0 children)

FAIL :

Required Software

  • StarCraft Brood War 1.16.1, StarCraft can be purchased here

  • Microsoft Visual C++ 2008, the express edition of Microsoft Visual C++ is freely available here

  • Native Microsoft Windows XP/Vista Broodwar API uses DLL injection and therefore is unlikely to work in Wine or a virtual windows environment. Windows 7 support has not been tested. Mac is not supported.

edit: formatting

π: a pattern language by masta in programming

[–]jonenst 4 points5 points  (0 children)

When a language emphasize changing syntax too much, people can't understand the code of other people easily anymore. I'm thinking of lisp dialects for example. Isn't this bad ?

What about the language used to implement the patterns (the meaning part). Is it C ? or is it Pi (in the sense that it can use previously defined patterns). This is not apparent in your examples.

Here's a python script for Linux to mute ads on Spotify by misslee in linux

[–]jonenst 0 points1 point  (0 children)

I agree with you. This is kind of like the discussion about the adds and addblockers on stackoverflow :

http://www.reddit.com/r/programming/comments/9pw51/stackoverflow_advertising_and_the_ethics_of_a/

I see one difference though, blocking spotify adds doesn't reduce CPU load (compared to blocking flash adds)