« first day (3098 days earlier)      last day (1851 days later) » 
00:00 - 17:0017:00 - 00:00

5:02 PM
I was hoping I'd be able to recycle one of my SO answers about palindromes, but I can't find a close enough match. Oh well. ;) I can't think of a clever algorithm that doesn't produce strings & count them. But we can certainly do better than producing all p+q and filtering out the non-palindromes.
 
@PM2Ring Can we do that without finding all substrings?
 
ok room6, I need help. I asked our security/IT guy to open up a port on the server for me to serve up a dev flask server. Where he would've had no problem in the past, we now have a new parent company. That means, I have to articulate a case to use flask instead of the battle tested CGI script paradigm. The truth is I've yet to do something useful with flask beyond the basic hello world tutorial and I don't have the chops to articulate "Why Flask?" let alone "Why not CGI?".
So I need useful links so I can start making a case for using Flask to build apps instead of making a script/html/cgi combo
 
Wouldn't you need to open up a port anyway, even for a CGI script?
 
@PM2Ring Then here is my program. But it produces just twice of the answer and taking time. Can you make it better? I, as a beginner, may have used lots of unnecessary stuff.
def get_all_substrings(input_string):
  length = len(input_string)
  return [input_string[i:j + 1] for i in range(length) for j in range(i,length)]

def isPalindrome(st):
  st1=st[::-1]
  if(st==st1):
    return True
  return False

s="abba"
count=0
substrings=get_all_substrings(s)
print(substrings)
print(type(substrings))
for ii in range(len(substrings)):
  for jj in range(ii+1,len(substrings)):
    if(isPalindrome(substrings[ii]+substrings[jj])):
      count+=1
      print(substrings[ii]+substrings[jj])
 
@taritgoswami Yes, because for a given p we have strong conditions on possible valid q strings. Eg, if the current p="cat", then q can only be "tac" or "ac", so we just need to test if the tail of the input string contains either of those substrings. Using a data structure like Aran-Fey's that tells us the locations of each char in the string could make that process faster than using .index to search the whole of the tail.
 
5:13 PM
There is already one open dedicated to the task. I'm assuming we'd have to open up a NEW one for flask and that would require justification. It would be fine so long as I can intelligently back up what I want to do. @PaulMcG
 
I earned 20 points and now could comment in chat YAYYYY
 
And why can't you point flask at the existing port?
 
/shrug idk... that is part of me learning what is possible and what is not.
see there, you've already pointed me in a useful direction
 
Assuming there is not already a webserver listening on the existing port, you would do something like
if __name__ == '__main__':
      app.run(host='0.0.0.0', port=80)
 
@ksalf Welcome to the best chat room on SO. ;)
 
5:17 PM
But also, please review the warnings about running the development Flask server in production
 
*according to this chatroom
 
@PM2Ring: Thank you very much, Sir
@AndrasDeak - It is the best room sir, no doubt.
 
@ksalf we try ;) but there's no need to call anyone "sir" here, we're all peers
 
@AndrasDeak True. But when even chatrooms on other SE sites want to adopt some of our room rules, we must be doing something right. Right? ;)
 
5:20 PM
There is an apache server listening. question is, can I piggyback on the same port? Otherwise, I can open up another port while still having apache doing the listening? Should I have another webserver running wsgi like gunicorn? If so, what argument do I make that convinces that this is worth the opening up of an additional port?
 
@PM2Ring A man, a plan, a cat, a canal, Panama!
 
High-brow
 
@AndrasDeak: Got it. everyone is SenIoR here for me, shall try avoiding 'sir'
 
We all started as juniors of some kind :)
I'm not even a real programmer
 
except benjamin button
 
5:22 PM
@ksalf cabbage
 
@Code-Apprentice The famous formula 1 driver, yes
 
@piRSquared I got my earlier info from this, may help: stackoverflow.com/questions/20212894/…
 
@toonarmycaptain: cabbage :)
 
RE: chat. Rules are rarely what make things work. It is trusting the admins to administer fairly that makes things work. The same admins could make another rule set work just as well so long as the users trust them to make fair decisions. Good Rules + Bad Admins == Bad Chat
 
@AndrasDeak I haven't been elevated to a peerage. :p
 
5:24 PM
@PM2Ring I am not able to implement the concept they need to be non-overlapping.. can you check please where I need to change in my code? chat.stackoverflow.com/transcript/message/45898131#45898131
 
