« first day (1446 days earlier)      last day (3507 days later) » 

11:00 AM
this works fine now
thanks Jon :)
 
Wow... Britain's getting quite strict about travel to Syria/Iraq and possibly not allowing people already there to come back if they're suspected of nefarious reasons
 
Yah we just got our first diagnosis of freakin ebola in Texas.
It's all going down hill
 
@Johnston Stephen King's The Stand is coming true!
 
@JonClements I had to look that up.
 
@Swordy Ah, you can do that in one expression rather than loop over w:p tags first.
 
11:05 AM
28 days later with a bit of terrorists added in for extra drama
 
@MartijnPieters could you show me that?? but i need text of one paragraph in one list , 2nd in another and so on..
 
@Johnston I better hurry up and buy a nuclear bunker
 
@Swordy I added a loop to my answer, but if you need separate lists per w:p then by all means nest the loops.
 
I'm writing to you from my nuke bunker. Haven't seen the sun in 3 years. but hey at least no ebola.
 
and "t for t " shouldnt be required , right?
 
Jesus Christ the op made we work for that one. I'd better get the bloody accept.
 
morning everyone
 
cbg
 
cbg @corvid
 
@Ffisegydd He did indeed
 
11:18 AM
The solution he wanted in the end was the simplest, I probably should have provided that first really :P
But at least it's a nice question now which suggests alternatives for anyone else who comes by.
brb lunch
 
There should be a death penalty for posting unrunnable code
The rule being "For every line shorter the minimal working example is than your broken excerpt, one of your vital organs shall be fed to Jon Clements".
 
I'm quite pleased with this one - similar to some other answers, but I like it :)
 
11:36 AM
strategy games have such ridiculous learning curves...
 
@Veedrac okay... putting in some error handling :)
 
I keep scouring Philip Eby's blog for signs of cool Python amidst all the self-help crap^Wstuff
 
has anyone have any experience in Vala?
 
@Veedrac right catered for no lines, first line being duff, or subsequent lines being duff
 
@JonClements locals().get('lineno', 0) srsly?
 
11:44 AM
lineno doesn't exist if the first line is duff... and I'm getting bored with the answer now :)
 
bad puppy!
Set lineno = 0 outside the try then.
 
Anyway everyone knows the best way to silence StopIteration is to use a generator:
from itertools import count

def zip_with_expected(file):
    ints = map(int, file)                # ↓ hush little puppy
    yield from zip(count(2), ints, count(next(ints) + 1))

with open('testing.txt') as input_lines:
    for line, got, want in zip_with_expected(input_lines):
        if got != want:
            print('problem on line {}: got {}, expected {}'.format(line, got, want))
            break
    else:
        print("All was fine")
 
That's just boring though :)
 
Cabbage folks
 
cbg
 
11:53 AM
Hi @Veedrac, the book (Jef Raskin) has arrived, and I began to read ! I don't regret, excellllllent !
 
:)
 
@Martijn do you reckon the dupe is correct on this one? Yes - the %T isn't going to work, but it's not what they were asking to achieve anyway... so I think the answer about using %H instead is correct...
 
It's exactly the kind of book I was looking for... A true visionary mind !
Do you often think about it since you've read it @Veedrac ? Has it influenced your work ?
 
I guess. I don't do enough interface design stuff but when I do this kind of stuff is the kind of stuff I try and think about
 
@JonClements I'd say that dupe is correct.
It explains exactly why it doesn't work and why it doesn't work.
 
11:56 AM
Largely it's odd how the whole field of UI has turned less and less scientific
Or maybe the science is still there but being drowned out by the freelancers. I dunno.
 
Can I ask your UX ideas about this : bigpicture.bi I've now added versioning : write some text... Hit save : a random name is generated... After this, each new <SAVE> will add ~1, ~2, ~3, at the end of the URL. Straightforward.... But now I have another question :
 
@Basj wow - you're still working on that!? :)
@Martijn @hybrid_property's are awesome... had forgotten how useful they were :)
 
