« first day (1148 days earlier)      last day (4023 days later) » 

00:02
The whole work from home thing seems pretty interesting.
But, I really should expand my programming language competency list...
 
3 hours later…
02:35
does anyone else also prefer the old SO top bar, or is it just me?
I liked that chat was one click closer with the old bar
I had an easier time getting to my reputation page before. . .
is there any way to get the gOLDen layout back? (I really don't want to have to greasemonkey the thing)
Create a petition.
I like it
I get to see reputation changes globally now, instead of having to go to each exchange site
02:47
I suppose if you're active on a bunch of the sites, it makes sense.
Contrasts well with the background as well
03:38
@mgilson The problem is that I'm not on a lot of sites
I'm not on a lot either.
Most aren't
So why did they change it then?
It would make more sense if they gave you an option if you wanted one or the other
Possibly to encourage more active participation on more sites.
Maybe they just felt like the UI needed a change and thought this would be a good idea.
It's hard to say without asking them.
04:17
has anyone here used Django with South?
Hello
Hi Andy
04:46
@mgilson I think you can click on the reputation number in the bar to get there in one click
@shuttle87 -- click where?
I'm looking for an easy way to get here
I always found this view to be the most convenient for figuring out if I've hit the rep-cap yet or not.
Oh ok, that's not the same page as what I was suggesting?
Yeah, I think you were talking about my user profile page.
ah ok
yes I think that I was
It might have been 2 clicks away before (funny how I can't still remember).
04:50
I think it was 2, but to be honest I never really check that page
It's the one that provides the best view of your performance today.
which is silly ...
But I got in the habit of checking it back when I actually cared more about rep.
Now I just like to see how my answers are doing. It helps me see if I'm still writing good answers, or if I need to work harder.
 
1 hour later…
06:11
erm guys... I just imported antigravity and my laptop started to float off the table. What's happening?
(of course, I did sample everything from my medicine cabinet, so maybe I'm just hallucinating the whole thing)
@inspectorG4dget -- What else did you expect to happen?
@mgilson I was kinda hoping to levitate off my chair, seeing as I'm wired in
Ahh yes, I can see why you'd want that ...
Well, despite what XKCD has been propagating, computers don't influence things which aren't computers ...
What makes you humans think I'm one of you? Should I gather that I have passed the Turing test?
good point. I suppose I was just making an assumption based on your profile picture. If I have offended you based on my presupposed ideas based on how your profile picture looks, then I ask your forgiveness.
06:22
That is a picture of the meatbag that built me. Also, I've learned from my good friend Watson, so don't try this on me :P
btw @mgilson, that was all sarcasm (which I don't fully understand). I'm very much a meatbag, myself
Now I don't know what to believe ;-)
Is meatbag slang for human?
@mgilson: yes. It's from Futurama
Ahh. Only seen a few episodes of that one.
Apparently, it's also from Star Wars: starwars.wikia.com/wiki/Meatbag
that's not star wars propper.
06:39
Thank you for saying that @mgilson. all hail
Also, here's one: 4ms.me/18q9RUP
Also, look at the Behind the Scenes section of that wookipedia page
Nice.
Well, seeing that I haven't gotten anything done for the past 2 hours, I think it's probably time for me to head home.
umm... obligatory "it's a saturday" comment
Hello, cabbage!
Still friday here.
:)
Still friday?
It's two pm here, saturday.
06:43
then again, I'm doing homework over christmas break on the other side of the world, in tropical India, in my parent's dining room, so I'm not really in a position to say
It's 5:34pm here saturday
12.15PM saturday here
'ello @aIKid
it's 10:43 PM, Friday here.
@Haidro Chase @mgilson bro! You guys are close!
By the way, i finally get the silver python badge!! XDD
Congrats @aIKid. Keep it up and you'll have gold in no time.
06:45
Haha, thanks!
congrats @aIKid
It's my 69th day being here!
Just discovered that I have my gold python badge. When did that happen?! o.O
congrats
it's my 330th day here
@inspectorG4dget Lol. Congrats!
06:46
way to go @aIKid
330 days consecutive too
@inspectorG4dget -- August 24 at 3:03
awesome way to get that fanatic badge. Also, have you seen the proposal for the uber fanatic badge?
lol @mgilson. Thanks :)
oh my god the rainbows
06:49
@mgilson I'm suddenly reminded of this
don't forget the unicorns, @Haidro
I'm reminded of this
yes.. dem bairs
cbg!
@KDawG cabbage!
How're you going?
@aIKid quite fine except for one small thing related to python....
06:55
What? How could anything related to python decrease your happiness?
@Haidro: yeah, you beat me by two days
@mgilson wait I'll post it as a question....
:)
@KDawG Easy, or hard?
General, or framework-related?
Anyone want to help me with my fuzzy logic assignment? | s/help\ me\ with/do
@aIKid Depends on your knowledge though I find it quite hard
@aIKid general stuff
and here ya go:
0
Q: Strange behavior when comparing uncode objects with string objects

K DawGwhen comparing two strings in python, it works fine and when comparing a string object with a unicode object it fails as expected however when comparing a string object with a converted unicode (unicode --> str) object it fails A Demo: Works as expected: >>> if 's' is 's': print "Hurrah!" ... ...

06:57
2.7 has sone issues with unicode
use if 's' == str(u's') instead
I think it's a duplicate..
Hang on
I've answered it before, i'm sure.
There's also something along the lines of 'ab'+'cd' is 'abcd' being False (I just checked and that specific example fails, but I have the right idea). I've read such a post on SO before. Anyone know which one I'm thinking of (link please?)
Because they aren't the same object
the second one is the string of the unicode one
Bah, can't find it.
@aIKid lol phew
07:07
@KDawG Hahahah
By the way, got to go. See y'all later!
Thanks @inspectorG4dget and @mgilson having a hard time comapring which is the best :P
@aIKid rhuarb mate!
bye @aIKid
Here's a fun example: "ab" is "a""b"
:)
lol. @KDawG is now known as Sophie
Dafaq???
07:09
@mgilson: what @KDawG said
:)
So, python automatically concatenates string literals which are adjacent at parse time
So, when you write 'a' 'b', python sees 'ab'.
dood! I've been pythoning for 6 years, and I didn't think that was legal syntax o.O
@inspectorG4dget -- It's one of the greatest things about the language.
@inspectorG4dget agree :D
It allows for long strings to be broken up in the source code without new-line breaks.
e.g.
07:12
> It's one of the greatest things about the language

