« first day (2042 days earlier)      last day (2907 days later) » 

12:16 AM
woo, the first sprouts of my android app are working!
(written in python, of course)
 
user559633
12:33 AM
are you open sourcing it?
 
heh, no
it's just a thing to notify me when my service goes crazy
my phone occasionally drops the provider's signal and silently goes into "emergency calls only" mode
I mean, I guess I could even put it on github, but as I don't know anything about app development, nor java, nor android, the result will definitely be an exquisite corpse
Currently I have a button and two dynamic labels, and pushing the button produces a notification/vibration depending on press/release
if I can get the GSM stuff to work (which will be the hardest, lowest-level part), I should eventually succeed
actually, the largest problem will probably be to make it run a service in the background...
 
 
2 hours later…
2:39 AM
what does it mean to search a single folder non-recursively?
 
user559633
3:01 AM
@clickhere context?
 
user559633
maybe look at a folder instead of traversing subfolders
 
user559633
Ξ /tmp/whatever_your_name_is → mkdir -p test/test_a/test_a_a
Ξ /tmp/whatever_your_name_is → touch test/beep test/test_a/beep_1 test/test_a/test_a_a/beep_2
Ξ /tmp/whatever_your_name_is → tree .
.
└── test
    ├── beep
    └── test_a
        ├── beep_1
        └── test_a_a
            └── beep_2
 
user559633
e.g. if you were to search a single folder non-recursively at the level of test, you'd only get the file "beep"
 
you wouldn't get test_a too?
 
user559633
>>> list(os.walk('./test/'))
[('./test/', ['test_a'], ['beep']), ('./test/test_a', ['test_a_a'], ['beep_1']), ('./test/test_a/test_a_a', [], ['beep_2'])]
 
user559633
3:04 AM
vs os.walk will traverse folders
 
user559633
sure, you'd get the folder test_a as well, but not its contents
 
ah ok, ty
 
user559633
yeah nw :)
 
4:14 AM
A new challenger appears
queue Guile music
 
4:54 AM
cbg
 
Dear friends, I got error in this line : fuente = Gst.ElementFactory.make("filesrc", "file-source") self.reproductor.add(fuente)
as : File "/usr/local/lib/python2.7/site-packages/dbr/reproductor.py", line 36, in init self.reproductor.add(fuente) AttributeError: Reproductor instance has no attribute 'reproductor'
 
5:11 AM
and?
this is your own software
self does not have .reproductor, possibly it is the reproductor itself?
perhaps self.add()
or is this the bookreader?
 
5:30 AM
actually its a working code in Gstreamer 0.1
i just change to GStreamer 1.0
 
and you got answer in ask ubuntu way ago
the api has been changed, gstreamer 1.0 is not compatible with 0.1
if you canfind a link to the dbr source
self.reproductor = gst.Pipeline("player")
fuente = gst.element_factory_make("filesrc", "file-source")
self.reproductor.add(fuente)
?
it is a problem in reproductor.py
 
5:46 AM
 
6:02 AM
I dont understand how my answer has 2 downvotes and an answer recommending shadowing a builtin intentionally has an upvote
because I opined that "@property" is at best a waste and at worst a way to introduce hidden problems
 
6:27 AM
Cabbage
@JoranBeasley And I certainly don't agree with his latest comment:
No, just use [] instead of list() :) But seriously, you can't always advocate for breaking an API, even if the naming decisions were very bad. If the OP was fine with breaking the API, he wouldn't have asked the question, he would have just changed the name. Remapping a builtin isn't unheard of, and it's certainly preferable than having a giant comment saying "this function has to be last in the class definition". — Brendan Abel 11 mins ago
Maybe we should invite Brendan here so we can thrash it out...
@IljaEverilä "I want code". I'm so tempted to comment: "I want a pony". :)
 
Don't we all :D
 
7:18 AM
cabbage
 
Whoever wrote this ML book decided to use Ruby as their programming language in book. WHY!?
 
Because they wanted to trouble you! :P
 
7:34 AM
Well they succeeded.
Might as well have done it in JS.
 