@JonClements I did a Python version one year ago... Working. Then I tried to do an "online version" last january. As I didn't know JS, I asked someone on freelancer.com . I lost 200€ because at the end it was not was I expected. :) Then I gave up during 6 months.
 
@Basj... ahh I remember testing the tkinter version :)
@Basj someone on freelancer who doesn't know what they're doing? gasp :p
 
@Basj A few comments on the saving if I may?
 
12:02 PM
@JonClements Then ... after long holidays without computer this summer, I had a strong feeling of starving of programming / drugs ;)
@JonClements then in beginning of september I decided to learn JS, and to do it myself...... F**ck about the 200€ lost on freelancer.com :)
@Veedrac sure!!
 
1: It seems pretty fast. Would it be possible to add more automation to the saving.
Preferably instead of versions one should just have infinite undo.
 
@Veedrac fast in which meaning ? automation on what ?
 
As in, it saves pretty quickly.
 
@Veedrac is it bad ?
 
lol, no
 
12:04 PM
@Veedrac that's right :)
 
Fast saving → you should think about autosaving
 
Ohhh yes , that's right about autosaving
 
Have you seen what Google Docs does?
I think it's probably the best way to do this
 
I implemented this versioning (~1, ~2, ~3, ...) because : if you share URL with someone, and he modifies it, bammmmmm you have lost the original version!
@Veedrac yes already used but I don't remember. How do they do ?
 
Every edit to files are uploaded as you make the changes, and all edits are stored incrementally (think Stack Overflow's revisions, but as you work). When you want to undo to a previous revision, you have a list of edits that you can scan through.
In your case, each edit (whatever you decide "an edit" should be) would automatically make a new revision, and you could pop out a list of revisions to go "back in time"
 
12:09 PM
@Veedrac your remarks are linked with my User Experience question I have :
I would like to propose 2 different things :
1) For people who will "share" the link (on internet, to friends, etc.) => Then it is important that SAVE does not modify the original.... [As an example, yesterday I shared on a chat a BigPicture project, and someone (probably with a script) added some nazi svastikas everywhere and my original project was overwritten!! ]
Then for people who want to share project, the system is :
http://bp.bi/blabla => http://bp.bi/blabla~1 => http://bp.bi/blabla~2 => http://bp.bi/blabla~3
 
Yup
 
2) For people who will not "share" => then I would like to have :
http://bp.bi/blabla => http://bp.bi/blabla => http://bp.bi/blabla => http://bp.bi/blabla
Then he doesn't need to update his "bookmark" on every save
 
Is there an easy way to check for two consecutive characters in a string?
 
@N1ghtshade3 What do you mean?
 
The user is inputting an equation and I have to check that there aren't operators next to each other
 
12:13 PM
@Basj It seems to me you want bp.bi/blala#latest:username
Which will link to the latest revision by that user
 
@Veedrac hum interesting... Does this system exist on some online service already ?
 
Actually, that overcomplicates it.
Just have bp.bi/blabla proxy to the latest revision
 
@Veedrac what do you mean ?
 
So bp.bi/blabla will show the latest version of blabla and each of the revisions will save as bp.bi/blabla~revision. Then if you have a link to a revision it will stay constant but if you have a link with no revision you'll always see the latest.
Exactly the same as what Github does
The only difference is that Github also has logins
 
@Veedrac yes but what happens if a spammer saves all the time with bad content => the latest will be a bad one all the time !
 
12:18 PM
@N1ghtshade3 It seems to me you should just build a proper parser and then everything will just work
That seems impossible to fix without being able to differentiate users. You want to be able to let User A update what the link points at but not let User B update it
 
oops, wrong tab
 
@Veedrac do you mean I absolutely need user management ? (login, etc.)
 
You don't actually have to have users
you could just allow people to associate passwords with their files
 
@N1ghtshade3 you've asked a question on SO itself, please at least give people on SO a chance to answer before you come asking here. See sopython.com/pages/chatroom for the chatroom rules.
 
12:22 PM
@Veedrac: what should happen when someone edits and saves on bigpicture.bi/1898oa ... as the link is public, the original version should never be modified (or anyone could put a nazi symbol like yesterday someone did)
 
