This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
String hello = "Hello Dunia"; | |
String nama = "Eby Sofyan"; | |
int angkaSepuluh = 10; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
getProgress = (taskId, progressBarId, progressBarMessageId, isDownloadFile = false) => { | |
var progressUrl = `{% url 'progress' %}?task_id=${taskId}`; | |
function onExportUserProgress(progressBarElement, progressBarMessageElement, progress) { | |
progressBarMessageElement.innerHTML = `Progress ${progress.percent}% . . .` | |
progressBarElement.setAttribute("style", `width: ${progress.percent}%`) | |
progressBarElement.setAttribute("aria-valuenow", progress.percent) | |
} | |
function onExportUserSuccess(progressBarElement, progressBarMessageElement, result) { | |
alert("Complete progress 100%") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from dj_celery_progress_sample import celery_app | |
# Celery task function base | |
@celery_app.task(bind=True) | |
def count_thousand_number(): | |
for i in range(0, 1000): | |
print("Current index is : %s" % i) | |
return "Complete count thousand times" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# write this in celeryconfig.py | |
import os | |
import tempfile | |
broker_url = "redis://localhost:6379/0" | |
result_backend = "redis://localhost:6379/0" | |
accept_content = ["pickle", "json", "msgpack", "yaml"] | |
task_ignore_result = False | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def the_magic_of_python(*args, **kwargs): | |
still_learn = bool((args[0] and args[1]) == True) | |
if still_learn: | |
learn_python = kwargs.get("learn_python") | |
print(learn_python) | |
else: | |
lets_try_python = kwargs.get("lets_try_python") | |
print(lets_try_python) | |
args_params = (True, False) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def the_magic_of_python(*args, **kwargs): | |
print("This is args values : %s" % str(args)) | |
print("This is kargs values : %s" % str(kwargs)) | |
the_magic_of_python(True, False, first=15, second=26) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def the_magic_of_python(*args, **kwargs): | |
print("The first value of kwargs is : %s" % kwargs.get("first")) | |
print(kwargs) | |
the_magic_of_python(True, False, first=15, second=26) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def the_magic_of_python(*args, **kwargs): | |
print(type(kwargs)) | |
the_magic_of_python(True, False, first=15, second=26) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def the_magic_of_python(*args, **kwargs): | |
for i, arg in enumerate(args): | |
print("This is the %s parameter, value %s" % (i, arg)) | |
the_magic_of_python(True, False, 1, 2, 3) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def the_magic_of_python(*args, **kwargs): | |
print("The first args parameter is : %s" % args[0]) | |
print(args) | |
the_magic_of_python(1,2,3,4,5) |
NewerOlder