@AndrasDeak: I hope that I learn fast and become lke you
 
I'm certain you will
 
Thank you
 
(Not that becoming like me should be anyone's goal :P)
 
@piRSquared yay me for jumping into the convo without much context at all, woo! Uh, this apache server, are the config files under your control? apache can also run wsgi for flask if thats an option too.
Now, re: CGI, afaik the justification is usually about speed
 
5:26 PM
:P
 
@ParitoshSingh not under my direct control. But so long as I can articulate good reasoning, I can influence the controller.
 
in that case, the apache server would be able to run the flask work as a hosted app, without having to open a diff port. atleast production wise that would be the route to go. might make developing in that mode a pain
(or well, one of the possible routes)
 
that is a good approach (i think). At least that is what I'll try for first.
 
@taritgoswami I noticed that your code produces overlaps. There are a couple of ways to fix that. I'm still trying to think of the best way. It's a little hard for me to concentrate right now: it's 3:27AM, and there's heavy machinery 100 metres away building a tramline on the main road. It's so loud it's hard to think. :( I'm hoping that Aran-Fey will repair his code. ;)
 
@AndrasDeak I don't get it...
 
5:30 PM
@piRSquared flask.pocoo.org/docs/1.0/deploying/cgi very briefly mentions cgi as being the last option
there may be articles that elaborate on why. i myself do not know much there
 
@Code-Apprentice I heard a lot more about Jenson Button than Benjamin Button, even though I'm vaguely familiar with what the latter is about and what you were referencing
(not your fault)
 
Flask in production do no need a port, to be functional
https://vladikk.com/2013/09/12/serving-flask-with-nginx-on-ubuntu/

Ran it with 3 API'S, works like a charm
 
@Aran-Fey Maybe just a note about x = a or b working the same as x = a or b or c? Or stated that this is true for as many abcdef as you need to compare to? It seems clear enough to me, and I suspect would have early on too.
 
@AndrasDeak never heard of Jenson Button...but then I'm not a race car fan.
 
@toonarmycaptain It's not the number of ors that I'm concerned about, it's that that question is comparing multiple variables to 1 constant, whereas most people do the opposite - compare 1 variable to multiple constants. For us it's barely noticeable, but I wouldn't be surprised if some newbs are confused by that
They tend to insist that their "what's 1+2" question is different from our canonical "what's 2+1" question, after all (figuratively speaking)
 
5:37 PM
@piRSquared last ping promise :P docs.python.org/3.4/howto/webservers.html is a good read, last i looked into these things, this link didn't exist for python 3, it must be new-ish.
 
@Code-Apprentice I'm told F1 is not a huge deal in the US
 
no it isn't. We have NASCAR here
 
6:00 PM
@Aran-Fey Fair enough. Well, I think a note stating exactly that would suffice too, noting the if x == 1 is equivalent to if 1 == x and noting that the id/nature of the item is irrelevant except for what it evaluates to, that if a = True or a = (1==1), the if x == a is functionally the same to if x == True or something spelling that out.
 
6:16 PM
@AndrasDeak To be fair, neither is Football. Barbarians.
 
hi guys im looking for help about converting my iterative code to recursive... is there anyone interested :P
 
why would you want to do that, though
 
homework of course :D
im confused about desicion making with recursive form
 
alright then. someone might be interested after you post your code
 
cbg
 
6:30 PM
cbg
 
just don't post the code directly, use a code paste service
 
@Aran-Fey Sorry, not much in a position to give that much thought at the moment. I'm away for a few days.
 
Alright.
Room consensus was for Kevin's question to be reopened, so I suppose I'll just do that. Shouldn't do any harm.
 
6:53 PM
@And
 
you can edit/delete messages in chat for 2 minutes
today's xkcd is interesting for a change
 
@AndrasDeak i love voyager being thrown in there :)
 
@AndrasDeak ... unless you are in Austin, only F1 site in the US
 
7:09 PM
cbg
 
@PaulMcG I did not know this. I don't care for F1 much, though.
 
@piRSquared Is the Flask App for internal use? Where is the server?
If you're trying to make an internal app and demonstrate that it can actually be useful - and there are people willing to actually test it out, you can always just launch on your local network on host 0.0.0.0. In fact, that's always been my approach against pushback for something new
 
@roganjosh the server is an internal intranet
I need to build an app that accesses databases on the domain. Our IT is supportive so this will get done. But I have to be prepared to defend my choices with more than "All the cool kids are doing it"
 
Can the DB endpoint only be accessed in-situ then?
 
Yes, but not without tweaking
I'm on a windows machine that cannot access them directly. I run my python on a remote server that has access
 
7:22 PM
I think hooking into Apache might cause headaches for you if you're just starting out with Flask. Gunicorn is ridiculously easy and it detaches your work from from anything else utilising the Apache server. You can make all the justifications for Flask that you like but people will be watching and you will almost certainly make mistakes somewhere. It would be better to isolate your app as much as possible IMO
 
I can kick off a dev server on the remote machine but it requires that I punch open a port which is the source of the problem and questions. If I could do it on my personal machine, then there would be no problem. So I've got someone who will show me how to configure a VM with the same settings as the remote machine.
But eventually, we (royal we) want to move this direction anyway. So setting it up on apache will be in the cards.
 
Sure, I just mean that it would be best to isolate it because anyone with objections will use any honest mistake while you're trying to learn new tech
 
too true. I'll take that advice
 
re apache, once you get to it, take a look into mod_wsgi. It was a fairly pleasant experience for me, and i myself didn't know much about anything when i looked at it
 
that is encouraging (-:
 
7:31 PM
@ParitoshSingh You generally use the Apache stack then vs. Gunicorn + NginX?
 
we generally have headless chickens, including myself, who refuse to switch off of windows
 
Yeah, the fact that Gunicorn doesn't work on Windows has been quite a bugbear for me
 
so, pretty much yes :P since windows, and servers, when no one had anything set up, the only one that made things easy to figure out was xampp.
and that introduced us to apache
 
Though, thankfully, I've not really had many surprises from going from dev server on Windows to gunicorn on the linux VM
 
hi.. how can I dynamically update a plot in matplotlib? See this example bpaste.net/show/c6a41eab298c. I would like the updates to be in-place
 
7:34 PM
I think here we're iteratively figuring things out. Our first project that required servers was done with CGI on xampp. Now, its apache (because xampp on windows was only 32 bit apparently. didn't sit well with python 64 bit, and i didn't want the entire python stack to change) with mod_wsgi.
and project 0 was outsourced ui work to php. we do not talk about it anymore.....
 
haha
 
@Anush hb = plt.bar(...) then use methods of hb, things like hb.set_data etc.
various pyplot objects have various methods you can use to update, you need to look at the docs and maybe their methods interactively
 
Reopening Kevin's question didn't work out so well... got re-closed 7 minutes later
 
Ugh. Then again I guess there's no reasoning for it being open if you happen on the question...
I guess we have to wait until Martijn has the time to check it out, and either leave the status quo or reverse the dupe
 
@AndrasDeak ok so I don't have to use FuncAnimation ?
 
7:36 PM
@Anush you can if you want to, in which case this mutation will have to happen inside the function passed to FuncAnimation
 
@AndrasDeak I am really just looking for the simplest possible method currently
 
@Aran-Fey ah, Jean-François
 
@AndrasDeak if I use methods of hb, how does the image get shown/updated?
I can't use plt.show()
as that makes the system stall
I mean until you close the window
 
@Anush You can't, but plt.draw() or fig.canvas.draw() will work
 
ah ok
let me see
 
7:38 PM
alternatively, enabling interactive mode via plt.ion() at the start might also work
 
@AndrasDeak cool.. let me try that first in that case
 
@Aran-Fey I'm going to ping him in comments with a link to the discussion as an FYI
 
Please do
 
i am having such a hard time figuring out how to use Sphinx/autodoc/autosummary
 
It isn't easy
 
7:43 PM
here i was thinking "oh my docstrings are pretty detailed i'm hardly going to have to do anything!"
 
gotta love good doc strings though
 
@AndrasDeak I gave it a go but I am not sure how to set the new data. I tried bpaste.net/show/f30a5aac3e30 but hb.set_data doesn't exist sadly
 
@AmagicalFishy this is what I have in an rst titled returns.rst that is referenced as returns in my index.rst
Function Summary
----------------

.. currentmodule:: returns

.. autosummary::
   :toctree: generated
   :nosignatures:

   get_period_returns
   get_returns
   get_returns_sync
 
@Anush so you need to look at the docs as I said
 
Where I list the three functions that I want docs created for get_period_returns, get_returns, and get_returns_sync
 
7:49 PM
@AndrasDeak ok thanks. I have attempted to find the right page
 
once I run sphinx, it creates three files in a directory title generated. One for each of the functions.
 
how would you, for example, go about getting autosummary to display the method differently?

say:

.. autosummary::
...

file.get_period_returns
 
the contents of one of those files returns.get_returns is:
returns.get\_returns
====================

.. currentmodule:: returns

.. autofunction:: get_returns
 
did you write these .rst files manually?
 
returns.get_returns.rst was autogenerated
 
7:51 PM
so i've gotten that far, but let's say I want "get_returns" to say "FooBar" on its link in the table that's generated
 
@AmagicalFishy I'm not sure what you mean by differently
@AmagicalFishy hmm name the function differently (-: otherwise I'm googling for an answer
 
so I have something like:

```
.. autosummary::
:toctree: module_name

module_name.model.model_1
module_name.model.model_2
module_name.model.model_3
```
and the table that's generated displays "module_name.model.model_#" for every entry. i'd like it to display only "model_1"
another problem i'm having is, since i'm using Django, all the models are inheriting from django.models.Model---and all of those inherited methods are showing up in the documentation
i only want the methods/attributes i've defined in the file to show up
(also, the table of contents has something like:

module_name.model_model_1
module_name.model_model_2
module_name2.model_model_1

and i'd like it to show:

module_name
----models
--------model_1
--------model_2
module_2
----models
--------model_1
i've been searching through the documentation quite a bit and am having a hard time understanding even the basics =/
i could go through each file and delete all the methods i don't want to show up
but that like... hardly feels automatic. i might as well just write the stuff myself. =/
 
8:12 PM
Huh, all day I've been trying to get to grips with inventory management where I'm at and everyone has scoffed at the pathetic-ness of the barcode scanner. $250 for a Tamagotchi!
Brought it home to play with and the driver installer says "Successfully installed!" before then opening the installation wizard. That company is making a killing on their products if they can charge this much for little effort.
 
Sounds fair enough
 
8:33 PM
seems like opinions are divided on the post
 
Hi someone knows if in eclipse we can debug only one function in debug configuration with pytest? thx
 
FWIW, Kevin's post is "how to test a variable against multiple values", while the other one answered by Mj is "how to test multiple variables against a value". While the content covered is the same, the perspective is different
Just my 2c, feel free to consider/ignore
 
that's exactly what Aran has been saying :P
 
so you'd be in favor of reopening Kevin's question, is that right?
 
his point being that Kevin's version is more likely to come up for noobs
 
8:36 PM
yeah, I agree with Aran then, they could both stand to be left open
 
greetings boys
 
@ExoticBirdsMerchant or non-descript green blobs
 
that to! i could be my sign
 
I think Kevin's post should be kept open. I have used Martijn's answer multiple times for a CV but I agree that it never really covered what I wanted to convey properly, while IMO Kevin's does
 
1 min ago, by coldspeed
yeah, I agree with Aran then, they could both stand to be left open
*Rawing :P
 
8:39 PM
Who dat?
 
you claim you don't know who this person is, but
Jul 22 '18 at 19:34, by Aran-Fey
>>> os.listdir(r'C:\\\\\Users')
['All Users', 'Default', 'Default User', 'desktop.ini', 'Public', 'Rawing']
you have them listed in your Users directoryyyyyyy
 
must be a hacker
 
seems legit.. ;D
 
9:00 PM
Hmm, I've changed my mind about this $250 tamagotchi. It's got some pretty cool features and keeps giving me reassuring beeps. I'm kinda glad I smuggled him home from work; I don't wanna have to take George back :/
 
Huh? You need to feed the barcode scanner?
 
He's currently on A-grade USB juice
 
I mean, what makes a barcode scanner a tamagotchi? :P
 
I like the fact that he beeps when I open the synchronization menu and one of the options is to make him beep more
 
You named a bar code scanner?
 
9:07 PM
The fact it's literally the same size
 
aaah...
 
And has a 1990's digital display
 
smuggling wasn't that hard then :P
 
Nope, pocket job, and a pilfered cable tie for the ridiculous connector (thankfully I'm in the Electrician's office so they're abundant enough)
It's kinda a good job I did because he was set to auto-update to a file that would be loading the scans into our crappy DB
 
who set it?
 
9:11 PM
The same IT department that has become my absolute enemy. They dropped this project 8 months ago and I'm nearly done with the one I'm on, so I'm turning my gaze elsewhere
 
I imagine Sauron...
 
Sadly the head of engineering has said that he will declare that I'm gonna work on this project from the very start, rather than let me get half a system set up before I start work on it
But for now I just need a prototype up. I have a few days to get that running. IT will do everything to shut it down
The last project I managed to push past the point of no return before anyone knew about it. Then they'd look foolish stopping it. This one is... on shakey ground if they know from the start.
 
Ah, yes. The old "different divisions within the company trying to break each other's neck" deal.
the best way to maximize profit and productivity
 
The problem is that the IT department does nothing and has got away with it for nearly 30 years
So we have George, the barcode scanner, and an Engineering stores with thousands of items. We have no system to manage stock. Literally none. Nobody knows when stuff enters of leaves or when things need to be ordered
 
@taritgoswami Sorry for the huge delay. And I'm sorry to say that I didn't have much success. My theory didn't work out so well. :( Eg, if p='abb' then q can be any of {'bba', 'ba', 'a'} or s + 'bba', where s is any palindrome. I tried a few things that almost worked, but my code was getting rather messy and complicated.
So I just wrote a program that does a brute-force search. It uses a generator to make substrings. You may find it of interest. See gist.github.com/PM2Ring/a9a677b31a93b6ae787a33d8375316ca
 
9:16 PM
@roganjosh how does that company even work still?
 
IT hooked the scanner up to the AS400 8 months ago and just dropped the project. You can scan barcodes and they go somewhere but even the store manager can't see it
 
Why has whoever's the boss of IT accepted this for 8 months?
 
@AndrasDeak margins are good. Waste is ridiculous, but not quite enough.
Family company, nobody ever leaves. There's a good trick in just saying "it can't be done" and everyone just lives with it.
 
so...incompetence
 
Yep
George is my new pal, he's gonna help me lay the next paving stone
And, thankfully, very easy to use. I just have to remember all the settings that IT set him up with to keep reverting him back when I'm done testing :P
 
9:21 PM
subterfuge!
 
Literally no other way, sad to say
The second in command of IT doesn't wanna lose his £120K a year
 
stackoverflow.com/questions/55621280/… This is an interesting newbie mistake. It appears that the OP expects the input string to have the r'' syntax that we use in python code.
 
I'm not proud of that code I just posted, but at least it works. Even if it does have quadruply-nested for loops. :cringe: I think this is the 1st time I've booted up this machine this year. And the 1st coding I've done since November. Even my muscle memory felt like it was in an unfamiliar place.
 
It's a fairly common problem, but I never found a dupe I was happy with
 
@Code-Apprentice that's why one should not call raw string literals raw strings
 
9:24 PM
@Code-Apprentice I'll look at their question in a minute. But it's not that unusual to get questions asking how to turn an input string into a raw string.
 
> !NOTE: IN CASE OF OLD COMPILERS REVERT TO THE ABOVE COMMENTED CODE!!!!
I was wondering who the yam made that refactor. Good thing I keep a changelog; it was me (4 years ago).
 
"Who does this guy think he is?! Oh..."
 
It was more like "I hope this guy knows what he's doing". Oh well :D
 
:P
 
@PM2Ring the OP of that question was trying to concatenate an r to an input string.
 
9:29 PM
A question.
 
@Aran-Fey I've seen Martijn answer such a question, but I just tried looking for it without success.
 
Apparently I had profiled the code and this was one of the performance bottlenecks. Replaced 20 lines of a spaghetti double-loop with two calls to a fortran95 intrinsic. Good job me, I dearly hope I tested it properly.
 
@AndrasDeak what's this "changelog" you mention?
 
so you have to do a list of lists
 
9:32 PM
@roganjosh: API Connection sir, i will fetch data from flask rest API
 
So via AJAX?
 
yes, sir
Sorry for replying late, i just could not see where I posted my earlier replies, it's all gone!
 
They got moved to another room because it looked like you were just asking about JS
 
@lmao that's because you are asking a JS question in a python room...
 
@roganjosh I'm still not convinced to be honest, but yes
 
9:34 PM
Ooh, I am sorry
 
But, what is the core of the AJAX request to Flask?
@AndrasDeak IMO benefit of the doubt here. I think I know the issue
Or actually, can you just console.log the response?
 
FWIW a username of "lmao" will strongly diminish my initial levels of doubt
 
diminish doubt about what?
 
upon dragend event being fired, i'll send location to API and in turn get values for centre...centre in google.maps...i need to to use this centre and store it in array
 
Diminish doubt about guilt. I understand "benefit of the doubt" as in "doubt that the accused is guilty".
 
9:37 PM
like ar(lat, long)
in short i need to know a tuple equivalent in js, if it exists?
 
@lmao you're jumping ahead a bit here. I'm trying to get us to a base and work through from there
 
never thought about the idiom, though
 
Lmao is like 'laughing mao'
 
the phrase "benefit of the doubt" implies that there exists doubt about some negative assertion. The benefit refers to leaning towards a more positive assertion since doubt is present. By diminishing doubt, you also decrease that benefit.
Hope that clears it up (-:
 
Firstly, does your Flask server respond and secondly, can you console.log the response? It's pointless to discuss this particular issue further if the server doesn't respond because the issue is upstream
 
9:39 PM
@lmao Mao?
@piRSquared not really, but thanks for trying ;)
 
everything is fine , server responds nicely
I can see the response as well
 
see the response where?
 
on my console, sir
@AndrasDeak: Yes sir, laughing mao!
 
No need to refer to me as sir btw, I'm not sure I live up to the title :P I need to refresh my memory of the issue, 1 sec
 
ok
 
9:41 PM
@lmao I'm not sure if that's better or worse
 
@AndrasDeak: If it makes people smile, it's always better!!
hahaha
 
Right, so what do you get from console.log when you catch the Flask response?
 
@roganjosh this is your third time asking, correct?
 
As was already mentioned, you can't have tuples but can JS understand the response?
@AndrasDeak it is, but the OP is also being distracted
 
an array, containing name, other fields, lat, lon...
 
9:43 PM
@roganjosh I'll choose to ignore that hint :P
 
Ok, so you have the full communication link set up. You decide what gets sent back to JS here. What structure does your view function create?
 
{name:'lmao', age:'19', lat:31.9807, long:121.7689}....like that
 
@AndrasDeak not really a hint to anyone, it's still light-hearted, just that I can see why they might miss it :)
@lmao is there a reason you need to send it back in that structure?
 
yes, sir, i need to store it in my array in js
and append the values fetched from api, as the user further traverses the map
 
Why not send back [[31.9807, 121.7689], [...], ...]?
 
9:46 PM
What I am not able to do is create a tuple kind of thing in js
+ 1, sirrrr, that is what I did not think of
I need to restructure my response, thank you
 
No worries
 
1 more question
 
Sure
 
If i am booted out of this room
How would i know it?
Will I get a message or something?
 
you were not booted out. Only the comments asking about JS that seemed not to link to Python
And "booted" is probably too strong a term, sorry
 
9:49 PM
When my messages disappeared, i thought i was booted out, so was just wondering what happened
ohh ok
 
you'd get a message and wouldn't be able to come back for a minute
 
I'm not a moderator so I probably shouldn't comment on the in's and out's, but we've probably all had comments "booted" (as I put it).
 
Ok, i get it now, I hope I'll never be sent out, for that would be a Mt Everest of insult. lol
 
Insult to you or to us?
 
Me of course!
 
9:52 PM
if you listen to what people are telling you it won't happen
 
Which you did
 
eventually
 
I will listen to everyone, all the time
 
the moved messages suggest otherwise [edit: the original message this was in response to used the past tense before being edited]
there were multiple signs, explicit and implicit, that you seem to be asking a pure-JS question in the python room, something we frown upon
but there's no harm done, just pay more attention going forward
 
There was one question from the OP in all of the messages and we did pull it back on track and it became a reasonable discussion
I'm not sure there's need to reprimand them more here
 
9:56 PM
I'm glad we agree
 
Yeah, i do accept my fault there, I was thinking that I must quickly convey my problem to you guys, and missed the warnings
 
never be in a rush when asking for help :)
 
Very true, shall not repeat it next time
 
Not even for the benefit of others. The good thing about SO chat is that it's permanent so messages stick around. You can take your time.
 
In any case, the issue wasn't what I anticipated so we'll see if |safe needs to crop up later (since I presume you're going to try plot those points).
 
10:48 PM
Just seeing this:

https://www.sciencenews.org/article/black-hole-first-picture-event-horizon-telescope
 
11:00 PM
o/
I'm having an issue with some file generation, my script generates two txt files with the same name
for highlight in highlights:
    bookTitle = highlight.split("(")[0]
    bookTitle = bookTitle[:-1] + '.txt'
    with open(bookTitle, 'a') as bookHighlights:
        bookHighlights.write("\n" + highlight)
 
how can two txt files have the same name?
different directory?
Taking one step back, what exactly is "the issue"? What should it do and what does it do instead? What is highlights?
 
no
highlights it's a list of strings
here is the test file
Marele Gatsby restults in a txt file Marele Gatsby.txt so does Sarpele
 
yup, as it should
 
But for Efficient Android Threading I get two files
 
Sarpele should be doubled too
 
11:04 PM
highlight is the text between the =====
It's not, for sarpele I get the data in the same file
 
Oh, I see, you're appending them. So what are the two filenames?
 
I duplicated the data for Marele Gatsby and it got into the same file too
Yes
Which two files?
 
nevermind
 
Sorry, I'm a little tired
But I don't get why it's generating the same file twice :(
 
In [178]: s1 = 'Efficient Android Threading (Anders Göransson)'
     ...: s2 = 'Efficient Android Threading (Anders Göransson)'
     ...: print(s1 == s2)
False
non-printable characters
In [180]: len(s1), len(s2)
Out[180]: (48, 47)
I copied those two strings from your test file
 
11:08 PM
But I use highlight.split("(")[0] which get's me just Efficient Android Threading'
 
In [183]: s1[:3]
Out[183]: '\ufeff\ufeffE'

In [184]: s2[:3]
Out[184]: '\ufeffEf'
@grrigore it clearly doesn't
 
hmm
So there is something before that
 
In [187]: unicodedata.name(s1[0])
Out[187]: 'ZERO WIDTH NO-BREAK SPACE'
two in front of the first title, one in front of the second
 
What IDE are you using?
 
ipython
 
11:10 PM
I'm using atom, I just wanted to do this stuff in python, but I don't see any debugger here
 
pdb is an stdlib debugger, I prefer pudb
 
It's there a way I can check if there are things like '\ufeffEf' before my string starts?
 
probably, though you'll have to ask yourself how you want to define "things like" that
Non-ascii? Non-printable? Non-valid as a file name?
 
Hi there
I'm getting following error in python
TabError: inconsistent use of tabs and spaces in indentation
``` >>> for iteration in range(100):
... print(iteration)
... df[iteration] = df.sample(1000)
... mean[iteration] = np.mean(df[iteration]['Price'])
File "<stdin>", line 4
mean[iteration] = np.mean(df[iteration]['Price'])```
 
Fromat your code
 
11:16 PM
I'm using vim
Is there any way to format there
 
yes, please see sopython.com/wiki/…
edit -> highlight -> ctrl+k usually works; triple backticks never do
 
@AndrasDeak Hmm I Googled and it seems to be something about encoding
 
Anyway your error is clear enough: you have a mixture of tabs and spaces. Get rid of the tabs.
@grrigore probably not. Just a copy-paste from some website that injects zero-width spaces. Happens in SO chat too occasionally. Should go away if you don't copy-paste content into your input.
(I'm only saying this because of that)
 
well the txt file is from my kindle
 
I am not copying and pasting
 
11:19 PM
@Yatshan not you, sorry
 
I am just typing in vim with own
 
actually, not sorry: I specifically pinged grrigore with that message...
 
Cool
 
@Yatshan I have this in my .vimrc:
autocmd FileType python setlocal expandtab shiftwidth=4 softtabstop=4
 
@AndrasDeak Thanks will have a try
 
11:21 PM
if you press tab you get 4 spaces instead
you can use :set list to see non-printable chars in vim, tabs show up as something like ^I
 
MacPro doesn't have any vimrc file
So I have to create a new one and source it
 
I'm not sure you have to source it, vim should look for it on its own in your home
actually, it's not valid bash, so you probably can't source it
 
.replace("\ufeff", "") # Replace broken BOM this was the solution :) thank you, @AndrasDeak
 
@grrigore hmm, weird. I didn't know the BOM is the same as a zero-width space, and I don't see why there would be a varying number of BOMs at the start. Oh well.
let's hope other kind of non-printables don't show up later :P
 
Hope so :D
Have a nice day/night
 
11:27 PM
you too
 
00:00 - 17:0017:00 - 00:00

« first day (3098 days earlier)      last day (1851 days later) »