« first day (1831 days earlier)      last day (3013 days later) » 

4:00 AM
(as evidenced by the fact that everything is in main... I'm doing refactoring now)
 
@Doorknob gnome's screenshot tool is really lightweight and good
 
I don't GNOME
also, that's not what I consider "lightweight"
lightweight is, for one thing, no GUI
 
what about scrot
 
oh well
the GUI is pretty much one dialog but eh
 
@undergroundmonorail scrot doesn't have the handy-dandy feature that import has of click'n'drag to specify an area of the screen to capture
 
4:02 AM
@Doorknob yeah it does
 
does it?
 
scrot -s
you can click a window to capture the window or clickanddrag to capture an area
 
use a camera and just take a photo of the monitor
 
@undergroundmonorail I was about to say "ooooh awesome" but then I noticed that that has the same bug that import has
 
what is taht
 
4:04 AM
sometimes the outline of the rectangular area that you're selecting doesn't go away and shows up in the screenshot
 
ohh
i wonder if they share rectangle code
@AlexA. you almost had me going to the man pages
 
( ͡° ͜ʖ ͡°)
 
oh huh I just found this github.com/dreamer/scrot/issues/2
it says it's an X issue
anyway, I plan to make mine work by sticking a resizable rectangle under the mouse and having keys that expand it vertically/horizontally. Mostly because it's really annoying when I estimate the start point of the screenshot and it's too low or high and there's no way to fix it
 
maybe scrot -sd 1 would work for some things
 
delay? hmm...
 
4:06 AM
yeah
 
oh nice that totally worked and didn't show the border
@undergroundmonorail is my hero
 
@AlexA. ^
It's very interesting to me how the top and bottom are both Democrats.
 
Rather unfortunate, IMO, since if Bernie doesn't make it through the primaries then I'd want Hillary.
But the support for Bernie is very encouraging! I just hope all of those people make it out to the polls.
 
4:09 AM
@AlexA. believe it or not -m is actually a valid scrot flag
2
 
YES
 
22
Q: Please keep the links Vimium compatible

k0pernikusStack Overflow is one of the sites with the best Vimium compatibility that I have seen. I used to surf it pretty well keyboard-only. This is how it should be: Yet today I found one edge case: On my profile site, I can track either my next privilege or next badge, and while I can click the ...

 
   -m, --multidisp
        For multiple heads, grab shot from each and join them together.
 
\( ° ͜ʖ°)/
 
@Doᴡɴɢᴏᴀᴛ your new avatar is awesome.
 
4:09 AM
@El'endiaStarman :D
 
Anyone know what written/spoken language is golfiest?
 
IIRC Spanish is golfiest when spoken (i.e. speed at which it can be spoken)
 
Surely not English
 
@Doorknob Wouldn't that be ?
 
I've heard people speak Mandarin very quickly.
 
4:14 AM
@feersum haha
 
Granted, I don't understand a word of it, so for all I know they could be relaying information at a slow rate while speaking quickly.
 
   Email bugs and feature requests to
   <scrot_sucks@linuxbrit.co.uk>
 
lel
Unrelated: What does yield do in Python?
 
it's like return but the function keeps going
 
@AlexA. makes a generator
 
4:16 AM
Neither of those two responses mean anything to me
 
waits for right-of-way traffic to pass
 
Few days ago someone called me on my private mobile to report a bug. My number is not public, so they must have gone through the company.
 
@mınxomaτ O_O
@Calvin'sHobbies haha
 
def f():while True: yield 1:

a = f()
a.next() #1
a.next() #1
a.next() #1
 
@undergroundmonorail So like FuncName = value in VB?
 
4:17 AM
def test():
    yield 1
    yield 2
    yield 3

print(test())
for i in test():
    print(i)
 
for i in f(): # runs forever, i = 1
 
Anonymous
@AlexA. Alright, so you got your function, and you're used to using return to return one thing. yield effectively pauses your function, returns something, and then allows execution to continue where it left off the next time something is pulled from the function (using iterator magic).
 
@mınxomaτ maybe
 
@Mego Why would you continue execution if you've already returned something?
 
4:18 AM
@AlexA. It returns the value but maintains the internal state of the function (i.e., stack, variables, etc) so that the next time you do func.next(), it picks up where it left off and continues.
 
Anonymous
Because sometimes you need to return a lot of somethings, and you don't want to eat 5 GB of memory for a list
 
@AlexA. different things, maybe like Fibonacci
 
@AlexA. Let's say you want to loop through all prime numbers...
 
@El'endiaStarman If you use yield, does the function always have a next method? Or do functions always have that anyway?
 
(Stopping eventually, of course.)
 
4:19 AM
@AlexA. Generators only
 
~~functions don't have it, generators do. the generator syntax is very similar to function syntax~~ i thought about it and i don't think this is actually correct
 
Anonymous
@AlexA. It has a next with yield, but you shouldn't ever directly call it. Use iterator patterns (for n in f()).
 
next is a built in, but you can use for loops
 
@AlexA. I believe that is a property of generators, specifically, a kind of function. It probably would error if you tried it on a typical function.
 
better for limiting and extending iteration length
 
Anonymous
4:19 AM
Using yield makes it a generator and not a function
 
Oh, I think you can also do next(func).
 
>>> def simple_generator_function():
>>>    yield 1
>>>    yield 2
>>>    yield 3
>>> for value in simple_generator_function():
>>>     print(value)
1
2
3
>>> our_generator = simple_generator_function()
>>> next(our_generator)
1
>>> next(our_generator)
2
>>> next(our_generator)
3
 
Interesting :O
When would that kind of functionality be useful in practice?
 
I feel like those examples are a bit simplistic. Mine might be a bit complex but I'll post it anyway.
 
fibonacci
 
4:21 AM
2 mins ago, by Quill
@AlexA. different things, maybe like Fibonacci
 
@El'endiaStarman yas pls
 
I used it quite a bit when dealing with recursive solutions, like web scrapers
 
Trying to find it...
 
def fib()
	a = 1
	b = 1
	while Irue:
		yield a
		a, b = a+b, a
i didn't test that
but assuming it works you could for f in fib(): to iterate over all fibonacci numbers
 
Oh, duh, had a copy in my Minkolang interpreter code.
 
4:22 AM
You can sort of simulate this with static variables (of course it's pretty limited):
ConsoleWrite(foobar() & @LF)
ConsoleWrite(foobar() & @LF)
ConsoleWrite(foobar() & @LF)

Func foobar()
Local Static $value = 0
$value += 1
Return $value
EndFunc
 
def getPrimes_parallelized(): #uses sieve of Sundaram
        yield 2
        yield 3
        P = [[4,1]]
        i = 2
        while 1:
            if P[0][0] <= i:
                while P[0][0] <= i:
                    P[0][0] += 2*P[0][1]+1
                    P.sort()
            elif P[0][0] > i:
                yield 2*i+1
                P.append([2*(i+i*i), i])
                P.sort()
            i += 1
 
@undergroundmonorail Clearly, since you misspelled True :D
 
you missed earlier in my code when i did Irue = 7
 
Anonymous
 
you can also pass values back into a yield statement, e.g. def f(): x = yield 1 but I forget how that works
 
4:24 AM
i vaguely remember the syntax for that being horrible
 
Okay, explanation of my code: I keep a list of primes and the largest multiple I've seen so far. I sort and maintain this list as I go along, yielding primes when I find a gap.
If you try to do list(getPrimes_parallelized()), you will have a baaad day.
(I mean, until you kill the Python process.)
 
in notepad++, how do you zoom the text back to normal zoom?
 
if you do rm -rf / you will have a baaad day
 
Anonymous
@Calvin'sHobbies Hold ctrl, mouse wheel
 
@Calvin'sHobbies ctrl + num /
 
4:26 AM
@Mego but how do I know when the zoom is 100%?
 
when it doesn't change when you ctrl + num /
 
Anonymous
@Calvin'sHobbies You'll know it when you see it
 
@Quill sudo and --no-preserve-root or bust
 
38 secs ago, by undergroundmonorail
@Calvin'sHobbies ctrl + num /
that resets it to default
 
@Mego This is really helpful! Thank you!
 
4:27 AM
@undergroundmonorail oh, gotcha, thanks
 
also i think you can restore the zoom level to 100% with ctrl + num /
@Calvin'sHobbies np
 
@El'endiaStarman Because that will try to collect them all, right?
 
Yep. Evaluates the whole thing.
And considering it's an infinite list...
 
Okay, so I guess Python generators are like Julia iterators, and list(generator) is like collect(iterator).
 
 
Anonymous
4:27 AM
@AlexA. Glad to helpp :)
 
range is a generator, by the way.
 
I thought xrange was the generator?
 
in python2
in python3 they got rid of old range and renamed xrange to range
 
Oh, okay
Python 3 is so much better, why do people still use Python 2?
 
old range is list(range(n))
habit
 
4:29 AM
@AlexA. golfier!
 
not being totally down with print() yet
 
@AlexA. because certain plugins only support python 2
porting stuff is hard. why do it if python 2 works
 
@AlexA. 3 doesn't support PIL (or didn't used to I think)
 
