« first day (3201 days earlier)      last day (1744 days later) » 
02:00 - 19:0019:00 - 23:00

2:50 AM
cbg
 
3:22 AM
0
Q: why does my code ignore my if statement and only returns the first condition?

mitra mirshafieemy if statement doesn't work def func_add(str): if str== 'shit' or 'hatred' : return 'No ' + str ; else: return 'go to the next function'

lol that example
 
closed as a dupe but it shows the frustration if the op of making the code work i guess
 
3:39 AM
cbg folks
 
ugh need to install ubuntu on my new laptop
are there any issues if i take my 16.04 live drive sitting around and install that then just upgrade to 18.04
or should I really just go and redo the live drive
 
just redo it
Install+upgrade can leave cruft around and takes more time
 
Tbh I just kinda wish I could copy and paste everything from the last laptop over and just leave it at that
so much little tweaking that I'm gonna have to remember and redo eventually
 
I keep notes of necessary tweaking
 
3:42 AM
I think you can create a list of names of packages you installed in 16.04 and then reinstall them in 18.04
other files you can copy and paste like docs videos etc
 
Is it time to upgrade to 18.04 even
 
There is a good wiki on how to upgrade wiki.ubuntu.com/BionicBeaver/… I guess you already seen it, also if you want to upgrade or not is something upto you
 
4:15 AM
Hi, I need some help formulating a regex or any other logic
 
Hello
 
I have data of the following form :
Kranawettgasse 19/1/8
Brückengasse 10-12/1/10
LAAER STR. 44 /1/18
eisentratten 87/2 eisentratten 87/2/2
Krottenbachstraße 3a/3/1
Barawitzkagasse 34 /4/2/52
Margaretengürtel 74-74a/6/12
Altebergenstraße 2e/2/8-FENZ
I need to extract 1 in 1st case, 1 in 2nd case, 1 in 3rd case, 2 eisentratten 87 in 4th case, 3 in 5th case, 4 in 6th case, 6 in 7th case and 2 in the last case
Basically the digit after the first '/'
or characters
 
That sounds easy enough? What'd you try?
 
Yeah, I found out a solution but there are more variations that I found out just now, let me list them here
I tried using str.split
 
that's a good start
 
4:24 AM
Ok it fails for cases like 'Grüne Zeile 1.c'
Here 'c' is the required expression in the output
and also for 'Possingergasse 63-11-21'
 
since neither one of those contains a slash, you'll have to explain how you want to handle them
 
In the cases I specified, I want c as the first output and 11 for the 2nd one
Problem is the symbols '.' and '-' can be anywhere in the string owing to errors in the data
So I just can't use split to get the 2nd item
So it can be like 'Grüne Zeile. 1.c'
 
so if I understand correctly you're essentially looking for a pattern like <number><special character><another number>
 
Yes ideally the the first character/substring after special character is the one but it can be wrong in the case I showed above because there using split I would get 1 as the 2nd substring
@Aran-Fey It may not be number, may be alphabet as in 'Grüne Zeile 1.c'
 
try re.search(r'\d+\w?\s?[/.-](\d+\w?|\w)', ...)
 
4:41 AM
This returns a match object, how do I extract the value?
 
match.group()
 
please google that
 
recbg
 
Got it thanks@Aran-Fey@DeveshKumarSingh
How do I become as good as you at regex :D?@Aran-Fey
 
Lots of practice. But getting good enough to write a regex like that shouldn't take longer than an hour
 
4:52 AM
Cool thanks again
 
@Aran-Fey Haha lol regex is hard but the more you go the more you realize that regex is limited, it has a limited amount of quantifiers.
 
Cabbage fellas!
 
Tim
5:16 AM
@RaphX Give a site like regexr.com a go, makes learning regular expressions a lot easier when you can see the results immediately
 
@Tim Or regex101
 
regex101.com better i guess
 
Tim
101 is nice. There are dozens of them
But I think I'll change my recommendation to 101, nice interface.
 
Good sunny morning! 🌅
 
cbg @AndrejKesely
 
5:26 AM
Am I missing something? What is "Form" in this case? stackoverflow.com/questions/57139491/…
I presume the slide is badly written
 
