« first day (1659 days earlier)      last day (3292 days later) » 
01:00 - 14:0014:00 - 00:00

2:00 PM
Oh thanks
Hm
I have had a bad experience with my lecturers in C++ a year back in my engineering school, and then I chose to use python and try come back but I don't feel that much compared to others.. What do you guys think?
 
What are you asking specifically?
As it's not entirely clear.
Hey up @davidism
 
cbg
 
I feel inferior to other programmers even if I try to convince myself that I like programming, what is your advice?
 
Don't feel that way
Also, don't come to a chat room for existential help.
 
You probably are inferior to other programmers. Everyone is worse than someone else, apart from the person at the top of the pile who is distinctly unique.
The fact that other people are better than you doesn't necessarily make you bad.
 
2:09 PM
I really shouldn't give advice 5 minutes after I wake up on the weekend. :-]
 
haha
I am just thinking about practicality, like I am a 3rd year now moving to my final year in engineering school, and I moved to python because I thought it was easier
 
It is easier.
 
Alright here's a practical question, how to learn from the documentations? I don't understand what I read sometimes
 
That just comes with experience, really. But you should search for the terms you don't understand.
Like the difference between iterator and generator
 
Will I just search for them just like that? Or is does it depend on the problems I am trying to solve
?
 
2:16 PM
What do you do if you don't understand a term during your studies?
Such as in an engineering text book.
 
Hmm I actually haven't used a book in a while
 
We can't sit here and teach you how to learn though :/
 
My advice:

1) All good writers read lots of books. All good coders should read lots of code.
2) When reading code, when you encounter something new - first stop: read the comments in the code. Second stop - the official documentation. Third stop: somewhere else (like here)
3) Code. Invent little projects that push your coding boundaries. Make sure you have clear project definitions
 
I like this identicon
 
2:20 PM
Yeah it's one of your better ones recently.
 
@Ffisegydd Thanks Boss I will try my best
@IntrepidBrit Thanks Boss I will also try my best
Do you recommend me to use Kivy as a starter?
 
For coding? Probably not. But in the end of the day, whatever enthuses you to actually code should be the focus of what you learn around.
I personally would have been bored to tears if I had started with something like Kivy. Making pretty UIs don't interest me, but I do enjoy building tools that UIs can build off
 
Actually my project is due date in a two weeks ;/ and I don't have so much experience in this area and that's why I am asking
 
2:35 PM
Depends on the project
 
Um, it is in really that serious project. Just a gui for the shortest path algorithm. It can be just a normal interface but I have yet to explore Kivy
 
3:04 PM
cbg
 
The internet is telling me to vote Lib Dem.
 
Does being ignorant of basic syntax count as a typo? :) stackoverflow.com/questions/30003571/python-decimal-list
 
@Ffisegydd There are worse things to vote
 
So... what does Lib Dem mean?
 
Unfortunately LDs is 59%, Greens are 56%, Lab are 52%, Con are 48% so it's pretty close all around.
 
3:10 PM
It sounds like "As left as possible", but Europe tends to bungle left and right sometimes so I never know.
215% voter participation is pretty good.
 
Doing bbcgoodfood.com/recipes/1708/… for dinner later, gonna be banging.
 
@Ffisegydd You're a moderate then?
And that looks tasty
@QuestionC Lib Dems are left wing, but not as right wing as labour
They tend to prefer a system where people are encouraged not to stay on benefits (by raising the minimum tax threshold), whereas Labour will try to prefer other methods of getting people off benefits
(I'm trying to be politically neutral)
 
'other methods' sounds... euphamism-y
 
Haha. Not intentional ;)
 
"We have ways of getting people off benefits"
 
3:24 PM
For example, they'd prefer to chuck money into a centralised solution (say education) to increase socio-economic equality
 
shifty eyes
I think we might have different ideas of left and right. It sounds like Labour is left (increase spending on education) and Lib Dems are right (cut welfare).
 
Nope, Conversatives (or Tory) party is "cut welfare" and are very much to the right
Okay, I have to rhubarb outta here
Be on tomorrow
 
hello Python!
got a quick question, need some help with subquery in sqlalchemy
anyone able to help?
 
Just post the question. No need to ask if anyone can help.
 
3:40 PM
@IntrepidBrit I dunno. I just find that all my opinions are shared by different parties :P
 
@knowbody if you have a question, just ask it. Also, I answered your latest SQLAlchemy question, the answer you accepted is useless.
 
