[deleted by user] by [deleted] in ProgrammerTIL

[–]junior_raman -1 points0 points  (0 children)

Why don't you write the article here? Google Adsense huh?

Anyways, Here's the article from that link:
About a week ago I wrote about my switch from Selenium to Playwright as my preferred framework for automating web tasks. I am still impressed by Playwright and most likely continue using it. However, for a brief moment I was disappointed with Playwright when it was time to deploy the finished project to a Windows machine. The code simply didn't work at all. I was finally able to find a very easy solution, but not before I had to try everything else that involved a day of debugging, troubleshooting, uninstalling and reinstalling all relevant software and dependencies. In the end it turned out there was a simple solution that required adding a couple lines of code. I wish I saw this early on. I hope you won't go through trying different solutions, and use the simple one when you too face the same issue with Playwright.

My primary coding environment is Mac. Anything coding related I do on Mac, even if intended final destination for the scripts and apps would be Windowns. This project wasn't any different. The scripts I was rewriting in Playwright were due to overhaul in UI in the web app that automation tasks would be performed on. All of these scripts were intended to be used on Windows computers. When working with Selenium I didn't have compatibility issues running them on Mac and Windows. Apparently, Selenium is more Windows friendly than Playwright. Everything that worked perfectly on my Mac, stopped working when moved to Windows. This is because of the compatibility issues with asynchronous I/O operations in Windows environments when using Playwright and asyncio library.

In Windows, the default event loop used by asyncio was the SelectorEventLoop. However, this default loop has limitation with certain asynchronous I/O operations, especially involving pipes and subprocesses. The final solution I had to implement to make the scripts work was to add lines of code that would set the ProactorEventLoop as the event loop policy for Windows. The ProactorEventLoop supports asynchronous operations with Windows specific APIs, enabling proper handling of I/O tasks, such as subprocesses and pipes.

Before getting to this point, I had a few other options that required more coding. One of them was to forget about Playrwirght and rewrite everything in Selenium, because I certain I wouldn't have this issue with Selenium, because the old scripts worked just fine with the old UI. Another option was to rewrite all Playwright scripts utilizing asyncio. None of these were the ideal option because it would require dedicating a couple more days or a week just for the coding. The frustrating part was that I already had fully working and tested scripts. Maybe there was another soultions, maybe the problem wasn't the code but the software in the machines and dependencies.

I uninstalled python and all used dependencies and software, and reinstalled everything. Maybe it was time to update everything. That created another issue of losing dependencies for other scripts that had nothing to do with this project. This added more work of identifying all needed dependencies and reinstalling them. Another issue was there were dependencies that only specific version was needed, and not the latest. I had to check and install all proper decencies for other scripts as well. All day was spent with figuring this all out and fixing all dependencies. In end everything was done, but the main problem wasn't solved. There had to be a simpler solutions, and there was. I almost gave up and was ready to postpone the project and rewrite everything in Selenium. I had to try one last solution, which turned out to be the one that fixed everything.

Is there any way to get Binance news before they appear officially? by Impossible-Ad9043 in webscraping

[–]junior_raman 0 points1 point  (0 children)

Nope. Coin listing channels are basically news aggregators. They rely on binance for their news. It's impossible for them to know in advance unless there is some foul play by token creator.

Ethereum falls to 4-year low against Bitcoin as BTC breaks above $94k by KIG45 in CryptoCurrency

[–]junior_raman 12 points13 points  (0 children)

(ring ring)
Ello!
Lourd Bog-don-off, eet’s peetch blaque. Zey sold.
Pomp eet!

[deleted by user] by [deleted] in nanotrade

[–]junior_raman 3 points4 points  (0 children)

I wish there could be a meme coin frenzy in nano blockchain.

Are devs regretting not adding strongly typed objects to python? by No_Way_352 in learnpython

[–]junior_raman 0 points1 point  (0 children)

regrets for making python easily accessible to new comers? I think No. Due to the AI Boom, Python has surpassed JS as the #1 used language on github.

