Ankit_ Anmol
@QuantumCodes
Hi, I am Ankit_Anmol from Scratch
https://scratch.mit.edu/users/Ankit_Anmol/
0
Transferring replitDB data
For some reason, i had to move a repl to another repl with the database data.
Original repl = the repl with the db data
New repl = the repl to which the new data is to be transferred.
So the approach i used:
Print the replit db url from the original repl.
print(db.db_url) #I used this
print(os.environ["REPLITDBURL"]) #this works the same
Go to the new repl and add a secret:
os.environ["REPLITDBURL"] = "the original db url." #i didnt add in
code like this lol. I manually put in the sidebar
Stopped the original repl (didnt delete)
Everything works fine. Heres the problem: Replit DB URL updates every month (It has changed once). Is there any way to transfer DB data permanently?5
2
0
0
CSS float problem
This is a portion of my website.
I am using CSS to align different text to opposite sides of a bar. (I am using the float property)
When i put a image to the right side text, the text moves to the center(box #2). Without the image, everything is good(box #1).
I want the 1st box also look like the second one. How to do that?8
4
0
I recently made a package that i uploaded to pypi:
Code: https://replit.com/@QuantumCodes/ScraGet
PyPi: https://pypi.org/project/ScraGet/
Whenever i
Python
i searched for posts about this but didnt find recent one.
So... i crrated this..
Problem:
Everyday, whenever i open my browser, it shows i am
VulcanWM Replit is adding some new updates and because of that some bugs are coming up and they prolly have to log you out
There’s no way to fix this and it’s also happening to me1 year ago
Limitations:
50 MB per database (sum of keys and values)
5,000 keys per database
1000 bytes per key
5 MB per value
I dont quite understand some thin
Coder100 Please do read the docs:
image
as you can see, if you all values had 5MB you could only have 10 keys because of (1).
no because it literally says you can only have 5000 keys and hold up to 5000kb only
compare to json? json storage is counted in terms of mb just the same as replit db data is compared in terms of mb. bytes are characters, and I would think json is very inefficient in terms of storage. Perhaps you need to rethink that question.1 year ago
Can someone hack this? Hack = reveal the secret (environmentvariables) variable "y" has the secret
If u can, say the secret and pls say how to fix th
Coder100 environment variables are only set by those that have multiplayer access to the repl or made the repl.
In other words, if you can't edit the repl, the environment variables are hidden.2 years ago
I wanted to learn asyncio (for a discord bot)..
I didnt find any good tutorial explaining step by step..(referring to Tutorials at realpython)
So i st
Python
If i have a thread that runs a function that returns something, how do i get the returned value?
from threading import Thread
def func():
x = "ret
Chiroyce I think Django is faster, check this out — https://replit.com/@templates/Django-App-Template2 years ago
Was the font changed in python console or is it just me? (Cuz i didnt change)
InvisibleOne It changed for me, I think replit updated their console. I'm still not one hundred percent sure how much I like it. It isn't bad I guess. But I liked the last console font.2 years ago
There exists an inbuilt hash(val) function where x is a variable. It can hash x.
Usually inbuilt funvtions have a color in replit IDE zuch as str(x)
Coder100 No, those aren't really bugs, the syntax highlighter isn't always correct a lot of the times, and the devs probably have a reason for it.
Anyways, hash isn't entirely a type per se, as str and int are.
https://replit.com/@Coder100/BasicUnderstatedLint-try-this-out.
int and str are probably highlighted for that reason.
2 years ago
this is a new feature (or rather i knew recently)
What does this do?
It is only available on multiplayer repls/team repls
It shows its observing but w
Coder100 It is like spectator mode, you sync up with whatever the user is doing, and you can find them easily.
(like if they are in another file, just click on them to get there)2 years ago
i dont really understand whats the problem.. it used to work, i didnt change anything there... i was just adding other webpages. After i added the /vi
Python
the playsound package doesnt work. Is there any way to play a sound on python replit? I want to play an online sound (ie) not downloaded
xfinnbar You can using the replit package, but I recommend making it a website for a better user experience.2 years ago
if i want to ping many websites at once (using requests library) it takes a long time.. is it possible that it first pings web1, then withoutnwaiting
Coder100 You can use threading, like this:
from threading import Thread
websites = []
def ping_website(link):
add code to ping website
for i in websites:
t = Thread(target=ping_website, args=(link))
t.start()
also never ever ping a website every half second -- that's on the verge of making the website crash. Make it do every 5 minutes.2 years ago
InvisibleOne I would try threading, that way you can run a whole bunch of threads.
import threading
import requests
import time # not sleep
def ping(website):
try:
requests.get(website, timeout=1)
except:
print(f"Timeout error with website {website}")
while True:
for i in websites:
thread = threading.Thread(target=ping, args=[i])
thread.start()
thread.join()
time.sleep(0.5)
This way it won't wait for that thread to be done, it will just move on to creating another thread without2 years ago
6
TicTacToe AIA (best in the world) AI plays tic-tac-toe against you. You target is to lose! I mean-- to win...
Written by: AI in the game
80
3
6
so, i wanted to detect whether a link exists or not (or) if it exists but the person has not run the repl. (I am making a pinger)
Repl example: https
Python
AntarcticaAdv If you want to show the error try this:
import requests
try:
x = requests.get("https://Pinger-testing.quantumcodes.repl.co/",timeout=3)
except Exception as e:
print(e)
`2 years ago
This is a starter template for simple POST/GET requests from python to HTML through flask. You can easily switch between the post and get methods by c
Python
I made this script that works when you change the method variable to POST.
method = "POST" (line 5)
but when i change it to get: method = "GET", then
Python
SamDev7 You don't need the method variable. Since the arg username is not required, you can see first if username is sent.
if 'username' in request.args:
Get Username arg
2 years ago
19
TypewriterThis is a typewriter engine made in python.
81
1
19
Yoshimon44 Maybe because of the end="" statement, the program kept putting the I values in this "buffer" mentioned in (https://realpython.com/lessons/sep-end-and-flush/), and flush=True made the program keep taking out whatever was in the "buffer" and resetting it?
im not sure, im quite unknowledgeable about things like this, but thats just what i think
1 year ago