« first day (3106 days earlier)      last day (2065 days later) » 
00:00 - 16:0016:00 - 22:00

01:00
@wim ...or a candidate for using Go or FP instead?
@wim Johnny Depp is smoking some strong stuff these days... but good for him... that would be a neat film/series to bridge to (two) new generation. like Paul McCartney's duet with Taylor Swift(?)
New users posts self-duplicate questions on letter n-grams from input file: please close the bad nltk asking into the other asking. Leave the second one open because it's a not a duplicate of existing questions as far as my checking goes. (surprising don't have good canonical)
how do I completely reset a linux directory?
Also, what's our general policy for tagging(/retagging) as vs [tag:python-3.<specific_version>] vs plain old ? Should we only tag [tag:python-3.<specific_version>] when either there's a specific a bug/ performance issue/compatibility/feature on that specific version? Else retag to , or if ti's very general?
@qaispak This is the Python room, please don't ask here. Anyway do you mean 'delete, including all subdirectories' or 'git checkout/reset' or something else? Please use SuperUser.com
I thought a lot of users here used shell stuff... goes well with Python
and what I meant was, I made a bit of a mess. Installed a few things. Mounted a share on a directory. I just wanted to clean it all up.
It helps if you show us the bogus install and mount commands.
I basically did this:
mount -t cifs -o user=admin,password=123,ro //199.1.1.1/somepkg /mnt
01:27
@cs95 Did you see the Elvis operator...?
(Those are fake creds)
I'm a little confused.. since mounting the directory structure is changed and I'm trying to make it go back.
I don't know the answer to that, please use SuperUser.com, it has lots on that.
alright, thanks
@smci sightseeing was the last thing I wanted to do there ;_;
Btw if you did the bad installs after the bad mount, did they get installed unwantedly onto that volume...
01:38
yeah they possibly did. I just want to clear everything from it. Actually I ran some scripts and most installs failed..
wim
wim
@smci Right.
 
2 hours later…
04:01
Yo o/
04:50
recbg
05:04
@qaispak Oh dear. You should test the living shit out of install scripts on a sandbox area, like a throwaway VM image, and catch all error conditions. But you probably know that already.
 
1 hour later…
06:08
@Code-Apprentice Is it nt ok to post image here? Sorry I didn't know abt that. I will try to copy paste later on.
06:54
Can anyone explain me this line of code:
sum([all(i % x == 0 for x in a) and
           all(x % i == 0 for x in b) for i in range(mn,mx)])
How all() working here?
From the documentation, I read that all() returns True or False.
@taritgoswami all basically tells you if all the elements in the given iterable evaluate to True.
>>> all([False, True, 0, 1, '', 'hello', 5 % 5, 6 % 5])
False
>>> all([True, 1, 'hello', 6 % 5])
True
@shad0w_wa1k3r Yeah, but the above code is used to check- for two given lists a and b, sum of all elements i where for all x in a, x divides i and for all x in b all those i divides x.
So, how all working here?
.. it returns true if all items in the iterable that it is given are truthy
I think you want to ask what sum is doing...
>>> sum([True, True, True])
3
>>> sum([False, False, False])
0
@Aran-Fey Ooh, that makes clear.. thanks :)
07:07
cbg morning
07:19
@Aran-Fey strong with the guessing games eh :D
08:17
@shad0w_wa1k3r mind reading is a necessity here at SO :D
08:30
indeed
08:58
@taritgoswami That would be usually written as a generator expression rather than a list comprehension. There's no need to build a list just to get its sum. So just drop the square brackets. OTOH, a gen exp has a little more startup overhead than a list comp, so if the number of items to be summed is really small, like <5, the list comp is slightly more efficient.
@AshisGhosh It's ok to post useful, relevant images here (or funny ones). Images of text are rarely useful, especially images of code. We want code that we can paste into our editors, so we can modify it and run it, we can't do that with an image.
09:43
cbg
@Aran-Fey Another way to say that could be:
>>> True == 1
True
>>>
@PM2Ring Can you elaborate? all() takes iterable inputs, so after removing square brackets what we get are those iterable?
@taritgoswami I will explain the whole thing, lets got step by step
Oops sorry.
@U9-Forward Ok, please
1. to explain what all is doing here:
So if you have a list:
l = [1, True, 2/2]
And you do:
@U9-Forward Yes, but that's slightly misleading. The bool class is a subclass of int, so True isn't exactly a synonym for 1, but it does evaluate to 1 in a numeric context. See docs.python.org/3/library/functions.html#bool and the links there.
09:58
@PM2Ring I was goofing around
 print(all(l))
