« first day (1920 days earlier)      last day (3029 days later) » 

1:06 PM
Any opinions on the best way to get the set of all the keys in a list of dicts? Here are 2 alternatives I've come up with. my_stuff is the list of dicts.
allkeys = set()
for d in my_stuff:
    allkeys.update(d.keys())
allkeys = set(k for d in my_stuff for k in d)
Yes, I realize the 2nd way could be done with a set comprehension... :)
 
I prefer the setco ... Simpler to understand
+1 understandable and elegant — Jon Clements ♦ Jul 9 '12 at 16:41
 
user559633
We've found that the best solution for this problem is to generate HTML and component trees directly from the JavaScript code such that you can use all of the expressive power of a real programming language to build UIs.
 
user559633
not sure i'd be throwing stones if i lived in their house
 
Cbg
 
Cbg
 
1:09 PM
@BhargavRao The 2nd way is shorter, but I suspect the 1st way may be faster, assuming .updatecan loop over d.keys() at C speed.
 
@tristan Should I now be ashamed that I am doing all the rendering on the client-side?
 
@tristan So JavaScript's a real programming language now? When did that happen? :)
 
@PM2Ring Have a sample "really long" my_stuffto test?
 
user559633
@PM2Ring Ha, yeah, exactly.
 
user559633
Oh, did you guys get a standard way of printing text yet? No?
 
1:12 PM
@BhargavRao Nah. And this isn't really important, it's just for a SO question. And I'm feeling too lazy (& it's getting a bit late) for me to run timeit tests.
 
user559633
@khajvah No. Why not? I know you could generate it server side, but clients are very fast.
 
@tristan console.log()! So portable.
 
@PM2Ring Np, I'll test it from the sample in the liked Q.
 
Mind you, I've had fun doing stuff in JavaScript, but I've never done anything particularly complicated in it. And I've never bothered learning jquery or similar things.
 
user559633
@RobertGrant Exactly. JS and ES6 seem to be...fine, but good lord I would not be talking trash if that was my point of comparison
 
1:14 PM
 
user559633
At least with Scheme or Lisp, you can hide behind its syntax
 
@BhargavRao Sorry. I should've mentioned the OP's data is a little weird. :)
 
@tristan isn't it "real" compared to HTML?
 
@PM2Ring You should do an entire client with Angular.js. So fun </sarcasm>
 
@PM2Ring Lol.. :D I will just time the results and fly away
Oh damn, I realized that I have no Python on my system :O
 
1:19 PM
@tristan Related
@BhargavRao Are you using Gentoo?
 
@khajvah Nah, Installed Windoze today ... Only because one of my conference papers asked me to submit the file in .docx
 
One weird trick I did in JavaScript a few years ago was an LZW compressor / decompressor. One variant could be used for producing self-decompressing LZW-compressed JavaScript programs - it stores the compressed output in base64 encoding. Unfortunately that variant no longer functions on modern browsers.
 
user559633
@khajvah that's from 2012. an important thing to keep in mind when doing web development is that you should not learn from the past under any circumstances.
 
@BhargavRao Never mind. I'll just post the version that uses the pseudo set comprehension.
 
@tristan :D gives me hope.
 
1:24 PM
@PM2Ring Sry anyway. Is there an online interpreter that can test the timings?
 
@BhargavRao Maybe... Don't worry about it. I guess I can throw together some timeit stuff myself.
 
@PM2Ring Decided to stay up late then? :D
 
:)
Ok. On that dataset the for loop with .update is noticeably faster than the comprehension: 0.083 vs 0.103 for 10000 loops on this old machine. So I suspect it would be even more efficient with a bigger list of keys.
 
So your thoughts have come true. (But I still like the setcomp)
 
> Head of Application Software
what does that supposed to mean?
 
1:39 PM
And what does "junior, senior, lead" mean?
 
@RobertGrant Noob, experienced, project leader
plus, what is "Application Software"?
 
user559633
junior, senior, lead is meant to represent which levels they're hiring for.
 
I think it means "we'll have anyone, but we will blame you for everything"
 