I thought he meant Django Forms @AndrejKesely
 
@Tim +1, regexr is awesome
 
@aadibajpai I think regex101 is better though, anyway they're virtually equivalent.
 
@U10-Forward regex101 is probably better because it supports the python flavour and go too but I think I like regexr more because of the UI and experience.
 
@aadibajpai yeah
 
5:40 AM
cabbage
 
rbrb just as @ReblochonMasque gets here
 
@U10-Forward read the link rather than saying nonsense?
@AndrejKesely yes
> Class includes two members: form and object
Pretty obviously nonsense
I suspect google translate. Or maybe not. The sentence structure is also off.
 
6:04 AM
cbg all. After hours of struggle I figured my dataframe series had heavily escaped newlines strings '\\\\n', though they were visible just as "usual" newlines '\n' in `df.head()`. So, I had to do `series.replace('\\\\n', '\n', regex=True)`, to move everything to newlines..so now that items have move to a newline(within each row cell), I've got another problem...there are whitespaces on every newlines follow-up, something like this:

a:1
   b:2
      c:3
 
@AndrasDeak Yeah, probably google translate
 
@amanb what is your dataframe like? Where is the "something like this" from?
You probably have an XY problem with those backslashes
Where did the original strings come from?
 
the print looks like you have \r instead of \n now
so no spaces, just vertical movement
 
@AndrasDeak, well, the dataset is coming from a MongoDB database, written to a csv with a column that had dictionaries but I had to apply regex to only extract the key-values I needed and move them to a separate column. Now at every stage, the newlines have escaped and its become a total mess
 
> Now at every stage, the newlines have escaped and its become a total mess
what you should fix ^
> written to a csv with a column that had dictionaries
Also weird ^
 
6:12 AM
@AndrasDeak, yes I agree but I have no control over the source data..I get the csv and I start working. Till that stage the damage is done and newlines and whitespaces galore
 
I think the problem at this stage is that we don't understand what you are trying to describe
a CSV cannot contain dictionaries -- how do you mean?
 
May 2 at 15:26, by Andras Deak
not to sound all high-horsey or anything, but most of these problems are best solved by hitting the person who gives you undefined crap data until they stop
 
@AndrasDeak, haha, I totally agree.
 
@tripleee I bet str(dct)
 
can you show the repr() of a (small!) piece of representative data?
 
6:19 AM
Its a bit complex to explain, but long story short..I have a dataframe series which has rows that look like key-value pairs but they are in fact just malformed strings like this:
 
you can't mix code and other formatting in the same message but you can split it to two messages
 
User: Hello
   Bot: How may I help
   User: Can you do the dishes?
   Bot:  Sorry I have limited powers. Please call customer care at 911.
   User: Well, what am I gonna do now?
@tripleee, yeah, i just did that
 
there are no \n:s in that though
 
using the series.replace statement i managed to make \\\\n into newlines, which moved strings to newlines but with a side effect that some follow-up newlines now have whitespaces in the beginning
 
I'm afraid we will not know what you are talking about until you show some actual data, such as the repr() of a Python string which actually contains the problem
 
6:26 AM
now I'm trying to find a way to remove these whitespaces at the start of every "speaker"(BOT/User), because I want to move the "speaker" and the conversation string ("Hello" etc..) into two seperate columns, basically breaking the conversation into separate utterances
@tripleee, the above was an example string and one of the row cells in the series.
 
so you start with "User: hello\nBot: hello to you too\nUser: I have a question\nBot: go ahead\nUser: you mean I can ask now?\nBot: yes go ahead\nUser: me? now?\n" and you want something like [('User', 'hello'), ('Bot', 'hello to you too'), ...]?
or if your question is merely "how can I remove spaces after newlines too" that's series.replace('\\\\n\s*', '\n', regex=True)
but I suspect the real data is actually JSON or something like that ...?
 
@tripleee, that's it..it worked..it was just so simple
@tripleee, i just changed the regex to include whitespaces like you suggested...this was so straightforward...just include \s* to remove whitespaces...rolling eyes:)..thank you very much
It's time to get my hands on a regex primer...I'm constantly reminded that they are so important to understand..any good recommendations?..
 
