« first day (2335 days earlier)      last day (2599 days later) » 

8:00 PM
I recommend rimworld if you like strategy games
 
@MarcusS I picked up Witcher 3 with out playing the prior ones. Was a really good game as a starting point. Some points I got confused or I didn't really understand. Overall it made me want to play the original 2 to understand. Overall it's worth the money.
 
I've managed to waste 23 hours on it in just a few days :D
 
@Kevin or latex
 
I'll summarize the plot as I have gathered it through Internet osmosis: there's this guy named Garett or Garth or Gumble or something. He's a witcher. He witches(verb) witches(noun). But most of the game is actually about playing cards.
 
I found myself wandering around trying to do side quest... the sheer amount of side quests took up so much of my time. was worth it I guess...
 
8:02 PM
I have another question, albeit not sql sorry xD. I found code of a calendar that is perfect for my coursework I'm doing, however its quite advanced for me to be able to understand. When you click on a date it highlights green, and I want to link that date to a sql query function. Would anyone be able to help me sort this out?
 
@simons21 regarding your previous question: I've seen it a lot that a single-element tuple is unpacked on assignment: my_scalar, = function_returning_single-element_tuple(), note the comma. I'm not sure how idiomatic this is...
 
Paste the code at dpaste
 
With just that information given, the task could take anywhere between thirty seconds ("just do mycalendar.bind("date_click", execute_sql)"), or five thousand hours ("turns out event handling doesn't natively exist in this library, so we'll have to rewrite it from the ground up")
 
Or, yanno, these smart guys can tell you without looking.
 
At the very least, it would help to know what calendar code is being used and where it came from
 
I've looked up the actual details of The Witcher series and I've decided I'm at least 60% right.
 
I didn't know if I was able to post links. It came from stack overflow, where some guy took it of the internet
-1
Q: Calendar with tkinter (print the selected date)

rodrigocfI got this code online in order to create a calendar with tkinter: """ Simple calendar using ttk Treeview together with calendar and datetime classes. """ import calendar import tkinter import tkinter.font from tkinter import ttk def get_calendar(locale, fwday): # instantiate proper calend...

original link
 
If you look for the bit that highlights the date green you can stick your code there
 
sorry to be a pain, but what code would I use? I haven't written the sql function yet but that's the easy part
 
If you're asking "how do I get the datetime that's currently selected from the calendar?" you only need to do calendar.selection. If you're asking "how do I execute code in response to the user clicking on a new square in the calendar?", you probably need to edit the function around line 185, self._show_selection(text, bbox)
 
8:11 PM
I haven't look too much at the code, but the function "selection" looks like it gives you the date when its selected? You could use that function with the details returned to craft your sql command?
 
"That second one sounds pretty hard," you think. I agree! It would be easier to just add a "submit" button to your window or something, and bind to that instead.
 
If you take the easy option you're no fun .
 
all of it seems pretty hard to me haha. Our school hasn't really shown us how to use any of this and I know using something that you don't know how to use is bad practise but its like the only one that works. the selection function seems good however ive tried to make it print out to the shell so I know the function is working but that never works, and I wanna use both of those ideas from you kevin xD
but they look too complicated from my perspective lol
 
I'm in the same boat as you at school
Buuut, what about the pressed callback? That should be doing something
 
it does something, I just can't find where
 
8:17 PM
from calendarWidget import Calendar #replace `calendarWidget` with whatever is the name of the file you saved the Calendar class to (don't name it calendar.py, that's already a built-in module name)
from tkinter import Tk, Button

def clicked():
    print("This is what the user selected: ", calendar.selection)

root = Tk()
calendar = Calendar(root)
calendar.pack()
button = Button(root, command=clicked, text="submit")
button.pack()
root.mainloop()
Result after clicking some squares and buttons and such:
C:\Users\Kevin\Desktop>py -3 test.py
This is what the user selected:  2017-03-16 00:00:00
This is what the user selected:  2017-03-26 00:00:00
 
I was totally going to say what Kevin said, that was my next idea. ;)
 
I don't wanna sound picky, that is some decent code, but is there a way to have that work without the button?
 
why don't you play around with it yourself
 
so if they click on a date it automatically prints out the date?
 
Are we just doing your homework for you at this point?
 
8:20 PM
callback from the calendar when it's clicked on. Take a google
 
