« first day (2005 days earlier)      last day (2940 days later) » 

12:51 AM
I need some code review:
def remove_dir(dir_str):
if os.path.exists(dir_str):
shutil.rmtree(dir_str)`
Is there a better way to do this?
also should the function name have an underscore?
 
1:28 AM
yes...
 
sorry, got ahead of myself
Assuming you have the correct indentation in your source file, there's nothing wrong with your code - you need to delete a directory structure, so you check to make sure it still exists, then delete it. Perfect.
Why are you asking about underscores? You already have one. Do you want more?
 
Well, its a race condition
Are python functions supposed to have underscores? I usually do CamelCase for C++
but PyCharm is taking a dump on my coding style
 
OK, but the presence or absence of an underscore won't address that
 
I have 2 issues
 
PyCharm adheres to PEP8
so it will complain when you go against the suggested style-guide
 
1:33 AM
I strongly suggest reading PEP8, the Python Style guide. Generally, Python identifiers (variables, function names, etc.) use snake_case
@idjaw aww, you linked to it first. Now I feel bad...
 
hehhe all good. :) we're in sync. That's all
 
@Mikhail you will find exceptions, even in the Python source code itself. Some people like to name classes with CamelCase. Some name "constants" (I put them in quotes because there's no concept of a constant in Python) in ALL_CAPS. Like almost every rule, there are deviations
 
or deviants
 
you went there, not me
 
from lxml import etree as ET
woops should be et
fucking PyCharm
 
1:42 AM
that's why I use Sublime. And don't lint :)
 
 
2 hours later…
3:56 AM
Is it possible to make Pycharm take another program as an input parameter?
basically what i'm doing is testing my program by doing ./python.py ai
ai is another executable.
 
4:37 AM
Aw shoot - does anyone know how to fix github repo after you attempt to upload a file greater than 100 MB's?
 
its hard
BFG Repo-Cleaner
or just make a new repo
 
aw man :/ this sucks
I have a few stars on this repo
And a couple people were relying on it
 
then you should try BFG
 
Okie - give me one sec, I'll check it out
 
@OneRaynyDay you can force-push but dunno if it will gc on the other end...
 
4:53 AM
If its BitBucket, you gotta write them an email, and in a few days they garbage collect your shit
I got tired of waiting so I switched to GitLab
 
@Mikhail sounds like you need to think about some happy little trees, you've got too much anger: twitch.tv/bobross
 
Its all these fucking tabs
or spaces
 
okie just removed all blobs > 100 mb
thanks! trying to push now :o
 
ok, that was a subtle way of saying it, but since you didn't get it: cool it with the edgy language
 
@Mikhail Hmm... I'm having some troubles.. Have you used BFG? I "removed all blobs greater than 50M" but when I used their next command, git reflog expire --expire=now --all && git gc --prune=now --aggressive it still counted the same amount of objects I think... That's so strange :oo
 
5:02 AM
They don't like my edgy language here :-)
 
Tomorrow my house will be filled with paper airplanes.
@OneRaynyDay just make a new repo and push the old repo to it, minus the commit with the data
Then delete the old repo and rename the new one.
 
@davidism But the problem is I wanted to keep the stars on github(even though I only got like 2), so I was hoping for a better solution. I guess if need be I will just push to a new repo then :/
 
Just contact github and wait a day, it's not the end of the world.
The whole point of distributed revision control is that you don't need the central server.
 
@davidism Do you mean contact them after I pushed to new repo or do you mean just tell them that I screwed up my current repo and they'll fix the current repo?
 
Tell them what commit needs to be stripped, and why, and they'll probably do it.
 
5:09 AM
Ah cool - thanks :)
 
5:23 AM
Hi friends, what is the problem of this make process of a python app in ubuntu : pastie.org/10794325 ?
that worked some before , but now not working
this app is in python
 
6:07 AM
yay for javascript
I am debugging javascript on my mobile. when I upload an image with $.ajax, it fails.
the fail handler is called.
@Anes and no information present
... so the fail callback is called. I get an object as an argument. I print it out, it says "[Object object]"
of course there is no debugging available... so I just need to alert different things
 
6:48 AM
@AnttiHaapala Isn't JS lovely?
This is typical of my morning so far: stackoverflow.com/questions/36565249/…. User self-deleted their account within minutes of posting that.
Why would you even do that?
 
7:10 AM
good morning
 
7:34 AM
in ipython, i can to object. and then hit tab to see what i can do, is there a way to do that in sublime ?
 
cbg all
 
Cabbage
 
7:52 AM
Cabbage!
@OneRaynyDay What do you mean, fix the repo?
 
8:13 AM
Cbg
 
8:24 AM
Mornin' cabbage
 
8:34 AM
Mornin('Intrepid')
 
int(repid)
 
How's Tuesday treating everyone?
 
8:56 AM
Prospects of meeting overload are overshadowing the usual possibility of Tuesday for me.
 
Today is MapReduceDay for me.
 
Does this fill you with excited anticipation, or grinding dread?
 
MR is an interesting programming model, I've had some experience with it for toy examples but am now reading up the more advanced design patterns.
The problem I'm going to come to is that I don't know much Java, so I can read it all fine but if you asked me to write some from scratch without Google I'd be as useful as a <subject> <predicate> <object>
I've also been thinking a lot about semantics and triples, as I'm sure you can guess.
 
9:14 AM
Is it like Spark?
 
I can't tell if you're being sarcastic or not - I'll assume not. Sort of in the sense that they're both big data analytics programs and both run with HDFS/YARN. MapReduce is more aimed at a sequence of map and reduce jobs (go figure) whilst Spark is more aimed at in-memory analytics as well as some more "typical" analytics (i.e. what you'd expect to be able to do with a pandas dataframe, but spread over 100s of nodes in a cluster on PB of data).
 
No, wasn't sarcastic :)
 
Seems quite interesting Fizzy.
Sucks to be you Snapey, meetings days are rubbish
 
Yeah - hey ho. One down - next at 11. Sounds like you're still finding the whole thing fairly interesting, Fizzy. I guess you're quite unlikely to need to write Java from scratch in the absence of Google (unless you're in some farfetched perilous movie script that depends on you remembering the syntax to disarm a bomb in an isolated shack. And no-one programs bomb detonation code in Java).
 
When I was doing stuff with it, Spark was pitched as MapReduce with more operations (e.g. filter), rather than they're different tools for different things
 
9:24 AM
That's how I've heard Spark pitched, although I've never used it.
 
They do the same thing in the end (analyse big data) but Spark can be more iterative as opposed to a set of MR jobs. There's probably some complex CS term to describe it.
Which is why you can do Machine Learning with Spark much more easily.
 
Makes sense.
 
It also means that, as you're not submitting set jobs, you can do it from the command line.
So I could have a RDD object (data object) on the pyspark command line and say "Okay, filter out only this subset of my users" and have it process it on 100s of TB of data across a cluster.
 
in which Fizzy tries to pretend his python project has TB's of users
;)
 
;______________________________________________________________;
Have fun in your meeting(s).
 
9:29 AM
touche
 
check calendar Oh god. I've got a half hour meeting on Thursday. How ever will I survive.
 
hey guys, does anybody know a video which is just like a 30 minute intro to the bare bare bone basics of programming (preferably in python), ill have more info tomorrow but i have a friend who is stuck in a non-beginner (but likely still easy) programming course with NO knowledge of programming
 
@Skyler just give them a tutorial, don't bother with video.
If the video is too fast for them, they'll have to pause it and Google for more resources, if the video is too slow then they will end up skipping bits of it and then potentially missing something they don't know accidentally. Tutorials mean you set your own pace.
 
We should write our own tutorial that's in a Jupyter notebook so they can execute code as they go. It's probably already been done before.
 
9:33 AM
@Ffisegydd usually i agree with this advice, basically though it sounds like they are in something of a discouraged position so i dont know if theyd be able to really psyche themselves up through it
you know what i mean
 
If they don't have the will to do a tutorial, do you really expect them to do the course itself?
 
@Ffisegydd im a bit borderline on that part myself to be honest, still trying to help a bit if i can to hopefully not make it borderline
i might even be overestimating how bad off they are
i didnt really get to ask them about it
 
I am plan to switch from RUby to Pythin, anyone give me suggestion there
 
@DineshSaini what suggestion would you like?
 
I have review the application that worked on live chat and socket based
 
9:40 AM
@DineshSaini pythons can choke on rubies so dont feed em that
 
Example: Group Chat and find node and python are good
anyone experience with both can help, right?
 
@DineshSaini that's not really how it works here. It'd be better for you to ask a specific question that you need help with.
We're not very good at open-ended "I just need help" scenarios.
 
So group is for technical help in framework like Django?
 
This room is for help in Python, but I'm saying you need to give us a specific problem.
 
The specific problem is design a group chat application
 
9:44 AM
That is not a specific problem. That's your high-level goal.
"I have designed my chat, written part of the backend, but I'm having this specific issue with Twisted" is a specific problem.
You just saying "I want to design a group chat application" - how are we supposed to help with that? You've not even stated what your issue is, what you're struggling with, etc.
 
I have question with architecture level and communication, May I use active record design pattern in Python?
 
That’s not even a problem. Just do it.
4
 
Any library in Python available for that?
 
If you’re coming from Ruby and Rails, then start with some Django tutorials and learn how it’s done there.
Trying to apply framework specific concepts to another framework or platform without actually taking the target framework and its own concepts into account is usually a bad idea
 
Or in less words: Don't try to write Ruby in Python.
 
9:52 AM
^ that
 
:P
 
(Y) @Ffisegydd @poke highly appreciated
 
10:18 AM
I have following tables
1. Booking , 2 - UserCar, 3- User
Is it better to just have usercar as foreign key inside Booking or both user and usercar
Most of my reports on booking will be based on User.
I am using Django. So I thought better to ask this question here. If you guys feel it does not belong here please let me know.
 
10:41 AM
cabbage
 
11:06 AM
@Anuj You want to try to reduce the number of relationships like that as much as possible (generic DB advice)
You don't want to get yourself into a cyclical relationship situation.
So I would hazard a guess at UserCar, simply because that requires less duplicated relationships.
 
cbg friends
 
@idjaw cbg
 
11:28 AM
@IntrepidBrit Thanks
 
@PM2Ring :D
 
Thanks. :) I moved it to trash because I stuffed up the parentheses, but didn't notice until it was too late to edit.
 
@PM2Ring I never even noticed
wait, if spaces are in pep8, why does anyone even use tabs?:P
 
Broken spacebar
 
I change tabs to spaces
 
11:37 AM
Whitespace is for the weak.
 
Says that using whitespace
 
brainfuck for the win
 
<|:‑)
 
Haha, I've just read the sopython team page
> We are an active and friendly room full of Python experts and beginners who all share a common love for the language.
emphasis mine:P
 
We are friendly
 
11:46 AM
Biting isn't friendly?
 
yeah, you are:)
 
not sure if that’s a singular or plural “you”…
 
Only Jon bites us, No one else :/
 
mostly the former;D
 
xD
 
11:47 AM
OK, I know that friendliness is with respect to people popping in here
 
Jon only bites when you take away the scooby snacks. That's your own fault.
 
especially ones showing certain level of comprehension
 
@BhargavRao The rest of us are constrictor-pythons
 
@idjaw and you should always duck
 
what? ouch....crap..again.
 
11:48 AM
Looks around Jon's not here
Hey we can eat the snacks
 
Jon's in idjaw's basement again, probably
having eaten all the cookies
 
I'm really not good at hiding scooby snacks
 
I had a long running addiction to sim city 2000
 
I think I've never played that
 
11:50 AM
plus it was one of the only games back then that was good and on the Mac
 
I have transport tycoon in a special place in my heart
with music:D
 
the latest sim city was such a disappointment
 
@AndrasDeak TTD <3
It was necessarily a disappointment, but it wasn’t really very special and rather limited
 
having high hopes to live up to rarely turns out well
 
This was a particular case
they really did not do themselves any favours in getting people to like the game
forced multiplayer. Couldn't save offline. Cities were really small to try to push online even more
it took out what made sim city so much fun.
 
11:54 AM
Also the launch issues…
 
oh yes.
especially that
for an always online game
 
it really didn’t help that the game was mostly unplayable for the first 5 days
 
that was an epic fail
 
That has a terrible image effect, regardless of how good a game is.
I’m actually sure that it would have been received better if that didn’t turn out so disastrous
 
11:56 AM
it probably would have gone smoother. But people were still very upset that there wasn't any true single player.
 
I'd be pissed by that
If I wanted to interact with strangers on the web...oh wait
 
Yeah, but still, I actually enjoyed it for a good while. It had some nice ideas. I really liked the new physics and street simulation engine
I also liked the interaction with other cities in your region, that was a nice touch that was always there in a very basic way in earlier versions (like trading energy with neighbors), but never to this detail. That was nice.
 
Well on the topic of admitting....me and a friend played the game together. We had a solid week.
it was funny. We both were upset at the multiplayer, and it seems like the game could fully enjoyed in multiplayer
so we banded together and played the game to see what we really thought
it was for science :P
 
were there any issues with hindering other users?
economical PK and the like
 
I didn’t like the very limited city sizes, and having always the same territory. It needs a randomizer and a landscape editor that was there from the beginning.
 
12:00 PM
the confining boundaries really limited you.
 
I also didn’t like the crazy DRM stuff. 10 dollar for a few new building models is just bad.
 
pff
yeah, not my game
 
Oh but that's just typical EA being EA
 
that explains a lot:D
I'm not even remotely a gamer, but I've heard of EA's pricing strategy
 
I remember this one city which was really successful but which had lots of problems simply because there was no more room to build anything.
 
12:01 PM
@poke Skeet City?
 
It’s not just EA though. Everyone does this.
huh?
 
Some are worse than others. But yes...it's the common practice now
 
sorry, just making unnecessary associations:P
 
season passes. DLC. New characters.
 
anyway, enough “Sim City” criticisms. The best Sim City was 3000. End of discussion.
:D
 
12:02 PM
thank goodness I'm too broke to have a console
 
moving on
 
and don't want to install windows for a game:P
and moving on
 
>>> "This is a tweet ( ͡° ͜ʖ ͡°)".split(' ')
['This', 'is', 'a', 'tweet', '(', '͡°', '͜ʖ', '͡°)']
 
WHY DID YOU SPLIT THE FACE?
you monster
 
Can't you use str.split to get the whole face?
@idjaw :( .. That is a part of a tweet that I am using for analysis, the face is gettin split and spoiling my other analysis ;_;
 
12:05 PM
oh
 
This is a better MCVE
 
ah :)
ok
 
:D
how would you locate the spaces inside the face?
 
I had 3 secs left for editing that
 
somehow regexp for non-ascii characters?
that won't cut it either, because of the opening parenthesis:S
 
12:07 PM
so you are looking for
['This', 'is', 'a', 'tweet', '( ͡° ͜ʖ ͡°)']
 
I believe you need a deep neural network.
 
@idjaw yeah, but w/o the additional '
 
"If it's an emoji of a face or something else, don't split"
 
is it just that emoji-art?
or other varieties?
 
@idjaw I assume it should be fairly general
people use all sorts of crap in tweets
I also assume that Bhargav has a buttload of tweets to parse
 
12:09 PM
>>> re.split('(?<=\w)\s(?=\w)', 'This is a tweet ( ͡° ͜ʖ ͡°)')
['This', 'is', 'a', 'tweet ( ͡° ͜ʖ ͡°)']
Close enough
 
but there is so much that can be used to "draw" text art in tweets
there is much more to it than regex and splitting I imagine?
 
Sigh, ff crashed :(
 
>>> re.split('(?<=\w)\s|\s(?=\w)', 'This is a tweet ( ͡° ͜ʖ ͡°)', re.ASCII)
['This', 'is', 'a', 'tweet', '( ͡° ͜ʖ', '͡°)']
almost
 
@poke Just miss :(
>>> list("( ͡° ͜ʖ ͡°)")
['(', ' ', '\xcd', '\xa1', '\xc2', '\xb0', ' ', '\xcd', '\x9c', '\xca', '\x96', ' ', '\xcd', '\xa1', '\xc2', '\xb0', ')']
So it has hidden spaces in between :/
 
They are not hidden?
 
12:15 PM
wait, @BhargavRao, you just need to split this specific instance?
 
That one and ( ͡°͜ ͡°)
 
This could be a nice canonical for why you can't loop through a file multiple times without rewinding it: stackoverflow.com/questions/36572993/…
 
wait a minute
@PM2Ring Almost the same question answered last night: stackoverflow.com/questions/36561963/…
 
@idjaw So it is. I'm a little surprised Martijn didn't do a dupe search...
 
12:28 PM
Strange urge to hammer the new ones :P
 
I would use Martijn's as the canon
it provides the answer and the "you should do this"
more complete
 
come on, we would always use Martijn's as the canon
 
haha yes
 
cbg @AnttiHaapala
 
12:29 PM
cbg @AnttiHaapala
 
cbg @AnttiHaapala
 
@idjaw Ok. But I'll add yours as well, since it contains a link tpo the docs. Give me a minute or two...
 
@PM2Ring Also tell me if there is a need to close others as dupe
 
thanks @PM2Ring . It's unfortunate OP accepted the other answer that did not have the link to make it more complete
 
Someday when I am free, I will sit, edit and make all my answers better :/
 
12:34 PM
@BhargavRao is it really worth the effort?:P
 
agreed. It's to the point and concise.
 
Oops. I forgot to add an excerpt. Fixed.
 
excerption handling is important
 
12:40 PM
@MartijnPieters: Nice. It's now in the canon
@BhargavRao First, acquire a minion who'll search through your answers for you, looking for the ones that need improvement. :)
 
Yep, I will open an offer on so.com/jobs :P
 
just find a suitable rep whore in and offer them 10 rep
 
@BhargavRao Nice. I'll add both of those
 
I may have written better ones before. Sorry, firing off a quick answer between meetings is not conducive to proper dupe searches. :-/
goes off looking for a brown bag now.
 
TIL that you can use index.js like an __init__.py
 
12:49 PM
o.O
you mean some... I don't know what that means, lol
js doesn't have modules... and anything you include is included
 
Antii says I'm in the stone age for using Python 2.6, but what about this guy?
im using python 2.4 — maximus 11 mins ago
 
hardcore
 
trololol
I think I've heard that some souls are stuck on Python 1.4 still
at least it's not Java ;)
 
@PM2Ring that's like jurassic period... beware of the dinosaurs
 
I thought the tales of Python 1.x were legend
 
12:51 PM
Cabbage!
 
@WayneWerner Wow! I do still have some old 1.4 code hiding on this HD, but I haven't run it in years.
 
1.4to3.py?
 
wooow we don't even have a tag for python 1
 
Python 1 wasn't quite "strictly conforming C program"
 
talk about obscure
 
12:53 PM
I did compile it... and run, and 50 % of all statements I tried crashed the interpreter
 
That's because, like Cobol, the only people still working in those environments have complete knowledge of the language
 
@AnttiHaapala you kept using the wrong ones, then
 
(notreally)
 
TestingYard$ python3 Wikip.py ":)"
Smiley or happy face.[4][5][6]
Just removed the non ascii stuff and it's working properly
 

« first day (2005 days earlier)      last day (2940 days later) »