user559633
another finished product from the SO team before rolling out new features
 
It was earlier "Kick Ass Python Developer"
 
1:41 PM
"Hacker mindset with ability to work in less than ideal environment" so amazing
 
so tempting
 
user559633
$2,000 usd?
 
user559633
holy wow
 
user559633
lol 'Potential for CTO-track role in approximately one year.'
 
big salary in PL
 
1:43 PM
@tristan That's average for third-world countries.
cries
 
user559633
Whoa. Cost of living must be nothing there
 
@tristan that is for month, not year :?
 
In Mountain View? Yeah.
 
user559633
$2k per month is still very little for those skills.
 
@BhargavRao Drats. The OP's just turned up and accepted the other answer. Oh well. THe other answer's not bad, although it uses the .pop() method to remove the unwanted keys, which I think's a bit dodgy, since he's not using the popped value.
 
1:44 PM
@tristan lol, the average salary, where I live, is about $300 per month, for programmers, it's about $500.
 
@tristan kidding; I thought MV was really expensive?
 
Secure file sharing. I worked in a startup exactly in this area.
 
@tristan not in poland
 
user559633
@RobertGrant Mountain View is very expensive, yes.
 
what sucks is that in FINLAND everything is expensive, except software engineers.
 
1:46 PM
Was a hot topic after Snowden.
@AnttiHaapala Well, they're quite expensive, too.
 
Switzerland must be nice.
 
Cost of living in Poland is 50.65% lower than in Finland (aggregate data for all cities, rent is not taken into account). Rent in Poland is 51.41% lower than in Finland (average data for all cities).
 
@PM2Ring Yep, code-only is "really neat" until someone asks to explain :D
 
so, $2k is like $4k in Finland
 
Reading your answer now
 
1:47 PM
And salary is twice.
before taxation, of course
 
@bereal more than twice I think
 
@tristan I realise that at some point I thought you were talking to me when you weren't, I just thought I'd go with it anyway
 
switzerland is damn expensive
 
Well, Senior's salary in the capital region starts from ~4k
 
@AnttiHaapala always wanted to go there, for some reason.
 
1:49 PM
4k€
 
My starting sal is 1.5k$ per month ;_; (fresher)
 
@BhargavRao so...?
 
But 4k in Finland after taxes is like 2.7
 
@AnttiHaapala You guys are fighting over 4k$ and I am sitting here like :O
 
@BhargavRao just depends on cost of living
 
user559633
1:50 PM
We offer a limited-duration contract for a period of 5 years.
 
user559633
5 year contract. That's so long
 
Yeah that's massive
 
you go to MV cali, and you get 10k-20k/month
 
A permie only takes a month to let go!
 
... then you spend that 10k-20k on living
@RobertGrant in Finland but if not agreed otherwise, 2 weeks until 5 yrs :P
ah I read wrong
 
1:55 PM
Cost of living? ... Shaving Blade here costs $0.01 ... :D
 
:P see...
I spend 5 € on a frikkin 5-blade Gillette
 
Lol, what bout there? @Antti
 
and still get rash
 
Mind reading in progress...
Hey, mine was 3 blade Gillette. I haven't used 5 blade.
 
and how about dining out?
lunch at work place, buffet though, 10 €.
if you want to eat indian lunch, 10 € :D
dinner: x 3
 
1:58 PM
I spent 20$ for a 7 course dinner.
 
yes...
 
Lunch at workplace is free :/
 
the dinner is like beefsteak and starter.
if you drink beer then add 7 € for each pint
 
7 euros for a pint?
 
Sigh .. Haven't bought any of these. Can you change to some student stuff? Like stationaries?
 
1:59 PM
yes, in a restaurant
 
holy crap. I pay 1.5 in a restaurant
 
Yeah, it's $6-15 for a pint here, depending on how cheap you're willing to drink.
 
if you pay 1.5 for a pint here, it is a special discount for a can in grocery store
 
in a store it's like .5-.7
OMG, I live in a heaven
 
2:01 PM
I mean, you can get beer that cheap here, it's just not worth drinking.
 