8:13 AM
This is awkward, I'm a software engineer, I've been studying for a long time and I keep googling for everything in my job, I feel like I know nothing !!
 
8:27 AM
I don't have to Google everything: I have a local copy of the Python docs on my HD. :) But seriously, I'm sure you've absorbed a lot of info about the languages you use. And it's good to check that your assumptions are correct and up to date. OBxkcd: xkcd.com/903 "When Wikipedia has a server outage, my apparent IQ drops by about 30 points."
 
Hah. Makes me feel better. Especially for that stuff you do relatively infrequently like setting up a project again.
Particularly since I've just automated a bunch of that in Ansible, I'm sure I'll forget more.
Spent most of the weekend dealing with a compromised server
:(
Turned out I'd copied an old install script that installed redis3.0.0 instead of 3.2.0, which was pre big red button fix.
derp
 
Morning cabbage!
 
CBG AM
 
Sup Brit
 
Feeling well travelled. Got back into the office, and looks like I'm being out of the country again soon
Do I smell bad or something?
 
8:35 AM
Maybe it's a sort of 'here comes Jesus, look busy', kind of thing
You make others look bad by your mere presence
 
I'm pretty sure that's not the case :P
How's the Python room been? Y'all been behaving yourselves?
 
How was the US?
Lots of garlic here.
 
@IntrepidBrit Mostly. You didn't miss anything scandalous, just a few HVs getting kicked.
 
It was good actually. We had better years for rustling up business, but the last couple of have been lucky/exceptional
Thouroughly enjoyed getting stuck into American food. I think I'm going to become better friends with the gym as a result
Bit odd how there's been a spike of HVs. Exam time, maybe?
 
8:50 AM
Sometimes Eternal September is more Septemberish than usual.
 
Can you please suggest a better way to achieve this?
 
What is "this"?
 
I am converting results array to output
See the solution in the paste link
I am running three loops to achieve this
 
Please explain your actual problem, don't make people source code dive to understand it at a high-level.
 
ok
results is a list of dictionaries having panel prices on car_type level and car_model level
I have to output a list with dictionaries each having the name of panel and all the prices
but if for any panel and work_type combination if there is car model price exist then do not need to take car type price in consideration
 
8:59 AM
@Ffisegydd Sometimes, I feel that 1st September 1993 should become the new unix epoch...
 
@Anuj what's wrong with your current solution?
 
This sounds a lot like homework tbf.
 
Oh it absolutely is homework.
Which is why I'm inclined not to share the solution.
 
You could use list comprehensions for a start.
 
It's not a homework
it's a problem i am encountering at my workplace
 
9:03 AM
What's wrong with your current solution?
 
and that is my solution to it. I just came here to know if there is better (more pythonic way ) of doing this
 
^^^
 
there is nothing wrong with my current solution. It's just doesn't feel good to me
I think it can be improved
 
1) Pre / over optimisation is the devil.
If your code is readable (and you can understand what the hell is going on) - move on.
 
I'd bet a shiny penny that you've got other problems in your code that are more important than this.
 
9:07 AM
2) Wot Fizzy said
3) Why are you reversing your sort in line 80?
 
That's just how they roll.
@Intrepid how's that ML thing we were discussing a while back going?
 
I want the car_type prices to come first in the list
That's why sorting based on car model and reversing
 
Huh?
 
results = sorted(serializer.data, key=lambda datum: datum['car_type'])
this can also be done
I thought reversing will not cost me because it would be considered at time of sorting only
 
But it makes zero difference, as you're then iterating through the sorted list to create a new object?
 
9:15 AM
yes. But some of the objects are getting overridden by doing this
 
@Ffisegydd Currently, it's not. Now that I'm back, I'm going to start making the proposals and make sure we're focussing on the right features with "field experts"
They're likely to look at me strangely and conclude I'm some kind of wizard.
 
I'm actually working on an ML project at the moment as work is a bit slow.
 
Anything you can talk about Fizz?
 
@Anuj Well as long as you have a reason. Although I'm inclined to agree with Withnail
 
