« first day (3856 days earlier)      last day (1075 days later) » 
00:00 - 19:0019:00 - 23:00

12:10 AM
can anyone help with this question? stackoverflow.com/questions/63403220/…
I have managed to successfully get the html data of the vbulletin by successfully logging in via my python script. However the challenge is getting the data from the html code..
 
cbg
 
@Ahmed.B that's not the full HTML, is it? It seems to be too short for that error message.
It seems the response data has bytes that can't be decoded with utf8, which means either that the data is corrupt, or it's not encoded with utf8 to begin with.
hold on
 
@Ahmed.B I posted a comment to help clarify your question. Why are you reading the contents of one HTTP request and then using it as a URL for another request?
 
that ^
 
12:21 AM
@Ahmed.B This article has some tips for debugging your code. I recommend printing the value of url. Also, the line soup = BeautifulSoup(requests.get(url).text, 'lxml') does way to much all at once. Break it down into smaller peices. For example respsonse = requests.get(url) and then you can print(response).
 
12:38 AM
@Code-Apprentice thanks I have seen your comment and will look into making it simpler. I understand its difficult to extract data from a vbulletin forum than a normal webpage.
 
@Ahmed.B I think the problem for you here is understanding what data you have at each step. Most likely your variable named url isn't really a URL.
instead it is the content of an HTTP response
 
ah yeah, Python stdlib brokenness, I sometimes forgot how broken it is.
 
@Code-Apprentice I believe that is correct. However I need to extract the data from the table which is in the content of that HTTP response and like I mentioned in my question it is difficult compared to normal webpage scrapping.
 
@Ahmed.B what makes it more difficult?
@metatoaster what's broken exactly?
 
it's in the backlog, argparse is often presented with broken behavior
add_argument is documented to accept a type argument, but something internal breaks it
 
12:48 AM
@Code-Apprentice the amount of <td> tags which contain the data I require. And they are repetitive with the same class etc.
 
though the poster that had the issue may or may not have the correct argparse.py since they use anaconda
so who knows.
 
@AndrasDeak it is the full HTML I believe.
 
@Ahmed.B that's not difficult to deal with, just use a for loop. But I think you aren't there yet. Your current error has nothing to do with <td> elements.
@metatoaster you must be referring to a different conversation than the current one. Are you familiar with the reply feature in chat?
 
@AndrasDeak k, saw it, solved.
 
1:13 AM
@Ahmed.B then you should parse that HTML directly rather than trying to use it as a URL.
 
thx
 
1:28 AM
AH, time for some advice...
I'm trying to fire up a new VM using VMWare
I need a good iso for a lightweight linux os to run a jupyter server
 
in before nix :P
 
I'm expecting just that (-:
 
If you have enough space (like > 30 GB probably?) try NixOS for it. :P If you don't, maybe try a container-based approach. Like CoreOS or Alpine...
 
plasma or gnome?
 
xfce
 
1:34 AM
I thought you wanted lightweight, you don't need a desktop environment to run jupyter lab
 
yeah, backpedaling. downloading minimal iso
 
Good point, headless is fastest
 
if you're running a vm a container is kinda redundant but it would be cool for the cred/experience...
 
Installed and running. I'll try to install Jupyter in a bit
 
1:37 AM
nice, which OS did you go with?
 
nixos
 
oh sweet
 
One more commission to Aaron :P
 
Put something like this in your systemPackages:
    (python38.withPackages (ps: with ps; [
      python-language-server
      pyls-mypy
      pyls-black
      ipython
      jupyterlab
      statsmodels
      scikitlearn
      sympy
      requests
      tornado
    ]))