@Basj In my opinion, you should never be able to change files (only make new revisions). Files should be delimited name~fork~revision. People should be able to apply passwords to forks such that if anyone wants to save they either need to fork it or have the password. If they have the password, they make file name~fork~revision+1, otherwise they make file name~fork+1~0. You should be able to link to name~fork which will always refer to the latest revision.
 
Weeeee itertools.tee :D
 
What datastructure does tee use?
A deque?
I bet it is.
 
It returns iterators IIRC? @Jon loves it.
 
It has to store the copied elements somewhere.
 
12:31 PM
hi
 
Oh I see what you mean.
 
@Ffisegydd Aww, no. It uses an internal linked list implementation: github.com/python/cpython/blob/master/Modules/…
@shantanuo cbg
 
todel=[['test','this'], ['antoher', 'example']]
what is cbg?
sum(todel, [])
 
What will this return?
 
12:34 PM
Why don't you put it into your interpreter and see for yourself?
 
good idea.
I want to know "why" does it return what it returns.
 
how could i generalize an expression to get the length of a list , for eg :
it could be ['a','b','c'] or ['abc'] , directly using len gives 3 in first case and 3 in the 2nd one too. I want first one to be 3 , and 2nd one to be 1. I checked [this](http://stackoverflow.com/questions/2058985/python-count-sub-lists-in-nested-list) but dint understand..
 
@shantanuo Because Guido said so.
 
Whenever someone asks me what some code will evaluate to, I imagine they're taking a final exam, using their phone to chat discreetly
 
@shantanuo it's equivalent to [] + ['test', 'this'] + ['antoher', 'example'] :)
 
12:36 PM
sum is effectively the same as
def sum(iterable, default=0)
    total = default
    for item in iterable:
        total = total + item
    return total
 
@shantanuo Note that this is O(n²). Really not a good idea.
 
In [17]: len(['a','b','c'])
Out[17]: 3

In [18]: len(['abc'])
Out[18]: 1
@Swordy what do you mean, they do return 3 and 1?
 
maybe i formed a bad example
 
@Veedrac I keep this in mind..... Maybe good idea!
 
An example that fixed your problem? :)
 
12:37 PM
@Swordy len(['abc']) gives 1.
 
it's equivalent to [] + ['test', 'this'] + ['antoher', 'example']
Got it. THanks.
 
Hint to discreet final cheaters: cut out the middle man, download a portable Python interpreter to your phone.
I use QPython for Android. Not that I do much coding on my phone, but it's nice to have the capability.
 
something dumb is happening here.. I used a general expression for it and for a single list it returned 21!!
 
@Kevin My friend runs Arch Linux with a tiling window manager on his phone
 
12:39 PM
no_of_com = len(comments_list_1[i])
where
comments_list_1[0] is ['Please note that I have slightly altered your title, and remember to refer to the revision when citing this work elsewhere.']
 
@Kevin Ditto. I was quite impressed with what I managed to do whilst bored on the bus
 
I suspect "people that cheat on programming finals" and "people capable of installing new operating systems to their phone" have a very small overlap.
 
Maybe it's an exploitable niche market..
 
We'd never be able to cheat in our exams, it's too open.
 
@Ffisegydd Good idea. We should do exams in the desert.
on mats
 
12:41 PM
@Veedrac you go do that if it makes you feel better.
We'll stay inside like normal people.
 
@Ffisegydd umm.... I get excited seeing tee, but what about just bool(re.search(r'[-+*/]{2,}', s))
 
It's not open inside
That's about the most closed place there is!
 
Just rig up a tiny computer inside your shoe. Tap morse code using your right foot for input, receive mechanical jolts in your left foot for output.
 
Depends on your definition of open.
@Jon yeah but that's boring
 
@Kevin The sand acts as a dampener, rendering your shenanigans useless
 
12:42 PM
@Ffisegydd hey - you're not allowed to use my reasoning!
 
@Ffisegydd Stealing from a puppy. Nice.
 
