Tag Archives: URL

[Solved] LaTeX Error: \Url Error ->\url used in a moving argument.

LaTeX error: \Url Error ->\url used in a moving argument.

Error Messages:

\Url Error ->\url used in a moving argument.

Causes and Solutions

To use \url{…} in footnotes, images, table titles, etc. and other commands, you need to use \protect before.

For example:

\thanks{
  I would thank to Xovee Xu (\url{https://xovee.cn/})
}%

// or 

\caption{
  Please refer to \url{https://xovee.cn/}
}

Change to

\thanks{
  I would thank to Xovee Xu (\protect\url{https://xovee.cn/}). 
}%

// or 

\caption{
  Please refer to \protect\url{https://xovee.cn/}. 
}

[Solved] urllib.error.URLError: <urlopen error [SSL: WRONG_VERSION_NUMBER] wrong version number

There are totally four methods to solve this error

 

Solution:
Method 1: the SSL certificate problem
you can open the URL with the following code

import ssl
 
# This restores the same behavior as before.
context = ssl._create_unverified_context()
response = urllib.request.urlopen("https://no-valid-cert", context=context)

https://no-valid-cert you can change it to the website you want

Method 2: Change https to http, because some versions of python verify the SSL certificate once when you urllib.urlopen an https.

Method 3: Add the following codes:

import ssl
ssl._create_default_https_context = ssl._create_unverified_context

I just add it to the py file when calling commands from the urllib library that comes with python 3.8.0

model = ALBEF(config=config, text_encoder=args.text_encoder, tokenizer=tokenizer, init_deit=True)

That is, when the model is initialized (init_deit), the error occurs when calling return self.sslsocket_class._create in lib/python3.8/http/client.py under python 3.8, but at the beginning of the py file for initializing the model Add these two lines and you’ll be fine

Method 4:
Upgrade your python interpreter version, e.g. 2.7 or 3.7 to 3.8 or even 3.9

Using postman Test Django Interface error: RuntimeError:You called this URL via POST,but the URL doesn‘t end in a slash

1. Access interface

Using the postman provider

2. Error reporting:

RuntimeError:You called this URL via POST,but the URL doesn’t end in a slash and you have APPEND_ SLASH set. Django can’t redirect to the slash URL while maintaining POST data.

3. Solution:

In fact, two methods have been suggested in the error report

Method 1: add a at the end of the URL/

http:10.192.171.128:8000/ops/rbac/group/distribute

Method 2: set append in settings_ SLASH=False

Java handles special characters in URL

The URL can’t display some special symbols, so the encoding will be used at this time. The encoding format is: a percent sign followed by the ASCII (hexadecimal) code value of the corresponding character. For example, the encoding value of a space is% 20. (ASCII reference)
some characters have special meanings in the URL, and the basic coding rules are as follows:
special meaning
hexadecimal value
1. + indicates empty space (spaces cannot be used in the URL)% 20
2/ Separate directory and subdirectory% 2F
3.?separate actual URL and parameter% 3F
4.% specify special character% 25
2 5. # indicates the separator% 26 between the parameters specified in the bookmark% 23
6. & amp; URL

For example: http://192.168.xxx.xxx/source/20190112 121000.txt

Note: such a URL cannot be successfully requested because the URL contains special words. The example URL contains special characters for spaces, so it needs to be converted to http://192.168.xxx.xxx/source/20190112%20121000.txt

Such a URL can request success.

Supplementary points:

Encoding and decoding functions of URL in Java java.net.URLEncoder . encode (string s) and java.net.URLDecoder . decode (string s);
URL encoding and decoding functions in JavaScript
escape (string s) and unescape (string s);
JavaScript

 

Failed to resolve: com.github

Error after running someone else’s Demo:

Failed to resolve: com.github.yangjie10930:EpMedia:v0.8.2

Solutions:
1 in project build.gradle Join in

allprojects {
    repositories {
        jcenter()
        maven { url "https://jitpack.io" }
    }
}

Full version

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.3'

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    repositories {
        jcenter()
        maven { url "https://jitpack.io" }
    }
}

task clean(type: Delete) {
    delete rootProject.buildDir
}

2 add in module

 compile ('com.github.yangjie10930:EpMedia:v0.8.2'){
        transitive = true
    }

Full version

apply plugin: 'com.android.application'

android {
    compileSdkVersion 25
    buildToolsVersion "25.0.0"
    defaultConfig {
        applicationId "com.joe.epmediademo"
        minSdkVersion 18
        targetSdkVersion 25
        versionCode 1
        versionName "1.0"
        testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }


}

dependencies {
    compile fileTree(dir: 'libs', include: ['*.jar'])
    compile 'com.android.support:appcompat-v7:25.1.0'
    compile 'com.android.support:support-v4:25.1.0'
    compile 'com.android.support.constraint:constraint-layout:1.0.2'
    compile ('com.github.yangjie10930:EpMedia:v0.8.2'){
        transitive = true
    }
    testCompile 'junit:junit:4.12'
}

python: HTTP Error 505: HTTP Version Not Supported

The urlliB2 module of Python is used to obtain the data code as follows:

Try:
    data = urllib2.urlopen(url).read()
except Exception,e:
    print e
return data

Url parameter is:

http://sms.gildata.com:8080/sms/sendSms.do?content=Hello world&msisdns=18373239087&user=gildata2&key=804

The following problems occurred while executing the code:
HTTP Error 505: the HTTP Version Not Supported
online are urllib2 module does Not support http1.1 agreement, must carry on the processing of one sort or another, but I later found out that seems to be the url does Not support Spaces, I will Hello world this parameter Spaces take out, can successfully send text messages to come out, if it is in space can be used to add escape character % 20 instead of Spaces, you can also use % 0 a instead of a newline.

Drupal Internal Server Error 500

After the completion of the local test site, I uploaded it to the space and found an Internal Server Error 500. In this way, I had to close the Clean URL before. Htaccess could work and the 301 jump could be realized. But when I open clean URL, if you’re using drupal’s default.htaccess, you won’t find the page. Now I’ve simply rewritten.htaccess, because All I need is a 301 jump.
The original source: http://suyou.info/node/32

    < IfModule mod_rewrite.c>

    RewriteEngine on

    RewriteBase /

    RewriteCond %{HTTP_HOST} ^www.(.+)$ [NC]

    RewriteRule ^ http://%1%{REQUEST_URI} [L,R=301]

    RewriteCond %{REQUEST_FILENAME} ! -f

    RewriteCond %{REQUEST_FILENAME} ! -d

    RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]

    < /IfModule>

CFNetwork internal error (0xc01a:/BuildRoot/Library/Caches/com.apple.xbs/Sources/CFNetwork/CFNetwork

Just started a project from the N layer of JSON data to take an array of URL, after a variety of traversal what finally get the correct URL, but the running program found that the image does not display, print URL image display normal. Report the following questions, a variety of Baidu also did not find any description of the answer to the question. See also: stackoverflow.com

The discovery is all about the problem in the URL, and finally check the code:

Found that in fact the website repeatedly wrote, change back OK

[Python] urlerror: < urlopen error timed out > error

These days when I do crawler with Python, I always encounter Python URLError: < urlopen error timed out> The more threads open, the more frequently they occur. Later proved that the program did not have a problem, checked the information on the Internet, the network is blocked, more than a few times to try it.  
For example, the original code looks like this:

if headers:
		req=urllib2.Request(url,headers=headers)
	else :
		req=urllib2.Request(url)
	opener=urllib2.build_opener(cookieproc)
	urllib2.install_opener(opener)
	page=urllib2.urlopen(req,timeout=5).read()

can be changed after adding a loop:

if headers:
		req=urllib2.Request(url,headers=headers)
	else :
		req=urllib2.Request(url)
	opener=urllib2.build_opener(cookieproc)
	urllib2.install_opener(opener)
	global Max_Num
	Max_Num=6
	for i in range(Max_Num):
		try:
			page=urllib2.urlopen(req,timeout=5).read()
			break
		except:
			if i < Max_Num-1:
				continue
			else :
				print 'URLError: <urlopen error timed out> All times is failed '

This exception can generally be resolved