« first day (4065 days earlier)      last day (888 days later) » 

6:45 AM
Hi all
 
 
2 hours later…
8:49 AM
I have just posted a question here stackoverflow.com/questions/70196375/… Does anyone know why my code is not working?
 
Please refer to our room rules, we don't allow cross posting fresh questions from main site.
 
9:48 AM
Hey guys, i am trying out this Django built in filter but doesn't seem to be working, any idea what it could be?
{% autoescape off %}
"description": '{{ project.description|force_escape }}',
{% endautoescape %}
 
Can we have a more useful description of the problem than "not working"?
 
so in the description the tags show up still and i don't want the html tags basically, just want to escape it
was trying to send a screenshot but wouldn't work so here's the value of how it shows up.
"description": <p>Some really cool description</p><p>With line breaks</p><p>and of course some <strong>bold text</strong></p>
 
That looks like it's working? What did you expect to get as output?
 
Some really cool description
With line breaks
and of course some bold text
something like this with the bold text as strong
 
So you don't want to escape it then? I'm lost
 
9:55 AM
i do, actually i will be honest i don't really understand what escaping is, i am just aware that these < and &p> are something i have never seen before...
I was thinking the description should show up as i have sent in the previous message not with those weird tags
so it comes up like this
"description": <p>Some really cool description</p><p>With line breaks</p><p>and of course some <strong>bold text</strong></p>
but i want it like this
Some really cool description
With line breaks
and of course some bold text
 
I don't know django, so maybe this is on me. But I can see that you're applying a function that escapes HTML on something that looks like a key:value pair in a dict. That's not necessarily wrong, but certainly a bit puzzling. And it makes it really unclear what your desired output is. Is it HTML? Is it escaped HTML? Is it a javascript string that contains HTML?
 
I wish python had tic toc
 
okay sorry let me give another example. I have this other variable that i am using.
"employmentType": "{{ project.employment_type|replace|upper }}",
this gives the output: "employmentType": "FULL_TIME",
so i want something like this, i don't wish to have the strange < and so on tags on the description
 
@S.Code The escape filter takes a piece of text and modifies it in such a way that if you insert it into a HTML page, the browser will display the input text - and not interpret the text as HTML. For example, if I write "<strong>foo</strong>" here in chat, the server has to escape that text before sending it to you so that it's correctly displayed as "<strong>foo</strong>" and not as foo.
@S.Code So given "<strong>foo</strong>" as input, you want to get "foo" as output?
 
oh then i don't even want that at first place
no i want the bold <strong>foo</strong> to show up
 
10:03 AM
Maybe silly question, but why are people downvoting this answer? askubuntu.com/questions/1292949/… I had an issue, asked a question and answered it. To be fair the answer is trivial, but it still fixed my problem.
 
@S.Code To show up? Show up where? How does this text that looks like it's stored inside a dict "show up" anywhere? Are you inserting it into a HTML page? If so, how are you doing that?
 
okay so my company has projects (jobs) we are like a recruitment company and I am trying to write a javascript google jobs script like this developers.google.com/search/docs/advanced/structured-data/…
So ideally the description looks like this
"@context" : "https://schema.org/",
"@type" : "JobPosting",
"title" : "Software Engineer",
"description" : "<p>Google aspires to be an organization that reflects the globally diverse</p>"
not like the one I get on my screen with this stuff &lt;/p&gt;&lt;p&gt;
so that is what i am trying to achieve
 
i think maybe start over S.Code. let's remove the part about your attempt and then start from scratch: First things first - "description": '{{ project.description}}', without any escape or anything, what does this give. ie. whats contained in project.description, and what is it displaying. and Second, what did you want it to display. Remove the escape thing, remove the force_escape thing, and just tell us what you have and what you needed.
 
sorry it took me too long to explain
 
It sounds like google simply doesn't let you put HTML into your description. But if it did, the correct solution would be to do nothing - "description" : "{{ project.description }}", done.
 
10:11 AM
okay so doing no autoescape or filter, i get this in the description
code: "description": "{{ project.description }}",
output: "description": "&lt;p&gt;Some really cool description&lt;/p&gt;&lt;p&gt;With line breaks&lt;/p&gt;&lt;p&gt;and of course some &lt;strong&gt;bold text&lt;/strong&gt;&lt;/p&gt;",
 
So someone has already escaped it
 
perfect. and what was project.description containing? can you print it's repr somewhere in the backend?
 