You're lucky Kevin-bot is set to GOOD_MOOD=True
 
All right, you've twisted my arm. You could change the definition of _show_selection to:
def _show_selection(self, text, bbox):
    """Configure canvas for a new selection."""
    print(self.selection)
    x, y, width, height = bbox
    #rest of code goes here
 
GOOD_MOOD=False
 
Voila, now it prints the selection.
 
idjaw I have, I tried lots of different things but they all didn't work
 
8:22 PM
sudo service kevin_bot restart
 
the solution is to try more things
 
@simons21 sounds like it's time to sit down and learn how to debug then.
 
Now I will step away to look at funny internet pictures for the remainder of the day.
 
was it wrong to set kevin to a bad mood? I've never seen an angry Kevin
 
Thank you Kevin for putting up with my novice questions
 
8:24 PM
@idjaw I've had my share of sour moments. I'm not proud.
 
embrace Evil Kevin
 
I vaguely remember Kevin get frustrated in a non-jovial way once.
 
It might be hard to distinguish from outside between angry Kevin and ordinary blunt infodump Kevin
 
must be scary
 
8:25 PM
The star lord is still human. We can take him down!
 
You can kill me with a stake through the heart. You can kill most things that way, come to think of it.
 
He is still only human
uuuuugh
mvn clean integration-test -Dvagrant.destroy.sip

sip.......it was supposed to be skip....my boxes got destroyed....need to wait again.
 
You know, I remember Pitch Black and Chronicles, but not the third one at all, even though I remember enjoying it at the time.
 
♫ I'm only human after all. Don't put the blame on me. ♫
 
Unless we're referring to a different "only human" quote.
 
8:27 PM
It's almost Friday after all.
 
There's Daft Punk's Human After All but there's no "only" there I think
 
I'm only dancer.
 
My quote was from Matrix Reloaded
...I think that was it
 
@davidism is there a third one?
THERE IS!
and I've seen it
and it's very stupid
which is a challenge after Chronicles
 
It was more similar to the first than the second, but not as good as either.
Chronicles was the best kind of dumb sci fi.
 
8:30 PM
it can't be best kind of dumb since Starship Troopers
although that's so bad it's bad all over again
 
Chronicle was pretty good although it got kind of awkward upholding the found footage conceit towards the end
 
oh yes...I saw Chronicle
 
No, Chronicle.
 
8:32 PM
what?
 
I thought it was pretty good.
 
I liked it as sort of an exploration of what happens if you get superpowers when you're not living in a universe following comic book rules.
 
Am I allowed to ask another silly question, or have I used all of my silly question tokens for today?
 
oh, then I get why I don't get Kevin's issue with found footage
I thought I wasn't observant enough or something
@simons21 you still had one but just used it up
 
(yes, I started talking about a movie that was different than the one Andras and davidism were referring to, if anyone is still puzzled)
 
8:34 PM
Starship Troopers was great
 
@AndrasDeak it look me a while to get that
 
For a moment i thought that was GTA
 
can you call a function in a print statement?
 
@RobertGrant I'd ask you if you're being serious, but then again I can just poke a hole in your head and suck your brains out to get that information
 
8:35 PM
Great perspective on a functioning fascist society
 
@simons21 yes
 
print(foo())
You could have just tried it?
 
@AndrasDeak Not if I...give my knife away to the girl and die instead of using it on you myself? Who wrote this?
 
@davidism OK, I've seen that trailer a while back, I know the movie
too bad unsteady cams make me sick as much as FPS games:/
blair witch and Pi were both torment
 
Blair witch in more than one way
 
8:39 PM
Suppose I have a list, a = [1.2, 3.6, 5.4, 3.9, 6.7] How can I convert this to a list of singleton list like this: [[1.2], [3.6], [5.4], [3.9], [6.7]]?
 
Speaking of motion sickness, I watched Cloverfield recently, because I liked 10 Cloverfield Lane so much.
 
@Kevin oh dear
 
yeah, no.
 
It was almost, but not quite, entirely unlike its sequel.
 
haha..oh poor Kevin.
 
8:40 PM
10 cloverfield was surprisingly good
 
@Shubham loop over the list, construct a new list with each item in a list.
 
It was surprisingly goodman
 
so goodman
 
