« first day (3415 days earlier)      last day (1758 days later) » 
04:00 - 19:0019:00 - 23:00

04:53
@roganjosh Thanks a lot, I will check it out :)
 
3 hours later…
07:45
@roganjosh dude! that is amazing! Seems super helpful
I wonder if you or someone else has something like that for UI itself. I have a mental roadblock with how to get a UI up and running from scratch.
08:15
@ParitoshSingh huh, I just thought it was a collection of my ramblings in JS :P I'm not sure I have a UI template (you mean a default css?)
Indeed, something that works even if i don't really touch the css :P
sighs that would be the dream.
There are tonnes of free ones online but I scrapped doing that because I ended up getting boxed in. My own in yam and stitched up, so im not sure it's helpful
Bootstrap is the starting point :) from there, my css goes downhill :P
I will take a look at it once i feel brave enough. I've never actually done it, build a UI that is. Just makes me squirm and run away
Give me something already built to modify? sure, i can do that. Especially the JS and ajax logic. But i always relied on my colleagues for the real heavy lifting.
However, i'd like to change that sometime.
08:36
..eh. maybe some other time.
Sorry, got a call from work. Internal server error fun. Bootstrap is remarkably simple for front-end. The only thing I have css for, really, is a collapsible side bar
My only real gripe about bootstrap is that the Ui is balloon-ish. Sometimes I want to pack a page with options (like a table with 50 products that each have 5 config variables for the model i run) and even table-sm is big
09:15
ok, no problem
@ParitoshSingh This is base.html, sidebar.html and my custom css style-jpilkington.css. Between them, I think that will give you a basic site with a collapsible sidebar with bootstrap 4
One that will work on mobile too
devise a plan to migrate bootstrap to primeng.
Oh wow, thanks a bunch!
@SaisivaA That's Angular?
yes, ofcourse
09:18
Well, that's no good for me because I use Flask
Based on the environment need to build the project in respective servers(tomcat, aws, unicorn....)
so you can start project with angular and flast combinations.
*flask
@roganjosh ./confused. angular would be on the frontend, just like bootstrap no? So, no real relation to flask
I was playing with React earlier this week and that was enough wasted time
@ParitoshSingh It would require you to API-ify your entire backend and ditch render_template
For no discernible benefit that I could see over using Jinja
oh, i see, i didn't expect it to work that way. I thought it's essentially same as bootstrap, you just import angularjs (which i understand is a flavour/implementation of angular)
yap, prefer to work on flask for both ui and bussiness logic like a dichik dichik.
09:24
But having said that, i have no idea what's what when it comes to this stuff
Feb 17 at 21:26, by Code-Apprentice
@roganjosh yah, mixing React with some templating language is a path to misery
In that case, that's great!
Let's me cross off a few things that i was always worried i'd have to learn :P
:P
I gave it a good day and I can see how React can help for certain setups, but it was totally pointless because I could already do everything it allowed... in a single framework. Angular, to my understanding, goes one step further so I'm ruling it out by default
10:13
Huh, I've been sceptical at-best about emotional support animals but an emotional support honey badger would be remarkably effective
10:28
how to find all my last msg in this room ?
you can always use the search, top right. There's also a "load to my last message" button if you scroll up as long as it's not too too far back
10:48
@ParitoshSingh thanks
11:23
@roganjosh that's because you don't have a dog :P
Fresh cabbages everyone!!
11:38
@AndrasDeak sure, a dog would be comforting. But will it strike fear in the hearts of people bothering me? We need a honey badger for such things
I feel bears are the perfect example, most people find them adorable, there's even teddy bear, but they are frightening, strong, and thirsty.
Pretty much like nesting for loops. Some people say wow, such complexity, much data science, but they are killing machines
Julia arrays are 1-indexed. :(
I'm told black bears are mostly teddy bears, brown bears are less so, and grizzlies are as fearful as honey badgers
@ParitoshSingh that's not really a deal breaker
MATLAB uses the same 1:end notation and it's fine
the problem would be 0-based with inclusive bounds or 1-based with exclusive bounds
I see. Debating which language should i branch out to, alongside python. Just one of those fridays i guess. Too much time to think on what all stuff i should have been working on. not to mention, learning things on the UI side, maybe picking up a new project to work on, and maybe starting some new courses
bet you 10 bucks the day will end and i'd have achieved nothing. :P
Julia seems nice because it's high-level and almost as readable as python from what I can tell, and it compiles your functions for you. And its grammar is much more powerful. The downside is that the community seems much smaller, and I don't know how general-purpose the available library ecosystem is. I suspect its forte is data-oriented.
11:47
Aye, first glance it seems to be focused primarily as a statistical and data analysis language.
Yeah, I was reading an article on how feasible it is for Julia to become a core tool for data scientists, but for the 3 pros, there were like 10 cons and it concluded it was better sticking to python
Well new contenders will always be in that situation. Python has become inevitable in data processing.
I think the big things going for python are that it's already "existed" for so long, has such a good ecosystem, and doesn't have too many "deal breakers" or obvious flaws for contenders to latch onto.
I played with Julia exactly once...but I decided that I'm not bored enough to learn a new (and markedly non-python) language just for the heck of it
Which means all contendors have an uphill battle if they wish to do anything about it.
11:51
it only needs a critical mass of users and active community members to suddenly make most of those cons go away
@AndrasDeak Yeah, but it needs to also have the starting support, I mean the investment/resources necessary to survive until it can achieve this critical mass of users. Feels like trying to compete against coca-cola/pepsi in their own game.
12:04
@ParitoshSingh join me with kotlin :)
kotlin, kotlin..rings a bell. Isn't that for android?
It's also completely compatible with java and they're working on kotlin/native which will compile to any OS
So you could have a core project that compiles to Android and iOS. It kinda half works but being actively developed
Which half works? Android or iOS? :P
12:08
The important one :P
You are a brave man roganjosh :P
Bring it. Honey badger also doesn't appreciate Apple
cbg
Am I just being trolled here
@roganjosh I think they're saying that the =y part is being generated by whatever
i.e. XY problem
12:23
yeah, i don't think you're being trolled
perhaps BooleanField('student_account') defaults to y in y/n
more to the point, student_account = BooleanField('student_account') ..uh kevind
Aha, thanks. I definitely didn't read it that way round
Do you think that's an MCVE?
doesn't look like it but I still don't know any web stuff
Let me re-read now that you've set my perspective straight
Yes it's an MCVE for a non-issue
12:25
OK
oh, it's a checkbox, and they want 1???
Yeah. It makes no difference because an unchecked checkbox won't come through on a form and so you only need a truthy value
value is the name that appear in the html
Sounds like they just need that part told to them in that case.
I'm on a phone, feel free. I've retracted my close vote
12:28
@roganjosh at best, i'd be copy pasting what you said right here, with ofcourse no idea whatever i actually "pretended to write" actually meant.
also suspicious that their class='whatever' works...it should be a SyntaxError. Pythoff perhaps?
no, it's also a syntax error on 2.7...
@ParitoshSingh lol ok, I'll answer it shortly if it's still open
Can jinja fix that?
{{ form.student_account(class="form-control") }}
if that gets executed in python it should be a syntax error...
That's valid in jinja
that's a very good question. Im assuming the answer is yes, but still, good spot
12:30
>>> def foo(**kwargs): pass
...
>>> foo(class=3)
  File "<stdin>", line 1
    foo(class=3)
            ^