so not doing anything gives the same output
yes the project description is this simply
Some really cool description

With line breaks

and of course some bold text
 
ok no, i'd like you to tell us it's repr from the backend just to be sure, from python side of things.
print(repr(project.description)) Someplace in the actual python code for example should print it, or basically what exactly does the string contain is what im curious about
 
okay let me do that, we are using containers so it is hell to bloody find this in terminal of the container
 
10:14 AM
ah, rough. one other alternative is to write the repr to a file temporarily
 
can i just console.log it instead?
 
no
because that means its been passed from django through the template. i basically want to eliminate that step and double confirm what the raw data was
find some way to, purely from backend, get what the contents are. no django, no webpage
to phrase it differently, you need to be absolute sure about two things "what you need to get" (which you seem to be sure about), and "what you have" (which needs investigation)
 
okay give me about 5 mins, sorry
 
dont worry, take all the time you need
 
while True:
    try:
    request = self.queue.get(timeout=timeout)
    do_stuff(request)
except queue.Empty:
    pass
Will calling this with a 10ms timeout consume a lot of cpu?
Currently it is 500ms, but that adds a considerable lag to the ui
 
10:30 AM
id say just set it and find out. it probably will
 
The thing is we use zeromq everywhere and it adds 0.5s lag in so many places. But I'm afraid the cpu will too busy after reducing it to 0.01. I wish there where a lower level interface like linux polling, which I read is quite smart about not straining the cpu too much
 
Dare I ask why the timeout is even there? How is this contraption different from while True: do_stuff(self.queue.get())?
 
it allows it to finish. The True is actually an object which can terminate the loop
come to speak of cpu usage. I really have to check what is going on, because I'm around 80% doing nothing. 1cpu is 100% constantly, another 90% and the rest fluctuatctes between 50-80%. That seems a bit odd I'd say
 
I guess the smaller timeout should not be much of an issue. The get only takes about 1 µs on my system. So even at 10ms it's still mostly sleeping.
 
Looks like the ubuntu monitoring tool isn't that good, the processes tab shows me exactly 1 process with 5% usage, the rest is all 0
htop works tough...
 
10:38 AM
I'm not sure how compatible it is with zeromq and whatever other stuff your program is doing, but it might be worth considering rewriting your code with async. That should eliminate any need for polling
 
@Aran-Fey I really don't like async too much, also the coworker who wrote the application looked into it and he says he couldn't get it to work. But I will have a look next year, when a complete rewrite of the app is due, after Ubuntu 22 releases
 
Hi
Question :)
I have the below code:
`git_output = subprocess.run(['git', 'branch', '-a'], cwd='~/demo/test', capture_output=True,
text=True).stdout`
but I get:
`[Errno 2] No such file or directory: `
look like it doesn't familiar with the ~ sign, as with full path it works
 
Because ~ is a shell (bash, etc) feature
 
10:55 AM
how can I overcome it?
 
sorry guys got a bit distracted but here we are
 
@A.Man Umm, use the full path?
 
this is being printed in the console

'<p>Some really cool description</p><p>With line breaks</p><p>and of course some <strong>bold text</strong></p>'
 
Yes, but the full path depends on user machine
there's a folder with use id in the relative path
 
Path.home() / 'demo' / 'test'
 
10:57 AM
askubuntu.com/questions/1009829/… I keep forgetting this difference every few years I have to check some cpu usages
 
https://stackoverflow.com/a/4028943/5876683
nice, I'll try it
great! it woks :)
tnx
 
OMG, it's blazingly fast. That timeout was the key to increasing the speed of so many things :) And cpu usage is fine
 
@S.Code Do you have autoescape turned off? Because something is escaping it
 
yeah i have this but idk if it is working or not
{% autoescape off %}
"description": "{{ project.description|force_escape }}",
{% endautoescape %}
 
|force_escape :|
 
11:08 AM
why the space in that?
 
That's not code. That's my reaction to you applying an escape filter after we already established that you don't want to escape it.
 
okay i wanna swear really bad but damn thanks a lot
i just needed this
{% autoescape off %}
"description": "{{ project.description }}",
{% endautoescape %}
 
12:03 PM
Game experts: "don't bother maxing out Literature, it's a joke stat"
official guide: "don't bother maxing out Literature, it's a joke stat"
Me: "but what if... I _did_ bother maxing out Literature"
Numbers going up is good, this is a number I can make go up, ergo,
 
