How to upload a text content as a file in
We have created a binary data from the text which is in the format of
The
#javascript #jQuery #ajax #FormData #Blob #upload
$.Ajax()
?FormData
class is used to create a multipart/form-data
inside of JS code. A sample code speaks thousand words:var formData = new FormData();
var blob = new Blob([YOUR_CONTENT_HERE], { type: "text/html"});
formData.append("file", blob);
We have created a binary data from the text which is in the format of
text/html
, then I have appended the data as an input file with the name of file
(which will be captured on server-side).The
Ajax
part is utterly simple:$.ajax({
type: 'POST',
url: 'https://www.example.com/storage',
data: formData,
processData: false,
contentType: false
}).done(function(data) {});
NOTE:
DO NOT OMIT processData
, contentType
parameters.#javascript #jQuery #ajax #FormData #Blob #upload
Today's Tech Term:
D2D:
D2D is shorthand for Disk-To-Disk and refers to data backups using disks.#tech_terms #D2D #disk_to_disk
https://stackoverflow.com/questions/1964839/how-can-i-create-a-please-wait-loading-animation-using-jquery
#jquery #ajax #loading
#jquery #ajax #loading
Stack Overflow
How can I create a "Please Wait, Loading..." animation using jQuery?
I would like to place a "please wait, loading" spinning circle animation on my site. How should I accomplish this using jQuery?
By using the below library in
- https://github.com/faisalman/ua-parser-js
#github #uaparserjs #ua_parser_js
JS
you can get OS name, Browser name and version and many more stuff from within Java Script
:- https://github.com/faisalman/ua-parser-js
#github #uaparserjs #ua_parser_js
GitHub
GitHub - faisalman/ua-parser-js: The most comprehensive, compact, and up-to-date JavaScript library to detect user's browser, OS…
The most comprehensive, compact, and up-to-date JavaScript library to detect user's browser, OS, CPU, and device type/model. Also detect bots, apps, and more. Runs seamlessly in the browser...
DAAS
: DAAS (short for Data As A Service) is a “central repository”/”cloud strategy” that facilitates on-demand accessibility of business-critical data by an organization’s users in a timely manner.#tech_term #DAAS
What is the difference between the below exceptions:
Vs:
A bare
A better
#python #PEP8 #try #except #try_except #exception
try:
// Your code block
except:
// Your exception block
Vs:
try:
// Your code block
except Exception:
// Your exception block
A bare
except:
clause will catch SystemExit
and KeyboardInterrupt
exceptions, making it harder to interrupt a program with Control-C
, and can disguise other problems. If you want to catch all exceptions that signal program errors, use except Exception:
(bare except is equivalent to `except BaseException:`).NOTE:
When catching exceptions, mention specific exceptions whenever possible instead of using a bare except:
clause.A better
try & except
:try:
import platform_specific_module
except ImportError:
platform_specific_module = None
#python #PEP8 #try #except #try_except #exception
Does that happen for you too, to
Let's say you are in a long path like
#linux #cd
CD
into a wrong directory and need to get back to the previous directory?Let's say you are in a long path like
/mnt/new_volume/backup/files/archive
, now you switch to home of your directory. In order to get back to the previous directory, you just need to issue the below command:cd -
#linux #cd
https://spyhce.com/blog/understanding-new-and-init
#python27 #python3 #__init__ #__new__ #old_style #new_style #OOP #class #super
#python27 #python3 #__init__ #__new__ #old_style #new_style #OOP #class #super
Spyhce
__new__ and __init__ | Spyhce blog
The __new__ and __init__ methods behave differently between themselves and between the old-style versus new-style python class definitions.
Tech C**P
Click is a Python package for creating beautiful command line interfaces in a composable way with as little code as necessary. It’s the “Command Line Interface Creation Kit”. It’s highly configurable but comes with sensible defaults out of the box. …
👆 Great library for creating python scripts for server maintenance. Read on.
What do you think the best way is to extract active users from the list below in
Waiting for the answers :)
#python #question
Python
?users = [
{
"email":"[email protected]",
"is_active":True
},
{
"email":"[email protected]",
"is_active":True
},
{
"email":"[email protected]",
"is_active":False
},
{
"email":"[email protected]",
"is_active":False
}
]
Waiting for the answers :)
#python #question
In
another mailbox:
Security and Filtering -> Acceptance and Routing -> Advanced settings -> Add acceptance / routing rule
Phew! Now in
Now in
This is it.
#mail #mail_server #axigen #filter #routing
axigen
mail server you can set a filter that if sender email address (from) has a specific text using regexp then redirect it toanother mailbox:
Security and Filtering -> Acceptance and Routing -> Advanced settings -> Add acceptance / routing rule
Phew! Now in
Conditions
section open combo box and select Email
under Recipient
. Click Add condition
. A text box is appeared now which you can select Regexp
from the combo box and enter your regex like:.*SpecificSender.*
Now in
actions
section in name enter the mail address you want to receive emails in and in Folder text box enter INBOX
.This is it.
#mail #mail_server #axigen #filter #routing