SyntaxError: invalid syntax
Nah, its enclosed in {{}} so the jinja parser handles it
weird, thanks
Its actually the only sane way to pass bootstrap classes (form-control) to jinja to be rendered
Jinja is hella complicated, though. The tracebacks are epic so I couldn't tell you exactly how it does it
I vaguely remember i had to build a mental model of 3 stages of parsing when templating was involved before i could make sense of what all was going on with jinja. Essentially, jinja can intercept and do some additional work before handing off stuff to python
It was a nightmare and a half to understand when it went wrong. It rarely went wrong though
@roganjosh rofl, this!
@ParitoshSingh sometimes you think you've set off some nuclear bombs for a missing comma :P
12:41
@roganjosh Seen this question before, still don't get it. Why does the OP insist on setting it to 1? There is no code at all showing how they got there. Is the "y" even a literal "y" input, or just some normalisation of any Y/y/Yes/yes/1/True/true?
And now we'd be asking about the X in the X"y".
waits for applause...*crickets*...uh, i shall take my leave now.
No idea. Like I said, as far as I'm aware, it's a non-issue but maybe I'm overlooking something. I'm still debating whether there's value in stating that explicitly to the OP or whether it should be closed. I retracted my original vote, though, because the question read as nonsense to me pre-edit
I admit to having literally no knowledge about wtforms, but if a truth'ish boolean field is printed as "y", usually that's fine.
Exactly. It only needs to be truthy
according to my google foo, BooleanField only knows false-ish input and the rest is truth-ish. So there's a good chance it doesn't store its actual "value".
12:48
Because of HTML weirdness (or maybe it's my brain that's weird?) an unchecked checkbox doesn't get submitted with a form. Or perhaps I'm just setting the form up incorrectly. To me, the form should submit a falsey value for an unchecked box... instead I just don't get the field at all
do you use wtforms as well?
I think there's madness in even trying to understand HTML tbh, so weird things will necessarily cascade into libraries that have to deal with it
@ParitoshSingh almost never. I have a couple like for a login form. My own site's "contact me" page is a WTForm, but that was purely because I hedged my bets on it doing something more securely than me that I'm not aware of
Ah. So, i think it might be wtforms doing something that native html doesn't. I vaguely recall html doing the thing you did, where the checkboxes never show up on the backend unless checked. But, "pure speculation", i think maybe wtforms does let the information flow to the backend? It seems to indicate as much based on the docs
now, trouble is, I am already basing all this on speculation, and there's a point after which that probably becomes actively detrimental.
Basically, im telling myself to stop. send help
Nobody knows where discussion of HTML becomes detrimental because you're starting from a "wut?" basis
I mean, im just glad it's not html and php that we're talking about here at the same time. goes down memory lane...shudder
13:01
After an obligatory look at some source code not meant for mortal eyes, I am at reasonably sure that "y" is the default value. If the OP wants another values, they have to set it. d'uh.
There's an ancient table in my project database that stores bools as "Y" or "N" and it makes 75% of all ORMs barf and die trying to read from it
"That's actually a fairly typical design choice for beginner-to-intermediate sql developers, so most ORMs should be able to handle it", you hypothetically say? Well, blame our 25% success rate on the cursed burial ground the server was built on top of, then.
13:25
Hi everyone!
Greetings
i dont remember how right know, but hey buddies, anyone knows how to make a new list of a list sliced every 15 elements?
sorry i dont know how to explain it perfectly english
for example from a= [a,b,c,a,b,c,a,b,c]
You can specify a step argument when slicing a list. Example:
>>> seq = list(range(100))
>>> seq[0:100:15]
[0, 15, 30, 45, 60, 75, 90]
i want to do total = [[a,b,c,],[a,b,c],[a,b,c]]
Oh, I misunderstood the question.
There's a link to this kind of problem in the wiki, let's see...
13:27
no, because im just getting the 15 element, i need make a list of the 15th element
sorry my english is not good, im trying to explain as much as i can
>>> [seq[i:i+15] for i in range(0, len(seq), 15)]
[[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14], [15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29], [30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44], [45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59], [60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74], [75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89], [90, 91, 92, 93, 94, 95, 96, 97, 98, 99]]
^, iterate in steps of 15, and slice as you go.
Zip iter multiply trick ftw ;)
That changes the type, though...
13:33
Hmm, I think I'll edit the canon so the #Or in Py 3.x, just use: segment is the uncommented one
ok buddy, you saved my life
at the end cannot use it because i though the patron was every 15th but is irregular... but i tried jaja
but thanks you so much, have a good day all of you
@M.Mariscal side note: I know this is a language thing, but you should know that calling people "buddy" comes across weird
oh sorry friend
i will keep it in mind
I don't know if this will help, but sometimes I find itertools.groupby useful for separating chunks of data that have irregular size
13:38
cool i will take a look
@M.Mariscal if you can tell the sizes in advance you can use iter(lst) and islice in a loop
it = iter(data)
chunked = [itertools.islice(it, length) for length in list_of_lengths]
Something like that
Isn't this the canonical?
i would think so yes...
13:49
Yeah. If you're looking for the edit I promised, I meant I would change the recipe on the SOPython wiki.
Ah, ok, I got muddled sorry
Oh,the WTForms question got answered. All good :)
14:37
Cabbage all
cbg
I'm worried that the UIs I design will look weird on different screen resolutions. How do I get good at this?
Currently going with "accumulate 20,000 hours of experience via trial and error" but I feel like there's probably a better way
Let's speedrun this mother
Buy one of every device capable of displaying your UI and test accordingly
You'll need elves and such
That improves the 20k hour route, certainly. Right now I build, deploy, and wait two weeks for a user with a small phone to complain. If I had a small phone, then the feedback is much more efficient.
I bought a lenovo laptop with super high res display and nothing renders correctly, everything is tiny and I have to find flags to manually adjust everything, I am using Ubuntu desktop so that may have something to do with it as well
14:48
UIs built in what?
HTML, primarily, but the wisdom I seek should be applicable to anything.
If it's tkinter/pyqt, I have nothing to add and I'll just slink back into the darkness
I use several sites that have custom scrollbars that are a third the size of normal scrollbars for no reason. I can't click on them half the time, and I hate it very much.
The worst culprit styles it as a rectangle that's about 10px by 5px
In that case, chrome allows you to view sites in lots of resolutions. I can't remember off the top of my head whether it handles multiple different desktop resolutions
I'm 95% confident than it does, though, in F12
F12 and then there are a bunch of icons on the very top of that panel on the left hand side
what about just zooming in and out
14:55
That's not concomitant to screen resolutions I don't think
My bad, 10x5 was an overestimate
I suspect Tapas' main demographic are phone users, who don't care about scroll bars since they navigate by swiping. Desktop-friendly access is an afterthought.
So, lesson 1: don't do this ^
15:12
@roganjosh is your site cross device responsive or compatible whatever it's called?
@Dodge the site I have on my SO profile doesn't even work on my new laptop without potentially triggering an epileptic fit :P The one I've built at work generally works on most devices, but I gave up supporting mobile views
I screwed up somewhere on my own site and the sidebar has some kind of conflict so, depending on resolution, the text vibrates if you try open the dropdown
Ah, I was thinking the one you've linked here. I was going to ask if you wrote the JS to do the resizing etc. I have a site and that is something I happily cargo culted, for now. I think one could make a career out of that sort of thing but it is so tedious and boring.
As I look at it now as much of the resizing is done with media queries in the CSS as what is done in the JS. At any rate, not terribly exciting work I don't think.
I rely on bootstrap to do most of the work. I've yammed up somewhere on my own site but got it working on my work dashboard. That's the fun of cargo culting front end stuff :P
creating a UI == Fun, making it work everywhere != Fun
Pretty much :)
An extra fun part was finding that all my IE horrors (it obliterating the UI) was because I forgot <!DOCTYPE HTML> at the top of the base template
People actually choose to do this as a job... no thanks
15:28
Yeah, IE doesn't count. I am currently working through grad school and notice that every single expensive UI for all of the fancy university services is only really supported on two browsers, Chrome and Firefox. The people who build those interfaces are total professionals and basically refuse to guarantee functionality anywhere else.
Hey, each to their own. I have a lot of respect for front-end devs that make stable sites because I know just how monstrous the issue is.
Not just monstrous, but horrific to debug too
I want to qualify my statement that aspects of web dev are terribly exciting by saying that many things that I currently do and have done are not terribly exciting, I'm not judging, well not that much
What are you planning after grad school? Or is that too far ahead? :)
Crop science / plant breeding
Interesting. What's the aim?
I used to work a lot with Artemisia annua
15:43
I live in one of the largest cotton producing regions in the world. We've relied on an aquifer that is going dry. I hope to facilitate a transition to rain fed system through a number of means like enhancing cotton genetics and providing rapid in season info for decision making and risk management via UAS and satellite
UAS based phenotyping in breeding is all the rage, lots of low hanging fruit at the moment
Texas is a major cotton producer?
yes, specifically the high plains of texas around Lubbock
i'd never have guessed that, from an outside perspective. pretty cool
Wow, I really would never have guessed that
Lol
15:48
My knowledge of Texas:
- surprisingly liberal metropolitan areas
- big river on the bottom
- cows???
- cotton
something something yeehaw.
How do they keep the cows from eating the cotton, and from falling in the big river?
I think I know this one. First, you put the fox and the grain in the boat...
I'd use a muzzle and floaters
@connelblaze hello
15:50
I'm starting to learn webscrapping with python
Some kind of vertical structure. Perhaps a fence? Maybe a wall
And we'll make the cows pay for it
3
can see that it's easier to scrap normal site than js site
LOL
@connelblaze indeed
15:52
The typical answer to "how do I execute JS on the sites I'm trying to scrape?" is "use Selenium"
crystal ball +1.
I think.
I suppose if I'm right, that's a +1 for this crystal ball as well no?
Sometimes I tell people to reverse-engineer the JS to see if there are any easily-spoofed endpoints, but that's harder and I don't think any previous querents have ever attempted it
perhaps they died trying
Which, y'know, fair, because I don't attempt it either
perhaps they got stuck in a surprisingly liberal metropolitan area
15:59
there's a main problem I have
I don't know if I can get help here
I'm using selenium
We give help where possible, but it's not always possible to give help
I heard betting sites are harder, so decided to use pinnacle as a case study
@Kevin okay
Please be more-specific about the issue. And it's "scraping". The double "pp" makes it mean you're throwing something in a bin as "scrap"
I finally got some things to show, but I think I can do better
or make it come out more customize way
@roganjosh thanks
can I paste the codes in pastebin then share links here?
Sure.
16:04
No worries, but the main point is: please give a MCVE
is there any builtin type other than range that has a well-defined len but is actually lazy?
Is this related to the main site question of "how do I make __len__ return 10**100"? I figured he wouldn't take "you can't do that, and you shouldn't want to do that" as an answer :-)
https://pastebin.com/w8fCyMw4
this is it
I wonder if __length_hint__ can return a long int?
i wished I could loop through body and get all the inner divs text
16:09
>>> length_hint(Foo())
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
OverflowError: Python int too large to convert to C ssize_t
@Dodge this has really got me thinking. I did actually know this and I've just re-lived the surprise after forgetting it. There's some major players in this area, no? Roughly, what do you see as the low-hanging fruit? You've invoked my past life :P
my anecdotal opinion of __length_hint__ is "as useful as a third head on a brahmin", by the way.
@connelblaze that for bo in bod: value = bo.find_elements_by_css_selector('span.price') doesn't look right to me. It's often a mistake to unconditionally create a value inside a for loop, and then refer to it later in the code outside the loop. In other words, it's unusual that you're referring to value later on in the code.
forgot to comment that
didn't work
@Kevin Yes, it's related to that. I'm still waiting for a reply on what they intend to do with it.
16:13
I feel like there aren't a lot of good reasons to want the length of a generator-like object, but I'll keep an open mind
@Dodge I have a shedload of analysis on a. Annua that I was gonna publish. All of it to try and help the anti-malarial market. I was developing in-van tests using thin-layer chromatography to try and assess crop viability for extracting artemisinin
Once or twice I've been mildly annoyed that I can't easily guess the length of an itertools.permutations call.
Where "easy" means "without working out the formula on paper or looking it up on Wikipedia"
I don't see anything wrong with wanting to know the length of an iterator. I just don't see anything useful in knowing the length of an object that couldn't even be reified on all storage racks of all our batch farms.
@roganjosh the low hanging fruit I speak of is stuff like machine learning based image analysis in UAS collected data in a crop like sorghum. You have 2000 entries in a field and want to systematically analyze various aspects of growth from a series of 30 orthomap layers, these methods are new and untested, the list goes on... I have a cool gif I will share of sorghum head extraction with Keras base ML in UAS vidoe, one sec
I often wish finite sequences kept track of their lengths
16:18
@Dodge mmm. I think we should Skype if you're open to that
Sure, [email protected] to send an email
@ParitoshSingh I'd also like if map and such were more akin to range.
I wouldn't hate it if the map object implemented __len__ so that it returns a meaningful value iff all of the input iterables implement __len__
Indexing that's O(1) in time and memory is a whole kettle of fish though
@Dodge FWIW, I also did ML on plants here. It would breach room rules to give an accurate appraisal of that paper. But I've had time to think since
so is there a way to get my desired output
16:27
@roganjosh Here is a gif of a UAS video stream that I have deployed a mask regional convolutional neural network on for the purpose of extracting sorghum seed heads in real time to estimate anther development in a segregating population, few people are doing this work currently
@connelblaze I bet there is a way. I don't know enough about Selenium to say exactly how, but I'm pretty confident it's possible.
Sunny cabbages everyone
@roganjosh I'll read that paper when I have some time, looks interesting
I'm working with selenium too and hit a bit of a road block
Interesting maybe, but I wrote it on command of my supervisor saying I needed to pee on the territory before releasing the real stuff. That never happened
16:30
Anybody got any idea how to find elements (via xpath, id, path, anything) within google drive?
@CeliusStingher you can try BeautifulSoup using requests
The last time I tried to inspect the source of a google page, my brain melted. They're pretty good at obfuscation.
I wish there were more tutorials on this
Class names all be like "feCgPc q1kEvb vsXRLb y yf"
yeah especially with so many divs and inner-divs and class names
@Kevin hahaha yeah
16:33
sounds like "div and conquer"
DOM navigation is hard enough when the page designer isn't trying to foil you
hahaha
wow... thought doing this would be within 3 - 6 days
i guess... I lied!!!
16:54
@Kevin I sometimes want to know if there is at least 1 item that will be yielded in the generator before just blindly iterating over it, so I have to use a tee iterator to peek.
user11585758
17:06
guys guys i got error :(
coming from god that's very scary
user11585758
:) :*
if you tell us a bit more we might be able to effect divine intervention
user11585758
while i was saving the model in tensorflow
with this command