@Veedrac needs must.
 
Dumped for a pivot_table - now theft of poor excuses!
How did our relationship come to this :*(
 
Dumped is a harsh word. I prefer "demoted" O:)
 
you never did care for my feeling! you b'stard.... starts grabbing saucepans to throw at you
 
12:45 PM
@Swordy len(x) != len(x[i]).
 
Hey free saucepans!
 
@JonClements Reminds me of a picture...
 
@Ffisegydd I want them back though... some of them are quite expensive
 
I do love a good saucepan, it's one of those things where the quality makes a big difference.
 
I bought one for about £9 once... never again
1 message moved to recycle bin
whistles innocently :)
 
12:47 PM
Yeah I've got a really nice cast iron one. Weighs a ton but very nice to cook with.
 
Oh, OK then.
I see it's like that
 
Power corrupts.
 
@Ffisegydd I've got a really lovely iron cast steak pan thingy...
 
@Jon yeah the cast iron one I've got is a griddle pan, perfect for steak, gammon, etc.
 
Made the mistake once or twice that it was all metal
max heat across two hobs still it steams, then throw you steak in...
then picking it up without some mitts/wrapping on your paw - not my best of ideas
I was planning a nice meal with friends - not a trip to A&E
Oh cool... Civ5 supports touch screen
 
12:51 PM
Yeah, shame I've never had chance to try it.
Do you wanna play tonight or tomorrow?
 
I'm about tonight if you want
 
And see! I still play video games with you and not pivot_table! (Mainly because pivot_table is an abstract concept and so is unable to use a keyboard and mouse).
 
just trying to see if I can get it set up to use a monitor
@Ffisegydd awww... I supposed I've been harsh then :(
please forgive me Stewie!!!!!
 
Of course I forgive you...BFF #2!
 
awww #2... but for how long...
Umm... okay - fullscreen doesn't appear to go well with multiple monitors
 
12:55 PM
awww Am I the #1?
 
@thefourtheye pivot_table's are cooler than puppies apparently :(
@Ffisegydd ahh got it - have to set the external one as primary display to have it full screen
 
Come on Puppy... Don't give up... Lets hate them with the whole of our heart...
 