ipython is probably redundant...
the Python language server stuff I'm not that familiar with to be honest.
probably take out tornado too
Everything that's required by jupyterlab should be installed automatically just by declaring jupyterlab
oh shoot, you'll need to open your firewall probably...
maybe something like this: networking.firewall.allowedTCPPorts = [ 22 80 443 ];
If it all works immediately or if there's problems let me know.
oh yeah, it serves on specific ports it rotates through doesn't it...
Just specify port 80 when launching, that should be fine... like jupyter lab --port=80
@piRSquared get all that?
so the awesome thing about NixOS is you can tweak your config all you like and everything just works (most of the time, and if it doesn't, you can roll back to a prior working config.)
here's some useful aliases:
  environment.shellAliases = {
    aliases = "nixos-option environment.shellAliases";
    edit_config = "sudo vim /etc/nixos/configuration.nix";
    rebuild_config = "sudo nixos-rebuild switch";
    collect_all_garbage = "sudo nix-collect-garbage -d";
    collect_some_garbage = "sudo nix-collect-garbage";
    truncate_logs = "journalctl --vacuum-size 500M";
    size_of_current_nix = "du -sh  $(readlink $(nix eval '(<nixpkgs>)'))";
    vi = "vim";
  };
I use edit_config and rebuild_config all the time.
 
2:01 AM
Nice vim plug
PiR2 always struck me as an emacs type
 
I have used both a lot. Emacs is great when it works right. vim usually works right all the time though...
 
@Code-Apprentice yes I am familiar, I forgot to use it, sometimes I click the wrong thing and I forgot the :number thing.
@pythonabsir Yeah, you shouldn't have used action="store_true", that appears to be the issue within stdlib where that action does not support the type argument, see bugs.python.org/issue24754. That said, my point still stands about the stdlib being faulty, since pitfalls like this pop up from time to time.
Anyway, I am just frustrated with Python in general these days.
 
@metatoaster ok, thx, reading worked.
 
2:19 AM
@pythonabsir note that "store_true" only makes sense for a boolean flag
 
@Code-Apprentice k, thx
 
Still, the annoying thing is that the OP in that issue used the correct type, sure it might be redundant, but the stdlib is failing in a rather not particularly useful manner just drives me up the wall.
 
"PRs welcome"? :D
 
nah they closed it as not a bug lol
 
@metatoaster it makes sense to assume type=bool when action="store_true", but the error message isn't terribly helpful.
 
2:23 AM
@metatoaster ah yes, of course
 
@Code-Apprentice exactly, that's what I mean, after spending some chunk of time writing programs in Rust and getting used to the actual useful feedback I get from that compiler, coming back to Python is an actual shocking experience.
 
I haven't done anything in Rust. I've heard a lot about it, though.
Right now I'm kindda learning kotlin
mostly I'm struggling with Android SDK issues
 
It's crazy how just a few weeks with Rust basically convinced me top drop Python as my primary language.
 
and probably being way to pendantic for a learning project
 
@metatoaster still docbug and crap error
 
2:25 AM
Android SDK can be a pain, I vaguely remember trying to get it to work a decade ago and it was a pain then.
 
I've worked with it off and on for like 5+ years for hobby projects.
I just don't do it often enough to stay up on the latest and greatest
 
@AndrasDeak yeah I guess I could technically do a PR but eh effort
 
Yeah, especially now that you're a rustacean
 
Well, not quite full time rustacean yet, still got many Python projects I have to maintain
 
@AaronHall I see it. I'll read it in a bit
 
2:29 AM
sometimes I also get interesting pull requests for my Python projects that I can't seem to ignore, but I also have been dragging my feet in getting those changes out
 
 
2 hours later…
4:07 AM
@AndrasDeak Woah, woah!! Me EMACS???!! Dem's fightin' words. Vim all the way.
 
@piRSquared then you might want something like this - I inline my vim config in my systemPackages too:
    ((vim_configurable.override {python = python38;}).customize {
      name = "vim";
      # add custom .vimrc lines like this:
      vimrcConfig.customRC = ''
        set nocompatible
        syntax on
        filetype plugin on
        " search in subfolders
        set path+=**
        " tabcomplete files with :find filename
        set wildmenu
        set relativenumber
        set number
        set shiftwidth=4 expandtab
        set hidden
        set ruler
        set colorcolumn=80
        set backspace=indent,eol,start
I like my config stuff slightly better than the wiki or documentation examples...
 
 
2 hours later…
6:30 AM
cbg
 
6:50 AM
@metatoaster Did that work out for you? I'm also quite pleased with my own experience with Rust, but deploying it to production and keeping it maintainable for others still seems like a challenge.
 
7:33 AM
hey folks , need help ..how can we extract '6at' from this string seltos "htk plus 6at diesel diesel 1493: using regex in python
 
You are probably not asking for re.search("6at", "htk plus 6at diesel diesel 1493"), are you?
 
many ways, only some of them more useful for the generic case.
when thinking regex, it's important to define a pattern that you're looking to extract
@MisterMiyagi haha, had the same thought in mind :P
 
@ParitoshSingh Got several talk rehearsals coming up today. I'm locked into "asking stupid questions" mode already in preparation.
 
nice!
any interesting topics?
 
Just my same old story of using-other-people's-computers-because-they-don't-need-them-right-now at scale.
The minions have been busy.
 
gig
7:53 AM
Hey can anyone help me with this please
https://onlinegdb.com/HkNCbdzdd
sorry with this onlinegdb.com/Hy5ffOzd_
 
@gig you might need regex for that
Is this some challenge? I've seen several Q&A for parsing such formats lately.
 
gig
@MisterMiyagi tried with this regex [0-9a-z]+\.
@MisterMiyagi if I try with this regex getting really different output could you please help me
 
No. That's not something concrete I can work with.
If you can show what you have tried, that would be a start.
 
gig
@MisterMiyagi yes this is what I tried
https://www.onlinegdb.com/online_python_compiler
 
print("Hello World")?
 
gig
8:07 AM
@MisterMiyagi see this is there ?
 
Please take a look at the regex module re documentation. String methods don't do regex.
 
gig
Then How can I split them without using regex
 
Why would you?
 
gig
without regex how can I
is there any method to split as I want
 
Yes, in the re module.
 
gig
8:13 AM
yes tried re.complie([0-9a-z]+\.) not got
 
Take a look at the example for re.split
This should give you a hint how to write regexs, and how to split your input with one.
 
gig
I cant use it in my case onlinegdb.com/SJ0SrOzOu see this
 
You are not using re.split in that code.
Did you just miss using re.split instead of str.split, or do you have some restrictions on not using modules?
 
re isn't a variable name, re is the regex module. As miyagi said, regexes can't mix with string methods.
if you want to use the regex methods*. that requires using the regex library re
i'd suggest clicking the links miyagi is posting and taking a look
 
gig
yes @MisterMiyagi@ParitoshSingh I took a look at them and used re.split here
https://onlinegdb.com/H1OgK_GOd
could you say the mistake I am doing
 
8:24 AM
their* snippet is updated now
 
Right then. Jolly good.
What do you think the pattern r"\d+" expresses?
 
I'd say, slow down and try to understand how to use the tools, it seems like you're too eager to just plug things in randomly.
 
gig
@MisterMiyagi I was sorry I had updated now onlinegdb.com/rJbj9dzd_ plz see this same output I was splitting with spaces
 
Why are you splitting on spaces now? You don't need regex to split on spaces
 
gig
@Aran-Fey I was confused could you please guide me or tell me where I am doing mistake
 
8:37 AM
@MisterMiyagi haven't got as far as deploying to production, but for the mean time I am still liking using Rust
 
@gig I really don't want to do that. I think you should take a 10 minute break and then take another shot the problem. You have all the pieces, you just need to put them together correctly now.
 
@gig Please take a moment to describe in words what your condition for splitting the input should be.
 
gig
Ya got it @MisterMiyagi
 
 
1 hour later…
10:09 AM
Cbg
Can I get suggestions/improvements on this answer ~ Creating multiple differently colored shapes using tkinter and classes
 
 
1 hour later…
11:24 AM
@CoolCloud idk Typing, can you not type annotate default args? it just seems incomplete for padx and pady to not be annotated
 
@python_user NGL, I felt that too, but I was like it will be fine
But I am not sure if it is possible though. Since the default value already shows the type of arg it is expecting?
 
it is apparently, arg:int = 0 according to docs, I am not sure about the internals on if it can detect or not
 
@python_user Okay, cool. Updated
 
use edit summary properly :p "added 8 characters in body"
 
11:32 AM
@python_user Nah, no one gonna look that :P
 
# Correct:
def munge(sep: AnyStr = None): ...
def munge(input: AnyStr, sep: AnyStr = None, limit=1000): ...
 
yeah I was wrong, the docs have the spaces correct, should have just copy pasted
 
I already violated different levels of PEP8, by having line characters more than 80 and bla bla, so I guess I am not following PEP8 there
 
I just type more than 80 and later use PyCharm to do its thing, so you are not alone as long as you wrap it to 80 or less
 
I just don't like that __init__ is so long, can't think of a way to shorten it.
 
11:38 AM
@CoolCloud it will be even longer if you follow this python.org/dev/peps/pep-0484/…
good thing I dont use typing, unless interviewers start asking Typing questions
 
@python_user Yea...Exactly!
I don't know its use TBH, I have seen alot of people use it, so why not :P
 
not sure if interviewers ask Typing related questions, maybe regulars here who interview can share what they think
 
@CoolCloud line length is the most commonly violated rule, don't worry about that unless you have insanely long lines
 
@AndrasDeak Sigh
What you guys think about this?
inp             = input()
dislongting     = input()
whatevervarname = input()
datthing        .disting()
 
light it on fire
 
11:45 AM
don't like it very much. Oh, now I only dislike it a little bit.
 
Not gonna lie, it annoys me from time to time. And I come past it often now
 
@CoolCloud you need to relocate then
 
I line up my assignment statements quite frequently, it's my guilty pleasure. It's the method call on the last line that I don't care for.
 
I mean I have not seen this type much before this year, but after 2021, I've come past it often.
 
#You may remember less than 24 hours ago when I shared code like
x = True; do_thing(x)
x = False;do_thing(x)
 
11:47 AM
# Correct:
x = 1
y = 2
long_variable = 3

# Wrong:
x             = 1
y             = 2
long_variable = 3
 
i took the path of least resistance and got used to whatever my editor suggested :P
 
for the record
 
It does look oddly satisfying at the same time.
Ugh I am having mixed feelings
 
It's not my fault that the most fundamental logical doubletons have identifiers of different lengths
 
petition to rename it Fals
 
11:48 AM
endorsed
 
Or Trues
 
while we're at it, left and right need to line up too
petition to merge "right` into "rite"
 
Perhaps lehft
 
you'd have a field day with port and starboard then
 
actually nothing stops you from defining aliases, Kevin :P
 
11:51 AM
Directions are so messy, I should just use i,j,k unit vectors
 
petition to remove variable names altogether. no variable naming, no need to resolve these issues. Everything is auto-generated by the code itself.
 
"recursing a binary tree is easy, you visit the node, then recursively visit the -ith and ith child trees"... Hmm, maybe not
 
12:03 PM
@MisterMiyagi yes this would any number and followed by two letters
 
Hmm, does PEP 8 have an opinion on whether [x, y] is valid whitespace use? I don't see it among the forbidden categories in "Whitespace in Expressions and Statements"
I see that [x , y] is forbidden, which I can understand
 
kevin, no! oh dear lol
 
PEP8: Should have said ~ "Anything weird is forbidden" :p
 
The language immediately vanishes in a puff of logic
 
@Kevin Who would write such though 🤔
 
12:16 PM
Me, when I want to line up my matrices
x = [
    [1,    2]
    [1, 1234]
]
 
In practice it looks nice :p
@Kevin You missed a , right?
 
Yeah, well spotted
 
Like I said, very oddly satisfying
 
It's a bit annoying that [ 1, 2] is explicitly forbidden by the "Immediately inside parentheses, brackets or braces" rule. That means I can't use it to align to [34, 5]
 
We need to bring PEPKevin out soon
 
12:19 PM
#solution: superfluous unary plusses
x = [
    [+++1, +++2],
    [-123, 1234]
]
 
Please take out the 80 character limit in PEPK!
@Kevin Very thoughtful :p
 
the 80 char rule is my most favorite rule to break, so you don't need to ask twice
@NabiShaikh Perhaps re.search("\d\D{2}", "htk plus 6at diesel diesel 1493")
Or "\d\D\D" if, like me, you have trouble remembering the "repeat exactly x times" syntax
Or, hmm, am I misremembering what \D does...?
>>> re.search("\d\D{2}", "hello 6! foo")
<re.Match object; span=(6, 9), match='6! '>
Oops, that's not a digit followed by two letters
 
\D is non digit i assume. regex does that with capital vs small
\w for words if you wanted that
..i should just open regex101 instead of guessing perhaps
ok yeah, \D is any non digit.
 
Hmm, \w matches digits too though. Is there no "exactly and only letters" flag? I guess I imagined it.
 
there might be, though i suppose i've seen [a-zA-Z] in the wild very often
 
12:27 PM
Yeah, I think let's go with that
@NabiShaikh updated suggestion: re.search("\d[a-zA-Z]{2}","htk plus 6at diesel diesel 1493")
Comedy option: match "word characters excluding digits" with "\d(?:(?!\d)\w){2}"
Might actually be a sensible approach if you need to match non-ascii letter characters.
 
@Kevin yup
 
12:57 PM
left-right alignment problem solved!
class Node:
    def __init__(self, value, 左=None, 右=None):
        self.value = value
        self.左 = 左
        self.右 = 右

def visit(node, f):
    """walk over a binary tree and call f on its values"""
    f(node.value)
    for child in (node.左, node.右):
        if child is not None:
            visit(child, f)

t = Node(1, Node(2), Node(3))
visit(t, print)
 
that would do the trick. what language characters are those
 
Japanese. For "left" and "right", as you may have guessed already
 
There is nothing in the visual representation of the characters to indicate which is which. The box on the bottom right corner could have had the appropriate side missing, then I'd automatically know which of the two was left.
That's Japanese? Is Chinese the same?
 
1:13 PM
no, chinese uses different scripts. Im just not familiar with either to know more than that though.
 
That's what I thought but the internet tells me it's Chinese
 
As for letters trying to retain visual representations... we had that once. When writing was being invented. And then people realized how limited that idea was :P
 
Emojis are sending us back to that time
 
A lot (most? All??) of kanji are shared between Chinese and Japanese. China had them first.
> The Japanese term kanji for the Chinese characters literally means "Han characters".[2] It is written with the same characters as in Traditional Chinese to refer to the character writing system, hanzi (漢字).[3] Although some Kanji will have similar meaning and pronunciation as Chinese, some can have very different meanings and pronunciations as well
Kanji still has some vestiges of visual representation. The symbol for "claw", for example, looks rather claw-like in my opinion: 爪
 
There are several more mentioned here that visually mirror their meaning. 串 for Skewer, Shish Kebab, and 木 Tree, and 森 Forest
 
1:30 PM
Mm hmm, you can come up with fun justifications for quite a few kanji radicals that way. I'm curious how many of them are actually historically valid. 爪 is definitely supposed to look like a claw, because they can trace its lineage back to Oracle Bone Script, which is more explicitly pictorial than modern kanji
 
gig
Hi can anyone clarify my question

Can we do handwritten words recognition without using cnn ?
 
Compare to "方" (person/direction/alternative/square), which in my opinion looks quite a bit like a person doing lunges. But its Oracle Bone Script grandpa doesn't really look anything like a person. So that one is probably just my imagination.
 
@gig Yes, that's one of the classic "learn to implement a CNN" tutorial topics.
 
gig
@Dodge I am asking is there any model other than cnn for handwriteen recognition
 
That sort of thing started in 1970s I think, long before computers could run neural nets, so yeah, there are hundreds of papers on the subject. And many easily digested online guides.
 
gig
1:36 PM
could you please suggest any best for beginners
 
Why not CNN. whats the goal here
 
gig
I am just asking can we use any other model out of curiosity
can you people suggest any best tutorial or guide for handwritten words recognition
 
If the question is "can you recognize handwriting without using an off-the-shelf CNN library?", the answer is "yes, simply write your own CNN library". If the question is "... without using any CNN-like algorithm?", I don't know.
 
@gig I like PyImageSearch. It can get somewhat spammy with products but there are about a hundred free tutorials on many ML object detection topics.
 
gig
can you suggest free tutorial
 
1:38 PM
Anyways, the answer is yes, you can use any model if you wanted
Just..dont expect it to perform as well
 
heck, train any classification model for it, you can always treat individual pixel or pixel buckets as individual features.
Finally, you could even go for a non model approach, template matching comes to mind
 
gig
pyimagesearch will be commandline programming
 
It's python code, run it how you want
 
gig
@ParitoshSingh sorry didnt get it
 
1:43 PM
He uses argparse but totally not a requirement
 
@gig template matching is technique to find a smaller image inside a larger image by comparing against a template/reference image. see link
I will again caveat by saying that CNNs will most likely outperform most other approaches you can try.
But yes, no one forces you to just stick to CNNs
 
gig
is there best guide that you think for cnn for hanwritten word recognizer
 
[putting on my cynical hat] computer vision and machine learning are complicated topics, so I expect even "beginner" resources would involve advanced programming techniques and abstract theory. Unless, of course, you're just using a ready-made library that does everything for you.
 
Im still confused. do you want to "learn" how it's done or "get" good results and finish some task
if it's the latter, i'd argue that what you want is an off-the-shelf OCR
 
gig
the second one @ParitoshSingh
 
1:50 PM
okay, then perhaps give* pypi.org/project/pytesseract tesseract a try
take a look at their readme for some examples.
 
@Kevin, even if that's the case you still need to learn about optimizers, learning rates, loss functions, checkpointing, and general information on appropriate network architectures. Not to mention how to configure your GPU
 
note that pytesseract is a python wrapper, you'll need actual tesseract as well to make the wrapper work
 
gig
I had images of words I want to recognize them perfectly altleast 80% I tried pytesseract but not got accuracy so when I searched I got to know that need to use cnn for better reults
 
ah, recognizing words perfectly. Depending on the quality of the images and the difficulty of the task, that might vary from a "simple" to an "impossible" task
 
There is a guy on Udemy called "The Lazy Programmer" who teaches ML from scratch. It's pretty awesome to watch him explain it all, but super complex as well. I've done several of his courses.
 
1:52 PM
Once you get into programming specialties that require more than high school level mathematics, the amount of straightforward step-by-step tutorials drops very quickly. Authors assume that you can do research on your own, and can work through medium-to-high-difficulty design problems without copy-pasting whole code blocks out of their site.
 
Oh random sidenote, Kevin did you ever get to try tesseract 5?
 
I'm afraid not :-) I got satisfactory success rates just using OpenCV.
 
gig
yes is there any tutorial training custom ocr with some IAM dataset
 
Ah gotcha, fair enough :)
 
gig
can we recognize handwritten images with opencv itself?
 
1:56 PM
No, I don't think so. I didn't see any handwriting-recognition functions in OpenCV when I was working with it a week ago
 
gig
so definitely need to use cnn ?
 
gig, i think you might have to recognize that this will be a process filled with trial and error.
First things first... on ocr itself, there's a lot of options to improve performance before having to train your own models
 
Sure, try using a CNN and see if it suits your needs
 
Here's an article that is worth trying to see if you can get better results from the ocr itself. link
 
gig
could you please suggest a step by step tutorial of training with cnn also if you dont mind
 
1:59 PM
Second, if you decide to roll your own CNN, then a quick google search led me to this. Disclaimer: while it looks promising at a glance, i personally cannot vet the contents as i haven't used this.
 
You've been asking for tutorials for twenty minutes. If anyone knew of any good tutorials, they would have given them to you by now.
 
Hey, I did! and it's good, sheesh ;)
 
So his question has already been answered! Even better!
 
Third, ultimately, be prepared to explore more. Usually these things end up being an accumulation of different sources, it's a matter of time really.
 
gig
Ok Thank you for your suggestions will try :)
 
2:01 PM
If you are going to use a GPU I'm serous when I say you have to learn to configure that. It can be a chore
 
gig
Yes @Dodge
cant we use nlp for my req?
 
and i suppose, Step 0. There's no point asking a bunch of questions for which the answer is "yes/no/maybe", if you're not planning to spend the time trying out some of them.
 
Theory: there are people that do know the best combination of libraries, etc, to do handwriting recognition. And they will happily answer your questions at their usual contracting rates of $500 per hour.
For $0 per hour, you get a lot of "maybe"s and "here's the first thing that turned up when I used google, try that"
 
That would be a great analysis: How much money(time) has been donated to SO in the form of answered programming questions? Guys like Jon Skeet probably command a high hourly consultation rate
 
@Kevin That sounds suspiciously like what we are doing here most of the time...
 
2:15 PM
I give my time gladly, but if I ever saw the calculated value of my contributions, I would immediately wither into a husk in the style of Dorian Gray
(regardless of whether the value is higher or lower than I expect)
 
Those with high value take less time to answer while those with low value spend more time on answers, so maybe the total is small because you're fast.
 
@MisterMiyagi $0/hr consultant? Of course I know him, he's me
@Dodge I guess it depends on whether I can charge the time I spend hanging out in here talking about the etymology of Japanese characters
 
@Kevin We should work together and tripple the rate!
 
me irl right now: $_$
 
It's practically free cash.
 
2:51 PM
@Dodge new pic looks more IRL than the old snail one :)
 