9:18 AM
Heh, that's cool, didn't know about that. Might be a good entry point for me playing with some of that stuff. I was trying to get to working on ML stuff for football prediction at my last project, and realised a) it's super hard, and b) there's loads of people doing it wayyyy better than I (ever) will.
 
@Anuj: BTW, you will have problems migrating this to Python 3 because you cannot compare objects of different type in Python 3. Specifically, sorting a collection of integers mixed with Nones will fail.
>>> print(sorted([3, 1, 2, None, 4]))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: '<' not supported between instances of 'NoneType' and 'int'
 
@Ffisegydd Bloody hell. That's pretty morbid
 
It is a little. My models keep on failing because I just say "I WILL ADOPT ALL OF THE CATS!"
 
Ohh Ok. Thanks
What could be a better way to do this then?
 
The program sounds realistic
 
9:20 AM
Should I add an if condition in the first for loop
 
@Ffisegydd Do you have a repo for a cheeky looksee?
 
@Anuj I guess you could replace None with 0 or -1, or some other integer that's not a valid car_model
 
@Intrepid do you have a Gitlab account? It's on there in a private one.
Stay classy PHP.
 
@PM2Ring I can do that but that would mean running one more loop to change car_type or car_model None to -1
 
@Anuj Or you could modify the key function that you pass to sort so that it converts None to 0 or -1, but it would probably be more efficient in the long run to replace the None entries in the actual data.
 
9:23 AM
Your data model should be changed in that case anyway, maybe.
 
@Ffisegydd I do now!
 
I don't want to change my data model because None makes more sense there
 
FWIW, although I see the benefit of restricting comparisons in Python 3 I'm a little sad that None isn't given special treatment to permit it to be compared to anything.
 
Does None make sense?
Or would having an invalid int make sense?
 
(I'm about to try spelunking to recover a legacy hacked server that I need the 30Gb database from. Wish me luck.)
 
9:27 AM
Good luck Withnail!
 
@Intrepid added you to the group, should find it in the animal_rescue repo.
The project structure is based on my new favourite thing: drivendata.github.io/cookiecutter-data-science
 
It's a foreign key to another model in db (So having null makes more sense)
 
I'm a new Cookiecutter evangelist.
 
hang on
 
Awesome, thanks.
 
9:28 AM
if you're doing this pulling it out of the DB, why don't you just arrange this in the right form as it comes out of the DB?
 
@Ffisegydd I think using None is cleaner than using an invalid int. OTOH, it would be even cleaner to have an explicit record_type field so that it's more obvious that a heterogenous mixture of records is being processed.
 
That was basically my thought
 
I tried arranging it in DB but didn't get success so I am trying to do it in python
 
The joy of having a grill at the office
 
We have a vending machine. It's broken though -_-
 
9:39 AM
We have a broken toilet. Again.
 
"When I were a lad, we'd be lucky to have a broken toilet. All what we had was a hole in the ground, filled with pythons!"
In other news - jealous that you have a grill, unless people are people and don't clean it properly. Then I pity you
 
    d = defaultdict(dict)
    for l in results:
        key = l['name']+'-'+l['work_type']
        if d.get(key,{"car_type":5}).get('car_type'):
            d[l['name']+'-'+l['work_type']] = l
I have removed the sorting and doing this
So sorting is not required now
 
It is not quite well cleaned, I managed to get a bit of a fire out of an electrical grill yesterday.
Combination of what ever the hell is at the bottom and the grease from the steak equaled flames :P
 
@Ffisegydd Sod it. I've been looking at standardising my projects a certain way. Might as well cookie-cutter it so that others have a hope in hell of understanding how my brain misfires works
 
9:57 AM
@Anuj You could use format to build that key, and there's no point constructing the same key twice.
for l in results:
    key = '{name}-{work_type}'.format(**l)
    if d.get(key, {"car_type":5}).get('car_type'):
        d[key] = l
 
10:21 AM
@IntrepidBrit Yeah it's really nice. I'm forking that data science one and customising it for my use cases.
 
How odd. Two brand-new users with identical user names having a conversation... stackoverflow.com/questions/37320166/…
 
Father and Son Duo
 
@BhargavRao Maybe. I suspect that their relationship is a little closer. :)
 