12:18 PM
If only Father Tully gave you that book at the beginning of the game...
 
It would certainly simplify things
 
12:31 PM
TIL python modules are case-sensitive even on Windows
python -m pyinstaller says "no such module" while python -m PyInstaller works
 
12:42 PM
Wondering how that works. Does it store the actual name somewhere?
 
Probably just
>>> 'pyinstaller' in os.listdir('site-packages')
False
>>> 'PyInstaller' in os.listdir('site-packages')
True
 
The days of case insensitive file systems are over, I presume?
 
1:13 PM
having version numbers like x.x.x but not using semver is somewhat evil
 
I expect the Windows file system knows the capitalization of its filenames internally, but most built-in shell operations intentionally ignore that data
e.g. if you have a direcctory named src, then mkdir SRC will fail
 
1:48 PM
nvm, they do use semver. I just didn't know about spec 4: Major version zero (0.y.z) is for initial development. Anything MAY change at any time. The public API SHOULD NOT be considered stable.
 
Major version zero is for the radical kids. ✌️
 
2:21 PM
obligatory 0 ver
 
I have a question that I was hoping to run by everyone. I was looking into sliding window. I was trying to figure out a way to I guess adjust how far the window slides. It seems that most examples of sliding windows, the step (I believe this is the correct terminology) is typically set to 1 and people typically adjust the window size. So for example with a window size of 3 and a step of one will produce the follow: [a,b,c],[b,c,d],[c,d,e]... etc.
However, I was struggling to find a way to find a way to adjust the step. So for example I wanted a step of 3 to produce an output of [a,b,c],[d,e,f],[g,h,i]… etc. The problem is that is was actually pretty difficult to find a solution on SO to do this. I eventually ended up reading the documentation on a module that I was using to solve this. I was wondering if it might be worth creating a SO question about this? I already have the solution but the question/answers might help other.
I just wanted to hear what you all thing about that type of question? I just don’t want it to get marked as a duplicate or get down votes. I just couldn’t find a solution of SO but that doesn’t mean I was finding the right posts. Closes solution I could find is this
179
Q: Rolling or sliding window iterator?

David B.I need a rolling window (aka sliding window) iterable over a sequence/iterator/generator. Default Python iteration can be considered a special case, where the window length is 1. I'm currently using the following code. Does anyone have a more Pythonic, less verbose, or more efficient method fo...

 
2:44 PM
I was just curious what everyone's thoughts were and if this is worth making a question about since the question above got a lot of attention
 
Are you specifically looking for a step size equal to the window size? That's usually called "chunking" I think.
If that's the case, take a look at this question: How do you split a list into evenly sized chunks?
 
That was just an example. The step size doesn't need to be the sample length as the window size.
 
@ParitoshSingh lol
 
I already found the solution It was just a bit of a struggle to find. Usually SO already has an answer to all my question but all the questions I could find involved window size
 
@neuron I think you should be fine if you make sure to clearly describe the difference to the common edge cases of rolling window and even sized chunks. Probably a single sentence should be enough.
I also didn't find a dupe – there could still be some but it would not be easy to find.
 
2:55 PM
@MisterMiyagi awesome! thank you!!
 
@ParitoshSingh what a useful use of my time, exhilarating to file a PR adding my project :D
Low in the stack, low in the version. That's the HashiCorp way. xD
 
My projects start at v0.1 and they don't graduate to v1.0 until it meets the original requirements
Although in practice I only put version numbers on gists that I share in here. In order to communicate "this does something useful maybe" vs "this solves your problem exactly as you described it"
Maybe it's not communicating that very well, because a lot of the time I drop a 100% complete solution on the querent's lap, and they'll say "I'll look at it later" or "I'm not sure this does what I want, can you explain each line?" or they'll ignore me and go on brainstorming approaches that will never work
 
3:19 PM
@MisterMiyagi just posted if you want to take a look stackoverflow.com/questions/70202030/…
 
It's sad that simple questions have to be turned into massive walls of text just to defend them from overzealous down- and close-voters
 
What do you mean?
Too many examples?
 
Well, a good chunk of the question isn't actually a question but "this is not a dupe". :P
 
I'm saying that a simple "How do I make a sliding window with a customizable step size?" question shouldn't need to be 1.5 screens long
 
Hey everyone, I'm fairly new with Python and trying to understand the typing system. I'm using `call()` from `unittest.mock` in my unit tests to add expected calls to a List in a loop. The problem is I have Pylance reporting that the List variable is partially unknown. I can't define the List as `List[_Call]` because `_Call` is private.