I view the Python 3 performance tweaks like making more things generators as pointless
Since if you care about performance at all, then Python is the wrong tool.
 
@Calvin'sHobbies Still doesn't IIRC
 
4:29 AM
@feersum yeah, just use assembly
 
Thank you all so much for your help, @Mego, @El'endiaStarman, @undergroundmonorail, @Quill, and @Calvin'sHobbies!
 
Python is fine, better than being seriously overly verbose with a language similar in verbosity to Java
 
I'm trying to get really good at Python really quickly
 
Welcome. :)
@AlexA. *Groot
 
SPL really seems like my dream language. Too bad it's dead (and too dependent on linux).
 
4:31 AM
The best way to learn something yourself is to help others learn it too
 
@El'endiaStarman <_<
 
@Quill I dont know anyone who's trying to learn Python atm.
 
Why'd they bother with range and xrange in 2 in the first place? (Assuming just using xrange is fine, as in 3)
 
@AlexA. *stackoverflow
 
Anonymous
4:32 AM
@mınxomaτ It claims it can be run on Windows using MinGW
 
Anonymous
@Calvin'sHobbies Because Guido didn't think about how range(1000000000000000) would be an issue
 
@Quill I'm not good enough at Python yet to make any high quality contributions on that tag (other than closing things as duplicates)
 
