« first day (3829 days earlier)      last day (1102 days later) » 

12:15 AM
Grump: It massively bugs me that someone called a "Security Researcher" on their profile will just assume that a perfectly-stated (but nonsensical) output just gets interpreted as a typo so answers anyway, probably for rep. Can't wait for their close_enough filter on my password
 
 
3 hours later…
3:20 AM
@roganjosh I would legitimately love a close enough on my laptop password lol
@PaulMcG I read somewhere that sqlite only writes to the portion of the file which is changing, rather than reading the entire file into memory and rewriting the entire file to disk. That may not be what you meant by optimised though.
 
4:26 AM
Is there already something that does this?
def group(array):
    if not array:
        yield ()
    for i in range(len(array)):
        for b in group(array[i+1:]):
            yield (array[:i+1],) + b

for g in group(list(range(3))):
    print(g)

# ([0], [1], [2])
# ([0], [1, 2])
# ([0, 1], [2])
# ([0, 1, 2],)
 
 
3 hours later…
7:16 AM
cbg o/
 
7:34 AM
@toonarmycaptain the data will be contained in pages so I'm a bit confused by what "the file" is that you're both discussing. The .db on disk will be a collection of a lot of page files and it only updates the necessary page vs. rewriting the entire db. SQLite is super-quick for sequential writes
 
7:53 AM
How exactly was tags formatted :p
 
You need [tag:cv-pls] (but without the backticks)
 
Yaay :p
 
That's a strange error to get from their code. I would have thought they created a tuple and then the code would explode later on, but I wouldn't have anticipated that error.
Actually, they couldn't get a tuple because they have an assignment in there. I think I've already spent 10x more time considering the code than the OP though, so I'll move on :)
 
@roganjosh True that :P
 
 
2 hours later…
cbg
 
cbg :)
 
10:30 AM
Huh, we're getting blanketed in snow here in mid-April
 
10:56 AM
@roganjosh we had a blizzard two days ago
 
Might be another on the way for you at this rate! :)
Although maybe our weather systems tend to skim North of you when I think about their general trajectory
 
Yeah, we're usually on German weather plus two days
 
 
2 hours later…
1:24 PM
@piRSquared thought that was awesome, needed it. saved it in 'golden snippets'. then found more_itertools.partitions
>>> iterable = 'abc'
>>> for part in partitions(iterable):
...     print([''.join(p) for p in part])
['abc']
['a', 'bc']
['ab', 'c']
['a', 'b', 'c']
the order is slightly different, and returns lists of lists instead of tuples
>>> for g in more_itertools.partitions(range(3)):
...     print(g)
[[0, 1, 2]]
[[0], [1, 2]]
[[0, 1], [2]]
[[0], [1], [2]]
 
1:42 PM
Question: I have 10 people, each with an app that has a task list of 100 items, and they go through that list one-by-one suggesting the order that they will do those tasks. Separately, I have datetime stamps for each person on when they did those tasks (some time later). I'm trying to think of a good benchmark for how accurately the initial, planned, ordering aligns with reality. Also, this benchmark should be able to rank the 10 users. I'm thinking Damerau–Levenshtein distance...
but maybe I'm on the wrong path. Any suggestions?
I suspect that if they took task 3 out and instead put it at the end of the day, the difference metric will blow up even though most of the sequence is preserved
Hmm, almost everything seems to be DNA-related, which doesn't surprise me and might explain why I had no Earthly idea how to start :) Seems it'll start with Gap Penalty
 
1:59 PM
@roganjosh Probably reflects the out-of-dateness of my sqlite knowledge. Nice to see that they have tuned that up (though it makes the db file itself a little more unwieldy - it used to be just one file, so that once you built it, you could copy it to a USB drive and use elsewhere).
 
Ah, it's one file on your filesystem that you can copy/paste, but it almost certainly can target pages in that file for any modification. I can edit a row in a 5GB file in microseconds if it's got an index on the row
In fact, it's probably nippier than postgres for most things... until you need to do more than one thing at once, or have multiple users, or want type safety...
 
Hey everyone! Could someone please help me with a pandas issue? So basically I am trying something that looks like this:
df["new-column"] = [ func(value) for value in df["old-column"].values]
I know for sure that old-column exists, but I get a KeyError
Any explanations/fixes for this?
 
What do you get with df['new_column'] = df['old_column'].apply(func)?
In fact, are you sure the names are hyphen-separated and not underscore-separated?
 
no that is just an example, the real column names are length and synopsis
 
@aneroid ahh more_itertools. ty
 
2:13 PM
let me try what you just said@r
 
My suggestion probably won't change anything. 99% sure it's a typo
 
how do i apply len(value.split()) for value in df["synopsis"] as you said?
 
Neither I nor you mentioned split()
 