@KevinMGranger I've made that same joke about a dozen times since the movie.
It's a good joke.
 
8:42 PM
John goodjoke? nah
 
Yeah that's my queue to rbrb
 
rhubarb
 
Way to go Andras
that joke caused Kevin to leave
 
I made him queue
 
you're a monster
that's why I love you
 
8:43 PM
@davidism I did this:
 
the beauty of the beast
 
new_list = []
>>> for item in a:
... new_list.append(list(item))
...
Traceback (most recent call last):
File "<stdin>", line 2, in <module>
TypeError: 'int' object is not iterable
 
@Shubham [item]
 
>>> x = 23
>>> list(x)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
TypeError: 'int' object is not iterable
>>> [x]
[23]
Oops beaten
 
I hadn't even started typing yet
 
8:44 PM
@davidism @Kevin thank you.
 
@Shubham could also do new_list = [[item] for item in a]
 
>>> a = [1.2, 3.6, 5.4, 3.9, 6.7]
>>> [[x] for x in a]
[[1.2], [3.6], [5.4], [3.9], [6.7]]
 
Did you consider reading the docs about list? docs.python.org/3/library/stdtypes.html#list
 
Yeah, like that
 
I thought about mentioning list comps, but one step at a time eh
 
8:45 PM
@Shubham other possibility is that a is not a list but a int which might raise the same error
cbg
 
haha...docs...docs are for nerds.
 
@Kevin yeah I just broke my own rule
No farting on the couch
Don't know why I mentioned it really
 
@MoinuddinQuadri read the traceback, no it's not. The error occurs on line 2.
 
Sage wisdom.
 
sage might cause wind
 
8:46 PM
Heh
 
They're profound words for our thyme
 
Thank you @MarcusS @RobertGrant @MoinuddinQuadri In my case it is a list.
 
@RobertGrant laurel
 
@Shubham When in doubt, Googling the error message can help. In this case it would have taken you straight to this answer here in the first result: stackoverflow.com/a/19523620/1946923
 
No way, docs and SO answers? It's as if they did absolutely no research or debugging on their own.
 
8:48 PM
Cayenne we not make lame jokes like that and curry on with on-topic discussion please?
oh my goodness....the mother load
 
@MarcusS I agree. To be honest, I was trying to solve this issue for the last 15 mins. Idk, maybe my head wasn't working, I just couldn't figure out the issue. Been doing Python after a long time and I remembered that we can use list() to convert a number to a list. My mistake.
 
LOL
> Cardamon me, I was in a curry.
I blame Bobby for sending me down this path of horrible puns.
 
@idjaw As ewe wish. Mutton can stop us from this though.
 
:-|
 
Is it possible for input() to return a string containing a newline?
shift-enter doesn't do it...
 
8:52 PM
YOU'VE been Davidism Perpendiculared!
 
Might be OS-specific, now that I think about it.
 
Help on built-in function input in module builtins:

input(prompt=None, /)
    Read a string from standard input.  The trailing newline is stripped.
 
you know your joke is really lame, when you get the bold unamused face from davidism
 
Let the parsleyshment fit the crime
 
@AndrasDeak But it doesn't explicitly strip internal newlines, right? So hypothetically "a\nb" could get through somehow?
 
8:54 PM
There were too many puns, all the emoticons stacked up on each other.
 
oh, I see
 
Maybe with some kind of piping or stdin redirecting trickery
 
dupe target has hacky hack
 
at least on my end, I can try copy/pasting multiline stuff to input() but it only takes the first line
 
In Nier (and Automata) most of the music has lyrics, but they're all in languages that have been "adjusted" for thousands of years of linguistic drift. Or in completely made up languages.
 
8:57 PM
always a "song of the ancients" in there somewhere
 
Neat.
 
wim
damn, that's cool
>>> '\n'.join(iter(input, ''))
hello
world

'hello\nworld'
 
I might be able to help with that
before I paste random code that might not be helpful, do you take two inputs and pull them together to make a short sentence?
 
@wim that form of iter alone is pfoosh
 
9:04 PM
Nice, I had forgotten that iter had a second form.
 
on second thoughts, I probably wont be able to help, as my .join code seperates a tuple of tuples onto separate lines
 
User trying to justify using globals in their answer: stackoverflow.com/a/42680462
I don't have the willpower to argue the point.
 