I bought a DSLR in Canada for 720CAD, the same model was 30kINR (640CAD~) at my place sigh
 
the 7 € is for a nice IPA
@khajvah there is only 1 beer which you can buy for 50 c / can (0.33l)
it is 2.8 vol-% lager from german chain Lidl
but it is a very good drink for late coding sessions
 
@BhargavRao That gives me $4 for a pint.
 
@MorganThrapp I haven't bought beer in ma life :/
 
2:06 PM
@AnttiHaapala 50c/0.33, what's that?
 
@bereal His reply when he drinks that much after paying 50c for that
 
What's the cost of accommodation like in India? I bet it's quite a bit cheaper than Finland or NYC. :)
 
user559633
It's ~$3-4 USD here in Moscow for a pint of something decent
 
@BhargavRao I haven't bought beer today. Yet.
 
2:07 PM
never seen...
 
moscow seems to be damn expensive :P
@bereal in cans, from Lidl
 
user559633
The strong USD is making it really affordable for me.
 
That's actually pretty cheap.
 
@PM2Ring This is the mail from a IEEE conference in India i.stack.imgur.com/tgPj9.png
 
I would be super happy paying $4 for a decent pint.
 
2:08 PM
 
Moscow is getting cheaper every day... it's already 86rub/eur
 
user559633
@MorganThrapp Eh, happy hours in NYC and you can get 2 for 6
 
@MorganThrapp 2.8 ABV.........
 
@AnttiHaapala Ooof.
 
what is "decent pint" anw
 
user559633
2:09 PM
@AnttiHaapala e.g. not coors light or some road flare bullshit
 
@tristan Yeah, there's a couple places around here that do deal. I'm going to a wing night tonight at a local pub that does pitchers of craft brew for $6-$10.
 
@AnttiHaapala Which doesn't cause headache the next day.
 
user559633
@bereal yeah, it's insane. the sanctions mean that russians are getting better at making beers and cheeses
 
@k
@tristan yeah, can't understand why Russians wanted to buy cheese from Finland.
 
For those who know US beer, I would consider a decent pint to be anything Sam Adams or better.
 
user559633
2:11 PM
@MorganThrapp Yeah, I'd say that's fair. A Sam Adams or a Magic Hat
 
I tried a few cheap US beers, all of them were terrible.
 
@tristan Yeah, exactly.
@khajvah Agreed.
 
anyway... is there good cheese in the States :D
I wouldn't believe.
 
user559633
Yes, fantastic cheeses and cheap beers.
 
@tristan Though the one cheap beer I had recently that I was solidly impressed by was Yuengling's Black and Tan.
 
2:12 PM
@AnttiHaapala Yeah, it's called "Swiss cheese"
 
user559633
Seriously, America crushes it at everything we/they try. Except small cars. And general math/science education.
 
@khajvah Swiss cheese or "Swiss" cheese :P
 
hah
 
user559633
@MorganThrapp Yeah. Yuengling is surprisingly popular outside of the northeast. Once I found out how drinkable it was, it became my party stock
 
user559633
For native US cheeses, try a goat cheese like a humboldt fog
 
2:14 PM
I mean, in Vietnam, they fscking sell the imported edam for price / kg more than the bestest Alpine cheeses here
 
@tristan The standard lager is a little watery for me, but the black and tan is definitely my go to for parties. That or a 12 pack of Brooklyn.
Mmmm, I love goat cheese.
 
user559633
I don't really care that much for cheese, but I do love meats and fish.
 
I used to be a cook in US, the best cheese we had was goat cheese
it was also the most expensive one.
 
lol
 
user559633
2:18 PM
mehhhh
 
@tristan come to Finland to get you some reindeer or horse
 
Just got a 413 (PAYLOAD TOO LARGE) error from my node app. I giggled more than I'd care to admit.
 
user559633
@AnttiHaapala had both here recently. can't say that i'm really into horsemeat. which is weird because i hate horses, so you'd think that eating them would bring me joy
 
needs to be cold smoked :D
 