model.save(path)

# which saved the file with .pb extensions and file

Now i have loaded the model with
loaded = tf.saved_model.load('/content/gdrive/My Drive/autoencoder/')


Now i want to predict the model using .predict() with x_test and y_test but i cant find which code to use

like i previously had predicted the model using
model.predict(x_test,y_test)
user11585758
in stack overflows answer they are in .h5py which is different from mine

Thankyou in advance for answer.
If god exists, bless you all guys :)
17:11
I've never used tensorflow but does that saved_model.load call even work? How does it know which file to use?
user11585758
Thankyou anyway :).

I had used from docs which told that
imported = tf.saved_model.load(path)
"path", yes. Directory path or file path? But anyway the load either works or fails, I'd expect failure to be loud and clear.
Hey :)
Im trying to install this: github.com/GPflow/GPflow
There is this line:
pip install -e .
saying "With the release of TensorFlow 2.1 and Tensorflow Probability 0.9, you should only need to run" the above thing
how does thin pip install -e . work?
17:13
@god "The object returned by tf.saved_model.load is not a Keras object (i.e. doesn't have .fit, .predict, etc. methods). A few attributes and functions are still available: .variables, .trainable_variables and .__call__."
do I clone the github repo, and then run it in a directory? (which?)
the directory you cloned the repo to
user11585758
@Dodge , how do i do this :)
@god I think you want tf.keras.models.load_model
@MisterMiyagi thanks! will do
user11867329
17:16
@AndrasDeak Andras! Andras! Did you see me help that dude a couple days ago?
user11585758
yeahhhhhh Its worked thanks brother @Dodge also @AndrasDeak :)
tf.keras.models.load_model
user11867329
Does anyone ever used Google Cloud Vision API for OCR/DMS/EMS tasks?
Hi, Does following code file = open(fileName, encoding='cp1251', errors='replace') works on both Linux and windows. Though Ididnt had any issues running on Linux. But I see this is specifically for windows
What leads you to believe it's specifically for Windows? Got a link?
17:28
Using a specific encoding and setting an error handler at the same time doesn't look like something you'd want to do often
sorry under Encodings and Unicode
@Aran-Fey I did that to resolve this issue:
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x8d in position 3387: character maps to <undefined>
Since cp1251 is listed under "standard encodings", you can reasonably expect it to work on any CPython distribution
@Kevin so its not specific to py3?
Good question, let's see... It's also present in 2.7: docs.python.org/2.7/library/codecs.html#standard-encodings
@Celestial Do you really need the errors='replace', though? Can the cp1251 codec not decode the file correctly?
17:32
What I really meant was "it should work in both Linux py3 and Windows py3". No guarantees about pre-2.7 versions.
I can easily believe that the file was encoded with cp1251, but I can't think of any reason why the file would be encoded with broken cp1251
@Celestial It's made by Microsoft, and is commonly used as the default encoding on Windows machines, but it should work on everything. It's not exactly a large encoding.
@kevin yes, it didn't had issues running on py27 I mean I just used file = open(filename) but gives error when I switch to py3
@Kevin yes Linux build was good too but my reviewer wants a solid answer why I used that :_
@OakDev I'll order your medal. It might take some time to arrive in the mail...
@Aran-Fey@Kevin@Peilonrayz Thank you for your answers :)
17:41
@Celestial This isn't my area of expertise, but here's my understanding. In 2.7, files always behaved as if they were composed entirely of 8-bits-per-character ASCII strings. You didn't need an encoding, because there's only one way to encode ASCII. If your file actually contained Unicode characters, you had to read the data and then decode it later.
3.X is different. It assumes by default that the file is not necessarily ASCII. It assumes there's an encoding that it has to use (the one returned by locale.getpreferredencoding()), and if that guess is wrong, it will crash with a decode error.
@kevin so in this case encoding=cp1251 is resolving the encoding decoding work for py3.x?
Basically, yeah. If you wanted to get as close to Python 2.7's behavior as possible, you could skip all this encoding stuff and open the file in binary mode: file = open(fileName,"rb"). Then you're guaranteed to not get any decode errors. The drawback being, every method that usually returns a string will now return a bytes. That's not always desirable.
But it really depends on what you're trying to do with the data
is anyone here in the San Jose and/or Tahoe area? Wanna ski with me tomorrow?
Can someone help me out? Check my most recent question - it's to do with tkinter and buttons, any help is much appreciated :D
@kevin function is not returning any string or byte though:scanInputFile(fileName):
'''Scan single input file for test suites'''
file = open(fileName, encoding='cp1251', errors='replace')
lineNo = 0
while 1:
line = file.readline()
if not line:
break
lineNo = lineNo + 1