recbg
@AndrasDeak I did even before andrej posted a link, i mean before i saw the question i thought it was django form, but when i did i just closed the tab
 
7:02 AM
@amanb the Stack Overflow tag info page has a collection of resources
 
Where does python hold a huge amount of panda dataframe on runtime? I think one big query with searching in panda seems way better than a thousand query to database
 
pandas
And python holds it in memory...
 
@AndrasDeak :( pandas :/
 
7:45 AM
@AlperAyna if your available RAM is less than the size of the dataframe...it will be a problem
 
Yes, I think it crashed in the process, it stucks somewhere in between so it is not a good way to implement it seems
 
any pyodbc and mssql pros here? I got a problem with a query semmingly running on the wrong db
it does work in smss and in powershell using sqlcmd
and I do specify the correct database on the connection string
and other scripts do work, just not this one database
gonna try to isolate it
 
rbrb
 
240k * 5 column * 25-50 length string seems very big for ram
It stuck in 60mb or something
 
can you store your data in sqlite or something?
 
7:55 AM
It is already in database, I was trying to save time by not query it 1700 times
But it seems silly to store in pandas :)
 
the db does not care about being queried 1700 times
it will cache results anyway
 
It is actually more of local network issue of my company
 
oh
 
Sending query may take time up to 2-3 sec to mb 10 sec
 
can you get a dump of the data to use locally?
 
7:58 AM
Noone said this to me, I just want to improve the runtime, just for fun :)
I ll check it now
@Lett1 ha, you mean to test the network?
 
well, to remove the network from the equation
 
8:23 AM
So it seems that I dont need to bother to deal with it
It doesnt take too long to implement new way to query
300 sec for 1700 query seems okayish
 
nice
 
Thank you very much for your help though
 
I didn't really do anything
 
I love this chat, I have no one here who is good at python
You gave me some ideas man, that is enough
 
8:40 AM
also, you might wanna use the EXPLAIN/ANALYZE feature of your database
might help find a bottleneck
 
I am not database administrator & I have no right on it & I checked the DB and its designs really really bad, nothing to do at that part :)
 
ouch
 
 
2 hours later…
10:56 AM
cabbage all, bugrit
 
@AlperAyna I'd suggest that if it is as bad as you say, then you should document how you think it can be improved and why, and propose it (in a way that doesn't criticise the current design) as a set of actions to change things
 
@RobertGrant I am sure they wont do it because a lot of scripts depent this current design and they dont want to change everything, it is a lot of overhead for them. They wont do it :) old slow automotive company, they dont want to add more work to their current work
 
Fair enough
Step 1) move the logic out of scripts that talk directly to the database :)
 
@RobertGrant I know this because one of my experienced friend try work on this database and they said no for anything he wants to improve & fix. Nevertheless, he fixed a lot of issues before he went to another & better company :)
@RobertGrant It is just a connection string, still need to move it out ?
 
I'm saying that a good proposal for management to decide whether or not to do would be to gradually move data access to an API layer.
 
11:38 AM
@AlperAyna a standard strategy is to insert a "shim layer" that gives you a stable interface to the functionality you intend to change. Until you've done that, you're at the whims of the database design. Afterwards you can transform it (or they can) to a more sensible design.
However this is not a technical problem, and might best be solved with a course on influencing skills (how to get people to do what you want, basically, when you don't have the ability to do it directly yourself).
You may well find that technical input to the decision-making process is ignored. It often is.
 
Lmao, it is already like that. My friend was way more talented than his superiors and they won't listen to him because he is too good and they don't want to do lots of work to redesign and move all the data of 20 years (maybe 20? or more)
Thanks for all kind offers, they wont change the DB, I just need to figure it out for myself. I dont want to deal with them, they are stubborn people
@holdenweb Probably a shim layer for myself or query a big chunk of data to use myself locally for every run :) Btw this is not my job, this is an additional thing I do it for myself (and the sake of make programs run faster & and also fun :P)
 
cabbage
 
11:55 AM
cbg
 