2:33 PM
Slightly scary Finnish blues singer Ina Forsman: What Have I Done
 
user559633
yeah, cold smoking is awesome. it's not as popular as it should be in the states
 
With the change in the law a few years ago, cold smoking is the norm in the UK
 
user559633
 
user559633
How would I find out if I can just use that loading gif from SO?
 
That's mean.
 
2:48 PM
@tristan I was waiting for it to load for a minute
 
user559633
Yeah, sorry, chat uses a circular loading gif
 
Yay. My speculative answer paid off. stackoverflow.com/a/34857658/4014959
 
@PM2Ring 23 points :/
 
Yeah. But it's getting late, so I'd better go. Hopefully I'll crack 10k tomorrow.
 
@PM2Ring I'll post a pic and trouble ping you when you hit it :D
 
3:01 PM
Think twice before you do.
 
I almost didn't post that answer. I was waiting for the OP to respond to the comments. But then I noticed the question had 4 close votes, so I decided to get in before it was closed. :)
 
there's no way back, it's like a black hole
 
@bereal cool
 
rhubarb
 
3:09 PM
Rbrb
 
cbg all
 
cbg Matt
 
user559633
i'm off too. take care all
 
Has anybody played with Swift recently (Apple's new language, not the cloud one)? I'm having a really hard time finding good tutorials. The official book sucks...
 
3:16 PM
rbrb tristan
Haven't heard of it too :/
 
adios
 
@MattDMo never used it
 
cbg
 
it seems kind of cool so far - definitely about 10 times better than Objective C - but I'm already stuck on optionals...
OTOH, it has a case: switch syntax, which I think Python is lacking.
 
Yeah, you can somewhat imitate it with a dictionary, but I do miss case: switch.
 
3:20 PM
Anything is better than Objective C
The main downside of the Apple resurgence is that thousands of developers now use that language
Or upside, as it's hilarious
 
I haven't even tried to make anything useful in Obj. C - occasionally I'll run across a question in a review queue, spend 20 minutes trying to decipher the code, then go back and write 3 lines of Python to do what it was trying to do.
 
@MattDMo Are you the guy who made ST?
 
@khajvah Ha ha. No, I'm just an enthusiast and power user :)
 
oh I see
 
Jon Skinner is very elusive.
Feel free to ask me any questions, though. If I don't know I'll try to find out.
 
3:26 PM
@MattDMo These Jons are all talented
Jon Skeet, Jon Skinner, Jon Clem ... Wait wut?
 
@MattDMo oh, I don't use ST but thanks.
 
NP. You should try it out, though - it's awesome. Not an IDE, and so missing some of their features, but as a straight code editor it's fantastic. It's worth it just for the multiple selections capability.
 
I tried it once using vi mode but soon, went back to Vim. It looked decent though.
 
cbg bhargav
 
Lol, Ajay you telling now .. Anycase, cbg
 
3:40 PM
Apparently we have a Python to C++14 Transpiler now
 
@thefourtheye Huh. Sounds interesting.
 
@khajvah ah, you're one of those people :) If you ever want to try Sublime again, check out the Vintageous plugin. It's a lot more complete than the default Vintage plugin as far as key bindings and actions, and is under active development.
 
3:59 PM
Wikipedia is 15! No wonder it's always asking for money.
14
 
Wait I read that ^ on twitter :/
 
Convergent evolution
Assuming evolution means anything an art student brain imagines it could mean
A lawyer I know proudly proclaimed at dinner once that evolution means we'll lose our little fingers
Because we don't use them
 
He will certainly lose his brains then.
 
Turns out lack of understanding isn't anything to do with religion; people'll do it with anything that replaces it in their minds as well
 
DSM
Morning cabbage. (He said, using his little finger repeatedly.)
@RobertGrant: I didn't actually mind Obj-C. I enjoyed how much simpler its OO model was than C++'s.
 
4:12 PM
cabbage DSM
 
@DSM I am overly snobby about Objective C
 
So, I'm finding myself with some spare time at work and I want to learn a new language. Anyone have any recommendations?
 
><>
 
DSM
Are you looking for one which is entertaining or one which will be useful?
 
I'm not adverse to learning Fish. :P
 
4:15 PM
@MorganThrapp how about Mandarin?
 
@DSM Either way.
Something fun, and ideally usefulish too. I'm looking at Rust right now.
 
Rust is bad for iron. :/
 
I've also been thinking about taking a stab at Haskell.
 
Rust is boat cancer - I lost a bike to it, when I was younger
 
How much assembly do you know?
 
4:16 PM
@Programmer None at all.
 
What about C?
 
I mean, I can read it a little bit, but I certainly can't write it.
Nope.
 
Rbrb for today o/
 
I actually know quite a bit of assembly - most of my furniture is from Ikea
rbrb @BhargavRao
 
I did Python, then C and a little Assembly. It was cool to get the lower level concepts of the machine, but it was very frustrating at the same time lol
 
4:19 PM
Yeah, I want to learn something a little more low level than Python, that's why I'm looking at Rust.
 
Have you considered learning butterfly programming?
 
C-x M-c M-butterfly :)
 