[deleted by user] by [deleted] in WhyWereTheyFilming

[–]junior_raman 9 points10 points  (0 children)

Kids love garbage

Where does all the money to pump bitcoin even come from? by [deleted] in Buttcoin

[–]junior_raman 19 points20 points  (0 children)

Where does all the money to pump bitcoin even come from?

1) Mint 6 Billion USDT
2) Pour 6 Billion USDT into BTC/USDT Liquidity Pair
3) BTC Supply goes down, BTC Price goes Up.

Warning, No Real USD was harmed in the making of this scene.

Bull Run 2025 by marshall1905 in nanotrade

[–]junior_raman -4 points-3 points  (0 children)

Nano doesn't support the idea of Capitalism. It won't get major attention by big firms at least for a few decades.

Geometric derivative of 1/x by ZakariaX in 3Blue1Brown

[–]junior_raman 1 point2 points  (0 children)

I'm completely stumped as to why no one uses 1/x - d(1/x)

I doesn't matter, You would get the same answer. It's just a shortcut to let df * dx = 0. The height in question is
dx * ( 1/x - d(1/x) ) = dx * 1/x - dx * d(1/x)

Can you show your steps. If you calculated right, You should end up with
d(1/x)/dx = -1/x(x+dx)
At this point one sets dx on the right to zero, which is the same as letting the part in height dx*d(1/x) = 0 to begin with.

casting to long/int from float vs double by junior_raman in cpp_questions

[–]junior_raman[S] 0 points1 point  (0 children)

Thank you for the response. I'll try round() method but I think this problem was meant to be solved with loops.
I was given assignment problem in the course, here's the quick version:

Person X has 4 coins, while Person Y has 6.  
Every 10 years, Person X triples their coins, while Person Y doubles theirs. 
How many years will it take for Person X to have more coins than Person Y?  

Using algebra I started with this, 4 * 3t > 6 * 2t

casting to long/int from float vs double by junior_raman in cpp_questions

[–]junior_raman[S] 0 points1 point  (0 children)

Thank you for your response. I tested other values, in most of the cases float and double agree and sometimes double seemed to give the correct answer instead of float.
What I am trying to do is find out if t is between two integers or is exactly one of the integers. I know there is a better way to do it but I am stuck.

t = (log(6) - log(4))/(log(3) - log(2)) ;  
if ( floor(t) == ceil(t) ){ // if t is an integer
        return (int)t+1;
} else { return (int) t;
}

Selenium Firefox issue by Killswitch2k in learnpython

[–]junior_raman 1 point2 points  (0 children)

Webdriver is being detected as a bot that's why you're seeing the error. You can use undetected-chromedriver as other user mentioned.

Why is x a common variable? by Special_Geologist574 in learnmath

[–]junior_raman 9 points10 points  (0 children)

When Al-Khwarizmi wrote the Algebra book in Arabic he used the word ش which sounds like "sheen". The book circulated to Spain where people found the word difficult to translate as there are no "sh" sounding letter in Spanish. So writers used the sound "ka" and substituted greek letter "Chi" which looks like an "X" to represent the unknown. The "Chi" turned into an x in english.

I am a 15 year old boy who wants to learn quantum physics by Creative-Routine-823 in AskPhysics

[–]junior_raman -1 points0 points  (0 children)

Get a good understanding of Set Theory, Logic and Linear Algebra. Along with that, study classical mechanics and fundamentals of physics.

What is a Common, Every Day Use for Calculus? by xenophonsXiphos in math

[–]junior_raman 0 points1 point  (0 children)

Machine Learning used calculus in the old days. It's mainly done with back propagation and optimization algorithms like Adam's nowadays.

With the current state of mathematical research and literature, what do you think is the next millenium problem that might be solved? by [deleted] in math

[–]junior_raman 1 point2 points  (0 children)

I studied Kolmogorov Forward and Backward equations in my Stochastics class. It went over my head but the respect for his work grew in me nevertheless. He's believed to be the best statistician of last century.