12:07 PM
Hi!... I would like to know if this solution is correct... https://stackoverflow.com/questions/57101524/new-column-with-the-first-value-of-a-stablished-range
thanks!!
 
12:19 PM
Usually when you have eighteen lines in a row that all do the same thing except a single number changes each time, that's not the most efficient possible solution. Doubly so when pandas is involved
I expect you could do it in two lines with:
for i in range(1, 19):
    df3.loc[df3['n_cat'] == i, 'donnees'] = df81.iat[i-1,0]
I also bet there's some terribly clever pandas-exclusive solution that doesn't even need a loop. Not that I know what it would be.
I'd be interested in investigating further, if I had an MCVE... I can't run your code as it is now because df3 isn't defined. I don't know how to turn the data in the "the df3 is: " block into an actual dataframe, other than typing it out manually, and I don't want to do that.
 
12:34 PM
I can send you the data
 
Cool. Go ahead and edit it into your question.
 
it would be easier for everyone if you can make the python code that can make some of your data as a dummy example instead. take a look here too. @Master03Skywalker
 
12:46 PM
@Kevin how can I send you the files.. I have 2
 
@Master03Skywalker I'm confused. The dataframe in your question is only ten rows long. Why would it take two files to recreate it?
The code that recreates that dataframe should only take like four lines of code, tops. It should be easy to edit that into your question. You don't need to send me any files directly.
 
Also just add code that creates an example dataframe directly
 
1:04 PM
I've improved my terrible syntax highlighter from last week. Now it doesn't eat whitespace. Mostly.
my tokenize_with_whitespace function only tries to detect and insert horizontal whitespace into the token stream. I'm 80% sure that the native tokenizer never skips a newline, so I don't bother detecting vertical whitespace.
Something has gone terribly wrong.
Yeah no, makes sense. INDENT tokens don't appear at the start of every line, so only lines that start a new block are spaced properly.
I didn't account for the possibility that token.start and prev_end differ in both the x and y components
 
1:23 PM
Your tokenize_with_whitespace never uses its readline argument (:
 
Oops.
 
2:21 PM
Has anyone had chance to look at the original Apollo 11 source code on GitHub? Assembly code doesn't even look like code. No assignment operators, no loops, I'm shocked that it actually does anything at all, lol.
 
assembly just has JMP
that's all a loop actually is
 
what's JMP?
 
The only thing I know about the Apollo 11 source code is the # TEMPORARY, I HOPE HOPE HOPE comment that made it into production
@Dodge JMP is the jump command. It's basically GOTO.
 
# 	THE BIASES ARE ADDED ONLY WHILE PERFORMING AUTOMATIC MANEUVERS (ESP KALCMANU) TO PROVIDE ADDITIONAL LEAD
# AND PREVENT OVERSHOOT WHEN STARTING AN AUTOMATIC MANEUVER.  NORMALLY THE REQUIRED LEAD IS ONLY 1-2 DEGREES.
# BUT DURING HIGH RATE MANEUVERS IT CAN BE AS MUCH AS 7 DEGREES.  THE BIASES ARE COMPUTED BY KALCMANU AND REMAIN
# FIXED UNTIL THE MANEUVER IS COMPLETED AT WHICH TIME THEY ARE RESET TO ZERO.
 
2:25 PM
How terrifying would it be to write that comment in the code??
 
All of the comments are in caps because the programmers were screaming in terror during the entire development cycle
 
Oh yes, don't mind me, I'm just trying to make sure that we don't shoot astronauts off into the void
@Kevin rofl. Seems accurate
 
Okay, when I Googled JMP I got stat software and was confused.
 
Yeah, me too. I'm surprised there isn't a Wikipedia article for it.
 
"JMP assembly instruction" is a better search
 
2:28 PM
I guess one assembly instruction isn't noteworthy enough for its own article, even if it's a pretty common one
 
Maybe we've got different Wikipedias ;)
 
revert previous message, replace with "Yeah, me too. I'm surprised its Wikipedia article isn't on the first page of Google results for 'JMP'"
 
ah. Right :)
I guess JMP has terrible SEO
 
I am also surprised that en.wikipedia.org/wiki/JMP_(statistical_software) doesn't have a disambiguation link saying "for the x86 machine code instruction, see [link]"
 