can you imagine if M C Hammer was M C Butterfly, instead? Those parachute pants may have never existed
 
or M C P
Can't touch this SQL Server installation
 
MCP: Error 403: Can't touch this
 
DSM
4:34 PM
Whenever I see the letters MCP I want to say "End of Line"..
 
C:\Users\UKRGR>touch this
'touch' is not recognized as an internal or external command,
operable program or batch file.

rem can't touch this
 
hello :)
you have a persistant problem with installing a python module that makes you lose your will to live, where can you offer 50 bucks to someone to help you with it?
 
please get closer to the point, especially, regarding 50 bucks.
 
fiverr.com you could offer it to 10 people. Bound to get it fixed!
 
oh never heard of that site :)
thank you and will try my luck
just trying to install theano module with gpu itegration
 
4:40 PM
Sorry I'm joking - I doubt anyone'll do that for $5 :)
Maybe codementor.io?
 
why do you say 5 ?
i did not get the joke
 
Because fiverr.com is where you pay people $5 to do something simple
 
DSM
.. and $50/10 = $5.
 
yes i got that math part
maybe i just did not find it funny ^^
 
Well let's not labour the point
 
DSM
4:42 PM
That happens a lot around here. We don't take it personally. ;-)
 
As I said, codementor.io might be an actual solution
 
DSM
Well, except for me. I'm still annoyed no one liked "Llanfair", and that was ages ago.
 
Hi, I have following in my models.py
class Enum(models.Field):
 
@MorganThrapp @BenjaminGruenbaum Shared in other room. github.com/lukasmartinelli/py14
 
ctrl-k will indent your text to make it more properly formatted.
I recommend you edit it if you can.
 
DSM
4:48 PM
Long code also works better on a site like dpaste, as suggest in the room rules.
 
class EnumField(models.Field):
    def __init__(self, *args, **kwargs):
        self.values = kwargs.pop('values')
        kwargs['choices'] = [(v, v) for v in self.values]
        kwargs['default'] = self.values[0]
        super(EnumField, self).__init__(*args, **kwargs)

    def db_type(self):
        return "enum({0})".format( ','.join("'%s'" % v for v in self.values) )


class SpaCity(models.Model):
	CT_id = models.AutoField(primary_key=True)
	CT_name = models.CharField(max_length=100)
	CT_namecode = models.CharField(max_length=50)
 
