« first day (1816 days earlier)      last day (3132 days later) » 

12:00 AM
@Clearquestionwithexamples You may or may not want to use it, but you can get it in fewer characters than by using the __future__ import:
>>> x=getattr(__builtins__, 'print')
>>> x('abc')
abc
It's sitting there waiting for you to use it as a function. The __future__ import simply stops it from also being a statement.
 
12:27 AM
good evening...or whatever time of day/night it is where you are at! :)
 
Gooooooood evennnnninnnng.
 
Emacs meetup is winding down.
 
Emacs has a meetup?
did I just say something really stupid...
 
I'm in NYC. There's a meetup for everything.
 
That's awesome!
I want a vim meetup
 
12:37 AM
Yeah, just go hang out at the Rails meetup...
free pizza and beer.
I'm working on a Kombucha.
 
We get that at python meetups here
and js too!
 
Where is "here"?
 
montreal
 
Good for you.
 
I guess :)
Are you really working on a kombucha?
 
12:44 AM
Yep, I better head home now, though, cheers!
 
later
 
1:10 AM
I think I just figured out that I was being made fun with the pizza and beer...wasn't I? :P
 
I like Kombucha made with black tea
 
I don't think I've ever had it
 
1:27 AM
made fun of? I had some good pizza and beer!
 
its just a fermented tea (one I had wasn't even that high a proof) and the one I had was home-made and ginger/orange flavor added so I assume the taste varies (was like a vinegary-asian sparkling tea but I don't mind those flavors)
 
Ginger is the flavor of mine.
GT's Enlightened Organic Raw Kombucha Gingerade
 
Ginger is the flavor of mine, too! Wait, what were we talking about?
 
I can't gulp this stuff. It's kinda sour.
But it supposed to be good for you.
 
yeah, sour is a better word than vinegary
 
1:36 AM
alright...I found a place in Montreal where I can get some...gonna try this.
 
just don't make the mistake of gulping it cause "its just tea" like I did ;)
 
noted! :)
 
 
1 hour later…
I feel like that sometimes, then I look at my student loans and feel worse
 
4:09 AM
Cabbage all
 
4:40 AM
Cabbage :-)
 
5:17 AM
hi when i access bigquery and get the schema information using python client
job_id, _results = client.get_table_schema(datasetname,tablename)
i am getting this error
<type 'exceptions.ValueError'> at /GetFields
too many values to unpack
any idea
 
5:35 AM
cbg
 
cabbage
 
5:59 AM
any one?
issue is with this line
job_id, _results = client.get_table_schema(datasetname,tablename)
 
Good morning friends CBG
f = lambda n: reduce(lambda x,y: x<y,str(n))
print f(12254)

I wrote this code.
It is returning True...wondering what is going inside... was expecting false since '5' > '4' :(
 
@VineetKumarDoshi
the reduce works left to right, applying the result value with the next item
so it does '1' < '2' => True; True < '2' => True; True < '3' => True; True < '5' => True and finally True < '4' => True
 
oh so you mean ... inside it is like print True < '5'
 
also, you're using python 2
in python 3 you'd get TypeError instead
 
ok .. thanks its an eyeopener :)
 
6:14 AM
>>> from functools import reduce
>>> reduce(lambda x,y: x<y,str(12254))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<stdin>", line 1, in <lambda>
TypeError: unorderable types: bool() < str()
had you used python 3 it would have stood out right from start that this is not sensible
 
hmm
Is there any way to map two consecutive pairs of list? ... unfortunately map takes only one argument
like if list is ['1','2','3'] then map could return ['12', '23']
 
cabbage
@VineetKumarDoshi Sure. Here's how to do it with a list comp.
>>> a=list('1234')
>>> [''.join(t) for t in zip(a,a[1:])]
['12', '23', '34']
And with map
>>> map(lambda t:''.join(t), zip(a,a[1:]))
['12', '23', '34']
 
wow !! .. you're awesome !! .. very very clever use of zip!! ....
 