@U9-Forward It gives True
It would return True because all the value in l are either True or 1, so for example, False wouldn't be one of the True ones, nor 0, so if you stick them in:
like a list like:
l = [0, 1, True, False]
And:
print(all(l))
Would return False, because not all of the values are one of the True ones
@taritgoswami In your code, the arg to each all call is a gen exp, as it should be. But then you create an unnecessary list from each all(i % x == 0 for x in a) and all(x % i == 0 for x in b) value.
So to know if it is True or False, do:
print(bool(your_value))
So with 0 it would give False, and 1 it would give True
@U9-Forward Ok
10:03
So the two things in the sum would return their True or False, if both of them True, it would return 2, if only one of them, it would give 1, and if none of them, it would give 0
I think that's all i should say
@U9-Forward Ok. And it is a reasonable first approximation. ;)
@PM2Ring Oh, you mean isn't completely correct?
@PM2Ring gen exp mean?
generator expression, recently rebranded as generator comprehensions
@AndrasDeak Yeah...
@taritgoswami Just a shorthand
10:07
Ok
@PM2Ring Ok, now got it.
@U9-Forward Indeed! In Python 2, False and True were just names of 0 and 1. You could even bind different values to those names (if you were mad). But in Py 3, they've been "upgraded", so that they are instances of a type that's a subclass of int. But you should read the stuff I linked to. That's why I went through the hassle of finding that link & pasting it here, on my phone. ;)
$ python2.7
>>> True, False = False, True
>>>
@taritgoswami sum(range(1000)) does virtually the same thing as sum(i for i in range(1000)), but the 1st one is better, because it uses a C loop, not a Python loop. However, if we do sum(list(range(1000))) or sum([i for i in range(1000)]) we have to build a list in RAM before we can start calculating the sum. So those versions are slower, and on 32 bit Python, use 8kb more RAM.
10:31
@PM2Ring Ok, so:
sum(all(i % x == 0 for x in a) and
           all(x % i == 0 for x in b) for i in range(mn,mx))