Greetings :) Does anyone know how to do html extraction with BeautfiulSoup and/or Selenium Webdriver or any other ideas for this? I am trying to do the following ... extract the contents of an html page, however not all results are displayed on the same page (meaning they have a page2, 3, 4, and all the way to next button. I tried inspecting the source but not all results are shown in the html code aka it has to load up. Here is some of the html code:
 
it gives the following errors,
 self.values = kwargs.pop('values')
KeyError: u'values'

thnx in advance
 
<div id="footer" data-reactid=".1.0.2"><div class="holla" data-reactid=".1.0.2.0"><div style="display:none;" data-reactid=".1.0.2.0.0"></div><div class="active" data-reactid=".1.0.2.0.1:$0">1</div><div class="" data-reactid=".1.0.2.0.1:$1">2</div><div class="" data-reactid=".1.0.2.0.1:$2">3</div><div class="next" style="margin-right:0px;" data-reactid=".1.0.2.0.$11">â–º</div></div></div>
 
4:57 PM
@Masterminder Have you tried using the site's API, before you start scraping it?
 
@IntrepidBrit it appears it does not have one
 
@Masterminder are you sure you should be scraping it then?
 
@Ffisegydd only scraping it for a few things
 
@ckman Um, surely it would be that the kwargs you've passed to the EnumField doesn't actually have a key called values to pop?
@Masterminder What's the site's usage policy on robots (if you know)?
 
@IntrepidBrit it does not appear to have anything on robots
 
5:04 PM
Not even a robots.txt?
 
nope...
I have looked around previously for policies
 
Did you look at, e.g.: stackoverflow.com/robots.txt
And now I think there's a meta tag in the html about robots too.
 
I don't think it's SO, is it? It uses React
 
# this technically isn't valid, since for some godforsaken reason
# sitemap paths must be ABSOLUTE and not relative.
 
@AaronHall that only has the "Sitemap" in it
and nothing else
 
5:17 PM
@Masterminder Well, in that case I'd recommend beautiful souping it, save yourself a lot of hassle.
 
@MattDMo Will do, thanks
 
Do you know of any specific way to do that @IntrepidBrit ? I have been trying to use BeautifulSoup and cannot get page 2, 3
 
DSM
Well, does the main page contain a link to the following/all the following page(s) or not?
 
no there is NO link defined
 
People can navigate to pages 2 & 3, yeah?
 
5:20 PM
yes from the bottom of the page. When someone clicks 2 or 3, the html link does not change.
 
chomps popcorn
 
So it's presumably doing an AJAX call to pull in the new content?
 
It's almost as if this website wasn't designed for scraping :p
 
css, js is used. AJAX does not appear to be so
 
5:26 PM
Well, if you're sure...
 
cabbage to all^_^
 
okay say you have a site that finds results once you search for something. The site finds 25 results but only displays 10 of them to the web page. The rest of the results are concealed under a next button that requires clicking. Any idea on extraction of that?
 
Find out what clicking on it does and do that
 
I have done that
here is the html code for that
 
It's really cold but I need to go out for garlic bread :(
 
5:34 PM
ugh can't insert code ..
 
Well, if you can't find a resource via following the JS code (you should always be able to), then it might be faster to use something like selenium to grab the info.
Sorry Masterminder, I've got to leave now. Last one in the lab so the joys of closing up shop has been left to me
 
Any specific command @IntrepidBrit that might help? Was lurking through the documentation last night.
i see
anything on my last question :D?
 
I'd just learn very basic selenium
Then you'll be able to do it
 
Aye, it should be doable once you've played around with it for a couple of hours
Rhubarb, and I hope I don't have any more garlic this evening!
 
okay thank you @RobertGrant and @IntrepidBrit
i will try again
 
5:42 PM
Im just here to say cbg:) and Rhubarb!:D
 
Hello people
 
Hello
 
I was wondering if anyone has a first hand opinion for a really good book for oop design patterns?
 
6:02 PM
Rbrb
 
Rbrb, bobby.
 
emacs has dired built into it.
Anyone think it's clever to subclass OrderedDict to sort of manage a data object for export to json? I did that when coding with a friend yesterday, and I found the effect to be quite interesting. Thoughts?
 
@AaronHall I should try emacs one day. People seem to love it.
 
7:01 PM
I'm catching up on the Harry Potter movies, and I wonder why Tom Riddle/Voldemort is not listed as a lich on Wikipedia: en.wikipedia.org/wiki/List_of_liches#In_movies
 
7:41 PM
cbg
 
7:59 PM
cbg
 

« first day (1920 days earlier)      last day (3029 days later) »