Why would a public function return a private type? Am I doing something wrong?
 
3:30 PM
And when you say "it shouldn't need to be like this", I assume you mean "It's an unfortunate necessity that it needs to be like this in order to be well-received by the community", rather than "I want you to edit this"
 
Correct
 
@scorgn List[Callable] should work. You can also specify the signature. See typing.Callable.
 
Ordinarily I'd say the meaning is pretty clear, but I want to make sure neuron doesn't go to the trouble of shaving bits off the question when most readers are happy with the current length
For the record I, too, wish that short questions would be judged on their true merits
@neuron Speaking of examples, can you tell me what output you want if the input is "abcde", with window size 3 and step size 3?
 
@neuron u gene sequencing data, interesting
 
@MisterMiyagi Wouldn't I use List[tuple[...]] since _Call extends tuple?
I guess it has a __call__ method so with duck typing Callable would work?
 
3:37 PM
@Kevin I would want it to just be ['abc']
@Kevin that is an interesting question. The current code I have can't handle if the string is that shrot
import more_itertools as mit
seq1 = 'abcde'
print(["".join(codon) for codon in mit.windowed(seq1, 3,step=3)])
@Hakaishin correct. Sliding windows are used a decent amount in genetics
 
@scorgn Ah, you're right, I misunderstood.
 
So you don't want the "de" becausse it's too short... Ok. What if the window size is 2? Should the result be ['ab', 'de']?
 
List[Any] to the rescue?
 
@Kevin correct
With a window size of 2 and a step of 3 the output would be ['ab', 'de']
 
Ok, I thought so, but there was a chance that my definition of "window" was different than yours. Now I think we're on the same page.
 
3:46 PM
@Aran-Fey In reference to what I had asked?
 
Yeah
 
@Kevin awesome! I appreciate your help so far
 
I've got an idea for an approach, but I have to go to a meeting... I don't call dibs or anything, so if anyone else has the same idea as me, feel free to claim the glory
 
I think at one point I'll have to just use Any because the full type of _Call would be List[Union[tuple[tuple[Any], dict[str, Any]], tuple[str, tuple[Any], dict[str, Any]]]] (Python 3.7 so I can't use | instead of Union)
 
@Kevin curious to see what you come up with
 
3:52 PM
typing sounds like suuuuuch a great idea :) I'd love to add any to anything :)
 
I'm still a bit confused on why it's a private type in the first place
I guess because they don't want you to instantiate it directly with _Call(...)
But it is very inconvenient for typing :P
 
@Hakaishin In this case, I'd blame unittest and mocking for the mess. :P
 
Hi, I need some little help.
 
@Hakaishin In this case, I'd blame unittest and mocking for the mess. :P
 
Please choose an image as a sample,
and find the local extrema for the image, which is . find local minima and maxima looking at the neighbours in scale space.
And plot locations on the image of the. maxima
So Can anyone help me like Which opencv function or lib should I use to find this. I have done research and after the result I can see some edges detected in the image
 
3:59 PM
@MisterMiyagi Whole heartedly agree :D
 
Mahotas – Local Maxima in Image Can I use this? There is an article on GeeksforGeeks which does the job. but I am not sure
 
Python's type hint system is actually super verbose. Even if you're not using it for validations, without using it your IDE can't autocomplete functions/methods/properties/etc...
 
ugettext = lambda s: s
LANGUAGES = (
    ('en', ugettext('English')),
    ('fr', ugettext('French')),
    ('de', ugettext('German')),
    ('it', ugettext('Italian')),
    ('nl', ugettext('Nederlands')),
)
Anybody with django knowledge understands this lambda?
is ugettext somehow getting monkeypatched? This just seems silly to me
 
I do wish typing were enforced though rather than just for static analysis
@Hakaishin I would imagine that ugettext would be overwritten to translate into a specific language if someone had their settings set to the language
 
@scorgn maybe chose a language which does that? Instead of changing one which from the get go was built to not do that and I really hope will change that way
 
4:04 PM
@scorgn @MisterMiyagi someone on my question made a comment that my question isn't necessarily describing a sliding window but rather just slicing? Is that true?
I don't think it is but I'm not well versed in python
 
@Hakaishin I don't mean to say I wish you were enforced to use typing, I mean to say that I wish it would enforce that you've passed certain types into things if you decide to use typing
 
