« first day (1402 days earlier)      last day (3771 days later) » 

03:17
@NoobSaibot a property is not instantiated for a class
 
2 hours later…
05:18
cbg
 
2 hours later…
07:43
Cbg()
07:54
return "Cabbage!"
[ print(time.sleep(1) or i) for i in 'CBG!' ]
08:07
@thefourtheye So true.
@thefourtheye fantastic :)
08:24
cabbage
http://stackoverflow.com/questions/25358241/what-are-the-difference-‌​between-these-apps-django-contrib-comments-django-flue
Done
Does this count as rude?
No I don't think so
It's not particularly constructive though.
09:49
how do i get rid of this error?? I used
BNG_data["Structured_Address_pre"] = [','.join(filter(None,row)) for row in BNG_data[BNG_data.columns[11:27]].values]
----> 5 BNG_data["Structured_Address_pre"] = [','.join(filter(None,row)) for row in BNG_data[BNG_data.columns[11:27]].values]

TypeError: sequence item 0: expected string, float found
the column no 11,12 has values like
32 , 21 , number 4 , no 8 etc
Also has 08-Apr ;)
When using join you join together strings.
So you'll need to call str() on objects to convert them to strings.
i did str(row)
that dint work
[','.join(str(filter(None,row))) for row in BNG_data[BNG_data.columns[11:27]].values]
What about that?
What's filter meant to be doing?
filter ignores None values
Using pandas right?
09:54
so if a column is None , it ignores it and goes ahead with joining
yeah , u know me stewie ;)
;)
What does filter return if it gets a None row though?
suppose column 12 is a none so my data will look like something,,something.. (notice the blank between 2 commas)
filter will give me
something,something (ignores column 12)
TypeError: 'module' object is not callable
>I AM VIRTUALLY A NOVICE IN PROGRAMMING.
You, sir, are not just a novice at programming, that's the least of your problems.
09:59
@Swordy I see what you mean.
the error or the explanation? :P
I see what your function is trying to do in the first place :P
please please
O_O
I'm thinking, gimme a sec.
You want a list of strings?
Yes?
no , a string that joins all the columns with a comma
10:02
[','.join(filter(None,row)) for row in BNG_data[BNG_data.columns[11:27]].values] is a list comprehension though, it will return a list of strings. Where each string is ','.join(filter(None,row))
col1  col2      col3       col4
Hey  Stewie    wassup  Hey,Stewie,Wassup
i want col4.. This used to work before.. Why isn't it working now :(
So you have N columns of data and want to combine them in another column?
yeah..combine columns 11:27
11 to 27
Lemme whip up an example
yeah sure.. :)
10:08
hehehe were you previously following this example by DSM? stackoverflow.com/questions/12030398/… :P
XD
yeah..first time,i used that
[','.join([str(i) for i in filter(None,row)]) for row in BNG_data[BNG_data.columns[11:27]].values]
Try that @Swordy
uhhhh , doesn't work still ..let it be , you shouldn't waste ur precious time on this.. you have already helped enough :(
I'll see what i can do and will tell u in case i get it working
Your problem is that you've got numbers in there
And str.join only works with strings.
you know , it is working in another code
10:16
So you first need to convert them to strings (which I've done with the list comprehension by calling str on each element in filter(None, efogjerg)
Do you have different data though?
but not this one.. both have nearly the same data
As if you just have strings in the other data then it'll be fine.
want the screenshot?
the other data had numericals too
click on the above thumbnail and see
Yeah
And everything is either a string or a number?
the 1st 2 columns..
the error shows a float
TypeError: sequence item 0: expected string, float found
i guess i know what is wrong
10:21
Python 2 or 3?
columns 6 and 7 have values like
12.964875 ,72.0098
etc
python 2.7.5
Last time when i used the same piece of code , these columns weren't present
so it worked
Try this
import pandas as pd

df = pd.DataFrame(dict(a=['Hey', 'Yo'], b=['Swordy', 'Stewie'], c=['Wassup', 'WASSUP']))

def join_cols(x):
    out = ', '.join([str(i) for i in x if i is not None])
    return out

df['new'] = df.apply(join_cols, axis=1)

print(df)
     a       b       c                  new
0  Hey  Swordy  Wassup  Hey, Swordy, Wassup
1   Yo  Stewie  WASSUP   Yo, Stewie, WASSUP
So basically you want BNG_data["Structured_Address_pre"] = BNG_data[BNG_data.columns[11:27]].apply(join_cols, axis=1)
Or soemthing along those lines.
hold on , i'll check that
does apply suppor multiple columns?
i guess we'll need np.vectorize for that
No shouldn't do
As you can see in my example it's applying to multiple columns
do columns 6,7,8 etc have any hand in causing troubles (as far as you know)?
u used df.apply
10:28
I don't know, I can't see those columns.
here it is df.columns[[12:28]].apply etc
wait
df['new'] = df[df.columns[0:2]].apply(join_cols, axis=1) only uses the first two columns, so new is set to "Hey, Swordy" but missing the "Wassup" for example
And same for 2nd row etc
columns 6,7,8
they werent in my previous data and that code worked
Well 8 (or H) is float.
this time it isn't working , and i guess they might be identified as float
10:31
Yes but if you do either of the things that I suggested then that shouldn't matter
As you'll convert 12.39455 to "12.39455"
uhhhhhhhhhhhhhhhhhhhhhhhhhhh
i guess i troubled u enough
hows ur Phd going?
Busy busy busy. Moving house soon as well so having to pack all my things up in the evenings.
:)
does anyone on SO know ur real name?
Clements :D
10:36
We're all secretly Jon.
i dont see the yellow puppy here
Jon is actually a schizophrenic with like 20 laptops open.
He orchestrates this madhouse.
Each laptop playing a different character.
You mean Martijn is Jon
And peter varo is Jon on another laptop?
and maybe you are Jon on a 3rd laptop
I am all of you. You just don't know this yet.
And even I'm Jon , talking to myself all the time o_O
Jonception
10:43
"ftarlusee"[boolean_value::2]
@MartijnPieters If you mean knowledge on python , then you surely are (except for the pandas part) :D
(credit goes to gnibbler)
@Swordy The exceptions are just a ruse to keep the illusion.
11:19
Cabbage
@limelights Cabbage!
how's tricks?
12:15
Cabbage
Anyone using python cgi here?
WSGI > CGI
@Pilot if you have a question then just ask it, you don't need to ask if anyone knows X, Y, or Z.
Ok..so when I try to print the headers with some response code other than 200 still my http server returns me status code of 200\
     import json
     import sys


     from util import getMEMStats
     from util import getCPUStats

     def getStats(self):

         return {
             'mem': getMEMStats(),
             'cpu': getCPUStats()
             }

     print "Content-Type: application/json"
     print

     print json.dumps(getStats())
This is how my cgi script looks like
You can format your work as code by editing it, selecting it all, and pressing Ctrl+K
12:22
and I am using http request handler from CGIHTTPServer.py
@Ffisegydd should be better now?
Yeah awesome.
@Peter devart.withgoogle.com possibly of interest to you.
@Ffisegydd will you help me
No. I know nothing about CGI.
@vaultah can you help me
@Pilot please don't ping people asking for help.
Anyone who can or wants to help you will do.
You'll make no friends by pinging people and bothering them when they may well be busy.
12:27
@Pilot no, because I know nothing about it
Probably Jon stuck on CGI on one of his laptops.. :D
@vaultah ok
no worries
@Pilot Hopefully others will be on later to help you out.
The initial review queues are a bit depressing aren't they?
"Oh look, a first review question" clicks aaaaaaand it's been downvoted to a bajillion with 5 comments explaining why it's a bad question in slightly differing wording and levels of abuse
Why is it people keep insisting on using CGI? I've definitely noticed an increase in CGI-related questions over the last year or so. Is some course teaching it as the new hotness?
Perhaps it attracts the "do it yourself" crowd, that want as little framework as possible between their code and the output.
If I did web stuff as a hobby, I'm sure I'd dabble with it.
This would explain the persistent usage, but not an increase in popularity, though.
12:42
Or maybe there's an exodus from other languages that rely on cgi (or cgi-like) architecture?
People that come from PHP find CGI more familiar
Maybe there's been an increase in popularity of web development in general, which would increase the proportion of CGI questions to non-web questions
hmm, good theories
Even if CGI isn't popular in comparison to Django and friends
the thing about not getting between the code and the output reminds me of that very strange troll we had about 18 months ago, kept insisting that exact same thing and eventually became very abusive
12:46
@DanielRoseman That's a wee bitty odd
I understand the viewpoint. Reinventing the wheel is a lot of fun.
But fun != productive, in many circumstances.
but surely hobbyists tend to have the mindset of "i need to do this thing", rather than "i want to build the entire stack from scratch"
Unless it's someone who wants to understand the entire "stack", which is admirable in its own regard
I think there's room for both. Some hobbyists work to get a working product, some work to learn.
yes it is, but that's a completely different kind of questioner, and you can definitely tell the difference
a lot of the CGI questions are exactly those that the "I want to understand" mindset would quickly get to the bottom of
ie anyone who's really interested in understanding how it all works would dig until they understood it, rather than posting an SO question every time they get an indentationerror
12:51
Hmm, agreed
@DanielRoseman We are very familiar with that troll.
That was a very sad character.
I have the impression a school board somewhere mandated Python web programming be part of the curriculum and used outdated standards to set the required lesson plan, or some such.
It could be the rise of Raspberry PI popularity together with a popular blog post that used CGI, etc.
could be anything.
@MartijnPieters what happened to him in the end? did someone manage to block him from creating new accounts?
Let's poll every active asker in and see how they got started!
@DanielRoseman Tim Post put in some extra effort and we haven't seen it since.
12:58
On the other hand, "hey please fill out this survey" posted on a thousand posts would probably irritate the mods. Let's not.
Nobody wants to feel the wrath of the banhammer
I need explanation for how this code works or I'm going to a therapy now before I shot my head, I never thought programming can make you suicidal to this dangerous level ! — user3786562 1 min ago
I wonder if "what's with all these CGI users?" would go over well on Programmers. Too opinionated?
That post is too vague to answer, and those 4 answers are not adding anything.
@vaultah Might be worth considering a career change?
13:06
@vaultah I feel bad for users asking "explain this whole thing to me, I don't understand any of it". Because the problem is in their brains, not in the code. We're programmers, not psychiatrists!
Yeah
"I suspect you don't understand recursion because of an unconscious power struggle between you and your father"
Surely it should be "I suspect you don't understand recursion because you don't understand recursion"
Ha! Love Google easter eggs
There are some odd ducks at Unix SE
"Is there a tool / library / application". Just wow.
Closed
I wonder if people born under the astrological sign Cancer are less likely to be interested in astrology because of the negative connotations of their sign's name.
Here's a correlation - I'm a Cancer and I generally don't give a damn
We just need another data point then we can draw a line and close this problem.
13:33
If so, I wonder if newspaper astrology columns are lazier when writing forecasts for cancer, because they know it makes up proportionally less of their readership.
Bonus points if you can figure out how a "lazy" forecast differs from a high quality one.
(side meta question - I've realised there's a stupidly EASY way to resolve the question. Do I post ANOTHER answer, or just modify my previous (rubbish) answer?)
@Kevin More letters used?
I tend to edit it whilst also keeping the original answer there. So maybe have:
I'll post multiple answers, but only if the approaches are very different.
I think I've only done it once, actually.
"blah blah blah new awesome answer blah blah blah

ORIGINAL:

blah blah blah scottish independence blah blah blah whiskey blah blah blah haggis blah blah blah"
@Kevin By nature I'm a dirty hacker. It sometimes takes a minute or two to stand away from the problem and come up with an elegant sane solution. :p
13:38
Reminds me of an answer that I wrote a few weeks ago. It started out twenty lines long, and I got it down to like four lines after many edits.
Problem: "Don't want my users running another instance of program"
Solution1: "Constantly monitoring killscript"
Solution2: "Use permissions"
HR person came in to introduce the new hire to us. "This is our IT office". Makes us sound like tech support and not devs ;_;
I mean, yes, that's technically our department name. But that's not the department name in my heart.
Slap them with a glove and challenge them to a duel for the slight to your honour!
(Or honor, if you're so inclined ;))
Outsiders don't stay in the IT cave long enough for me to get a slap in.
Then might I suggest you need one of these: hbbb.com.au/estore/…. Power it with a RaspberryPi and you're sorted
13:47
@Kevin in one company I worked in, we had separate IT and Technical (ie dev) departments, but the directors of both were called Gordon.
Useful both for proposing and conducting duels. "slap I challenge you to wacky extendo arms at dawn"
3
Here's a Google easter egg I've just learned about: they have both a robots.txt file and a killer-robots.txt file.
14:07
Currently on Page 3 of Google Search Results... Here be dragons ...
"May your Google searches have no useful results on the first two pages" -- ancient Sumerian curse
It's a step or two above "may you live in interesting times"
I got to Page 4 but then ran away screaming in perpetual insanity. What has been seen cannot be unseen.
@Ffisegydd Do you have 100 searches per page?
Ah, no I don't believe so.
I actually just have 1 search per page.
If it isn't in the top 3 then I'm simply not interested.
You are most wise.
14:14
0
Q: python 2.7- urllib2 and .splitlines()- when i try to print the .splitlines() of an html code pythonw.exe stops responding

yolozfirst of all- it's a school project, and the class' teacher forbade us to use any module except urllib and urllib2.. which means- no beautifulsoup, htmlparser, re or w\e is out there.. the project is to program some sort of automatic "wiki game"- you pass two wiki pages (their names, not urls) an...

"first of all- it's a school project, and the class' teacher forbade us to use any module except urllib and urllib2.. which means- no beautifulsoup, htmlparser, re or w\e is out there.." That is one sick and sadistic teacher...
Oh this is beautiful: "to summarize-two questions: 1.how do i stop the .splitlines() from crushing? 2.how to take what i need from a line string? 3.can you think of any better algorithms using only urllib 1 and 2?"
"To summarize two questions: 1:... 2:... 3:..."
spaces between function name and opening parentheses, alternating between alllowercase and TitleCase, tuplez... Eek!
His name is "yoloz"
return True if booleanExpression else False
He's not even consistent in his awful choice of spaces-between-functions-and-parenthesis.
"no 're' or beautifulsoup mudules."
I'd personally just take the marks hit and use beautiful soup
14:20
I don't know how comp sci works. Can you do that? Or would you just get zero?
Unhelpful criticism of style aside, I feel very bad for this man, who must parse html without tools designed to parse html.
Shall we link his teacher to "the answer"?
He's not even allowed regex though.
Agreed. That's what happens when you use regex. I dread to think of what happens if you were forced to parse wikipedia using an abacus.
He doesn't necessarily need to parse html, he just needs to get every substring that looks like a wikipedia article.
14:21
Open beautifulsoup source code, copy-paste into script. Tadaa, no importing needed
Which you could do using regex.
Ooh, maybe there's an existing Wiki Game implementation online that you can make requests to.
Urgh he could just get the raw html and then split it on 'http://en.wikipedia.org/wiki/` and then for each substring returned take up to the first non-ascii/_ or something like that.
urllib.get("wikigame.html?start=astrology&end?=pokemon") kind of thing
That's get him all the urls without using bs4 or re.
14:24
Seems like this is a duplicate of this
One of them has already gone
I have half a mind to make the exact same comments that were on the previous one :-)
^ deleted post
I don't even know what he's asking
"Is it possible to do that? and if possible - how It could be done?" Yes, it's possible. You do it by executing the code you wrote in the question that you wrote.
Maybe his question is "how do I check if the variable name a is bound to anything, and if so, call it?"
14:31
but that way lies madness.
Morning, Jon. Or something close to it, accounting for time zones
15:31 is almost morning I guess
cabbage all
cbg both.
And cbg @Zero (don't try and sneak in like that without saying hello!)
And cbg @DSM too! You lot are like buses.
skulks shiftily
DSM
DSM
My turn: cabbage for all!
14:34
Wow... RO mass join... :)
It's actually an intervention.
leans down and gently rolls a miniature cabbage into the crowd
I think they were all having a secret Python meeting without us :/
Jon...sit down...it's time we discussed the fact that you're not really a puppy.
realises he forgot to take the pin out
14:36
Yeah. I'm not an expert on canine biology, but I don't think a 2.4 year old can call themselves a "puppy" any more. (using your profile "member for" time as a baseline, here)
It's like women that celebrate their "29th birthday" for five years in a row
@Ffisegydd Are you taking some of Kevin's medication? Of course I'm a puppy... don't be ridiculous
Kevin said that today's experiment was for me to take them rather than him ;_;
@Kevin Just because he joined 2.4 years ago, doesn't mean he's 2.4 years old.
has possibly been watching too much Doctor Who lately
New one of them coming on soon isn't there?
You're right, I think we need to allocate some time to learn English and Python. How about 2.5 years.
14:40
This Saturday I believe ... been doing a complete run-through.
I'm not looking forward to it. I have nothing against Doctor Who per se but whenever there's a new series all I hear about from a subset of my (idiotic) friends is fangirl-esque screaming.
Well, not complete. New series.
@Ffisegydd This Saturday
Be the first proper episode with Capaldi
@Ffisegydd I'm on the opposite end of the spectrum. I know precisely zero Dr Who fans in real life.
His name sounds like an Italian meat dish.
14:41
@Ffisegydd I am. New doctor isn't cute and will apparently take on a darker aspect like some of the original Doctors. Will be interesting and likely to piss off a lot of squealing maniacs ;)
@Kevin truly you live a blessed life.
And Jenna Louise Coleman has just announced she's quitting
Also - likely to be the first proper Scottish doctor ;)
Was also going to give Torchwood a crack for the first time, but gave up after three episodes. That programme is bad.
@ZeroPiraeus Yes. Proper, raging gash
14:41
@IntrepidBrit what? what about Sylvester McCoy?
Apparently there will be virtually no doctor-companion romance subtext, so that will probably deflate the fangirls' sails a bit
Well, I think my favourite "original" Doctor was Tom Baker, but my favourite "new" doctor is definitely Tennant
DSM
DSM
That'll be a nice change. I kind of like slightly-menacing alien Doctor.
@DanielRoseman I mean, he won't go all BBC English on us
And they may be getting Rose Leslie in as the new companion. Meaning a rush of "You know nothing, Dr Snow" jokes.
14:43
In a compressed session, Tennant's emoting gets a bit wearing for me.
@IntrepidBrit neither did McCoy, Seventh was Scottish through and through
unlike Tennant, which I guess is who you're complaining about
Most noticeable things this run-through: Martha and Donna are actually the best companions.
@Zero Martha took it very seriously, Donna was dim but had the best intentions
I liked Tennant, although the ominous "I'm the oncoming storm" bits didn't land for me. A Destroyer of Worlds doesn't wear tennis shoes.
@Kevin that's what he wants you to think.
When the robots come they'll all be wearing tennis shoes for enhanced grip and comfort.
14:46
I didn't see every episode, but I recall it being pretty light on world destroying overall.
@Kevin ahh, but if you're too busy criticising the clothing, you're distracted from realising the man with the tennis shoes is a destroyer of worlds...
... and, possibly not coincidentally, the ones where the relationship is not just a love story.
can you at least answer question 2 plz? :P @Ffisegydd — yoloz 52 secs ago
This is what I get for making a witty remark.
I do wonder why his splitlines is crushing - er, crashing.
Thought it might be an infinite loop, until I saw he didn't have any loops at all.
shortest looks like it's intended to be recursive, although it isn't actually.
So faint possibility of "oops I was running an older version which recurses forever" there
@DanielRoseman Oh don't get me wrong. I liked Tennant, but there was some grumbling because Tennant was forced to use his RP English one - despite the Beeb wanting to increase the amount of "regionalism" in it's offerings
14:52
@Ffisegydd Wow... that's one hell of an assignment... and with those constraints on top... I'm not sure sadist quite covers the extent of that... What the heck is the student meant to learn... were I a Python beginner I could see myself becoming discouraged just by trying to complete that...
Iterating through a link tree of height 5 would take pretty long, if you're following every link on the page...
@JonClements I wouldn't have tried progressing with coding. I'd be like "nup, I'm out" and likely to have become a carpenter
Sounds like a poor teacher. I understand trying to teach the basics and logic of programming but at the same time part of programming is using the correct hammer for the job.
When the only hammer you have is C++, everything looks like a thumb.
Couldn't agree more. That's why I think all new students should learn C, then move onto other languages relatively quickly
Don't star that, I've made the same joke before and I stole it from elsewhere anyway :P
I learn FORTRAN first and it was great, got me the basics of iteration, conditionals, etc and then we self-taught ourserlves Python.
14:58
Aw, I was just about to propose starting with Fortran and moving up, in chronological order. Beat me to it!

« first day (1402 days earlier)      last day (3771 days later) »