« first day (4321 days earlier)      last day (619 days later) » 

1:59 AM
Hi, Anyone using Pycharm here to write Python code? Mac keyboard input is not being recognized by Pycharm
Does anyone have idea how to overcome?
Thank you
 
 
7 hours later…
9:03 AM
@NordineLotfi Have to correct myself here. signal.raise_signal is not sugar around os.kill and will indeed directly deliver the signal to the process even on Windows. TY for the suggestion.
 
9:13 AM
VS Code is actually very decent and nowhere as clunky as in my recollection.
 
9:56 AM
@MisterMiyagi ah, glad this could help! I was confused at the time too, since I tried it on my own windows10 laptop..., anyway, thanks for remembering
 
 
2 hours later…
11:44 AM
Hi guys, I wanted to do a web scraping of the SO bountied page, but the web scrape performed only took the questions on the first page, anyone here have any ideas how I can do it on all the pages? :D
 
Instead of doing scrape(bounty_page(1)), do for i in range(num_bounty_pages): scrape(bounty_page(i))
 
hehe not so simple
I ran this driver.get("https://stackoverflow.com/questions?tab=bounties")
maybe that's why it took the first page only?
 
Sounds plausible to me.
 
just increase the page number until you can't read it anymore https://stackoverflow.com/questions?tab=bounties&page=1
 
@PeterT Oooooh lemme try looping the page nos.! good idea!
how do i tell if it can't read anymore, I could do a try except?
 
11:50 AM
see if parsing got you some new results or not
 
Ok, Ill try thanks
 
I claim 50% of the credit for the "try looping over it" idea
 
hehe you get 25%
 
i'd say Kevin deserves 75%
 
:O Kevin didn't state how but hmm :D
 
11:56 AM
99% inspiration, 1% perspiration
 
@Kevin Inspiration 99% :P
 
I am a beacon for my people
 
Your a 73k user so you're easily knowledgeable in this :D
Oh dear my output is too large
Anyone here know how to not make the output auto compress a long dataframe?
 
(assuming you meant during display) just write out the output to a file.
 
@DialFrost can I recommend to not scrape but instead use the offline data dumps from archive.org? here the link. You can make your own tool to parse it, or...use one I made? (it's horrible but it works): github.com/secemp9/stackdump2txt
 
12:00 PM
@ParitoshSingh ya during display, hmm What if I don't want to ?
 
shrug iono, if i was doing something like this, my first step would have been to search online and see the first result i get
 
I've forgotten most of the specifics of scraping. For example, I don't remember how to make selenium run in headless mode. But perhaps knowing that selenium has a headless mode, is useful information
 
but trying to make things fit in displays generally leads to more problems than it solves, since screen space is ultimately finite. something has to give.
 
@Kevin headless mode??? XD
 
@ParitoshSingh btw, I don't know maybe it's my imagination, but I never saw you reply to any of my mentions for a while now...it's fine either way, but I'm just curious if I did something that upset you somehow
 
12:03 PM
That's right. Normally, when selenium runs, it opens up a mostly normal looking browser window, and you can watch it scroll around and interact with things. But in headless mode, that window is invisible.
 
Oh Ic
 
@DialFrost I'm not in any position to prove that wrong, but I don't think it's a perfect metric for this kind of things (eg: context-dependent, human errors, etc)
 
@NordineLotfi oh. uh, sorry if i missed something! If i did, it was not intentional. not upset or anything at all!
in fact..i dont think i missed anything which means i clearly missed something. oops?
For what it's worth, i don't really keep chat open for long periods, just occasionally check in when i can. So the likelihood of me missing messages is very high.
 
You don't have to be knowledgeable about things to get 73k rep, but it helps
 
@Kevin Heh
 
12:10 PM
@ParitoshSingh I see :) I'm glad it wasn't anything I did. I don't mind it as mentioned, but wanted to make sure is all, especially since I can usually go off the rails in what I say (I used to do long block of text, but now I think I do better, etc), so I sometimes doubt if what I do/say is maybe annoying
Thanks for the reality check
 
I don't mind seeing long blocks of text. It makes my own long blocks of text less lonely.
 
@NordineLotfi yeah no such thing from my side atleast. also, i did scroll up, and noticed the message you probably were looking at. i did see the comment about qemu earlier, and i hadn't known what it was, so i went on a google spree instead of replying at the time and never found my way back to the chat. So if anything, you gave me another rabbit hole to dig into :)
 
12:31 PM
@Kevin Interesting
Wait guys, if my dataframe is too long in terms of the row, will it naturally output it all on top of each other? Or I am just doing smth wrong?
 
