« first day (2500 days earlier)      last day (2452 days later) » 
00:00 - 22:0022:00 - 00:00

10:00 PM
uh isn't the UnicodeDecodeError caused by something else: decoding binary data?
he's sending a PDF and treating it as a string?
 
@Rawing But, how can I say to the client that all the info was sent?
 
You don't have to. The socket tells you how many bytes it sent. You keep sending until you've sent everything. The client knows how much data there is because the first thing you've sent is the file size.
 
@Metaphox Yes, attempting to decode a PDF as UTF-8 is bound to raise UnicodeDecodeError at some stage.
 
@Rawing But send() give me the amount of bytes sent by the server no the amount of bytes downloaded by the client, no? How can I know that any byte was lost in the way?
 
It's TCP, I don't think anything can get lost
By the way, it's possible that when you send the filename/filesize bit, the client only receives a part of that. So if you send "A.pdf/23" and the client only receives "A.pdf/2", you're gonna have a problem.
 
10:06 PM
@Rawing This is way my client sent the amount recived to the server, so it can be checked.
 
To be on the safe side, you could send something like "A.pdf/23/", because then the client knows the file size is followed by a slash and can keep receiving until it gets one.
Okay, but you can't assume that the server receives the whole message.
 
Great Idea!
@Rawing I know.... :(
 
You can't check if you've sent all the data by sending more data, because that data can also get lost
 
@Rawing Yeah...
 
@PM2Ring ahhh.. We seem to have gotten the same hide->seek solution :)
Off to bed now... Will have another look later...
 
10:21 PM
@PM2Ring That use of regex is terrifying... Why not s̶t̶e̶a̶l̶ use Jon's code sum(c1 != c2 for c1, c2 in zip(word, w)) == 1?
 
@Rawing I wanted to come up with a solution that wasn't influenced by other code, so I haven't looked at Jon's solution yet. But that sounds like an interesting idea. An earlier version of my code used findall on a giant string, but I switched to doing the search on a set to make it easier to eliminate words that had already been checked.
It's getting rather late here, but I guess I can do a quick timing test before I go to bed.
 
I don't know if it's a problem for your algorithm, but your regex will also match the word itself (i.e. words with 0 different characters)
 
@Rawing No, because the current word gets removed from the set of all words before I do the search.
 
Oh, right.
 
I just tried Jon's test. The program runs 3 or 4 times slower than using regex. I didn't test it with timeit, I just used the Bash time command, so that's the total run time, including the time to extract the word set from the dictionary file.
 
10:32 PM
For real? I gotta try that.
 
@PM2Ring strangely - we've used very similar naming :)
 
Can someone send me a dictionary, I'm on windows :(
 
@Rawing For most of my tests I used the SOWPOD file, which is a file of words for Scrabble. You can find it here: 3zsoftware.com/download
 
@PM2Ring there's a few things I think I can change but at 23:30 - it can wait until after a bit of sleep.
 
10:35 PM
@PM2Ring Thanks. @AndrasDeak ...thanks I guess.
 
@JonClements Me too. I'd like to reduce the amount of RAM all those chains consume.
 
Also... Think I'm loading all 1-5 letters words regardless of input... So I'm doing another 9k chain not need for hide/seek of just 4.
So that's presumably going to be a 3/4 times slower thing... Definitely won't be the zip vs regex
Anyway... Night all
 
night, Jon
 
Holy cow, regex really is faster. Now I have to try a difflib solution.
 
Oops! I just noticed that my code loops forever if it gets to a stage where it can't find any matches. Fortunately, that was easy to fix. ;)
 
10:47 PM
Unsurprisingly, difflib isn't the fastest.
 
Huh. I knew there's an issue of not being able to ping people with 2-character usernames. Bot now it seems that the SO user search only starts searching after 3 characters :|
rhubarb
 
11:19 PM
Cabbage
I'd really appreciate it if you guys could give this a look and lmk what you think
(P.S. Probs only good to check out if you dabble in/use django)
 
Anyone know how to fix UnicodeDecodeError: 'utf-8' codec can't decode byte 0x89 in position 0: invalid start byte?
 
11:34 PM
Hey everyone :)
Anyone here good at tensorflow?
 
@Ender That sounds like you're trying to decode some bytes to text, but the data you passed isn't valid UTF-8
 
-2
Q: Reading and Writing CSV

MusclesI am attaching my sample CSV file. A little bit about the CSV. Idea is to read the CSV file and create a new csv file with the headers in this csv file and four other columns added in the header i.e. NewYork, Virginia, Texas, Alaska. In my sample file Each number under the No. header is repeated ...

^ maybe close?
 
00:00 - 22:0022:00 - 00:00

« first day (2500 days earlier)      last day (2452 days later) »