@scorgn ah that makes more sense. I guess that would be nice
 
Also I didn't choose to use Python :P
 
looks like that lambda can be replaced with _() in newer django versions
 
@Hakaishin Since it's just a variable would it be considered monkey patching if it were overwritten?
 
4:09 PM
sup dudes!
 
@scorgn Not sure, also I'm not entirely sure what monkey patching is. I understand it to mean a kinda not so clean way to change things which make things then behave different then what you would expect from looking at the code
ola :)
 
@Hakaishin It looks like it's a legacy compatibility wrapper for Unicode handling in Python 2.
 
Hmmm pycharms code analysis is mistaking a default value for a type hint. See this is what typing will bring us. False warnings which I now have to fix, grrr, youngsters with their types.
def foo(x, as_type=str):
    return as_type(x)

foo("42", int)
Gives following warning: "Expected type 'Type[str]', got 'Type[int]' instead". Which doesn't make any sense, since it's not a type hint
 
that's intriguing
 
@neuron Looks like Axe319 had the same idea as me, so you're in safe hands there. For the record, here's what mine looks like pastebin.com/raw/a7jQ7WxD
 
4:18 PM
luckily it doesn't do it for None, so I'm fine
 
@Kevin Oh well! I appreciate you giving it a shot
@Kevin is my question really just slicing and not a sliding window? Does a sliding window need to have an overlap?
 
@Hakaishin that still feels like a Pycharm bug and something you shouldn't have to work around.
 
@Axe319 true, but it's a small change to get rid of dozens of warnings. Which increases the usefulness of other warnings
 
@neuron As far as I know, there's no strict definition of "sliding window", so it would depend on who you ask. If you ask me, I think it's a sliding window.
Axe319's solution and mine do use slicing, so I guess it's both
 
@Kevin that was the impression I was under. It really seems to me that sliding window is just slicing. But I guess what I am not clear on is if there needs to be an overlap to be called sliding window
 
4:25 PM
@Hakaishin My guess is, it's a placeholder. The developer wants to translate those strings eventually, so he puts ugettext around them so they're easy to grep for later. But he doesn't have any translation files ready, not even one that simply returns each constant unmodified, so calling the real ugettext would fail. So he overrides it with a no-op until he gets around to writing at least one translation file.
Perhaps there is a built-in way to make ugettext a no-op if your translation file can't be found. But I couldn't find such a way in ten minutes, which means that maybe your guy couldn't either.
This is all based on one hour ever of practical Django experience, plus lots of googling. Assign a level of credibility to my words as appropriate.
 
@Kevin Nana I found: stackoverflow.com/questions/1329278/… which seems to indicate it was the earlier version of _
 
Another question for those who use unittest/mocking and typing together with a static typer checker like pyright/pylance.
If I define a function to accept an instance of Foobar, and pass in an instance of Mock, it seems that Pylance doesn't complain about it because it's smart enough to know that we're probably mocking Foobar. But, if I define a function to accept an instance of List[Foobar] and pass in an instance of List[Mock] it complains saying Mock is not compatible with Foobar. Anyone have any suggestions on how to work around this?
 
Ah, I was wondering whether makemessages would be able to find string literals inside a ugettext call even if it's not the "real' ugettext. So this at least confirms that it's useful to mark your strings as translatable rather than just having naked literals all over
 
The only solution I can think of is to make a class that extends Mock and Foobar but then at that point it would also inherit from Foobar which I don't want
 
4:40 PM
I feel like I see a lot of type annotation questions like "types A and B play nicely together, but not List[A] and List[B]. Why?". Apparently things get weird once collection types are involved.
 
Hmm, interesting. I think I may have found an issue related to it saying it's been addressed in the next version, but I don't know if it will also apply to Lists and mocks
 
I don't often say "there are some things that mankind was not meant to know", but the precise inner workings of type checkers might be one of them
 
An Intersect type would be convenient here
 
Hey all, long time no see.
 
Ineffability is lame. Find the gods and ask them if they can create a burrito so hot that they can't eat it. But don't ask them if List[Mock] is congruent to List[Foobar].
Well if it isn't old OldTinFoil
 
4:44 PM
Feeling extremely wrinkled and crinkled
 
Your surface area to volume ratio is enviable, surely among the top percentile of such
 
You flirt, you
 
@Kevin If Python would enforce the types you define in a consistent manner at least the static type analyzers would have a definitive source to go to :P
 