@PM2Ring Thanks for that advice. Could you please suggest any more changes which can be done to my program to make it better?
 
@PM2Ring :D
 
10:27 AM
Brace yourselves, eval() is coming: stackoverflow.com/questions/37320401/…
 
@Anuj I have no more suggestions at this stage.
 
Ok thanks
 
FWIW, I've noticed that Tim Peters has been answering questions in recent days. Eg stackoverflow.com/a/37313506/4014959
 
And now you know what the "Zen of Python" means by saying that the one obvious way to do it "may not be obvious at first unless you're Dutch" ;-) — Tim Peters 7 hours ago
 
Okay I've got to come up with some data science case studies (for real this time, not like last time I asked when it was for "making someone cry")
I should also come up with some Python questions.
 
10:41 AM
Monty or reticulated?
 
@JRichardSnape Ball.
TIL that Python is non-venomous.
 
10:58 AM
Muh
Just had a call with an online gaming company; the guy's seen my CV and portfolio, and it wasn't until 2/3 the way through I realised he was talking about building stuff in Java.
I feel like one or both of us should have picked that up earlier.
 
Jython!
 
Heh
 
@Ffisegydd What sort of data? "How many hours can you listen to Epic Sax guy on repeat?"
 
Didn't even think of that actually.
 
11:13 AM
@IntrepidBrit "Here is a pen, data science it for me."
3
 
cabbage
 
@Withnail To be fair, Jython shouldn't be at the forefront of your mind
 
hey, @IntrepidBrit, I've been told by certain sources in this room that you are to ask about sopython t-shirts...?:P
now I'm unsure about how much I can trust the sources
 
Haha
 
still, I'm asking:D
 
11:24 AM
Technically, they're right
But unfortunately, the company I was intending on using have ceased trading
 
They owed me some favours and had offered to do them at cost
 
ah, I see
 
They have literally fled to the remotest part of Scotland
Maybe I do smell
 
:D
and do you have any legal info about the zalgo shirts?
 
11:26 AM
Someone gave me a pointer many moons ago on it, and there would need to be some stack overflow branding on it (to show recognition)
 
or would that be a last step before production?:P
@IntrepidBrit oh, that doesn't sound so bad
especially that SO no longer sells merch
 
So I was planning to put their logo on it and a shortlink to the original zalgo answer
 
nice:)
well I hope that some other company will become your vassal soon
 
But when I originally checked, the conditions weren't particularly onerous
 
:)
meh
 
11:28 AM
It's unlikely to happen, for I frequently work near the docks, and aircraft carriers do not need funky custom t-shirt designs
 
Like this? :( :)
 
shame on them
 
And every other t-shirt printing company I've used has been an absolute rip off for low quality t-shirts
 
@PM2Ring ">division sign< >crossed parenthesis sign<"? ;)
but yes, like that:D
 
I've ordered some for a stag do tomorrow - I'll see how they turn out
But they're at £15 per tee
 
11:29 AM
oh, cool:)
lemme google that
 
@AndrasDeak You were short by one dash on the right:---:(--- :)
 
well, if it weren't for shipping, I'd even be OK with that
@PM2Ring no way...
I need some coffee stat, thanks
 
How much is the list price on Redbubble?
 
I'll have to look into customs stuff from the UK just to be prepared;)
 
@IntrepidBrit That's pretty damn pricey for a T-shirt.
FWIW, the once-flourishing clothing manufacturing industry in Australia is a vestige of its former self, due to cheap Chinese imports.
 
11:33 AM
I think it's around £10 on RedBubble
I think I might open source it, fire up the designs on SoPython so people can get them made locally
 
"locally":(
I'll have to find a proper manufacturer:D
but hey, no shipping
 
where you based andreas? i'll make and deliver for a very reasonable air fare
wearing the tshirt to avoid customs costs.
tshirtmule
/costeffective
 
Cabbage!
 
@Withnail Hungary
lol:D
 
Oh, i'm actually going there in August.
:P
 
11:44 AM
condolences
hope you'll enjoy it:)
 
I'm pscyhed, I like Hungary!
 
cool!:D
are you coming to Budapest?
 
We seriously considered moving there.
 
whoah
 
Yeah, start of a trip through the Balkans.
 
11:45 AM
you really are a psych
 
lol.
 
were do you live?
 
London
 
interesting:)
 