scanInputLine( fileName, lineNo, line )
closeSuite()
file.close()
@I am hoping this shouldn't be a problem
17:53
@Govind75 Please read the room rules, your question needs to be about 350 times older before you're allowed to ask for help here
Oh, my bad
"Why doesn't tkinter play nicely with loops?" is a fairly common question, so hopefully someone will be along shortly with a link to a nice canonical example. If all else fails, I'll do it myself
Cheers :)
I've literally just started using it so I am not very experienced.
Short answer: GUIs freeze up if their mainloop isn't running. If you're in a while loop, you're not in their mainloop
Ah I see, would I then use the mainloop() function to sort that out
17:56
The majority of Tkinter programs have a mainloop call, yes.
If I'm creating quite a few buttons would it be worth putting the whole thing in a class
If you need to access the buttons while the program is running, definitely yes. If you create them and then never need them again, no
Another soft question: What are some other programming concepts or I guess general methodology [like dynamic programming, divide and conquer] in order to master ~competetive programming or problem I usually ask here[Though they are now relatively more intricate]. Becuase I have found that as I do not go through top-down method in writing the code, at the end couple of days, I happen to write unreadable code.
user11867329
@AndrasDeak No doubt, is it like a scratch thing and I enter the code on stack?
OOP is quite a good fit for GUIs, unless the GUI is so simple that it's not warranted
18:00
I ain't asking to describe them, please enumerate or list them or give me reference to list of them.
I have loops within loops - I'm not sure I quite understand where to place the mainloop() function...maybe I should go watch a few tutorials.
First you create your GUI, then you call mainloop(). Then your program exits.
Everything else happens in event handlers or queued callbacks
@AjayMishra Honestly can't think of any
Was my question unclear?
or the two example which I gave cannot be put in same category and the consequence of whose is that no concept can be found which share feature in the intersection of those?
@Aran-Fey cheers, now it works!
The question wasn't unclear, no. I just can't think of anything else, although that doesn't mean much
18:07
@AjayMishra I think the category is clear enough. Unfortunately, the category is largely unmapped. In my opinion, there is a dearth of literature about medium-to-high-level design methodologies.
The only thing that comes to mind is graph theory/pathfinding/local search, but that's not exactly a "programming concept", so...
Programming is still a relatively new profession, so we're in the dark ages right now. Maybe in a hundred years there will be a plainly enumerated list of methodologies, but today you can only discover them through painful experience
sorry to use bad word, honestly I can't think a word which can cover all these stuffs.
@Kevin What you think would be the future?
@Aran-Fey Thanks.
I think there are techniques that we use every day that we don't even think of as methodologies. We don't have a name for them, because why would fish have a name for water?
"Once you name something, you get power over it"
18:15
The future I envision is one where programmers don't say that anymore
Well, it is true, our industry is barely 200 years old as max
user10984358
18:40
it might be 200 years old, but we have done more in the 200 years than people have with other profession haven't we? it took people ages to master hunting when you had to do it for survival
I... I... don't feel it is a valid comparison
user10984358
its not an apples to orange comparison, I was trying to emphasize the fact that something that the entire human race did took years to master when something such as programming which is taken up by less has evolved a lot
This kind of reminds me to a Louis CK stand up show, but he is a topic of debate nonetheless and that's not what I want to bring here
user10984358
well to answer the question asked, backtracking is usually asked in interviews, they give a grid and ask you how to reach one point from another
@inspectorG4dget Humble brag?
04:00 - 19:0019:00 - 23:00

« first day (3415 days earlier)      last day (1758 days later) »