cabbages y'all
 
cbg
 
@python_user It was my old one that still existed on the broad SE profile. Several other regulars switched recently as well, so I thought it would be appropriate.
 
wonder if cbg comes under txt spk?
 
I think there's a passe-droit special permission for it
(wasn't too sure of the percentage of French-speaking folks around here..)
 
2:58 PM
cbg is grandfathered in because it predates all our existing rules
 
:chefs_kiss:
 
3:40 PM
hi everyone, i have this message when i want to ask new question:
Sorry, we are no longer accepting questions from this account. See the Help Center to learn more.
How can i solve it??
 
@bashar This meta Q&A should be helpful.
 
4:23 PM
The [Help Center] text in that banner should be a link...
 
Feels like SO is so strict about its rules. I mean, just reviewing 2-3 posts wrong, you get banned from reviewing for 1 month and the time keeps increasing per bans
Do you guys design the UI first and then make the app, or just start making directly with whatever comes to your mind.
 
4:47 PM
i personally dont design UIs and then complain to whoever is designing a UI that they didn't do their job right
(i believe what you're after is a wireframe. it's the middle ground between the two extremes you're proposing. Draw a UI mockup for your idea, decouple the app and the UI, work on both aspects... or something something ideal world)
 
Mmmmm yes wireframe(nice terminology) but I use Photoshop or atleast, I am using photoshop for now.
 
5:05 PM
Most of my projects start out as console programs, and often they don't accept any sort of input
 
@Kevin Hmmmm I see
 
At that stage my "UI design" is just remembering to do print(answer) at the end ;-)
When I do GUI stuff I try to have a clear mental image of where I want everything to go, before I start writing code that touches the UI framework
I've used Paint to make a mock up from time to time
 
I find the best approach to UIs is to imagine how it works in my head and then (mostly) get it going that way, and people come to realise that it's now part of their life and come to accept it... eventually.
 
I'm reminded of my first programming language, Visual Basic. The WYSIWYG user interface editor was a big selling point at the time, IIRC
You need a textbox and two buttons? Just drag them from the toolbar onto the window blueprint. Zero lines of code required.
 
Easier times eh :p
 
5:13 PM
A nice application of the principle "easy things should be easy; hard things should be possible"
Creating such an editor for tkinter or pyQt could be a fun project for an intermediate-verging-on-advanced learner
 
Wise words
 
5:47 PM
Seems like I came up with a design, it seems simple. I think it can be adapted for now
But somewhere it looks like those scamming websites. Somewhere
 
table = soup.find('tbody', attrs={"id":"collapseobj_forumhome_events"})
name = table.text.encode('utf-8').splitlines()

produces lots of byte objects i.e. [b'', b'', b'', b'', b'Live: EPL..... ... . How can I get rid of these byte objects?
 
@Ahmed.B Loop through the list and use find those b'' and remove it?
 
Define "get rid of"
I assume you want something more sophisticated than name.clear() even though that quickly removes all the objects from the list
 
@Kevin Initially I had lots of \n\n\n\n \r\n\ produced so I used .splitlines() to remove them. After using splitlines() I now have lots of [b'', b'', b'', b' ....
 
@Ahmed.B Maybe a simple LC, like [x for x in name if x!=b''] will create a new list without those bytes
 
5:59 PM
what is x in [x for x ...]?
 
@Ahmed.B Each item inside the list name
 
Yep, filtering with a list comprehension is a fine approach. If you want to get fancy, perhaps something involving regex:
>>> import re
>>> text = b"foo\n\n\r\r\r\r\r\nbar\n\r\rbaz\rqux"
>>> re.split(rb"[\n\r]+", text)
[b'foo', b'bar', b'baz', b'qux']
I also wonder if BeautifulSoup has any helper functions for sanitizing webpage text... I don't really know
 
6:16 PM
Is it expected that they'd be byte strings and not regular strings?
 
name = table.text.encode('utf-8').splitlines()
there's your answer
 
doesn't necessarily tell you about intent ;)
 
For much of my career I never "intended" to have bytes or strings specifically, I'd just pingpong between them until I got correct looking output
I got better eventually :-)
 
I think I've just got a strong association between them and Python 2.7. It's (I'm sure) still well-known that I'm hopeless in this arena
 
They're just monoids in the category of endofunctors, bro, no big deal
 
6:24 PM
Cheers bro, I can sleep tonight without checking payloads for monsters
 
Strings are easy, they're just sequences of characters, some of which have quite large ordinal values. Byteses are easy, they're just sequences of unsigned integers between 0 and 256. The only precarious part is trying to cram one into the other
 
When I see stuff that I expect to see, but prefixed with b is where I get confused (I think). Or maybe I'm always confused
At some point I'll learn this stuff, I guess. It's my shameful secret but it'll be rammed into my head at some point when I can't just get away with brute-forcing things for a few mins to make it work
Well, "secret" is used very loosely
 
I could describe my own mental model, but it probably wouldn't be any more illuminating than any other explanation you can find online
 
just cross out the b
 
my mental model is quite the opposite
 
6:31 PM
@Kevin I've gone through all the usual guides but I think it's a case that I don't (knowingly) face this stuff daily, so I think it's best I don't waste your time :)
 
i cross out everything other than the b and tell myself whatever im looking at is a lie
That was the only way i could finally understand the crap that goes on behind the scenes. This was one layer of abstraction where python just got in my way
 
Call list() on your byteses to reveal their true form ;-)
 
nasty little byteses
 
What's b"taters", precious?
 
[116, 97, 116, 101, 114, 115] apparently, unless you boil em, mash em, or stick em in a stew
 
6:39 PM
Having a practical problem that can only be solved by understanding string/bytes is a decent motivator. "Our biggest customer, John ☃ Smith, is furious that his middle name shows up as â~ƒ on his user page. Fix it before you go out to lunch or don't bother coming back"
 
^ can attest to this. My turning point was writing out perfectly valid dataframes to a csv file, and having them come out "wrong" when opened in excel later by others*
And everyone just ignored it as if it was perfectly normal. i think that was the real deal breaker for me.
"oh yeah that happens sometimes. Just remove them".... What do you mean just remove them, why does this happen.. et al.
 
00:00 - 19:0019:00 - 23:00

« first day (3856 days earlier)      last day (1075 days later) »