:(
this is a pickle
metaphorical pickle i mean
 
Not really, it just means that you haven't defined the problem properly
Between us in the room, we'll likely be able to fix what it is you want to do. But you've introduced split() after I gave my suggestion, so we don't know what we're working with or towards
 
2:20 PM
alright, let me try again?
processedData["length"] = [len(synopsis.split()) for synopsis in processedData["synopsis"].values]

The output for print(processedData.columns) is
Index(['movie_id', 'year', 'synopsis', 'genres'], dtype='object')
 
Ok, and what throws the KeyError?
 
Oh I just figured it out, the input file is not being read properly :/
Thank you for your help
 
FWIW I don't see any immediate error in the code
@chtnnh You're welcome :)
 
 
4 hours later…
6:41 PM
Hi guys!
 
Hello
 
7:23 PM
Silly question: what is it called to use imports into __init__.py to hoist objects up to the package level? context
I even suspect it might be a dupe but I only know what's going on conceptually and not in definite terms :'(
 
8:07 PM
@roganjosh here's a lazy link that might shed some light on it. IDK either. the technical name that is.
 
8:37 PM
I'd be a bit surprised if it had a name tbh
 
I'm starting to think the same. "hoisting" is the way I've described it to myself and when I've tried to describe what I want to do to colleagues
err, that reads a bit funny. I didn't want to hoist my colleagues...
 
the closest term I can think of is "exposing" the name in the module namespace
still not really a Name with capital N
I also described this in the past as "pulling in" the name from a submodule
 
To be honest, it might be a good thing that it doesn't have a name. That'd make it sound special, when in fact it's something super trivial.
News flash: After importing a name into a module, you can then import it from there into yet another module. And if you're feeling super adventurous, you can even import it from there into a 3rd namespace! Mind-blowing stuff!
 
FWIW it seemed like a trick to me for a very long time. I didn't take a structured approach to learning the language, as you probably know, so I have quite a bit of empathy for the OP. It's not easy to search
 
@Aran-Fey some of the Patterns I see mentioned are of the same category...
the Double Toe Loop pattern (i.e. using one loop in another loop)
 
8:50 PM
@roganjosh Oh, sure, it's not obvious when you're just starting out. I'm just saying that we shouldn't give people the idea that everything that happens is some kind of "concept" or "technique" or "design pattern" they have to learn. Sometimes things are just a logical consequence of things you (should) already know.
I.e. the idea is to tell people "think about it for a second" instead of "go to google and research the thing named 'X'"
 
mmm. But if it was a case of inheritance and my answer just says "well, the parent class has children that do the same as the parent" then I've done a disservice when I could and should have known to give them the technical phrase. I was sense-checking myself
In any case, I'm satisfied that I didn't miss anything here. Thanks :)
 
Ah, I see. Yeah, that makes sense
Anyway, time to eat dinner and get some shuteye. Rbrb
 
rbrb
 
rbrb :)
 
9:23 PM
Hello everyone. I use mostly stackoverflow in spanish. If exist someone with experience with Django to ask a question I'll appreciate it a lot
 
¡Hola!
You should just ask your question, and if someone can help and is willing to, they'll be able to respond
 
Hola hahahaha. Thanks a lot. This is my question: stackoverflow.com/questions/66976842/…
 
What is 'DB_HOST' and 'DB_PORT'?
 
In that case is the database host and the database port (mysql: 3306)
 
Wait, is this docker? You haven't specified DB_PORT
 
9:34 PM
I've specified this on the Gitlab service. I setted it in the gitlab service. If I set in the script: echo $DB_HOST or another varible it prints ok the result
 
See this. I'm not a django user but it looks awfully similar from my searches
 
But Django doesn't recognize it :c
It works on my docker but not in the Gitlab CI :/
 
I think this is beyond me, sorry :(
Hopefully a docker expert will pop up but it's slow at the weekend so it might take some time. I'm aware it's not just docker but it's going to be linked with the gitlab CI
 
Oh, don't worry, I'll try more and ask more
 
Now there are two people asking "is this docker"? Perhaps you could explain a bit in your question how it is or isn't docker, because it seems relevant to the configuration.
 
9:43 PM
Yes, you have reason. It's the Gitlab CI running service. It's like a docker. I'm using a service called mysql and the documentation says that I can set the host the same to service. So if the service is 'mysql' the host is 'mysql'. So I get the host using getenv and the result is 'mysql' but it doesn't connect
 
Oh yeah, and I'd probably also link the documentation you're referring to.
 
yeah, that's what I meant, sorry
 
I can't convince myself that this gets env vars:
DATABASES = {
    'default': {
        'ENGINE': 'django.db.backends.mysql',
        'NAME': getenv('DB_NAME'),
        'USER': getenv('DB_USER'),
        'PASSWORD': getenv('DB_PASSWORD'),
        'HOST': getenv('DB_HOST'),
        'PORT': getenv('DB_PORT'),
        'TEST' : {
            'NAME' : f"test_{getenv('DB_NAME')}",
        }
    }
}
They have different names to what you're specifying in your container
It's fine that you're using the MySQL guide, but this isn't MySQL, it's django
 
It's strage 'cause when I print in the runner echo $DB_HOST (befer I execute ./manage.py test - to run the tests) or another variable it gives me the correct result.
 
9:55 PM
On all of those variables?
 
Yes, if I print $DB_NAME or $DB_USER... it gives me the value of the variable I've exported
 
Well, there's 5 variables, not 2
 
Oh, it's an example. If I print all the variables I've setted in the settings.py of Django it's ok. In fact, the error that Django response is "Can't find the host 'mysql'." It recive 'mysql' as host
Maybe is a problem of the Gitlab CI not Django.
'Cause in local it connects ok with environment variables
 
My searches suggest otherwise
Which I already linked you to, and I've since spotted other mentions of this issue
 
Mmm. I'll Keep investigating. Thanks a lot!
 
10:42 PM
Hey
 
hello
 
How are you?
 
Fine, thanks. How are you?
 
I'm good, thanks
Is this gc dedicated to helping with python codes? I'm new here lol
 
gc?
 
10:43 PM
*group chat
 
Ah.
@AmnesiaSmith This is just a chatroom that happens to be situated around python. You can read our rules to see what this room is for :)
 
Nice, thank you!
 

« first day (3829 days earlier)      last day (1102 days later) »