Or
map(lambda t:t[0]+t[1], zip(a,a[1:]))
It's a pretty ordinary use of zip, actually. :)
But here's one that might surprise you, using iter:
>>> a='abcdefghi'; map(lambda t:''.join(t), zip(*[iter(a)]*3))
['abc', 'def', 'ghi']
 
6:31 AM
^ ... i dont get this one!! .. completely magic to me :D
 
Another way to write it is:
>>> a='abcdefghi';g=iter(a);map(lambda t:''.join(t), zip(g,g,g))
['abc', 'def', 'ghi']
 
My goal was to make this code
lambda n: list(`n`) == sorted(set(`n`))
short by at least one char

From your suggestions i reached till here !! ... but that is still like 5 chars longer :D
lambda n: all(i < j for i,j in zip(`n`,`n`[1:]))
 
g is an iterator over the items in a. zip(g,g,g) produces a new iterator that yields 3-tuples consisting of the next elements from each of its args. But in this case its 3 args are the same iterator, so the tuple consists of the next 3 items from the original iterable, a.
 
6:46 AM
^This is really cool! ... thanks for sharing this :)
 
@VineetKumarDoshi What's the type of n ? Code golf can be a good way to learn how to write compact code. OTOH, the most compact code isn't necessarily the best code. Apart from such code being harder to read, it may be less efficient. Eg, the all-based version is superior to the sorted(set version, because all stops testing as soon as it finds a False value.
The first version (internally) only compares as many pairs of elements of list(n) and sorted(set(n)) as it needs to, but before it starts comparing it has to build the set, convert it back to a list and sort it.
@VineetKumarDoshi It's a fairly efficient way of processing a string or list in chunks of a fixed size. However, if the list doesn't have a whole number of chunks the last partial chunk will get dropped. But there are various ways of dealing with that, if necessary. See stackoverflow.com/questions/312443/…
 
n is an integer ... I used `` to convert them to string.
But in many cases practicing codegolfs helps us in using smart features ... although 'all' is not useful here .. but I learned about 'all' from codegolf challenges :D

Thanks for sharing this link
 
7:22 AM
Cbg
 
Hey up
 
@Programmer no, I'm off for a couple of weeks. Only fly to the UK on the 25th
 
8:11 AM
Cabbage
 
Cabbage
 
@ChillarAnand wait, who was that? :D
 
8:54 AM
Yeah we'll beat em up
 
first closed
 
@vaultah Oh my god, you have an avatar!
 
Haha
 
What happened?!
 
I found a good replacement for a white square, that's all 😃
 
9:37 AM
xD
 
@poke: With ref to stackoverflow.com/q/32965111/4014959 input("\nPress enter to exit.") is often seen at the end of Python scripts of Windows users. If a script is launched by double-clicking its icon then by default its console window will close as soon as the program terminates, so using input is a common way to guarantee that the window will be open long enough for the user to read the program's output.
OTOH, due to cargo-culting, lots of Windows Python newbies will chuck input("\nPress enter to exit.") onto the end of their scripts even when they don't need it. :)
 
@PM2Ring I know, but OP said “I'd rather it exit the program if no input is given”
 
Ah, fair enough.
 
Cbg!
I have been using mongo db
The issue I'm facing is each time I restart my laptop I can't access mongo shell
It throws an error "Error: couldn't connect to server 127.0.0.1:27017 (127.0.0.1), connection attempt failed at src/mongo/shell/mongo.js:146
exception: connect failed"
I have repair it each time running the command given in this link
79
Q: couldn't connect to server 127.0.0.1 shell/mongo.js

zjm1126when i setup mongodb in my ubuntu , i try : ./mongo it show this error : couldn't connect to server 127.0.0.1 shell/mongo.js so what can i do , thanks

 
@vaultah Your old white avatar used to make me think of White Room by Cream.
 
9:46 AM
Is there permanent sol for this ?
 
@d-coder This is this Python room, not the mongo room.
I'd suggest you look elsewhere for help.
 
@d-coder Is the daemon shutting down correctly when you shut down your computer? You should make it so shutting down your computer also stops the daemon nicely.
 
Thanks you both!
 
10:22 AM
now has Cream ear worm
 
cbg again
 
@JRichardSnape I ended up watching half a dozen Cream clips myself. :)
 