You know what the best thing about python is?
All of it!
myfunc(a=1, b=2, c="This is a really long string.  "
            "Look Mom, no newline!")
3
@inspectorG4dget u ddnt? It was one of the first things i tried :P
@GamesBrainiac: no I didn't XD
@mgilson better to just use """
@GamesBrainiac -- No. """ would put a newline in your string -- And a bunch of spaces if you wanted it to indent properly with the rest of your code.
07:14
@mgilson ahh, true. That really sucks.
@inspectorG4dget :)
triple quoting doesn't kill the '\n in the str
""" and ''' are really for multi-line strings. I had a single-line string that I wanted to break over multiple lines for readability.
You'll sometimes see people use + concatenation here. I think that carries over from javascript a lot.
I was always under the impression that myStr + someStr was the way to go. Never even thought to try str-breaking
And really, that's not horrible. If it's not in a tight loop, you won't notice the performance difference. But, if it is in a tight loop ... You want to optimize it as best as you can. And you might as well get used to it at other times.
07:17
a regex cookie: How can you extract Bill Gates outta Bill Gates 1000?
And, for what it's worth, after a while, I think that you get more used to reading it without that silly + to interrupt your flow of thought. the quotes are already bad enough.
"Bill Gates 1000".rsplit(' ', 1)[0].rstrip()
@inspectorG4dget in regex please... :)
Or, "Bill Gates".rsplit(None, 1)[0]
Actually, I'm glad you brought that up, @mgilson. Is there a way to get the interpreter to implicitly understand that if I refer to a variable before it is assigned, I mean the str value of the varname?
07:19
re.split(r'\d', 'Bill Gates 1000', 1)[0].strip()
does @KDawG want a compilable regex for this?
@inspectorG4dget yeah BTW @Haidro 's one works too...
@inspectorG4dget -- Not sure I get the question...
>>> re.match('(.*)\s\d+\s*$', 'bill gates 1000').groups(1)
('bill gates',)
I'm sure I can do better here ...
@mgilson: so if I say s + 't' and s hasn't been defined yet, then can I get python to implicitly understand that I mean 's' + 't'?
@mgilson Interesting..... BTW I think I'll go with @Haidro :D
07:22
@KDawG:

In [19]: re.sub(r'\s*\d+$', '', "Bill Gates 1000")
Out[19]: 'Bill Gates'
>>> re.match('(.*)(?=\s\d+)', 'bill gates 1000').group()
@inspectorG4dget -- Nope. No way to do that with vanilla python.
Gotta say this @mgilson your one die hard programmer :)
@inspectorG4dget thanks.....
no sweat @KDawG
@mgilson: is there any way to add some chocolate to vanilla python?
I've used the ast module to parse python syntax and keep an index of all the names used -- And then compiled that tree. When you pass the compiled tree to exec, you can specify a locals dict which you could use to substitute in the names {'s': 's', ...}
@inspectorG4dget and you tooo yet another die hard programmer :) :P
07:25
Just curious how does format work with the adjacent strings thing?
>>> "foo""{}".format('bar')
'foobar'
Just like anything else.
ok, just wanted to check :)
The parser makes "foo""{}" into "foo{}" before python really even sees the bytecode.
@mgilson: that is an awesome idea. Hacky as all hell; but awesome. Now, I have sweaty palms to see if I can find a justifiable place to use it :)
Although, FWIW, I usually group those in parenthesis.
@inspectorG4dget -- I actually used that one recently (which is why I know how to do it).
07:28
@mgilson: really? Sto-ry-Time! Sto-ry-Time! Sto-ry-Time! (pretty please)
I wanted a python-like configuration language. We were pulling data from a JSON API that returned objects like {"foo": ..., "bar", ...}
gotta go rhuarb! all.....
And I thought, wouldn't it be neat if I could get data from the json and operate on it using normal python syntax?
so then you could do something like:
 result1 = "green" + foo + bar
 result2 = "red" + bar % "grapes"
I suppose you had to maintain a custom locals while parsing the AST to make sure that you weren't overwriting things?
Then have a dictionary returned from your functions.
But, this was all running on a web-server, and there seemed to be times when using non-string syntax for string literals would be good -- e.g. if there was a hole in the JSON returned from the API.
so, instead of getting {"foo": ..., "bar": ...}, I only got {"foo": ...}
Then instead of getting a NameError above on my webserver and having the user say "Why didn't my page load? what is happening?", they'd just have some random "bar"s in there...
then at least they have some sort of bug to report.
So that's the beauty of it -- with locals.
It would basically be something like:
locals = {}
globals = dict_of_names
globals.update(json_data)
exec(compiled_ast_tree, globals, locals)
print locals  # Horray, now populated!
Of course, there were other fun things to think about as well ... You don't want to run untrusted code ...
07:35
That is beautiful
So, I had to use ast.NodeTransformer to remove nodes that I considered hazardous.
Or to convert them to nodes that I considered OK.
oh nice!
how can I star an entire comment thread (or substring thereof)?
@mgilson ok great, that's exactly what i wanted to know
So we're not vulnerable to the typical __import__('os').remove('important_file') because of the globals I'm passing specifically set '__builtins__': None
But then, in the ast tree, I converted regular import statements to pass statements
that makes sense.
07:38
And I converted foo.bar to getattr(foo, "bar") -- and I snuck my own getattr function into globals so that most of the time it actually did foo['bar']
For some whitelisted objects i'd allow it to do foo.bar, but only if bar didn't start with __
bahaha! That is some really intricate monkey patching
So that takes care of the Ned Batchelder "eval is eval" trick.
It still wasn't bullet proof. Someone could pretty easily run me out of memory
and/or CPU.
while True:
    pass
But, those things are taken care of by the sandbox environment the code is running in.
And, the only people who have access to make the config files are admins ... So, I think I was being pretty paranoid... ;-)
Seeing that most of them could just write something malicious into the code and then re-deploy it. O:-)
perhaps, but it's still fun to think about
07:42
But, I didn't know if we'd ever open it up as an API, so I wanted to do it right.
true. But then again, there is something to be said about pre-emptive engineering.
Sometimes. There's also something to be said about YAGNI
I think it was Spolsky who said something like "don't make a feature before you need it, because you'll end up spending more time maintaining it, without even knowing if it will be needed".
yes! That's what I was getting at
But, the beautiful thing was that because of the ease of use of the AST module, the whole thing was about 150 lines of code. So, maintenance shouldn't be too bad.
of course, this actually seems like it /will/ see the light of day, so I don't think you need to be too worried on that front
o.O
was this in py2k or in py3k?
07:45
Of course, using the config files to actually do something useful ...
Umm ... It was written and tested mainly on py2k, but I did do a little py3k testing while developing and it worked there too.
There aren't too many differences really. print is no longer a statement, but I think I disallowed that one anyway.
True, False became keywords.
intriguing. I've used AST in py2k and was slightly disappointed in some of the nuances of py2k.ast
then I saw Guido's talk and I've been wanting to try py3k.ast to see if I like it any better
yeah. It's been a while, but if I remember correctly, it had something to do with the attrs of imported and non-imported functions being different
I haven't noticed any major differences, but perhaps I wasn't playing around with those nodes ...
I'd have to lookup nonImportedFunction.foo and importedFunction.bar.baz.attr.foo in 2k
07:49
Hmm ... I don't see how ast would know the difference.
Maybe I'll need to look around for that talk.
I could be wrong. This was for a program that I was using to prove my master's thesis and I was in zombie mode while coding this. So I can't entirely trust my memory
(will check back on the code and see if I can find the spot)
Anyway, it's nearing midnight and I still have a half hour bike ride to get home.
alright, go home @mgilson. May the winds of fortune take thee home with increased velocity
Ahh, I've seen some of this talk.
and I've gotta go get lunch. See you around, cabbage!
08:12
Does windows have a terminal emulator installed by default? I'm writing a short manual for a program and I need to know if I need to tell the user to download one, or if there is one already installed
@inspectorG4dget Sent you a request in FB :)
@thefourtheye: I was wondering if that was you :)
Accepted!
Cool :)
Hey! @thefourtheye
@samrap Hi Sam :) How are you?
08:19
Good, excited for the weekend how about you?
Me too :) Me and my computer :)
Hahaha man's best friend
yup.... Forever alone memes suit me well ;)
Hahahaha that was me tonight :( No plans I usually go out on fridays
I feel like my learning curve would be much quicker if I didn't balance school, programming, and social life :p
If you dont enjoy your life in 17, when are you going to enjoy? ;)
08:27
Exactly! I get my license in a few months finally too
Hey if you get a chance check out Algebra Solver at samrapdev.com/programs.php and tell me what you think :)
It says page not found :(
Sorry I don't know my own website :D
You have used the bootstrap homepage template ;)
Nope!
I don't use bootstrap because I hate using frameworks like that, I'm too prideful haha
And I know that bootstrap is cleaner than what I write but I feel like it's cheating
I do use font awesome though bc it is awesome
08:48
Oh... I have seen that color in getbootstrap.com/2.3.2. Thats why I thought you were using bootstrap
I always feel that using regex is a knee-jerk response
Most of the time you don't really need it.
Regex is powerful, for sure, but that does not mean you should always use it.
when regex is your hammer, everything looks like a thumb
So, when to use it then?
Use it only when you need to use it and all alternatives are suboptimal-er than the regex
Oh wow that bg is similar, I was going for an iOS7 look with the bg :) @thefourtheye
08:53
@thefourtheye: you should check out the two problems discussion
@inspectorG4dget but how do I know that all other options would be suboptimal?
@thefourtheye When it is the only tool for the job.
Usually regex is a lot slower than other function alternatives even when you compile them.
@GamesBrainiac that's not entirely true. I could write code that would effectively be a regex, and that would be less suboptimal, given that I'd have complete control over the code
Hello Everyone
08:56
@inspectorG4dget Well, not entirely, sure there are certain cases where a composite regex might be faster, but most of the time there's already an inbuilt alternatives.
File extensions? You have the os module.
Basic string finding and manipulation? You have the string module.
@GamesBrainiac: isn't that what glob is for (never used it, so I could be wrong)?
Hi @Andy hows it going?
@inspectorG4dget You can use both glob or the os module. I personally prefer os.
@samrap It's been going all right.It's finals weeks, so no time for anything.
@samrap What about you? How are you doing?
@samrap It finds only slope now?
08:58
Consider this, @thefourtheye: suppose I gave you a list of words and asked which of them matched a certain template. I could easily write a loop to check each word; and checking each word would require a loop on the word and a parallel loop on the template. This would effectively be a regex. However, there being an existing implementation (import re) for this exact problem already, you may as well just use it
That's a bust, I don't have finals until mid january @Andy
@Andy: finals eh? fun times. </sarcasm>
@thefourtheye no I just didn't update the manual yet. the f command with the -q flag (f -q) factors a quadratic formula and the csq command completes the square of a quadratic
@inspectorG4dget Well yes, in that case regex is pretty much the only thing you can use.
Other methods require excessive looping.

« first day (1148 days earlier)      last day (4023 days later) »