@Kevin I'm stealing that one :D
 
:thumbsup:
I really need to fix my unicode emoticon userscript
 
4:49 PM
It'd be nice to know if function calls have sideeffects or not. I just had x = foo() and an unused x warning. Now I just changed it to foo(). Even though foo just looks like a getter, I'm not sure if it maybe does also other stuff. Also hitting the right keys to talk and the right words to speak is definitely luck based for me :P
 
Dropping in with a cheeky question - I'm using twisted.enterprise.dbapi. I'm quite happy with it, but I'm now trying to handle extreme situations - like someone accidentally accidentally deleting a database.

I've added an errBack to catch various issues and handle some basic logging, but I keep getting unhandled exceptions (in this case - pymysql.err.OperationalError: (1044, "Access denied for user 'USER'@'HOST' to database 'WHYISTHEDBGONE'")
Just can't figure out the proper way to catch these so I can log the issues and inform devops that they're bad, bad people
If anyone has the corner piece of the puzzle, that would be greatly appreciated
(These errors are happening in deferred calls, "Unhandled error in Deferred:")
 
In ordinary Python, I think you can throw an uncatchable exception by making it inherit from... KeyboardInterrupt? Something like that. Maybe your exceptions are similarly tricky.
I looked it up. SystemExit and its children won't be caught by except Exception:. But they will be caught by except:. So it's not truly uncatchable.
I wonder if you could hook into the exception system so you can inspect each exception even before it gets raised...
 
@Kevin BaseException
 
That's the one
Bah, sys.excepthook only fires for uncaught exceptions. Maybe the audits table has something...
> If the argument that's passed to me is not a failure.Failure instance, it will be embedded in one
You don't often see function specifications written in first person. twistedmatrix.com/documents/8.0.0/api/…
 
5:08 PM
Well, you can't catch the exceptions in the usual linear traverse manner, as this code will be executed asynchronously. I thought providing a function for addErrback would catch these exceptions (like other exceptions that I'm logging), but for some reason it's not
 
Yeah, I was worried that the callback-based error handling would make it hard to apply conventional error catching design principles.
Are there any other handlers in the callback chain? if there are, they are the prime suspects, IMO
 
I'll do some digging and see if there's anything misbehaving - thanks
 
Hey everybody. What do people chat here about?
 
Poking through the source*, I see that runCallbacks has some elaborate code for deciding which callbacks ought to be called. There's the contents of self.callbacks of course, but also chains of Deferred and loop detection logic that makes it seem less like an iteration over a collection of callables, and more like a general graph traversal algorithm
 
That was my understanding of it too, and if the error callback gets called if any of the deferred runs an exception state
 
5:23 PM
So if none of the object's direct callbacks are misbehaving, have hope -- the true culprit is inside the impossible maze, and you only need to find them
I suggest bringing a long string into the Labyrinth. A hundred paragraphs of Lorem Ipsum ought to do it.
 
I'm scared Kevin
 
The minotaur has intimidating abs, but he skips leg day. Aim low.
(*I don't actually know if this is the source code for the object you're using, or even if this project is the one you're using. But maybe it's close enough)
 
5:55 PM
Yeah, it all seems right to be honest mate. Just the RDMS + TCP server stuff from twisted
 
6:35 PM
hi does anyone know how to scrap likes and dislikes from all avaiable youtube videos?
 
7:10 PM
https://www.youtube.com/feeds/videos.xml?channel_id= gives metadata for the videos of a channel, but strangely it gives a "star rating" rather than a thumbs up / thumbs down count
 
7:32 PM
I forgot to bring my email password with me so I'm still/again locked out of everything for 3 days cabbage
 
@Kevin I mean is here a list with all avaiable youtube videos ids?
 
Doubtful
 
I does not found anything. I thing the only possible solution is to insert random search querys
based on dictonary or something else
There are approx 5 biilions videos on youtube. Would be hard to scrap all videos until 13.12
 
7:49 PM
hello!
 
Greetings
 
productivity curve?
 
@otto Scraping youtube for vote counts is almost certainly against their terms of service (though I'm not a lawyer and haven't read their ToS).
 