ok, will have to open Spotify, start with "Fresh Cream" and finish after "Goodbye".
after that switch to "Blind Faith", "BBM" and solo records.
not again.
 
10:50 AM
Follow that up with this sterling rendition of Whipping Post by The Allman Brothers Band.
 
11:21 AM
Look at JRS trying to steal my reps!
I feel like I should give the bounty to someone who isn't doing it to avoid writing his thesis...
 
11:35 AM
afternoon cabbage
 
hey hey! morning cabbage here :)
 
Survey progress bars are the weirdest thing ever.
Three indroductory pages put me to 20%, and now the slow question pages start…
“Please describe X in three words” – [large text area with 6 lines…]
German doesn’t even work like that. I can’t describe stuff in three words?!
 
11:56 AM
The letter X is pointy, symmetrical, underutilized
 
X was not really meant to refer to “X” but a “thing” that the survey is about :P
But thank you for your suggestions.
 
Well, we got the OP of this question to post some code. But maybe it would've been better if he didn't post it. :)
 
cbg
@idjaw are you in NY?
 
Montreal
 
Oh nice, I'm one hour south of you :D
 
12:10 PM
Cool in the us? Or in Quebec?
 
“I'm one hour south of you” – The timezone-addicted part of me was very confused for a moment.
 
same time zone :)
He had mentioned coming to a city near me last night so I was curious
 
@poke North, South, East and West are all the same, right? :p
 
it was the “one hour” part that triggered my timezone self!
 
12:17 PM
technically you can be in a different time zone one hour south of someone
 
where? Australia?
 
The International Date Line doesn't run perfectly north-south, IIRC
 
time zones aren't straight lines, necessarily
some are split on state borders
 
it jumps around to include or exclude various islands
Pic related. I see that Hawaii is in -10, and its due-south neighbor Jarvis Island is in -11.
Not sure if you can get to one from the other in an hour, though
 
hm
 
12:25 PM
"Yes, Jarvis Island is approximately south of Hawaii. But is it due south?" I don't know, inner critic, I can't zoom in that far.
 
I want to downvote your teacher’s task. — poke 5 secs ago
 
Haha, me too.
I think I may have oversnarked on that question.
 
You and me both
It’s impossible to loop over a string if you cannot use for loops and slicing.
 
@Programmer I guess so. I'm in New South Wales, Australia. We just went into Daylight Saving Time a couple of days ago, so we're now at UTC + 11h. The state north of us, Queensland, doesn't use Daylight Saving Time, so they're still on UTC + 10h, 1 hour behind us.
 
@PM2Ring DST doesn’t count :P
 
12:29 PM
I'm pretty sure you could look at American time zones and find a clear example
 
There's a clear-cut one in my picture I didn't notice: If you're in eastern Alaska and go north into Canada, you go forward an hour when you cross the border.
 
Working there must be fun
Go to work at one timezone, and finish working in the other
 
Happy hour ends, drive ten minutes, happy hour begins
 
@poke Fair enough. Ignoring DST, the far west portion of QLD is ½ an hour ahead of South Australia, which is due south of it. It's not of much practical significance though, because the population density in the region near than border is very low: it's desert country. OTOH, the NSW-QLD border near the coast is densely populated (by Australian standards), so the time difference when DST is in force can be most inconvenient.
 
Time is confusing. Civilization, please invent ringworlds, TIA
 
12:38 PM
Australia is such a mess.
OP: “well i've been googleing randomly trying to find an example to lead me into it...”
Me: “Well, you’re not supposed to google *randomly*.”
“rabbits” … “kittens” … “puppies” … “rabbits and puppies” … Why can’t I solve this problem?!
 