this works like C loop as in sum(range(100))? and will not consume memory like a list does. Right?
@taritgoswami Right.
Thanks :)
On a related note, all(i % x == 0 for x in a) is much better than all([i % x == 0 for x in a]). The second one has to build the whole list before all can start performing its tests. The first one starts testing if i % x == 0 straight away, and as soon as an x fails the test it stops, so no further i % x values are generated.
10:50
Spent half a decade hating python
Now, i have fallen in love with it...my story
Welcome to Programmers Anymous.
I spent half a decade thinking that Python's use of whitespace for structuring was stupid. But after seeing m.xkcd.com/353 I decided to give it a try, and I became enlightened. ;)
@PM2Ring If this becomes a meme, i am going to run to mars and back
I came across a video of that xkcd youtube.com/watch?v=XcdJjGk-M58
python has many illusions if you are not careful
@objectiveME I suppose so. And many of the objections against Python by programmers who've never learned it are based on misconceptions. Speaking of which...
@PM2Ring Which year was asyncio introduced
11:05
Not exactly related to python, but does anyone know how to connect to a remote server using nginx in windows? Any support link would help...
The most attractive thing about python is its ease of doing cooperative multitasking
@objectiveME Sorry, I can't remember. And I've hardly ever used it.
@objectiveME it is?
@PM2Ring wow, really
@AndrasDeak Yes, i can tell you from someone used to java
@objectiveME I once wrote an SO answer to an async question, but that's about it, and I've forgotten just about everything I learned about it.
11:08
@PM2Ring oh ok. Myself i find that package a gift from heaven. I have always wanted something like that. But in the docs, miost people assume its only well suited for network related tasks
I've used over 2 dozen languages in my decades of coding (counting many dialects of Basic as separate languages), but I never got around to learning Java. Or C++, I was happy enough to use plain C.
and also hard to take seriously for someone who goes by this initials 'BDFL', thats still earns a wtaf from me
python was never meant to be taken seriously
I dont think i can ever do any other language now
@AndrasDeak lol
@AndrasDeak Hence the name.
11:12
If you look past the mountain of bs from jokers using it, it really is useful
@objectiveME I like to use other languages from time to time, mostly so I don't forget them.
@PM2Ring That's good practice. I was never a polyglot myself. I like to sticking to what i know and gather my tools in one language
I am going to invest so much into python now
I like script-based ray-tracing, which I do using the POV-Ray language. And I like to create 2D graphics by writing programs in PostScript, although these days I'm more likely to do that by a combination of Python and SVG, or maybe SVG with Javascript.
Here is the rejected preliminary NSF proposal I had mentioned https://figshare.com/articles/Mid-Scale_Research_Infrastructure_-_The_Scientific_Python_Ecosystem/8009441 Clearly not perfect, but might be of interest. We assembled some metrics about Python use in science @danielskatz @AstroBrigi @jeremyphoward @choldgraf @cziscience @ctitusbrown @jim_savage_
large chunk of the python for science ecosystem applied for an NSF grant, got rejected the same week that a black hole was reconstructed making heavy use of the same ecosystem ^ :P
@AndrasDeak Its sad. The lady who got the black hole image i hear had to hide some python code out of shame
Trolls descended on her github like never before
I guess, there is a tiny bit of shaming going on in sciences if you are using python
11:21
if you're not just trying to joke and something like that happened it probably wasn't "out of shame"
But too bad, it works and thats all that matters
Python code generally runs slower than compiled code, but if you're doing heavy number crunching in Python you're probably using Numpy (or a library like GMP), so all the heavy lifting is running at compiled speed anyway. But in terms of development speed, both in terms of the initial creation of your code, and in its maintenance, Python blows most other languages out of the water.
@objectiveME I don't see any "had to hide some python code out of shame"
@AndrasDeak I cant link the trash here, found on reddit
look it up if interested
@objectiveME Haters gonna hate, idiots are gonna act like idiots. Sadly, ability to code isn't restricted to non-idiots.
11:30
I'm just saying there's probably a lot of misinterpretations going on and perpetuating half-truths or falsehoods won't help the situation
@PM2Ring I assumed that for the longest time. But compared to java, python really excels in day to day tasks
true
11:47
hi
I can't open the link to proper formatting guide
Is it blocked by your employer?
the page loads for me
Oh it's opened now thanks
the problem is sorting strings in a list, while sorting strings starting with 'x' first, now this is my code, but I have no idea why it's working character by character instead of string by string:
def front_x(words):
  x_words = []
  for word in words:
    if word[0]=='x':
      x_words += words.pop(words.index(word))
  x_words.sort()
  words.sort()
  return x_words+words
  x_words += words.pop(words.index(word))
>>> lst = [1, 3, 5]
... lst += 'asdf'

>>> lst
[1, 3, 5, 'a', 's', 'd', 'f']

>>> lst = [1, 3, 5]
... lst.extend('asdf')

>>> lst
[1, 3, 5, 'a', 's', 'd', 'f']

>>> lst = [1, 3, 5]
... lst += ['asdf']  # or lst.append('asdf'), even better actually