@AndrasDeak FWIW, I'm currently wearing a T-shirt that's got "BUDAPEST" "HUNGARY" embroidered on it. But I guess embroidering that Zalgo post might be a tad difficult. :)
 
11:46 AM
(Just the cost of living differential is enormous, and nice city, love central Europe.)
3d printer @PM2Ring ?
 
I seriously had no idea that actual people liked Hungary
 
ooh, i don't think i've been an actual person before.
 
@AndrasDeak My parents were so impressed they bought the T-shirt... which I'm wearing. :)
 
@Withnail lol:D
 
Yeah, we usually stay round the Bacjisly (sp) end of Kiraly. There for a couple of days in August before we head off to Novi Sad & Belgrade. Come say hi and get a coffee. :)
 
11:50 AM
@PM2Ring ah, makes sense. So they were forced to buy the shirt on knifepoint, and were too scared to admit it.
@Withnail wait, I'll have to decypher that;)
 
@Withnail It might be possible to do the Zalgo thing with embroidery, assuming the sewing machine can get the fonts but I suppose it'd be simpler to just screen-print it. Or iron-on print it.
 
we'll see, thanks:D
gotta go now, rhubarb
 
@AndrasDeak Budapest was chillingly beautiful when I was there last
 
rhubarb
 
rhubarb
 
11:52 AM
rhubarb
 
@IntrepidBrit It should be similar now too:) More animosity towards foreigners possibly, but at least it looks the same:)
 
Can't be more hostile to foreigners than the UK in the throes of a 'Brexit' referendum ;)
 
@AndrasDeak Wait, Is there any reason not to like Hungary? o_O
 
12:05 PM
Wow. This guy's keen: Member for 1 year, 10 months. Rep=99778, Gold badges in JavaScript and regex. stackoverflow.com/users/3832970/wiktor-stribi%C5%BCew
 
shivers regex
 
He's a really nice guy.
 
I almost answered a regex question a little while ago but the OP deleted it when it was only 20 minutes old. His main problem was a simple typo, but I was going to post some code that would've been more efficient than what he was doing. He was processing a small text file line by line that could easily be done in one hit with .findall; oddly he was already using .findall, even though each line only contained a single record.
 
@PM2Ring Link?
 
@BhargavRao stackoverflow.com/questions/37319913/… I'd would probably just do this line by line using strip and rsplit, but I guess regex is handy to build the list in one hit.
And I see from the timestamps it was only 12 minutes old when he deleted it.
 
12:19 PM
@PM2Ring strip and split is best there. regex is overkill
 
Sure, but re.findall(r'.*\s(\d)$', data, re.M) is pretty compact. :)
 
There's a lot of advice out there for preparing to answer interview questions, but not much material on doing the asking.
 
Yep. But I still prefer split. B)
 
@Ffisegydd tech questions or more general?
 
I'm not sure I really like techy questions, if they're not done well then they can just end up testing memorisation - for example "Write me a list comprehension that returns only even numbers."
You can do a bit better with something like "What's the difference between a list comprehension and a generator expression?"
But really I think better questions come from having a conversation - "What's your favourite part of Python? Least favourite? Oh you've used X library, tell me about it." etc
Unfortunately I also need some case studies to give them something to really get their teeth stuck into.
 
12:33 PM
> I am looking to be able to do this with only libraries built in to python because I do not like downloading external libraries.
Wow
 
recbg for a little while
 
re-cbg
 
@BhargavRao nooooooo :P
 
morning, you kitty cats
 
hello, dear crow
 
Morning cabbage.
 
cabbage
 
mroaw?
 
1:01 PM
@IntrepidBrit Mmmmmwaow.
 
hiss
 
brief-rbrb
 
Just managed to crash my PC running some ML fitting.
 
1:26 PM
Is there a super resource for dummies on python3 and database connections. I got it working once then I broke it lol
 