@poke Darwin, the capital of the Northern Territory is effectively on permanent DST, due to its longitude. Not that it needs DST, being so close to the equator. FWIW, I hate DST
 
Devil's advocate: if you consistently miss the mark while aiming carefully, maybe firing randomly in all directions will be more likely to succeed.
 
@Kevin Are you sure? *goes back to googling rabbits*
 
"... And that's the story of how Kevin got banned from the gun range."
 
Google capybara, they've got more attitude.
 
12:42 PM
@PM2Ring I am very neutral about it. I see why people could dislike it, and I see why it was invented. It doesn’t bother me, and stopping DST now, especially if only a few countries do, would be a terrible idea.
 
arent capybara the largest rodents?
or am i thinking something else?
 
@Programmer Yes, they are.
 
> The capybara is the largest rodent in the world.
So says Wikipedia
 
They're like oversized beavers
 
12:46 PM
Capybara tend to be more relaxed than the smaller rodents; I assume they have a slower heart rate. And they aren't scared of cats.
 
@PM2Ring Neither are rabbits:
 
I wonder if the same is true of wild rabbits
Or is it just limited to domesticated ones, who are already conditioned to unfear large predators (i.e. us)
 
@poke Fair enough. I guess you do need to get the cat & rodent used to each other to get photos like that; they aren't likely to respond well to each other at first. But I reckon it'd be a lot easier to do that with the larger rodents - I can't imagine a rat or guinea pig being too comfortable that close to a cat.
@Programmer There are some similarities, although capybaras don't undertake major engineering projects.
 
@Kevin We have feral rabbits and feral cats in Australia. I doubt they get cuddly with each other in the wild. :)
 
12:56 PM
That's a pretty nice gif. I'm a little shy of playing with color blending ever since my OpenGl days when I was flummoxed by all the possible settings for combining two transparent polygons
 
@PeterVaro Simple, but effective.
 
hello guys
good evening
 
@PeterVaro Wow, that’s beautiful
 
@JonClements
 
@PM2Ring @Kevin I don’t think you can get any wild animal to randomly cuddle with any other animal.
 
12:58 PM
@Aamirkhan hello... any reason for the ping?
wb @Morgan
 
@JonClements No just wanted to say Good Evening :)
 
@Kevin Try doing it in POV-Ray, where you have two "flavours" of transparency: filter and transmit.
 
@Ffisegydd Whilst I feel bad am more than happy am naturally delighted to be given the opportunity to steal all your reps, I actually feel bad because I meant to have a go at this when @morgan mentioned it last time and got distracted.
 
@JRS it's okay I'll get someone else to just post "Do the needful" and then give the bounty to them, so you don't feel bad steal my reps.
 
1:09 PM
:D
Sounds like a job for Kevin. Or Morgan could self - answer, thus completing a virtuous circle
 
So, is Go any good?
 
anyhooo - food
 
I'll do it on one of my sockpuppets.
 
@corvid I prefer chess
 
@Peter Have you ever used Processing?
 
1:17 PM
A couple of days ago I created a pattern in Conway's Life that continuously generates a stream of spaceships that spell out "sopython ". The RLE file is on pastebin; it's a standard format, so any Life program that can be fed pattern files should load it correctly, but you'll probably need to load from the RAW Paste Data or you'll get extra white space which may confuse some programs.
If you don't have a Life viewer installed you can use Gunstar which is an online viewer written in JavaScript. For smooth display, select a Generation Step of 4 in the Settings menu; that's because the gliders and spaceships have a period of 4.
FWIW, I used a couple of Python scripts to build that pattern, so I guess that makes it kinda on-topic. :)
 
Cute :-)
Looks like the design can be generalized to create any "dot matrix" style scrolling bitmap
 
Futures and promises are on the same wikipedia page, so how are they different?
 