(makes sense in a way I guess)
@thefourtheye I can't... my heart's already been broken :(
 
I knew it... pivot_table is a beyatch...
 
@Jon talking about pivot_table... gleefully runs with pivot_table through a meadow
Nicely timed question there :P
 
1:03 PM
Looks very complicated to me... :(
 
@thefourtheye Half the code is just creating the dataframe, all the magic is in pivoted = df.pivot(index='time', columns='type', values='value')
 
mmmm, need to learn what a Data Frame is....
 
Think of it like an Excel spreadsheet but capable of much, much more.
 
Like addition?
 
@Ffisegydd was it you who cancelled my pinned message about st?
 
1:06 PM
You can embed Turing complete scripts into Excel spreadsheets, so much more than that is very impressive.
 
Possibly? I don't remember doing it but I do remember pinning the Illuminator badge so might have unpinned your message. If I did, sorry :(
 
We're forced to write programs in Turing machine emulator :'(
 
@Ffisegydd np -- although I don't think pinning a message will unpin another ;P
 
In university
 
No it won't.
 
1:09 PM
Write a program that compiles machine code to turing machine symbols, and you're golden
 
@Kevin That sounds hard
 
Easier than an entire semester's worth of turing machine assignments :-) Maybe.
 
:D
 
@Peter what I meant was that I might have manually unpinned it at the time, don't remember though.
 
@Ffisegydd still not a problem, I may pin it again (I think that project worth the extra attention) in the near future ;) I just wanted to know if you have any reason to make it unpinned in the first place..
 
1:13 PM
We should limit the number of simultaneously pinned posts, so there's more room for my starred messages :-D
 
We should stop starring your messages altogether as you're slowly destabilising the starconomy.
7
 
@Kevin LOL
 
logging.basicConfig(format='%(asctime)s : %(levelname)s : %(message)s', level=logging.INFO)
What does this line do?
Does it log somewhere that I can refer to later?
 
I would hate for the value of a star to go down due to inflation.
It's hard enough as it is, getting the coffee place to accept stars as payment. It's even in the name! Starbucks!
 
@shantanuo you've given absolutely zero information on what you're trying to do, how do you expect anyone to be able to help you?
That's like me saying "Hey my function derp() doesn't work" and nothing else.
 
1:19 PM
That line appears to do some basic configuration on the logging system. Indicating that future logged messages should be preceded with the current time and logging severity level.
 
Where do the messages gets logged?
 
Good question. I've never used logging so I have no idea.
 
A recent question states, "Note that I'm using Python 2.7, so no mutable strings". Has Python ever had mutable strings prior to 2.7?
Or maybe he means "so no mutable strings, unlike in many non-Python languages where strings are mutable"
 
Probably.
 
1:25 PM
That link does not answer my question :(
 
It does.
 
I feel like the question "where do my log messages get written?" ought to be answered in, like, the second sentence of the documentation. It bothers me that this is not the case.
The logging HOWTO tells us, "If you want to track the location of your messages, you’ll need to refer to the documentation beyond the tutorial level – see Advanced Logging Tutorial." Really? Just looking at your logged messages is an advanced topic?
 
a doubt , whilst using print "%d" when i add an actual percent sign it gives an error. I used backslashes to print it literally.. but dint work
 
Strings have been immutable since at least 1.4
 
Ooooooo clever perhaps too much so...
 
1:31 PM
"Tuples, like strings, are immutable"
 
@Swordy I believe you escape percent signs by preceding it with a percent sign: "%%d"
 
@JonClements Ewwww
 
But I would personally prefer that you use string.format, in any case
Percent style formatting is old and busted. string.format is the new hotness.
 
hah , that worked , i owe u a donut
 
logging.basicConfig(filename='abc.txt', format='%(asctime)s : %(levelname)s : %(message)s', level=logging.INFO)
I changed that line to add filename, but still nothing is being written
 
1:35 PM
@Jon polygon.com/2014/10/1/6877543/… may be of interest to you.
 
@shantanuo Are you actually doing any logging after this line occurs? Are you calling logging.log or logging.warn anywhere?
 
@Ffisegydd I will admit to having checked a few initial beta plays
those worms just look like a real pain in the rear though... reminds me of Dune :)
 
Yeah the aliens are interesting as they don't care what culture you are, they just care that you're human.
So if one culture is trying to work with them/not be offensive but another culture is attacking them, they'll take it out on everyone regardless.
 
In [23]: logging.log(20, 'test stack chat')
2014-10-01 13:43:09,500 : INFO : test stack chat

In [24]: !cat abc.txt
cat: abc.txt: No such file or directory
 
aliens subscribe to equal opportunity slaying, then
 
1:43 PM
I should be looking into current directory. right?
 
@corvid :)
 
@shantanuo Works on my machine.
I saw that Harry Potter comic on the "programmer humor" subreddit the other day, and about 90% of the comments were complaining that it wasn't valid syntax.
 
For some reason it does not works on my server.
 
It looks OK to me, other than being in all caps...
 
1:48 PM
In [31]: logging.basicConfig(filename='abc.txt', format='%(asctime)s : %(levelname)s : %(message)s', level=logging.INFO)

In [32]: logging.log(20, 'test stack chat')
2014-10-01 13:47:11,158 : INFO : test stack chat
In [34]: import os

In [35]: os.getcwd()
Out[35]: '/tmp'

In [36]: !cat /tmp/abc.txt
cat: /tmp/abc.txt: No such file or directory
 
@shantanuo Maybe it won't log the messages until the Python process terminates.
 
@Kevin well, I had a go at that week question anyway
 
Tried that too. No luck.
 
I'm out of ideas, then
 
I was following the tutorial from here...
Don’t forget to set logging reads the first line.
I thought it should be useful. But I guess I will have to forget about that.
 
1:55 PM
@shantanuo do you have write perms in the cwd?
 

« first day (1446 days earlier)      last day (3507 days later) »