@Mego Yeah, but the make required many lib's that are really not that compatible with windows. If you build with just the base MinGW, you'll just have the base language.
 
Anonymous
@mınxomaτ Urge to port rising... Must resist...
 
@mınxomaτ I was hoping this was Shakespeare Programming Language. I was sorely disappointed.
 
4:33 AM
What's the least used python keyword? (in your opinion)
 
@Mego Do not resist.
Mabey I revive it in a github repo one day.
 
@Calvin'sHobbies Uh assert?
idk
Oh
finally
I read that was a thing earlier today and I've literally never seen it used
 
Anonymous
@Calvin'sHobbies ['and', 'as', 'assert', 'break', 'class', 'continue', 'def', 'del', 'elif', 'else', 'except', 'exec', 'finally', 'for', 'from', 'global', 'if', 'import', 'in', 'is', 'lambda', 'not', 'or', 'pass', 'print', 'raise', 'return', 'try', 'while', 'with', 'yield'] I'd say global
 
del, is
 
Anonymous
import keyword;print keyword.kwlist
 
Anonymous
4:35 AM
Ehh, I've seen del used a lot, but whether it should be used is a different story
 
Anonymous
I see a ton of exec but PPCG skews that a lot
 
pass perhaps, in finished code
 
@Mego Really? Which form do you see being used?
 
Anonymous
@feersum a=[1,2,3,4]; del a[-1]
 
^ that was in a Python tutorial I read earlier
 
4:37 AM
does as have uses besides import x as y?
 