@Kevin Ta. The premier Life program Golly uses a similar technique on its SourceForge page. But I improved / optimized it to use period 30 glider streams rather than period 46, so the output density is higher. And in the process I accidentally invented a better way of storing such patterns in loops of gliders. :)
@Kevin Exactly. A few years ago I did portraits of John Conway & Marilyn Monroe.
 
Hard mode: generalized animated gifs
I'm imagining a pixel display system similar to "life in life", with the gif frame data encoded in spaceships that move in the "grout" between pixels
 
1:26 PM
You can find links to both those patterns in this conwaylife forum thread
 
@Kevin Extreme mode: generalize animated gifs and generate a RLE sequence from it.
 
@poke yepp.. why?
 
For true verisimilitude, it should be able to read a GIF89a file format, encoded as a binary sequence of gliders.
 
It’s just that I’ve been hearing about it for years from certain people I have been following for long (Flash scene), but never really had the time to try it out. So I was wondering, if you would have anything to say about it :P
 
When someone else offers a bounty on my question, do I need to do anything other than just accept the answer to award the bounty?
 
1:30 PM
@Kevin There has been some work on general pixel displays. Yes, they use some similar techniques to the "life in life" patterns, so you can't avoid some intermediate stuff happening in the generations between the desired pixel states, but that's not a big deal: you just set the viewer to display every n generations. But if you want a decent sized grid of pixels n does have to be fairly high in order to get all the decoding and display build-up and tear-down stuff done.
 
@poke oh, I have -- since you are a real programmer, use some proper tools instead
:)
if you want something similar, than use: nodebox.net
 
I haven't used processing but I've heard that it's pretty user-friendly. From the type of off-the-cuff projects I've seen made with it, I imagine it has "fast prototyping" capability the way Python does.
 
which is built on top of pyglet
and if you want really awesome things, then use C/C++ and OpenGL 4+
both the efficiency and capabilities will be awesome and limitless
 
well, I don’t have much gfx programming experience but I really like pretty stuff, so I always wanted to do pretty stuff myself ^^
 
@MorganThrapp No. It's down to Fizzy now. Don't worry about it - glad it worked for you :) First time I've been called a beautiful man for a long time too!
 
1:32 PM
also worth mentioning vvvv
 
I want a graphics library with the maximum effort:reward ratio.
 
one of my collegues is a master of it --> he can do amazing things in almost notime, without a single lines of code
 
Not sure if that’s a good thing :P
 
Ex. Assembly can do anything, but the effort required is effectively infinite, so it's no good
 
@JRichardSnape Yup, now I just have to fix all the other bugs. That worked perfectly, though. I think the trick was moving to using pub instead of trying to manage my own Publisher instances.
 
1:33 PM
@poke yeah, well, I have the exact same opinion..
 
turtle is extreme low-effort, but you can only draw N pixels per frame, so the reward has a fixed upper limit
 
@Kevin it is very rare that you will ever need real assembly over the portable one (called C)
 
back then, I did a lot stuff with ActionScript. HTML5 canvas works pretty much the same now (with the same API)
 
@Kevin I'm working on it.. however it already took me a year or so to even get close to implement the core :P
 
@PM2Ring That is fantastic. I'm intrigued - is there a known way of printing arbitrary scrolled messages? If not, how on earth did you begin to code this?
 
1:35 PM
@poke actually Canvas is a bloody awesome stuff, but very far from being efficient
if you take a look at my latest creation, the hackathon website I've made for the company I'm working at
check the machine at the top, it is working
 
Yeah, in HTML/JS it’s a bit different. In Flash, you created sprite object which each had their own canvas you could draw on. So if you wanted to animate stuff or transform things, you could play with the sprites without having to redraw canvases
 
the barrel distortion and the font rendering and everything is written in JS -- yet, it is quite slow on some machines, which does not have proper computation power
 
@JRichardSnape Looks like you can change the pixels that get displayed by adding/removing gliders from the diagonal queues. Changing the height and width of the message is the tricky part, in my mind.
I grade the difficulty at "generalizable but I don't feel like doing it"
 