"all the core libraries do it"
On a side note, because it's really bad advice.
 
would that I could
call Zero :D
 
9:08 PM
for "they are used so much"
 
Heh :-) I'm sympathetic, but also pretty sure delving for "this is a really bad answer" is frowned on.
 
would you be able to tell me why what hes doing is wrong?
 
Have dvd the answer and uvd the comment though.
 
Because as soon as the web server runs multiple threads or processes, everything gets out of sync. Maybe not in this really really simple case, but as soon as it gets more complicated.
 
it can cause major problems with variables in other imports
 
9:11 PM
ahh, I understand now
 
red flag:
> davidism oh my bad. i didn't realize flask was a web framework.
 
I don't pull out the "I'm a maintainer of this library, I know what I'm talking about" card, but every now and then I'm tempted.
 
good chance for a peer-pressure badge though
yeah that would be borderline yourlogicalfallacyis.com/appeal-to-authority ;)
 
Zero's 34th Law of Neurotic Coding Practice: global is only acceptable if the complete statement is a common phrase in popular dsicourse, e.g. global warming, global village.
 
9:14 PM
Waiting for laser weapons so I can create nonlocal warming.
 
@ZeroPiraeus call it rule34 :P
 
Huh, that's an interesting insight into my subconscious isn't it?
 
I wasn't going to highlight that...
 
Was honestly just trying to choose a random number.
 
After the abuse of 4, the new guaranteed-to-be-random number shall be 34
 
wim
9:16 PM
@davidism and yet
Nov 30 '16 at 19:21, by davidism
I don't argue that they're good, but I don't argue that they're bad either. I have no opinion on them besides "I'm not going to change it."
 
It so happens that I'm reading Stross at the moment, too. Not that series, though.
 
@wim not the same thing
 
wim
not quite as bad, but a sin for many of the same reasons
 
Werkzeug's Local implementation is bound to whatever thread/event library is used. In effect, it's scoped to the request, not globally.
 
@ZeroPiraeus what about global variable?
 
9:21 PM
Hahahaha yes that's perfect :-D
 
adds that to all scripts
I figured out why this sass wasn't compiling to anything
 
Maybe uppercase it though.
 
Turns out you need to actually use the stuff you're importing
That was a pointless creation of an Ubuntu VM because I thought it was a Windows issue
@ZeroPiraeus I like that
I suppose in Javascript we could have var iAble
Or let tuce
tired
 
const int craving;
 
wim
9:28 PM
back on ... should the test setup / teardown do Base.metadata.create_all / Base.metadata.drop_all ? Or should we just truncate the tables, instead of dropping them?
I'm currently doing the first
I think Django's test runner truncates tables instead of dropping them, though ..
 
ive spent the last 30 mins trying to get my code to work
I want to call a function when a print statement is executed
 
wim
that's what from __future__ import print_function does ... ;)
 
@wim I generally call create_all, but that can get slow if you're dealing with a lot of data over a lot of tests.
 
wim
@davidism all tables created and destroyed per every test?
 
There's ways to use transactions and flush instead of commit, but I haven't really looked into them.
 
9:30 PM
print(self.selection)
agro = self.selection

def datefunction():
agro.get()
 
@wim yeah, or you can optimize it to only reset the data if your test involves writes
 
wim
yes, I was thinking of doing it with transaction and rollback instead
 
how do I link them?
 
wim
I generally like to reset it anyway, just to prevent any accidental mutable state / tests coupling
 
@simons21 is self.selection a variable ?
 
wim
9:32 PM
what about creating/destroying the database? once-per-test session?
 
@simons21 your question doesn't make sense, what are you actually trying to do?
 
ill be more specific
 
flexes fingers ready to type like a Ninja
 
@wim once per session, but unfortunately SQLAlchemy (and Django) don't have commands for creating the databases, only the tables. There's a way to write custom DDL for it in SQLAlchemy, or you can be lazy and just execute a raw query.
Or you can be lazier and require that the database already exists and just call drop_all at the beginning.
 
the code Kevin provided me recently with the calendar thing (orange knows) prints out a date when I click on one. self.selection is that variable. I want to be able to, when the print statement is executed, take whatever is in self.selection and query it with a sql command ( what the function will be used for) because I don't have a button to click when I want the command to execute, I was wondering how to call the function from the print statement
 