Anonymous
@Calvin'sHobbies I dunno. Sometimes a simple subclass of Exception is all you need: class SomeException(Exception): pass
 
except Exception as e
 
Anonymous
@Calvin'sHobbies with open(filename) as f:
 
@Calvin'sHobbies with open() as x:
 
ok ok :P
 
Anonymous
4:38 AM
@AlexA. ninjo'd
 
@Mego dayum
 
@ӍѲꝆΛҐӍΛПҒЦꝆ Something like this should work: jsfiddle.net/6tg9bryc (untested)
 
@Calvin'sHobbies locals
 
Anonymous
@Quill That's a builtin, not a keyword
 
meh
 
Anonymous
4:40 AM
>>> 'locals' in dir(__builtins__)
True
 
@Dennis So I can replace that huge string of chars with something of my choice, right
 
@Mego I see more in 3.5 (keyword.kwlist): ['False', 'None', 'True', 'and', 'as', 'assert', 'break', 'class', 'continue', 'def', 'del', 'elif', 'else', 'except', 'finally', 'for', 'from', 'global', 'if', 'import', 'in', 'is', 'lambda', 'nonlocal', 'not', 'or', 'pass', 'raise', 'return', 'try', 'while', 'with', 'yield']
 
Anonymous
@Calvin'sHobbies Yeah mine was from 2.7
 
nonlocal isn't in 2.7?
 
Anonymous
In 3.5 I'd say nonlocal
 
Anonymous
4:42 AM
Nope
 
oh yeahh
 
@ӍѲꝆΛҐӍΛПҒЦꝆ As long as it's 1024 characters or shorter, yes. For a longer char table, you'd have to make some adjustments.
 
3 mins ago, by Quill
meh
 
@Dennis I can fit it all in under 1000 chars.
 
4:43 AM
has @ӍѲꝆΛҐӍΛПҒЦꝆ's name changed again or did Chrome update fonts...
 
Anonymous
It's a shame that nonlocal is so rarely used, because it's so nice
 
Anonymous
@Calvin'sHobbies Both
 
@Mego Dangit ninja'd
 
Anonymous
My fingers are like lightning tonight
 
Anonymous
I'm ninja'ing erryone
 
4:45 AM
That's gotta hurt.
 
> what's that burning smell
 
Hot penguin fingers?
 
Anonymous
You know it
 
@Mego Let's test that: Whats the shortest valid Java program?
 
Anonymous
@Calvin'sHobbies public class a{public static void main(String[]args){}}
 
4:47 AM
What Java version? 8 has a couple tricks :)
 
@Calvin'sHobbies wtf is nonlocal
 