@PeterVaro The type input is delayed on my machine too. But looks nice
 
@Kevin yeah - visually it looks like the diagonal gliders are a kind of encoding. I guess you're right with "generalizable but...". Probably to get longer messages, "we're gonna need a bigger gun" covers it. Aside: I'm impressed that you have a grading system for the urgency and importance of hypothetical tasks.
 
1:39 PM
Apropos of nothing, I wouldn't mind a Flash Studio (or whatever it's called)-esque tool that generates an HTML5/javascript animation/game
 
@Kevin :) There's a guy or two on conwaylife who could probably build such a GIF decoder, using universal computation techniques (i.e., a Universal Turing Machine approach) but it would not be fast.
On a related note, after I uploaded my glider bitstream Fibonacci calculator, Calcyman submitted one that uses universal computation. My calculator uses a fixed loop of gliders, so it has an upper limit on the bitstring size; Calcyman's doesn't so it can potentially calculate Fibonacci numbers indefinitely. OTOH, mine runs about a billion times faster. :)
 
The length of the queues seems to correlate with the width of the message, and the number of queues seems to correlate with the height.
 
@RobertGrant Also, Flash Pro CC can export HTML5 documents with CreateJS
 
Ah lol
 
1:41 PM
@poke I know, that's because for 2d Context, you cannot create shaders
so I had to implement the per-pixel distortion in pure JS
on my machine (which is a power-plant) it runs fine.. but on a MacBook Air.. tragic :)
 
My machine also is a power plant
 
So much Math.
 
yeah..
 
That all looks rather cool
 
1:44 PM
I miss the times where I was able to understand it xD
 
anyway, back to the subject: use some very high level frameworks, like Unity or Blender or some lower level, like SDL and stuffs, if your want to create efficient, graphically-intensive apps
(and not Processing)
 
I wonder if Difference in declaring a function in Python and C would be satisfied if I wrote some examples of functions "created" at run time, ex:
def f(x):
    def g(y):
        return y ** x
a = f(2)
b = f(3)
print(a(4))
print(b(5))
 
@Kevin Correct. Each glider loop stores a row of the output image. The bit data in the loop gets inverted at each corner of the loop. At the bottom of each loop there's an (inverting) glider duplicator and a spaceship generator. The duplicator allows a glider to escape and kill a spaceship that's just been built by the generator.
 
Neat.
 
FWIW, there's an oscillator that converts gliders into spaceships. It works fine on period 60 glider streams, but the reaction's just a little too slow for p30 streams, and so a new spaceship can get killed by the reaction from the following glider.
 
1:50 PM
@Kevin You might as well just show all the stuff you can do with functions that don't make sense in C. Like redefining them, assigning to them, lambdas.
>>> def f(x):
...     return 5
...
>>> f()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: f() missing 1 required positional argument: 'x'
>>> f(2)
5
>>> f = lambda: 5
>>> f()
5
>>>
 
It's great fun building logic circuits in Life. Some of the principles are the same as doing it with electronics, but some are quite different. Eg, to get a signal to turn a corner, the easiest way is to invert it.
 
user559633
Happy good morning click around stackoverflow, skim news, ignore email, star-things-in-chat, drink coffee routine to you all
 
There aren't too many design environments where "I can't get the density I want because I need to space out my explosions" is a valid concern
4
 
Is there any difference in Python between def f(): return 4 and f = lambda: return 4
 
@Kevin There should be more of them, though.
 
1:55 PM
@QuestionC,
def f():
    def x():
        return 4
def g():
    x = lambda: 4
import dis
dis.dis(f)
dis.dis(g)
The only difference I see in the output is 0 LOAD_CONST, the first one being (<code object x at 00000000024B7EB0 and the second one being (<code object <lambda> at 000000000251D1B0
 
So at the very least, the repr of the objects are different. The types are the same though.
 

« first day (1816 days earlier)      last day (3132 days later) »