checking it now @davidism
this is what I need to do in sqlalchemy basically
3
Q: Join with DateTime and Latest Value from another Table

Devdatta TengsheI have a small database with the data from weather parameters being recorded daily. This is a Microsoft SQL Server 2008 express Database My tables are as follows: station (id, name, position) reading (station_id, timestamp, value) --station_id is the foreign key to id in station table I wa...

the first answer gives the sql query similar to the one i need to execute in sqlalchemy
@davidism thanks, I guess this is what I was looking for
 
@knowbody so you want the row with the latest timestamp for each name?
 
so I have two tables, and I want to search for a thing by ID in the first one, but before I want to join the second table to the first one. the second one needs be joined by the same ID but with the latest timestamp
not sure if that make sense
 
It makes sense. I was just about to go for a short workout though, so I'll have to answer when I get back. Otherwise I'm never getting out of here. :)
 
3:52 PM
thanks
is that a huge query in sqlalchemy then? @davidism
 
no, not really, it's about as long as the answers to that question. It would help if you posted your model definitions though. Use dpaste.com
 
there are no relationship in sql between those tables
but the place_id matches the idin the Place model
 
any squirrel programmers here?
 
No. This is the Python room.
 
We eat squirrel programmers.
 
4:06 PM
I heard you guys were related :p
 
cbf
 
am trying to modify the object pointed by lst...
def map_mut(fn, lst):
	"""Maps fn onto lst by mutation.

	>>> lst = [1, 2, 3, 4]
	>>> map_mut(lambda x: x**2, lst)
	>>> lst
	[1, 4, 9, 16]
	"""
	map(fn, lst)
lst = [1, 2, 3, 4]
map_mut(lambda x: x**2, lst)
does map() mutate class list type objects?
 
No, it returns new objects
 
oh is it more appropriate to use map/filter/reduce on immuteable types like class tuple?
 
4:21 PM
It's fine to use these functions with any iterables, just not when you want to modify original iterables
 
all you have to do is assign the result of map back to the list in place: lst[:] = map(fn, lst)
 
thats at least a 90% true statement :P
 
cbg
 
@davidism No the condition is to just mutate the existing list.
 
4:27 PM
that does mutate the exiting list
 
yeah
 
why can't I say lst = map(fn, lst)?
 
4
A: What is the difference between slice assignment that slices the whole list and direct assignment?

Jochen RitzelThe difference is quite huge! In a_list[:] = ['foo', 'bar'] You modify a existing list that was bound to the name a_list. On the other hand, a_list = ['foo', 'bar'] assigns a new list to the name a_list. Maybe this will help: a = a_list = ['foo', 'bar'] # another name for the same list a_...

 
because that assigns a new list to lst, rather than assigning to a slice on lst
they're different statements, why not try it out and see?
 
ok
for element in lst:
		element = element*element
 
4:31 PM
Won't change the lst
 
unless element happens to be some custom class that overrides assignment (can you even override assignment)
 
no, not for bare names
 
ok then definatly wont change the list
 
you could use descriptors on classes
 
oops ... thats what i get for comming in halfway
:P
 
4:35 PM
instead of using slicing operation, is there a way I can do it using for..loop/generator expression?
i mean using simple python constructs
 
for i,v in enumerate(lst):
     lst[i] = newValue
sorta...
but in general its risky to modify a list as you iterate over it ... in this case it shouldnt blow up in your face...
 
@overexchange are we just answering your homework for you? Have you tried anything?
and a slice is a "simple" python construct, it's a built-in part of the language
 
I agree with davidism you should just do slice assignment (if you even really need to do that ...)
 
@davidism any idea of the solution for my sqlalchemy?
 
@davidism this is discussion exercise from here www-inst.eecs.berkeley.edu/~cs61a/fa12/disc/disc4.pdf page 4
 
4:41 PM
@overexchange I've asked you before not to ask about your homework anymore here
 
Argh! Got tank ed ... But who cares :D I am capped
:D
 
It's the weekend, you should be outside, not rep capping!
I'm going to fly my quadcopter around the university, since it's alway empty on the weekends :)
 
I rep-capped in the morning itself... Thanks to ---
12 hours ago, by Bhargav Rao
The Good, The Bad and The Ugly
:)
Rbrb -- Dinner time
 
5:14 PM
@knowbody is there a reason you don't define a foreign key from PlaceScore.place_id to Place.id?
 
5:30 PM
no
can't I just do it in the query?
@davidism
 