>>> lst
[1, 3, 5, 'asdf']
11:56
@AndrasDeak thank you
no problem
@Moytaba BTW, words.pop(words.index(word)) is rather inefficient. There are better ways to do this.
m8_
m8_
Good morning!
@PM2Ring yeah, building a new "non-x" word list on the fly would probably be better
there's also word.startswith('x') for a slight semantic improvement
@PM2Ring Oh, ok I'll search for a better way too.
12:00
@Moytaba Andras has given you a good hint.
I've got stuff on the stove I need to attend to.
@PM2Ring right \0
We should host events :)
@Moytaba the problem with yours is that you're looping over the list, and then in each iteration you look up the index of your word in the original word to pop it. Even words.remove would be a bit better, but then you still keep looking for elements (O(N) at a time!) with each deletion, and deleting items from the middle of lists is not efficient. So you should construct another list that collects the rest of the words (i.e. ones that don't start with an 'x')
>>> words = ['x-wing', 'hedgehog', 'xylophone']
>>> sorted(words, key=lambda word: (not word.startswith('x'), word))
['x-wing', 'xylophone', 'hedgehog']
@AndrasDeak wow now I see how terrible it was.
@Aran-Fey Merci! Google python course says "sorted" is preferred too, but it's not explained yet :)
12:07
You can replace sorted(words, ...) with words.sort(...)
@Aran-Fey there's a big but subtle difference though :p
The original code also calls words.sort(), so I figured it doesn't matter ¯\_(ツ)_/¯
Poor man's sorted(x): x = x.copy(); x.sort()
shrugs - I came late into the convo
@Aran-Fey not quite .. I believe that a tiny bit of checking is done...
same here tbh - I'm just taking a short programming break and investing the little energy I have into this conversation
@Moytaba .index is slow because it has to scan the list items one by one, until it finds a match. It does that at C speed, but it's better to avoid it if you can, especially avoid doing it in a loop.
And when you pop or delete an item of a list all the subsequent items in the list have to be moved down to fill the gap. That moving happens at C speed, but once again, it's better if you can avoid it, especially in a loop.
12:13
@PM2Ring yes I see now.
thank you. although I know it's bad code, I'm still curious to know why it's not working properly when last element of the list starts with 'x'! Is anything else wrong too except efficiency?
"removing elements from a list while looping over the list", most likely
@PM2 remember the "old days" when you had to pick which cpu register and all that you wanted in assembly? And oh bloomin' heck, how easy it was to just crash the entire system if you got it wrong? :p
@AndrasDeak oh right 0/
when you mess with the length of the list it can cross its wires with the loop, leading to skipped items for instance
@AndrasDeak thanks.I did the same way
12:23
@JonClements I did my assembler programming on Motorola chips, not Intel, so things were a lot saner. ;) But you still had to take care to not access misaligned memory locations otherwise you'd crash with a bus fault on the 68000 (later family members could recover from bus faults).
The main register weirdness we had to deal with (not counting the segregation of address registers from data register, which is fairly natural) was that we had 2 stack pointer registers, that had the same name (A7, IIRC) one for user mode, one for supervisor mode, but in practice, that was never a problem.
modern day devs have a luxury is all I'm saying :p
@JonClements Oh, I can totally agree with that.
I don't think I could write a line of assembler if I had a gun to my head
"later family members could recover from bus faults" is reminiscent of history lessons explaining how once-deadly childhood diseases are no longer life-threatening
I did do a double-take reading that
12:28
A hundred years ago, a bus fault would put you in an iron lung, but today little Timmy will be back in school by the end of the week
OTOH, the old systems were smaller, and therefore easier to master. Also, the "bones" of the system were more exposed, and libraries were pretty minimal, so you couldn't avoid seeing how stuff was working at a fairly low level.
I regret that I missed the era of personal computing where you could reasonably understand every single component of the machine
it's not entirely your (bus?) fault
Alternatively, a bus fault is not a disease, but a lump that you get on your head when the school bus hits a pothole and you aren't wearing your seatbelt
@PM2Ring Agree completely. Would I want to write the equivalent of a dictionary in Python in assembly!? That'd just be nuts. Sounds like I should do though...
12:31
@AndrasDeak :) Even modern CPUs don't like you to do misaligned accesses, eg try to access a 32 bit word at an address that's not divisible by 4. They'll do the access, rather than throw an error, but it's significantly slower than an aligned access.
(And of course nobody wears their seatbelt on school buses. They're strictly ornamental.)
@Kevin don't miss out magtapes and punch cards :p
Mm hmm. I only want to experience the fun parts of the past.
@JonClements I've written hash tables in C. I don't think I tried doing it in assembler.
haven't touched it in years now - not even for optimisation - seems like distant memories
@Kevin I get confused... you've obviously invented the time machine stuff... but I'm still waiting for my LOTC? :p
12:42
The basic modules are in place but they've been colonized by space morlocks
How space morlocks got into a satellite assembly complex in North Dakota, I'll never know
obviously we need a time space continuum funding raise to get those Morlocks out :p
m8_
m8_
can someone explain how this works or what it does for a pandas df: df['col_A'][df2]. I presume this is saying, "values in col_A which are in df2?
that looks weird
@Kevin Even 80 years ago, medicine was pretty scary. Yesterday, I learned about the 1937 Elixir Sulfanilamide Scandal :( The good side of that story is that it motivated legislation that made medicine much safer.
@m8_ TypeError: Indexing a Series with DataFrame is not supported, use the appropriate DataFrame column
do you have an MCVE?
m8_
m8_
12:48
sure, one sec
Whenever I get nostalgic about cool-looking eras in the past, I think "that might be nice to experience", qualified with "... Provided I still have immediate access to modern health care"
(the error is what I'd naively expect but I'm not a pandas person)
@Kevin That reminds me of the Jarts in Greg Bear's Eon.
@m8_ if df2 is really a series then it just does fancy indexing on the rows, probably
@Kevin I rarely take antibiotics, but I don't think I'd want to live in a world without them.
Or in a world where people thought it was clever to use lead for plumbing.
12:52
every time travel fantasy ever: just put mold on it
@PM2Ring TIL "excipient"
Obligatory joke: given the shambles that is American health care, I might be better off with home-brewed mold.
Relatedly, I heard that congress is trying to get companies to stop selling insulin at 10x markup. Either this will cause a decrease in prices, or an increase in the bribes that lobbyists give congresspeople.
Ah yes, the good old "it's not corruption if there's a contract" thing
m8_
m8_
my_list = ['One','Two','Three']

data = [['One'],['Two'],['Three'],['Four'],['Five']]
df = pd.DataFrame(data,columns=['Num'])

not_in = ~df['Num'].isin(my_list)

df['Num'][not_in] = 'FIX - ' + df['Num'][not_in]
that's very different from what you asked
m8_
m8_
Is it?
13:04
now not_in is a logical array (or logical Series maybe), that's textbook fancy indexing
calling something df suggests that it's a dataframe
You have to be careful with moulds. You don't want to use the wrong ones. en.wikipedia.org/wiki/Ergotism
m8_
m8_
It is a dataframe
`type(df)`
`Out[83]: pandas.core.frame.DataFrame`
21 mins ago, by m8_
can someone explain how this works or what it does for a pandas df: df['col_A'][df2]. I presume this is saying, "values in col_A which are in df2?
print(type(not_in)) gives me <class 'pandas.core.series.Series'>
m8_
m8_
ah
13:06
and boolean array-like indices will act like a mask, choosing the subset of the original array-like where the index is True and omitting the rest
Yo again o/
m8_
m8_
I was confused on the actual difference between a series and a dataframe
>>> not_in
0    False
1    False
2    False
3     True
4     True
Name: Num, dtype: bool
>>> df.Num
0      One
1      Two
2    Three
3     Four
4     Five
Name: Num, dtype: object
>>> df.Num[not_in]
3    Four
4    Five
Name: Num, dtype: object
@TheLittleNaruto recbg
m8_
m8_
so, a Series is the datastructure for a single column of a DataFrame. So a dataframe has series but a series is not a dataframe
sort of, yeah
m8_
m8_
13:08
I think I'm tracking now
@AndrasDeak Hey
a series is like a dataframe with a single column, just a bit less/different
'sup ? I got one doubt :D
@TheLittleNaruto shoot
So I was checking this Request api , the response we can decode to json via resp.json() method. However there is no way to get the response in the form of dictionary. Any idea on this ?
13:09
Are you sure it's not a dict what you get?
>>> r.json()
[{u'repository': {u'open_issues': 0, u'url': 'https://github.com/...
that looks like a (python 2) dict to me
Will it be the same in case of Python 3 ?
Note: I am using Python 3
of course, without the u prefixes
@TheLittleNaruto Yes
Possibly you are under the impression that Python has a distinct "JSON" type which is different from its dict type. This is not the case.
actually, that looks like a list with a dict inside, that might be the source of the confusion
13:11
@AndrasDeak Let me understand, so in case of python 3 the output will be without "u" but it'll still be a dictionary and not json even though the method name says "json()" ?
Am I correct ?
Of course, it's possible for a JSON response to be an array, which becomes a Python list, rather than an object, which becomes a dict.
Any documentation that says it returns "json" is understood to mean that it returns a string or a dict or a list or a number
omg this is confusing then
it's only confusing if you think that JSON per se is a thing in python
I guess the docs doesn't specify the type because it can be a dict, a list of dicts, or whatever other combination of a few built-in types to match the JSON side
**kwargs – Optional arguments that json.loads takes.
that suggests that the behaviour is similar to json.loads, at least
13:14
@TheLittleNaruto The .json method loads the JSON into the appropriate Python dict / list for you. It's the same as getting the text response and passing it to json.loads.
the difference between response.json() and json.loads(...) is mainly an automatic decoding according to the encoding given in the response header, I think
And here's json.loads
Okay one more doubt
Can we merge 2 dictionary ?
yup, plenty of dupes for that ;)
Almost certainly yes, although you'll have to elaborate what you mean by "merge"
you have to decide what to do with duplicates
13:16
There are a hundred ways to do it and they all have subtly different results
input1: [Employees: {name: Naruto}]
input2: [Employees: {name: Andras}]

Output:
[Employees: [{name: Naruto}, {name: Andras}]]
I want something like this
NameError for Emloyees.. ;)
"Merge two lists of dictionaries" also has plenty of dupes ;)
(side note: single-item dicts are often frowned upon, this just came up a few days ago)
Ok we can safely assume there is no duplicacy
13:19
@TheLittleNaruto the inputs are syntax errors
everything should be a dict
@AndrasDeak Sort of. The handling of encodings on Web pages is complicated because the encoding reported in the HTTP header may not match the encoding in the page's <meta> tag, and neither are guaranteed to be the encoding that the page data actually uses. :( But the Requests module is pretty smart at deducing the real encoding from the header, the meta, and the data. And if all else fails, you can manually supply the encoding.
@AndrasDeak Ok let's not see the syntax, that I wrote it just to make you guys understand what I am looking for
The best way to get us to understand is to use correct syntax :^)
primarily because we can copy paste and run it in our IDEs if we need to check something.
13:22
>>> a = {"Employees": {"name": "Naruto"}}
>>> b = {"Employees": {"name": "Andras"}}
>>> c = {key: [a[key], b[key]] for key in a.keys()}
>>> print(c)
{'Employees': [{'name': 'Naruto'}, {'name': 'Andras'}]}
>>> from collections import defaultdict
...
... d1 = {'Employees': {'name': 'Naruto'}}
... d2 = {'Employees': {'name': 'Andras'}}
...
... res = defaultdict(list)
... for d in d1,d2:
...     for k,v in d.items():
...         res[k].append(v)
...
... print(res)
... print(dict(res))
defaultdict(<class 'list'>, {'Employees': [{'name': 'Naruto'}, {'name': 'Andras'}]})
{'Employees': [{'name': 'Naruto'}, {'name': 'Andras'}]}
Fortunately, these days, things aren't as bad as my previous message might imply. But badly-configured servers can still spew out bogus encoding headers, but if the header & meta disagree, the meta is almost always more reliable.
And we still have the cp1252 issue, at least from Windows systems.
My code is making a lot of assumptions about the contents of each dict. It assumes that every key present in a is also present in b, and vice versa. If b contains a key that a does not, it won't appear in the output. If a contains a key that b does not, then the code will crash.
Andras' approach is more fault-tolerant in this respect.
@Kevin Can you explain a little what you did in line number 3rd please ?
there's a range of assumptions that lets you interpolate between the two
13:24
cabbage :)
Oh Never mind
understood
Jun 5 '18 at 21:29, by PM 2Ring
From https://en.m.wikipedia.org/wiki/ISO/IEC_8859-1 It is very common (on the Internet) to mislabel Windows-1252 text with the charset label ISO-8859-1. Most modern web browsers and e-mail clients treat the media type charset ISO-8859-1 as Windows-1252 to accommodate such mislabeling.
Arigatou Mina-san :)
("Thank you Everyone" in Japanese)
I was about to ask :P
I knew xP
13:25
I also suspect that an hour from now you're going to come back and say, "actually, I need it to work on a = {"Employees": [{"name": "Naruto"}]}, sorry for the confusion"
Yeah that's crrect
we'll just send him back to Konoha to practice
That's what I want
@AndrasDeak xD
>>> a = {"Employees": [{"name": "Alice"}, {"name": "Bob"}]}
>>> b = {"Employees": [{"name": "Carol"}, {"name": "Dave"}]}
>>> c = {key: a[key] + b[key] for key in a.keys()}
>>> print(c)
{'Employees': [{'name': 'Alice'}, {'name': 'Bob'}, {'name': 'Carol'}, {'name': 'Dave'}]}
ISO-8859-1 is the official name of Latin-1, and cp1252 is Microsoft's version of Latin-1 that has a few different char assignments.
13:27
This is a good example of the importance of clear syntax when asking a question. Otherwise you'll go down a couple blind alleys before getting a useful solution
I don't mind answering under-specified questions, since it means I get to make up whatever assumptions I want about the input. But it tends to be a bit of a runaround for the asker.
Above suggested approach was throwing an error: TypeError: unsupported operand type(s) for +: 'dict' and 'dict'
@TheLittleNaruto try that and see what happens
So I searched that
Ok let me try that
13:31
on modern python 3 you can also do {**dct1, **dct2} to get a new copy
If your input really does look like a = {"Employees": {"name": "Naruto"}} and not a = {"Employees": [{"name": "Alice"}, {"name": "Bob"}]}, I would expect my most recent code to give that TypeError. Dicts of lists of dicts do not behave the same way as dicts of dicts.
At this point either go back to Konoha to practice or give us a proper MCVE of your problem if you want us to help further :P
MCVE as in "syntactically valid, runnable and looks just like your real input"
I think this is working
@TheLittleNaruto that would be surprising
>>> {**d1, **d2}
{'Employees': {'name': 'Andras'}}
@AndrasDeak Ok my server responds very slowly. Let me dump the log
13:33
Seeing that answer by mgilson makes me nostalgic for the times when he hung out in here... And I don't need to worry about contracting polio for this particular time adventure, since it was only three years ago
@TheLittleNaruto make sure you make it M for Minimal before posting it here or linking to it
Yeah sure
also commute rhubarb
I consider the M the least important of M C and V personally. I can debug a hundred lines of code even if it could have been more concisely expressed as ten lines of code. My Orb of Debugging Insight is not flummoxed by a simple 1000% increase in complexity.
Damn it I have to go home now! :(
13:37
I'm more worried about a 10k-column mess of nested JSON which makes seeing what the data structure looks like difficult
I'll see you guys after reaching home. Once again Arigatou :D
sayonara
14:00
Hello guys! Is someone aware of any function/package that will let me convert a floating point number (in decimal) to its 16bit IEEE representation?
I am a bit too lazy to write it myself
I have been programming in vhdl all day :'(
I've been trying to use blender to cut together about 13 video clips of my wife playing violin, and I'd like to script it with Python (so I can easily do the same kind of work over and over) what's the magic tutorial or docpage I'm missing to do this?
@RedFloyd Perhaps you could use numpy, which has a float16 type.
@AaronHall Not sure whether you're asking "how do I run command-line commands in Python?" or "What command-line commands does Blender have that would merge together video clips?" or "How do I use the Python bindings of Blender so I don't have to feed command-line commands into subprocess?", or what
The answers being, respectively, 1) subprocess, 2) I don't know because Blender expertise is not well-represented in this room, 3) Google suggests docs.blender.org/api/2.79/info_quickstart.html as an entry point for working with the Blender/Python api
I've found some blender tutorials that describe how to do 3d stuff, but virtually nothing on merging videos together.
14:15
That is consistent with my vague understanding of Blender: it's mostly for 3d stuff.
I'm aware of the API docs... docs.blender.org/api/blender_python_api_current/… but they're pretty voluminous, so I was hoping someone might point me at the tutorial I've been missing.
blender.stackexchange.com may be better-informed about such things than me
Wikipedia tells me that Blender can do video editing. Good to know.
I've asked in their chat, no response
might actually have to put myself out there and ask on their main site...
Any particular reason why you want to do it with blender? Why not, say, moviepy?
Additional googling suggests that the "video sequence editor" can be used to combine sequences of videos, and this editor is accessible through the API.
14:23
I just learned about moviepy a few minutes ago when I dropped blender from my search - I would kinda prefer to be able to say I can script Blender than just, I cobbled these clips together with Python, but my wife is getting a little impatient with my pursuit of the perfect solution.
@RedFloyd Try the struct module, specifically the f format character
> For the 'f', 'd' and 'e' conversion codes, the packed representation uses the IEEE 754 binary32, binary64 or binary16 format (for 'f', 'd' or 'e' respectively), regardless of the floating-point format used by the platform.
@Kevin Yeah that's probably close to what I'm looking for.
Maybe I need to look for "sequence editor" - which is what you said...
14:37
Oops, I didn't see that struct supports half floats, because I failed to interpret "(7)" to mean "half-floats (but don't expect to actually find this type in C)"
It may have been unwise to make the primary key of this table nullable
15:00
I have a function that returns html and a jinja template (index.html). My function is decorated with a flask route @app.route('/this/place'). What do I need to put in my template to get the html returned by my function into the resulting rendered html?
15:10
long time no see @piRSquared
o/ @AndyK
@piRSquared how are you?
@piRSquared sorry to hear that. I hope things are getting better with your family
They are. Thank you. But we are playing a weird game of "Figure out all the things that my kids and wife are sensitive to"
15:21
@piRSquared not much, usual complaints about work and its implied stress but things are cool actually :)
That sounds good (-:
@piRSquared it is. I went to Mulhouse last weekend for robot combats. The robot of my team was crushed the hard way
No wai... that sounds like a blast. Do you have video links?
@piRSquared man you are quick
Avant et après. 😁
there is a stream on the twitter link, not the one above but rather on the feed
the robot that blasted us is called widow-maker...
I so very much want to do this with my boys when they are old enough
15:31
Rude of the tournament organizers to place your bot in the Indestructible Murder Cube bracket and not the Papier-Mâché bracket
@Kevin it was not only papier maché , there was an iron grid below but indeed, it was funny but messy
You can say "chicken wire" instead of "iron grid", there's no shame in it
@piRSquared one of my mate came with his teenage son and younger daughter. They built the robot as a family, the dad doing all the technical work and the kids learnt to drive the robot
"Widow maker" raises many questions about the typical family structure of battle bots
@Kevin :45973986 fair enough, chicken wire is ok. :)
@Kevin the team that shattered us was a bunch of newly single again guys...
15:35
Hey now... 18 gauge Iron Grid sounds tougher
Ooh, that's a deadly confluence of free time and channeled anger
@Kevin indeed. but it was fun to do. We won the jury's prize
one year subscription to a technical journal
the peaceful robot
It was a real crowd pleaser when your bot's carapace ruptured and candy flew everywhere
@Kevin the crowd was rowring, honest
some people came to us, and said our message of peace made a difference amid the testoterone's robot culture
Reminds me of the fictional Great Outdoor Fight, a thousand-man battle royale mostly composed of rowdy tavern brawlers. One attendee in the most recent match was a master of Recumbent Tai Chi, a practice which has no practical offensive or defensive qualities.
Basically he laid down on the ground and made calming meditative noises until someone delivered a People's Elbow to his larynx
15:44
@Kevin aha
ooooo - headless blender...
blender -b -P /Users/Jenny/Desktop/my_script.py
@Kevin you been making any pythonic eye-candy lately?
Nay. I'm in my blue period, as in "don't hold your breath waiting for a new piece, because you'll turn blue"
15:59
in app.py:
@app.route("/this/place")
def this_place():
    return "<h1>hi</h1>"

@app.route("/ex")
def ex():
    return render_template('ex.html')
00:00 - 16:0016:00 - 22:00

« first day (3106 days earlier)      last day (2065 days later) »