url

video.js 动态获取URL 并播放youtube视频

北城以北 提交于 2020-03-28 09:32:28
怎样使用VIDEO这里就不说了 这里主要播放YOUTUBE视频 <script src="https://cdn.bootcss.com/video.js/7.5.4/video.js"></script> <script src="https://cdn.bootcss.com/videojs-youtube/2.6.0/Youtube.js"></script> //弹窗 <video id="my-video" class="video-js vjs-default-skin" controls preload="none" width="1000" height="580"> </video> //页面触发 传递动态URL 可传递播放列表页面 例如: http://www.youtube.com/watch?v=xjS6SftYQaQ&list=SPA60DCEB33156E51F <span class="open-video" data-url="https://www.youtube.com/watch?v=xjS6SftYQaQ"><a href="javascript:void(0);">Video</a></span> <script> //实例化videojs var player = videojs('my-video',{ techOrder:[

Android 中的编码与解码

别说谁变了你拦得住时间么 提交于 2020-03-28 07:46:12
前言:今天遇到一个问题,一个用户在登录的时候,出现登录失败。但是其他用户登录都是正常的,经过调试发现登录失败的用户的密码中有两个特殊字符: * 、# 。 特殊符号在提交表单的时候,出现了编码不一样的问题。那么编码是什么鬼?? 1、 什么是application/x-www-form-urlencoded字符串? 它是一种编码类型。 当URL地址里包含非西欧字符的字符串时,系统会将这些字符转换成application/x-www-form-urlencoded字符串。 表单提交时也是如此,当包含非西欧字符的字符串时,系统也会将这些字符转换成application/x-www-form-urlencoded字符串。 package com.app; import java.io.UnsupportedEncodingException; import java.net.URLDecoder; import java.net.URLEncoder; public class AA { public static void main(String[] args) { /** * 将application/x-www-form-urlencoded字符串 转换成普通字符串 */ String keyWord = ""; try { keyWord = URLDecoder.decode("

Rails - absolute URL for images in assets path for heroku

感情迁移 提交于 2020-03-28 06:59:38
问题 I am having images under app/assets/images/admin directory. In development I've used something like this to get the URL "#{root_url}assets/admin/filename.jpg" But its not working on Heroku. So what is the best way to reference images under assets folder on Heroku? 回答1: reference images under assets folder If you're using image_tag, you'll be able to call the relative path regardless of whether you're in production or development : <%= image_tag "admin/filename.jpg" %> -- If you're calling the

Nginx七层反向代理和负载均衡

让人想犯罪 __ 提交于 2020-03-28 04:37:55
1.介绍 1.1 Nginx不仅是一个出色的 web软件,其七层代理和负载均衡也是相当出色。 Nginx做前端代理,当用户请求服务时,可以根据 url进行判断,然后分配到不同的后台 webserver上。 1.2 Nginx的负载均衡实现原理:首先在 http模块中配置使用 upstream模块定义后台的 web server的池子,名为 proxy-web,在池子中我们可以添加多台后台 webserver,其中状态检查、调度算法都是在池子中配置;然后在 serverr模块中定义虚拟主机,但是这个虚拟主机不指定自己的 web目录站点,它将使用 location匹配 url然后转发到上面定义好的 web池子中,最后根据调度策略再转发到后台 web server上 2.负载均衡配置项的介绍 2.1 upstream调度算法介绍 ( 1) rr轮询(默认) 按照请求顺序分配到每个 RS,和 lvs中的 rr算法一样,如果 RS宕机,会自动剔除,默认情况下只检测 80端口,如果 RS报 402、 403、 503、 504错误,会直接返回给客户端。 ( 2) weight(权重) 在 rr的基础上再加上权重(默认是 rr+weight),权重轮询和访问成正比,值越大分配的越多,可以根据服务器的配置设置权重,可以解决服务器性能不均进行请求分配的问题 ( 3) ip_hash 解决动态网页

Nodejs登陆注册应用