sure, but why not define the tables correctly? Then you can define relationships too.
you can press up to edit posts, rather than pinging me on a new line
 
thanks, so what's your solution then?
 
It's called a correlated subquery: stackoverflow.com/search?q=[sqlalchemy]+correlate
would you rather see the immediate query, or the "right" way to do this?
 
I managed to get to the point where the response gives me a tuple of Place and PlaceScore and they are correct, but not sure how I merge them into one. I'm using Session
 
latest = session.query(sa.func.max(PlaceScore.ts)).filter(PlaceScore.place_id == Place.id).correlate(Place).as_scalar()
session.query(Place, PlaceScore).join((PlaceScore, PlaceScore.place_id == Place.id)).filter(PlaceScore.ts == latest)
I'll paste the right way to do this in a second, that's just the immediate solution.
That's a literal translation of the accepted answer you posted.
 
5:36 PM
ok, thank you!
 
Novice Question: How would I have an async method in Python that catches something sent from a server?
Not even sure what to look for or google, been kinda stuck. Just trying to get a jumpstart here.
 
What are you trying to do? You need to give more details.
 
I have an Azure EventHub. I'm sending and Receiving Event Objects. I can send find with Python, but I want Python to actively 'listen' for a response from a server, which could come at any time.
 
What is EventHub? How does it "send and receive event objects"?
Is it a socket? HTTP requests?
 
Sorry, Http Request I believe
 
5:41 PM
You make a request and it sends a response, one HTTP cycle? Or you tell it where to send responses and then listen for them?
 
The latter.
 
@davidism this gives what I've done myself, the response is a tuple (<Place: 12345>, <PlaceScore: 12345>)
 
Yeah, that's right. Why don't you want that?
@JcKelley so you need to set up a server listening for those messages
Try Flask
 
@davidism because I'd like to have response from one (merged) table, so I don't need to do place[0].name and place[1].timestamp
 
Why?
 
5:44 PM
because if I query for multiple ids it would be a pain
 
No it wouldn't? for place, score in results:
 
doing for loop through couple of thousands results it's not really efficient, hence wanted this to be done on the db level
 
Sure it is. I'm not clear why you think that looping over results is inefficient
 
anyway, is there a way to have them merged?
 
You've still selected the same amount of data and are doing the same things to it. It is equivalent.
Sure: for place, score in results: place.latest_score = score
 
5:48 PM
ok, thanks!
appreciate the help :)
 
that was a joke
Seriously, print out the query: you'll see that all the relevant data is already selected, there's no concept of "merging" in SQL.
SQLAlchemy then matches up all the data and creates model instances, which it would do anyway. What I posted is the correct solution.
SELECT place.id AS place_id, place.name AS place_name, place_score.id AS place_score_id, place_score.place_id AS place_score_place_id, place_score.ts AS place_score_ts, place_score.score AS place_score_score
FROM place JOIN place_score ON place_score.place_id = place.id
WHERE place_score.ts = (SELECT max(place_score.ts) AS max_1
FROM place_score
WHERE place_score.place_id = place.id)
 
cbg
First world problems -- I want to work on a project I forgot to commit and push from last night, so I have to walk all the way downstairs to get on my desktop.
5
 
6:33 PM
cbg
@AdamSmith you're using windows???
that is so not-star-worthy
no matter where I am, I'd not move a meter, just ssh into it...
after I watch a film from big screen in bedroom with wife, I take my laptop and ssh in the box to shut down the damned display.
if my phone crashes I'll ssh into it too
sometimes my X becomes unresponsive so I take my phone and use it to ssh into my laptop and restart the buggy daemon so that I do not need to reboot.
 
yeah I'm running Windows at the moment
I had a video card die on me so my desktop is using integrated video until I get the card RMA'd. Neither Mint nor Ubuntu played nice with the integrated graphics
once the card gets back I'll probably wipe and reinstall some nix flavor
 
7:11 PM
GF is doing Code Academy course, some of the lessons are...less than idiomatic.
 
Isn't it also Python2?
 
It is.
 
That's bad enough.
 
I know right.
 
7:37 PM
What's a good example of a poor CA lesson?
 
 
1 hour later…
8:58 PM
@AdamSmith what much I did it, I'd say most of them :D
 
 
2 hours later…
11:37 PM
"I found a program" should be a banned phrase on SO.
 
01:00 - 14:0014:00 - 00:00

« first day (1659 days earlier)      last day (3292 days later) »