Well, there is the disambiguation page: en.wikipedia.org/wiki/JMP
I guess you could always add the link to the article yourself ;)
 
2:31 PM
I'm surprised that a link to a disambiguation page isn't embedded automatically into every page that is listed on a disambiguation page.
 
That seems like a reasonable thing to do
https://github.com/chrislgarry/Apollo-11/blob/master/Comanche055/AUTOMATIC_MANEUVERS.agc#L184

Ahh, nothing like the feeling of ASCII art wiring(?) diagrams in your assembly code to help explain what you're actually doing
 
I guess it's not an automatic process because you wouldn't want the article for Jean-Marie Pfaff to get a link to the disambiguation page, since the connection is rather tenuous.
It sets a bad standard that every person's name must link to the disambiguation page for the acronym of their name
 
cbg
 
cbg @biggi_
 
2:46 PM
Yesterday I was playing a 90s point-and-click adventure game and I got lost in the obligatory Maze of Identical Looking Rooms. I drew out a map on paper but I didn't leave enough space on the left margin, and I ran off the page. I switched to mapping it out in Notepad but inserting rooms to the left of other rooms required a lot of deleting and retyping. I wonder if there's an existing suite of software for making these kinds of maps.
Nice-to-have features: 1) keyboard shortcuts that let me interface with the software while the game is running in full-screen mode. E.g. F1 is "take a screenshot and put it directly south of the previous room", F2-F4 are the same except with different compass directions.
 
you can use Vim fairly well for that - <c-v>G40I <esc>, to insert 40 new columns for instance
 
2) Support for three-dimensional mazes, in case of stairs/ladders/slides/pit-traps. 3) support for non-euclidean mazes, as in Colossal Cave Adventure's maze of twisty little passages all alike; or Hunt the Wumpus
 
I mean, it's not the best, but it's definitely better than notepad
 
Anyone remember Davidism sharing a crypto challenge or something alike? Does anyone remember the link ? I can't seem to find it
 
4) ability to stitch together previously unconnected parts of the map, in some cases merging two or more rooms that turn out to be the same room
 
2:57 PM
One could always make it oneself, if they were super interested
 
Oct 5 '17 at 17:11, by davidism
I need something new to procrastinate with, so I'm going to start https://www.cryptopals.com/. Join me!
@WayneWerner I could probably make the basic software up to feature #1. Features 2, 3, and 4 require more graph wizardry than I possess.
The intersection of "requires better-than-amateur grasp of graph theory" and "useful only to enthusiasts of a niche genre of video game that's been dead for twenty years" indicates that there probably is not an existing suite of software for this.
 
Seems like a relatively small subset of programmers, I expect
Probably /easier/ to just use graph paper and scotch tape
which is why a digital tool doesn't exist (yet)
 
Such is the way of things. I guess I'll just have to accept that my maps will entail a certain amount of frustration. But really, that's the authentic experience, isn't it?
 
If you use QGIS it will be easy and potentially visually pleasing, but certainly not keyboard-shortcut-driven, and silently constructed behind the scenes in real time.
 
Extreme phd-level challenge: write a program that takes as input a video stream of gameplay of a 2D MetroidVania, and outputs a single panoramic image of the entire landscape that was traversed.
 
3:11 PM
Can I preload it with said panoramic images, and the starting frame as the key to select which one?
 
You only get Bachelors-level credit for that :-P
All you have to do is compare every frame with its predecessor, and determine what spatial translation could cause one to become the other. Fuzzy matching is required to account for non-background elements whose movements can't be accounted for just by the movement of the camera, such as the HUD, the player character, and enemies
Successive frames that aren't similar under any possible translation must be scene transitions, such as when Samus finds an elevator. These new panoramas may need to be stitched back into the first panorama if the player finds a non-elevator connection to the original area.
 
But you could write a Python plug-in that might allow a user to open QGIS while the game is played and use a set of keyboard shortcuts to insert screen grabs on a raster layer in an organized manner. Moving up and down in simply a matter of generating a new raster layer at that point.
 