ⅰ亾dé卋堺 提交于 2020-03-28 02:38:10
1.搭建服务器: const http = require('http'); const urlLib = require('url'); const querystring = require('querystring'); const fs = require('fs'); http.createServer(function(req,res){ //创建服务器 var str = ''; req.on('data',function(data){ str += data; }); req.on('end',function(){ //解析数据 const post = querystring.parse(str); const obj = urlLib.parse(req.url,true); const get = obj.query; const url = obj.pathname; //console.log(url,get,post); var file_name = './www'+ url; fs.readFile(file_name,function(err,data){//读取后台文件 if(err){ res.write('404'); }else{ res.write(data); } }) }); }).listen(8080); 2.配置接口: //

django-配置url

左心房为你撑大大i 提交于 2020-03-27 11:25:32
1、我们创建页面的时候,已经知道在urls.py中配置url,但如果项目庞大有十几个url或者更多时,这样配置无疑是很繁琐,并且难以维护 import firstApp.views as bv urlpatterns = [ # path(url本身(地址), 响应函数, url的名称), path('admin/', admin.site.urls), path('index/', bv.index), ] 所以再使用另外的方法来配置 2、includ方式配置   1)、首先在我们创建的应用下,新建一个urls.py文件   2)、在firstApp/urls.py中配置url 注意:这里的‘index/’是我们url的 子路径 ,即我们在firstApp中配置的相关地址   3)、在firstPro/urls.py中配置我们新创建的firstApp/urls.py 注意:这里的‘firstApp/’是我们url的 总路径 ,即我们在firstApp中配置的地址都是配置在‘firstApp/’之后的   4)、启动服务后,在浏览器输入我们现在的配置路劲: http://127.0.0.1:8000/firstApp/index/ 即可看见我们的页面 3、但我们能看见路径 http://127.0.0.1:8000/firstApp/index/ 有时候觉得很不合理

用JavaScript编码URL?

戏子无情 提交于 2020-03-27 07:47:50
3 月,跳不动了?>>> 问题: How do you safely encode a URL using JavaScript such that it can be put into a GET string? 如何使用JavaScript安全地编码URL,以便可以将其放入GET字符串中? var myUrl = "http://example.com/index.html?param=1&anotherParam=2"; var myOtherUrl = "http://example.com/index.html?url=" + myUrl; I assume that you need to encode the myUrl variable on that second line? 我假设您需要在第二行编码 myUrl 变量? 解决方案: 参考一: https://stackoom.com/question/1Oau/用JavaScript编码URL 参考二: https://oldbug.net/q/1Oau/Encode-URL-in-JavaScript 来源: oschina 链接: https://my.oschina.net/stackoom/blog/3212217

JS中对URL进行转码与解码

此生再无相见时 提交于 2020-03-27 07:00:11
1. escape 和 unescape escape()不能直接用于URL编码,它的真正作用是返回一个字符的Unicode编码值。 采用unicode字符集对指定的字符串除0-255以外进行编码。所有的空格符、标点符号、特殊字符以及更多有联系非ASCII字符都将被转化成%xx格式的字符编码(xx等于该字符在字符集表里面的编码的16进制数字)。比如,空格符对应的编码是%20。 escape不编码字符有69个:*,+,-,.,/,@,_,0-9,a-z,A-Z。 escape()函数用于js对字符串进行编码 , 不常用。   var url = "http://localhost:8080/pro?a=1&b=张三&c=aaa";  escape(url) --> http%3A//localhost%3A8080/pro%3Fa%3D1%26b%3D%u5F20%u4E09%26c%3Daaa 2. encodeURI 和 decodeURI 把URI字符串采用UTF-8编码格式转化成escape各式的字符串。 encodeURI不编码字符有82个:!,#,$,&,',(,),*,+,,,-,.,/,:,;,=,?,@,_,~,0-9,a-z,A-Z encodeURI()用于整个url编码   var url = "http://localhost:8080/pro?a=1&b

JS中对URL进行转码与解码

廉价感情. 提交于 2020-03-27 06:52:38
1. escape 和 unescape escape()不能直接用于URL编码,它的真正作用是返回一个字符的Unicode编码值。 采用unicode字符集对指定的字符串除0-255以外进行编码。所有的空格符、标点符号、特殊字符以及更多有联系非ASCII字符都将被转化成%xx格式的字符编码(xx等于该字符在字符集表里面的编码的16进制数字)。比如,空格符对应的编码是%20。 escape不编码字符有69个:*,+,-,.,/,@,_,0-9,a-z,A-Z。 escape()函数用于js对字符串进行编码 , 不常用。   var url = "http://localhost:8080/pro?a=1&b=张三&c=aaa";  escape(url) --> "http%3A//localhost%3A8080/pro%3Fa%3D1%26b%3D%u5F20%u4E09%26c%3Daaa" 2. encodeURI 和 decodeURI 把URI字符串采用UTF-8编码格式转化成escape各式的字符串。 encodeURI不编码字符有82个:!,#,$,&,',(,),*,+,,,-,.,/,:,;,=,?,@,_,~,0-9,a-z,A-Z encodeURI()用于整个url转码,而decodeURI()用于整个url解码   var url1 = "http:/