@Geobits umm, sure (next time I'll ask something I know)
 
@AlexA. lets you access a different scope's definition of a variable
65
Q: Python nonlocal statement

oobooWhat does the Python nonlocal statement do (in Python 3.0 and later)? There's no documentation on the official Python website and help("nonlocal") does not work, either.

 
Anonymous
I am too slow
 
How the hell did this get an upvote?!
 
4:48 AM
4 mins ago, by Mego
I'm ninja'ing erryone
NINJa'D
 
I think it should be something like interface A{static void main(String[]a){}}
 
@Quill :O thanks!
 
in The 2nd Monitor, 2 hours ago, by Quill
-8
Q: Donald Trump vs The INTERNET

10 RepliesHe can't build a wall, but that was all part of the plan. Donald Trump may have lost the Republican primary, but this time he seeks a bigger challenge: THE INTERNET. Your Task Create a program that that modifies a webpage by replacing all instances of "Clinton" with "loser", all instances of "D...

might've been my fault
 
@AlexA. The challenge is a passive-aggressive way to complain about Trump losing; apparently, someone shares the writer's sentiments
 
Anonymous
@Geobits I dunno if an interface can be the main method holder class
 
4:49 AM
the ninja streak has been broken
 
@Quill ಠ_ಠ I can't believe you've done this
 
@Quill technically, lets you assign a variable from nonlocal scope, you can freely use and access them
 
@Mego I just found this out recently (someone tried to edit one of my golfs with it). I haven't tried it yet, but if not, several recent golfs need to be fixed. I think it got put in the "Java tips" post, too.
 
@AlexA. That message right there contains your two most common phrases
 
@Calvin'sHobbies yes, right.
 
Anonymous
4:50 AM
In my defense I haven't learned any Java in like 2 years
 
Ah, yea I think it's a new thing with 8.
 
yes an interface can
 
@Calvin'sHobbies <_<
 
Java 7 is a good Java to use if you don't want to have to use stupid tricks.
 
@AlexA. three for three
 
4:51 AM
no it isnt new
 
You can't make a program with static blocks, you can't use an interface for the main class, and there are no lambdas.
 
My school teaches Java 6 ಠ_.|._ಠ
 
@feersum It's also good to use if it's the only one you have on your work computer >_>
 
the static block thing getting removed really ticked me off because it was really cool
 
@quartata No one's stopping you from using Java 6.
 
4:52 AM
I felt like it made sense too
 
Is it working correctly?
 
@feersum except for all the cool java 7 features I would miss
 
@AlexA. Which makes me think you're a chatbot
 
@Mego Does map return a generator in Python 3 and not in 2?
 
Like what?
 
4:53 AM
@Calvin'sHobbies That much should have been clear already
 
Apparently I left my detour fibonacci generator on for 3 hours
the most recently calculated value was 7778742049
 
@AlexA. yes
 
@Eridan I found out one of our work projects was on Java 5 when I tried to use String.isEmpty() and found out it didn't exist :(
 
@Geobits rekt
 
ಠ__.|.__ಠ
 
4:54 AM
My school used to teach Scratch! real world stuff that was
 
@Geobits java is weird. why can't you just compare to "" ?
 
I thought there was some kind of library path issue at first. Had no idea why it wouldn't compile right.
 
@feersum many many things with <> being one of them
 
A computer I was using today was set to Java 4. No idea why.
 
@Quill You gotta love the mascot:
 
4:55 AM
@Cyoce you can string.equals("")
 
@Cyoce I guess you could, but then it would be something.equals("") instead, which is uglier by far.
 
I discovered this when printf didn't work
 
why not just string == ""?
 
You could also compare length, etc.
 
isEmpty() is actually shorter.
 
4:55 AM
the mascot gives me flashbacks
 
Anonymous
@AlexA. Mostly. It looks and acts like a generator, but it's not a generator.
 
@Eridan My O2 from 1998 has Java 4
 
@Cyoce Because comparing strings with == in Java has been asked about 9237 times on SO for a reason :)
 
@Mego ...huh
 
Interesting answer from the python devs themselves:
211
A: Why do people hesitate to use Python 3?

ncoghlanNote that I'm no longer updating this answer. I have a much longer Python 3 Q & A on my personal site at http://python-notes.curiousefficiency.org/en/latest/python3/questions_and_answers.html Previous answer: (Status update, September 2012) We (i.e. the Python core developers) predicted when P...

 
4:56 AM
@Cyoce that doesnt work in most languages for a reason
 
@quartata Your O2 with Java 4 is older than me :P And I have no idea what an O2 is
 
@quartata You wrote Java code in 1998?
 
No
 
@Eridan O2 is computer
 
I wrote QBasic code in '98 :D
 
4:57 AM
@ӍѲꝆΛҐӍΛПҒЦꝆ Almost. It fails for "⟮ɕṡ" for some reason...
 
I wrote elementary school assignments in 1998
 
But it came with Java 2 and I later upgraded it to 4
does not support 5
 
Aww, poor thing.
 
My first programs were written with Python 2 a year or two ago. I'm such a young whippersnapper.
 
If you weren't yet born in 1998, then yes. Yes you are.
I was dropping out of high school around then :P
 
4:58 AM
why are strings stored as objects with references? that's silly
 
Because strings are objects ;)
 
I wrote Perl and C back then
 
Because, ya know, Java
 
but that makes no sense
 
It only makes no sense if you've been brainwashed by C.
 

« first day (1831 days earlier)      last day (3013 days later) »