I doubt it. There are a large variety of database libraries, so it would be hard to write a resource that encompasses all of them.
 
yeah thats what I thought
 
Playing around with making a prog bar for my tkinter app and not sure how people estimate how long a task will take. In my case. I've got a simple app that will browsed a selected dir and print out each file if the file meets certain conditions. But if I simply do one loop to find out how many of those are I'm doing nearly double work for when I actually print the files. How is something like this approached?
 
Does it matter?
Looping over the files the first time takes "no time at all"
That being said, check out os.walk
 
1:30 PM
I'm assuming that checking each file for the certain condition is the expensive part.
 
You know the total and when you started, you know how many you've processed and how long it took, seems straightforward. Of course, this is only WinXP level of "time left", but improving that is an exercise for the reader,
 
@Ffisegydd to return to this convo (that I inadvertantly let me machine sleep over...) - my experience of a lot of hiring (both tech and non) is that the ability to hold the conversation is a) a general test of fit, and b) a marker for understanding and comprehension of subject. Those questions you've outlined are a pretty good opening, imo.
"What's your biggest technical achievement? Why did you pick it?" is another good one.
 
If processing a file that meets the condition takes five minutes, and processing a file that does not meet the condition takes five seconds, then you can't easily determine how long it will take to process a full directory.
 
We also asked a lot about attitudes to work, in a way that made people quite uncomfortable (which is a marker towards 'No', where we were).
 
1:32 PM
As an alternative to precomputing the conditions before showing the progress bar, you could:
1) use a heuristic; for example, assume that 10% of all files in the directory meet the conditions. Then you can increment the progress bar every tenth file without having to actually check them for that condition.
2) Increment the status bar asymptotically. After the first file, increment it 25%. After the second file, increment it 20%. After the tenth file, increment it 1%.
 
tl;dr, you're on the right lines
(imo - ymmv)
 
Or possibly a mix of the two. You can also adjust your heuristic as you gain additional data on the actual directory. "I've processed 20 files and seven of them meet my conditions; I'll adjust my '10% assumption' up to '33%' and move the progress bar accordingly"
 
Some interesting suggestions, kevin.
 
This all assumes that checking the condition is actually expensive. If you just need to look at the filename and time of creation in order to check your condition, I'd expect that to take a fraction of a second for a directory with less than, say, a thousand files.
 
engine = create_engine('sqlite:///:memory:', echo=True) Does this mean that the data base will exist only in ram for the time being because that would be cool.
 
1:43 PM
Scribble - yes.
Quite good for aggregating a "lump" of data together and flushing them all to a "real" sqlite database in a single go
More resource efficient than constantly flushing them to disk as and when they come in
 
SWEET I have my own rack and a G-aweful amount of ram so this will make life easier
 
@IntrepidBrit but you can just use a transaction for that
 
The witchcraft really begins when you use multiple processes to access a single in-memory database. Not tried that though.
@davidism You absolutely could. Depends on your use case.
 
I'm a confused crow. Meow.
 
What could possibly confuse a crow?
 
1:49 PM
Tkinter.Canvas.create_line's dashoffset argument doesn't appear to do anything. this guy has the same problem as me. Post made in 2009, no replies. The struggle is real.
I can't be the only person that has ever needed to make a dashed line with two colors.
Hmm, might be time to make a post on SO. Is it a blue moon already?
 
@Kevin That's a shame. It's a standard thing in PostScript: I use it in my tartan pattern maker.
 
122nd! Slowly climbing the leaderboard, but it's now taking a lot of work to just climb a few places.
I need to get home so I can install xgboost, a lot of other people seem to be using it and getting a lot of success
 
Kaggle?
 
Kivy?
 
Wrong short K-word
 
1:54 PM
@Kevin And SVG also has a functional stroke-dashoffset.
 
Yah.
 
I'm still downloading the dependencies to run your code :/
 
Yeah they're a bit hench. Not sure they're all technically required.
You'll definitely need pandas and scikit-learn. Numpy would also be preferable for some feature functions.
 
DSM
What if my code has an obscure dependency?
 

« first day (2042 days earlier)      last day (2907 days later) »