@Kevin :D Glad I'm not the only one
 
In my experience, web scraping doesn't involve dataframes at all
 
@ParitoshSingh ah, my bad for the rabbit hole. I usually go into a couple every now and then, so I totally relate.
 
Strange df.to_csv('products.csv', index=False, encoding='utf-8') doesn't give anything in my excel sheet
 
Perhaps Excel is looking at a cached version. Try looking at the csv file in Notepad.
 
12:46 PM
Hmm
nvm I tried this
```
writer = pd.ExcelWriter("web_scrape.xlsx")
df.to_excel(writer)
writer.save()
```
But it doesn't work :/
 
Looks fine to me.
 
@Kevin My excel sheet is blank :(
 
1:01 PM
Hang in there!
 
I gave up on excel and decided to print in the output instead, it's good, only problem is it's printing vertically for some reason :/
 
1:47 PM
try rotating your screen
 
Heh wut, I can't rotate my laptop XD
 
Try flipping it in the air, it will display horizontally every n/2 flips :P
4
 
hehe
 
2:05 PM
Pandas is a bit nuts but there's no way it writes an empty Excel file for a df that has values
If it does that, we might as well flip the table and all go home
 
@DelriusEuphoria macbook -> air
 
@roganjosh hehe
 
Lots of flippin' happening today
 
I just don't buy it, sorry. You've done something else
Or failed to use the writer correctly. I'm on my phone so research is slow
 
2:30 PM
@AndrasDeak--СлаваУкраїні :d
Cabbag
e
asynchronous inpu
t
 
2:47 PM
The rubber duck solved a problem I was having. Thank you, rubber duck. For the record, the answer was import re; re.findall("foo[^\w]", "food foo@ fool foo# foom")
I thought you couldn't put special sequences inside a character set because it would dumbly read "\w" as "literal slash and literal w". But I was mistaken. Seems like it is me that's dumbly reading.
That solves the fourth layer of my XY problem. Now I can find more refined results from my overly broad search for all instances of attribute access on a module that I think needs to be set before I can run the sql query that is possibly responsible for the absence of a print statement that I think is supposed to be present.
And after refining the search... Zero results. Either I wrote the regex wrong, or I haven't anticipated all the possible ways to set attributes on the module, or I'm searching in the wrong file, or the module is not involved in the third layer of the XY problem, or the sql query is not involved in the second layer of the XY problem, or the print statement is supposed to not be there.
 
Found him, they call him super duck
 
3:06 PM
@Kevin The introduction of regex solved my pr....oh.... Now I have t̶w̶o̶ n problems.
 
Ok, I'll take him. Along with the actual real rubber duck on my desk, that makes two. I need about four more to solve this XYZΓΔΘ Problem.
I'm being a little facetious -- I don't actually think I wrote the regex wrong. so it's only a five layer problem, not a six layer problem.
"Maybe I wrote the regex wrong" never actually leaves my big list of "things to check when something isn't working". Carefully reviewing the logic of the regex will only move it down the list by five ranks or so. The only way to kill it for good is a stake to the heart replacing it with a count/find/__contains__ based solution
 
3:30 PM
hey i have a git question is it entertained here
 
Maybe. There are a few rules of the road here : sopython.com/chatroom if you're not sure.
 
I had a local branch by the name of 'boz' and i ran git push --set-upstream origin honey/boz but it gave error, then I created another branch called honey/boz and ran the same push command this time it ran without error, the error it gave was same as given in this link below
3737
Q: Message 'src refspec master does not match any' when pushing commits in Git

sinooheI clone my repository with: git clone ssh://xxxxx/xx.git But after I change some files and add and commit them, I want to push them to the server: git add xxx.php git commit -m "TEST" git push origin master But the error I get back is: error: src refspec master does not match any. error...

and git push is eating my brain
 
did you mean git push origin HEAD:honey/boz
or git push origin boz:honey/boz
 
no I did not write any HEAD
oh I see that would do what I intend it to do? pushing my local boz into remote honey/boz ?
 
no it will push to origin/honey/boz
did you mean to push to a remote named "honey"?
 
3:36 PM
no the one you wrote that
origin/honeyboz
 
ok, well then the second command should do that
it's git push remotename local_srcbranch:remote_dstbranch
 
thanks a lot, i dont know why in my training they did not tell this specific command, I ended up creating junk branches on the remote
 
@jeea I recommend learngitbranching.js.org
It might not cover this exact case, but it founded my understanding of git
 
thanks a lot! learning resources are always welcome!!
 
Also, if you omit the source branch you can delete the remote. git push upstream :branch_to_kill
 
3:47 PM
huh, did not know that I usually do git push --delete upstream branch_to_kill
the git interface is a mess, I don't think it can be exhaustively taught in a reasonable manner
 
yeah, but you need very little to get by confidently
 
3:58 PM
@AndrasDeak--СлаваУкраїні You always have the best links. Thanks, man.
 
4:52 PM
So apparently it's not acceptable anymore to post a link to help/someone-answers, even if it's a new 1-rep user who didn't take the tour and comments "Thanks, this worked great!" or similar on your answer. There was a meta question about it a little while ago, and I had a similar "attempting to teach them our ways" comment deleted over the weekend (no mod wrist-slap, though). Stupid stupidness.
I guess we're not allowed to teach new users how the site works, because they have the help center. Which we're not allowed to point them to. Because the help center.
 
"We are the authority. You are the user. Therefore you will do what we say. Even if it hurts our users and hence (since we rely on monetising your presence here) ultimately us," perhaps? I dunno.
 
I'm trying to find the Meta post I was talking about. There was this proposal, which was down-voted into oblivion, yet it still seems mods are using those criteria.
Ah yes, this comment...
 
 
1 hour later…
6:32 PM
cabbage
 
7:07 PM
 
7:37 PM
@tripleee got it, and thanks for reminding me of the canonical. I had something earmarked to hammer with that too
 
8:03 PM
(I really think it's a misfeature that absolute import checks the current directory before the standard library. convenient for some, a constant mysterious pain for others. Who has time to memorize a list of standard module names?)
(on the other hand, the standard library really should be using relative imports, or at least have some kind of special namespacing)
@MattDMo there are also meta-questions about getting the system to put up someone-answers notices more prominently/automatically, IIRC.
(also, accept votes are IMO not really valuable to the site operation, users should instead have the upvote privilege out of the gate)
(experience has shown that if "this solved my problem" is indicative of who in particular understood the question, it's a very unclear question)
 
8:35 PM
I = lambda x: x
T = lambda a: lambda x: lambda b: lambda y: a(b)(x(y))
times = lambda x: lambda y: x*y
plus = lambda x: lambda y: x+y
result = T(T)(T)(T)(T)(T)(T)(T)(T)(T)(T)(T)(T)(T)(times)(T)(T)(T)(I)(T)(I)(I)(2)(T)(T)(times)(plus)(4)(3)(5)
print(result)#26
Today's experiment with higher order functions -- rewriting result = 2*3 + 4*5 using only non-nested function calls
The nested parens of "(x(y))" in the T = ... line doesn't count, because I say so
 
9:01 PM
church numerals eh
 
9:38 PM
hey guys, what exacrtly is going on with a n by n dim np.array A when you pass it n x n arrays x and y like this A[x,y]
i saw this syntax being used in some funky opencv lensing problem
the types of A, x, and y is specifically numpy.ndarrayso nothing out of the ordinary there
 
@Skyler advanced (or fancy) indexing, see numpy.org/doc/stable/user/…
If everything has shape (n, n) then the result would have shape of something like (n, n, n, n), so I doubt your example was accurate
actually, no
>>> n = 3
... A = np.zeros((n, n), dtype=int)
... A[A, A].shape
(3, 3)
Ah, I think I see. Pairs of indices are formed from respective values of x and y and those are filled in the result.
So A[x, y][i, j] should then be the same as A[x[i, j], y[i, j]]. Haven't tested it though, and it's easy to get confused with fancy indexing.
 
 
2 hours later…
11:17 PM
here is the function in question, ive broken it down in another notebook step by step so I know the final format of inputs into the last step
#note i modified the function to return an output but otherwise its original to a project

        def lensImage(img, src, lens, xs, ys):
            """Useage: lensImage(img,src,lens,xs,ys)
            lens a 2d numpy array in place using a given source distance src and
            black hole coordinate (xs,ys).
          Parameters
          ----------
          img : 2d array of floats.
            Image data from cv2 capture
          src : float
            Distance to source (pixels)
          lens : float
@AndrasDeak--СлаваУкраїні I can see that it shifts it but didnt quite understand how it was being done mathematically speaking. I have been able to observer how the d_shift terms create values which shift pixels but dont quite get it, are those remapping pixel locations for example?
 
11:32 PM
like its saying create a new array where pixel A_i,j is the value that corresponds to pixel at (x_i,y_j)
 

« first day (4321 days earlier)      last day (619 days later) »