3:44 PM
Create a new Google Street View sprite that you can drive around the levels, taking photos as it goes
 
 
1 hour later…
4:47 PM
@Kevin Also look for an editor with block selection (Wing IDE has this, and while I only use it rarely, when I need it it's invaluable.
@AlperAyna Well at least you are honing your skills (and learning to avoid stubborn people - good job).
 
Notepad++ does have rectangular selection, but I constantly forget what keyboard shortcut enables it, so in practice I never use it.
 
That's life.
 
For the curious: hold alt and drag the mouse
 
Typically it's some sort of ctrl+alt combination
 
I use block selection in IntelliJ/PyCharm often enough that I have the keyboard shortcut memorized
maybe this is a sign of repetitive code...
my most common use case is when I paste a list of words that need quotes around them as strings.
 
4:52 PM
I use vim bindings so...
 
I have a coworker that uses vim bindings, too, and I get so confused when I'm trying to help him
 
I used to use Vim a lot, then swapped to Sublime Text.
 
mostly I just avoid touching the keyboard
 
vim bindings in most IDEs just make me sad
:split rarely ever works
despite 100% of IDEs I've tried, having splits
 
Also for anyone interested (in the US): Vanderbilt is hiring multiple Python devs ;)
 
4:56 PM
the univeristy?
 
Yessir
 
or the family?
 
I didn't apply for those (for obvious reasons), however, I'm not saying there isn't another opening there that led me to those.
@WayneWerner that's one of them. I posted another (that is senior level)
That's a neato site...no sparky jobs tho :(
 
5:09 PM
Speaking of hiring stuff, how easy is it to get approved by SO to list job openings and view resumes. I've uploaded my resume to SO and completed some developer story stuff, but eventually began to wonder how easy it was for groups to be vetted as legit companies hiring devs and then view my resume. Could somebody just fake being a recruiter in order to get access to all of the resume info?
 
@Kevin Wing uses the same shortcut.
 
Hi, I have a logged in user in my flask application (they are in a session). And I need to make a post request in a form with their user id I assume (to identify them). Or do I just make a post request to "/settings" without their id and then identify them in flask through a session variable?
 
current_user will tell you who's currently logged in
via cookies
it's pretty silly to stick that data into a form, at least if you care about security
@Dodge What would they do with it?
FWIW, they'd have to pay SO a reasonable amount for that kind of access
unless your developer story is public, of course
 
current_user via cookies? how does that work
 
Reminds me of the twitter/reddit/facebook/something-else post that was like "I put an ad in the newspaper's Help Wanted section pretending to be hiring for Dairy Queen just so I could read and laugh at the resumes. Now the news is doing a piece about a new Dairy Queen opening in my town"
So we know that there's at least one person out there who would impersonate a recruiter just so they could make fun of your application
Or at least one person who would lie on the internet about doing that
 
5:26 PM
@isquared-KeepitReal the session is stored in cookies. Cookies are transmitted with each request, in the header of the HTTP request
by agreement and implementation detail in your browsers they can't be shared across sites
e.g. your google.com cookies can't be shared with super.fake.site.com
Flask login encrypts the user session information, and will user your @login_manager.user_loader function to get you your current_user
 
@WayneWerner I dunno, they could identify an individual by first and and last name and have enough work history to track them down. My settings are such that only recruiters can see my resume. If this was the case for others who did not have their actual name in their username, access to the resume would reveal an individual's true identity.
 
@Dodge Is this something you're worried about?
 
Oh no, my last name is my username. I was just curious
 
Oh yes, I see a session in there, but it is encrypted as you said
 
@Dodge So, you're right, people could find you, but that's also the point of a resume :)
 
5:30 PM
I am not supposed to decrypt it? But rather use login_manager to verify the user?
 
Yes the point of a resume is that an employer may find you rather than some person who is pretending to be an employer. But yeah, it's not of any real importance
 
@isquared-KeepitReal Right. You don't do anything. When you use the login_user(<user>) and logout_user() functions, that does what it says on the tin
 
I kinda prefer people not see my full name here, but meh I really don't care anymore
 
From a security perspective - it is an attack vector
if money was not an object and I wanted to get information about you that I didn't have, that would be a good way to do it
 