My mystery function looks much nicer now that I'm using a triangle as the first generation instead of a rectangle
@idjaw It's the result of an iterative process that goes as follows: start with a triangular hill of sand that extends as far as x=-1 and x=1. create a duplicate of the hill, pick it up, move C units to the right, and drop it. Stretch the graph's X and Y axes so the new combined hill has the same volume as the old one. Repeat until the result converges.
The stretch factor for the X direction doesn't need to equal the stretch factor for the Y, and in fact they have to be different if you don't want the convergent result to be an infinitely short and wide sheet of sand. uh, I think.
If any of that is confusing, you're in good company because I've been confused the entire time I've been playing with this
 
8:09 PM
@Kevin I'd love to fit a Gaussian to that function of yours
 
I'm just waiting for Andras to come by and say "that's obviously Zorn's Curve, even babby data scientists can derive it"
 
Although you have no randomness, this reminds me a lot of the central limit theorem...
 
I've been looking at gaussians and normal curves and such, but I'm not sure it's a perfect match, because my ideal curve has y=0 for all values of x outside of the [-1, 1] range
 
copying and rescaling *mumble mumble* sum of random variables
@Kevin hmm, right
 
Not just "asymptotically approaches 0", but hits precisely zero at precisely |x|=1
 
8:12 PM
so it's more like a bump function
 
Or at |x| = (the smallest real number larger than 1), I'm no limit master
Ok, I figured out how to share Desmos worksheets. Now interested parties can play with the sliders and such desmos.com/calculator/at4nleaji7
b = 1.48 is interestingly spiky
I derived the formulas relating a and b and c together, by assuming func(0) = 1 for all funcs in the series. The result is an aesthetically interesting collection of curves which all match my mental picture of the results I wanted... Except that func(0) != 1 for almost all of them
I may have forgotten to carry a 1 somewhere
 
8:28 PM
Hello kevin!
I saw your post about AST module in Python
 
AST is a fun module, I'm glad to spread awareness :-)
I think binomial distributions reach zero at finite X values, which is promising for my mystery curve...
 
AHA! Gotcha
 
So does the Python file `.py' has to have one class or it can have mix of classes and methods please?
 
It can be a mix.
 
Thanks!
Appreciated.
 
8:33 PM
any time :-)
 
Something was clobbering the error callbacks further down the line - and it was outside the library. bbiab, going to shoot someone in the face.
I may be some time
Thanks for your help earlier Kevin :)
 
any time :-)
 
8:58 PM
Does anyone know that if I have a huge file, how I can read a string from specific position, say on line 1040532 string starting from index 5607 and 100 characters from it?
 
"line" 1040532 might be tricky
not sure how "text" files seek
 
hello all, saw an example , where we declare a list as such dkeys = {'Objects' : []} and populate it as such
dkeys['Objects'] = [{'Key' : k} for k in [obj['Key'] for obj in someotherlist]]
how do i print what is in the dkeys['Objects'] list?
 
print(dkeys['Objects'])...?
 
i don't understand why it is declared this way dkeys = {'Objects' : []}
 
@ozil because who wrote that didn't know better
 
9:02 PM
couldn't it be simply dkeys = []
 
@ozil also no
dkeys = {}
or dkeys = dict() if you're prone to forgetting which bracket means what
 
@AndrasDeak - thanks . if you don't mind , can you elaborate on this dkeys = {'Objects' : []}
 
@ozil no
It looks like a dict with an empty list set as the only value. Then that empty list is discarded and a new list is assigned to the original key. It's what it looks like, and it's unnecessary.
 
ok thanks, yeah i couldn't understand the logic behind that
why do we need 'Objects' : []
inside the {} during instantiation
 
@ozil and unless you paraphrased the code, that other line looks fishy was well
# don't do this
dkeys['Objects'] = [{'Key' : k} for k in [obj['Key'] for obj in someotherlist]]

# do this
dkeys['Objects'] = [{'Key': obj['Key']} for obj in someotherlist]
 
9:06 PM
thank you very much @AndrasDeak
 
No problem. Are there later other kinds of dicts in that list? Or always {'Key': something} single-element dicts?
Because if there's always a single-item dict with the same key then the dict adds no information whatsoever, and you should just store the list of obj['Key']s.
 
ok thanks
 
The thing with confused-looking code is that it's rarely localised. If it's confused in one place there's a high chance that all of it is cargo-culted nonsense.
so I guess good luck
@Kevin only because it's for a finite n number of trials. And it's a discrete distribution. Probably not your guy.
 
9:57 PM
@Kevin This made me feel better. Because I had no idea what was happening.
 

« first day (4065 days earlier)      last day (888 days later) »