9:36 PM
So put that code in the same place the print statement is now.
 
@RobertGrant creating a linux VM on a windows system is never pointless
 
True - I quite enjoyed it
 
@wim One interesting method to consider in testing depending on DB in use is to use a master transaction created in setup, then have the test session join that and rollback in tearDown. If your tables etc. don't change that much.
...If that did not come up already
 
@simons21 call a function after the print function with the self.selection variable as an argument?
 
Or define a new function that does both printing and whatever needful needs doing afterwards. Which should be the same thing.
 
9:38 PM
Or just put your sql command after the print
 
def datefunction():
    print("working")
def _show_selection(self, text, bbox):
    """Configure canvas for a new selection."""
    agro = self.selection
    print(self.selection, datefunction(self.selection))
I might be stupid but I'm getting an error
NameError: name 'datefunction' is not defined
 
wim
@davidism oh, I did it with the MySQLdb cursor directly. It did feel hacky, and wondered if I was missing something, so glad hear I didn't ..
 
self.datefunction?!
 
I'd appreciate some UI opinions on an issue I'm debating at the moment (all 4 pics taken in context)... I put the questions directly under each picture: imgur.com/a/nx6Hw
 
@wim docs.sqlalchemy.org/en/latest/orm/…, if you haven't read that
Very neat-o stuff
 
9:45 PM
@MarcusS I don't think some redundancy is bad
 
Yeah, some is okay
 
sometimes it takes a while for me to find every little setting/feature in an app
 
@simons21 that code doesn't work for a number of reasons. Given the types of questions you've been asking, at this point it would be more appropriate for you to read a tutorial at this point than to keep asking us questions. sopython.com/wiki/What_tutorial_should_I_read%3F
 
wim
I found some pytest-mysql fixture , but it actually went and ran the /usr/bin/mysql_install_db script ... (!) and I was all, umm, ok .. pip uninstall that thing ..
 
being able to do the same thing globally vs starting from each individual instance (in case I understand the problem) isn't a problem
plus I sometimes long-press the menu button on my samsung which opens the corresponding options menu. If there's no options menu, then I might get confused;)
 
wim
9:47 PM
@IljaEverilä thanks, this looks good
 
@AndrasDeak So in the case of the food items, for example, you would expect long press = same as pressing settings button, I imagine? What would you expect a single press on the item itself to do?
 
no, I mean long press on the button on my phone that doesn't do "back"
 
@davidism i'll do that now, sorry for the novice questions
 
oh, in this case I refer to the settings on a per-item basis
in the pics there's only one item but there could be several
 
so what does the settings button do when there are multiple items selected?
 
9:50 PM
still per-item, currently
 
what do you mean by that?
 
only thing "selecting" multiple items does (in terms of the checkboxes) is allowing you to delete them all at once if need be
 
so what does "edit meal" do when you have 2 meals selected?
you can't edit both simultaneously, can you?
 
edit meal would be the item-level action
no, just the one you press
 
hmm
then maybe the settings button is confusing
for selected items and mass-manipulating selections you have the bottom left icon, that's good
but then anything else is per-item only, so I'd expect those to work through direct interaction with a given item
i.e. short or long press on given item
being able to select two items but have a settings icon that only manipulates the one selected last would confuse me
 
9:52 PM
For instance imgur.com/a/jvn5w you could select both and use the menu to delete both, but there are two settings icons here
 
@MarcusS wait wait wait, I completely misunderstood
I thought the bottom right one was the settings icon :|
let me reread
sorry
 
Bottom right menu in this case has different functions depending on the screen (e.g. add new food, add new meal, etc)
 
OK, I think it's fine to have both per-item settings icon and the bottom left one:)
and I'd either expect a long-press to open the per-item settings; or I'd expect it to select the given item (in a scenario where those selection tickmarks are not enabled by default, so multiple selection only becomes an option when you long-press first)
 
Ok so I read through the documentation you guys gave me and I'm still kind of confused on my error. Why does the above code work, but then the example below it gives off that error? pastebin.com/83N4sJSU
 
(in this app's case I just decided to make the boxes on by default)
 
9:59 PM
sure
 
what about single press?
 
I honestly don't know what to expect in that case:D I'd let you surprise me
 

« first day (2335 days earlier)      last day (2599 days later) »