heyyyyy mah dudes
Quick question: how do I learn Python in a day? /s
jokes aside, where are the best courses to learn Python?
 
5:36 PM
Check out the room rules at the top right
 
Personally "best courses" for me has been: Boss saying "get this done" and being thrown into the flames :)
 
there are some mentions in there
 
Yup, try to make something. Fail, be honest with self about the quality of work, and make small gains. Learn how to ask a question, parse docs, and google.
 
@WayneWerner oh! interesting. Thanks
 
5:41 PM
@biggi_ what if I'm trying to learn so I can get a boss to tell me what to do?
 
Huh?
 
wait ... there's a "rules" tab?
 
Only the pure of heart can see the rules page. Apparently.
3
 
I saw it... I must be pure of heart enough to see it, but not pure enough to follow them :(
 
Being aware that rules exist already puts you in the top 10% of help seekers. Nice work.
 
5:47 PM
I've even seen "Anyone here know Javascript, there's nobody in that room."
Gave me visions of a lost soul wandering the corridors of an almost empty SO chatroom building, opening doors.
 
Always searching for DenverCoder9, never finding. I know this pain very well.
 
@Kevin so I was attending an interview today, and the interviewer asked me to solve the exact same problem I posted a couple of days back. :P
coloring
 
Fun coincidence.
 
:D
not that only one though :P
 
Paranoid explanation: the interviewer looked up your SO username and read through some of your answers, and composed questions based on them to verify that it was actually you that came up with the solutions
 
5:57 PM
ha ha may be. :D but got a reality check about numpy, need to brush up :)
 
When ten different people apply for the same job and they all claim to be SO user Jon Skeet, it pays to have a verification step
 
:D
yeah
 
@holdenweb I see myself doing just that in the darkest of times.
btw is there an SO chat for psychological counselling? /s
wouldn't be surprised if there was tbh
 
Not that I know about, but I'm mostly an SO type.
 
SO is meant to solve programming problems, there might be other SE sites which deals with psychological counselling
 
wim
6:15 PM
TIL generators have a close method
>>> def gen():
...     try:
...         for i in range(100):
...             yield i
...     except GeneratorExit:
...         print("cleaning up...")
...
>>> g = gen()
>>> next(g)
0
>>> next(g)
1
>>> next(g)
2
>>> g.close()
cleaning up...
well, never needed that but nice to know I guess
 
I must go my friends, but I leave you with this.
"If you try to please audiences, uncritically accepting their tastes, it can only mean that you have no respect for them"
- Andrei Tarkovsky
 
6:30 PM
cbg
 
cbg
 
Today's pet peeve: when a question asks "why isn't this code working?" and they post code that should produce perfectly good output, and a rep hound posts an answer saying "try this: <a slightly different approach that also produces good output>"
Yes, well done, foo.split() splits on whitespace, so it will be able to split the OP's tab-delimited input. Now be a dear and explain why the OP's original code foo.split("\t") doesn't work.
 
So, I've been creating a webapp - currently I have some text strings that are inserted into template responses based on input. The text is stored as strings in a dictionary with the logic (if if input =1 msg = 'one', if input = 2, msg='two'). Is this the normal way? Or is it more sensible to use a database or templates?
 
6:49 PM
if you mean responses = {1: 'you chose one', 2: 'foo bar baz'}, it's what I'd do
 
@Kevin Thank you :D
 
of course the devil is in the detail: depending on how you construct that mapping other tools might make more sense
 
I've seen application designs where every single user-facing string literal is stored in a central database. This makes internationalization easier, apparently
 
cbg
 
I'm sure it does. And for a blog etc with a lot of content, I'm sure that makes sense. I've made a separate module with the logic, which is trying to determine probability of being immune to certain illnesses based on input data. So the msg responses can be different depending on the input, even for identical calculated probabilities of immunity, of I'd just have text rendered based on the probability returned, and put it in the templates.
 
6:57 PM
Everything goes in res/values/strings.xml and you fetch those strings in the code with e.g. R.string.main_page_prompt_user_for_age
 
02:00 - 19:0019:00 - 23:00

« first day (3201 days earlier)      last day (1744 days later) »