android utils 请求https的问题

使用xUtils 2.6 框架请求接口,地址是https的 出现javax.net.ssl.SSLException: SSL handshake aborted: ssl=0x61078d10: I/O error during system call, Connection reset by peer

这个错误,搜索了很多结果,不知道如何解决, 有人遇到过这样的问题吗?是怎么解决的呢

1个回答

架请求接口,地址是https的 出现javax.net.ssl.SSLException: SSL handshake aborted: ssl=0x61078d10: I/O error during system call, Connection reset by peer
这个错误,搜索了很多结果,不知道如何解决, 有人遇到过这样的问题吗?是怎么解决的呢

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
unity打包问题,unity 和android studio交互
CommandInvokationFailure: Gradle build failed. D:\Unity2018\Editor\Data\PlaybackEngines\AndroidPlayer/Tools\OpenJDK\Windows\bin\java.exe -classpath "D:\Unity2018\Editor\Data\PlaybackEngines\AndroidPlayer\Tools\gradle\lib\gradle-launcher-5.1.1.jar" org.gradle.launcher.GradleMain "-Dorg.gradle.jvmargs=-Xmx4096m" "assembleRelease" stderr[ FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':processReleaseResources'. > Android resource linking failed error: resource style/Theme.AppCompat.Light.DarkActionBar (aka com.ab1.ProductName:style/Theme.AppCompat.Light.DarkActionBar) not found. D:\WorkProject\test\TestPath\Temp\gradleOut\src\main\res\values\styles.xml:6:1-7:9: AAPT: error: style attribute 'attr/colorPrimary (aka com.ab1.ProductName:attr/colorPrimary)' not found. D:\WorkProject\test\TestPath\Temp\gradleOut\src\main\res\values\styles.xml:6:1-7:9: AAPT: error: style attribute 'attr/colorPrimaryDark (aka com.ab1.ProductName:attr/colorPrimaryDark)' not found. D:\WorkProject\test\TestPath\Temp\gradleOut\src\main\res\values\styles.xml:6:1-7:9: AAPT: error: style attribute 'attr/colorAccent (aka com.ab1.ProductName:attr/colorAccent)' not found. error: failed linking references. * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. * Get more help at https://help.gradle.org BUILD FAILED in 8s ] stdout[ > Task :preBuild UP-TO-DATE > Task :preReleaseBuild > Task :compileReleaseAidl NO-SOURCE > Task :compileReleaseRenderscript NO-SOURCE > Task :checkReleaseManifest > Task :generateReleaseBuildConfig > Task :prepareLintJar > Task :generateReleaseSources > Task :javaPreCompileRelease > Task :mainApkListPersistenceRelease > Task :generateReleaseResValues > Task :generateReleaseResources > Task :mergeReleaseResources > Task :createReleaseCompatibleScreenManifests > Task :processReleaseManifest > Task :processReleaseResources FAILED Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0. Use '--warning-mode all' to show the individual deprecation warnings. See https://docs.gradle.org/5.1.1/userguide/command_line_interface.html#sec:command_line_warnings 11 actionable tasks: 11 executed ] exit code: 1 UnityEditor.Android.Command.WaitForProgramToRun (UnityEditor.Utils.Program p, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <67e4f96bbb8d486db6550813353bb5eb>:0) UnityEditor.Android.Command.Run (System.Diagnostics.ProcessStartInfo psi, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <67e4f96bbb8d486db6550813353bb5eb>:0) UnityEditor.Android.Command.Run (System.String command, System.String args, System.String workingdir, UnityEditor.Android.Command+WaitingForProcessToExit waitingForProcessToExit, System.String errorMsg) (at <67e4f96bbb8d486db6550813353bb5eb>:0) UnityEditor.Android.AndroidJavaTools.RunJava (System.String args, System.String workingdir, System.Action`1[T] progress, System.String error) (at <67e4f96bbb8d486db6550813353bb5eb>:0) UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, System.String workingdir, System.String task, System.Action`1[T] progress) (at <67e4f96bbb8d486db6550813353bb5eb>:0) Rethrow as GradleInvokationException: Gradle build failed UnityEditor.Android.GradleWrapper.Run (UnityEditor.Android.AndroidJavaTools javaTools, System.String workingdir, System.String task, System.Action`1[T] progress) (at <67e4f96bbb8d486db6550813353bb5eb>:0) UnityEditor.Android.PostProcessor.Tasks.BuildGradleProject.Execute (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <67e4f96bbb8d486db6550813353bb5eb>:0) UnityEditor.Android.PostProcessor.PostProcessRunner.RunAllTasks (UnityEditor.Android.PostProcessor.PostProcessorContext context) (at <67e4f96bbb8d486db6550813353bb5eb>:0) UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
【小白求助】安卓opencv用分类器对人脸进行识别的一些问题
小白入门,最近在看opencv的人脸识别(分类) 然后按照网上的代码,学习了之后,自己写了一段,发现运行的时候会卡很久,甚至直接退出,并且越用越卡。 我想实现的是对一张图片进行读入,然后加载多个分类器对图片内容进行识别,从而达到分类的目的。 我那个问题困扰了我一天,想来求助大神 我加载人脸识别的模型没问题,但是同时加载两个模型,比如说人脸和上身,就会卡死。 代码分3个部分,分别是MainActivity.java , execDetect.java , Detector.java 以下是MainActivity.java ``` package com.RinGo.IMGfenlei; import android.content.Context; import android.content.Intent; import android.graphics.Bitmap; import android.graphics.BitmapFactory; import android.net.Uri; import android.os.Bundle; import android.os.Environment; import android.provider.MediaStore; import android.util.Log; import android.view.View; import android.widget.Button; import android.widget.ImageButton; import android.widget.TextView; import android.widget.Toast; import androidx.appcompat.app.AppCompatActivity; import org.opencv.android.Utils; import org.opencv.core.Mat; import org.opencv.core.MatOfRect; import org.opencv.core.Rect; import org.opencv.core.Scalar; import org.opencv.imgproc.Imgproc; import org.opencv.objdetect.CascadeClassifier; public class MainActivity extends AppCompatActivity { private Detector frontfaceDetector; private Detector smileDetector; private static String CAMERAIMAGENAME = "image.jpg"; private ImageButton imageButton; private ImageButton imageButton2; private TextView textView; private Bitmap bitmap; private Bitmap rectBitmap; private Bitmap resizeBitmap; private Toast toast; private Button addFile; private Button startDetect; private Button check; private execDetect toDetcet; private String show; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); textView = (TextView) findViewById(R.id.tv_face); // imageButton = (ImageButton) findViewById(R.id.iv_face); //imageButton.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); // imageButton2 = (ImageButton) findViewById(R.id.iv_face2); // imageButton2.setGravity(Gravity.CENTER_HORIZONTAL | Gravity.CENTER_VERTICAL); toDetcet=new execDetect(); addFile=(Button)findViewById(R.id.addPic); startDetect=(Button)findViewById(R.id.startDetect); check=(Button)findViewById(R.id.check); startDetect.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // startDetect.setClickable(false); textView.setText("正在检测"); // detect(); Thread d =new Thread(new Runnable() { @Override public void run() { toDetcet.initExecDetect(MainActivity.this,bitmap); // Toast.makeText(MainActivity.this, "initialize succeed", Toast.LENGTH_SHORT).show(); show= toDetcet.startDetect(); // Toast.makeText(MainActivity.this, " succeed", Toast.LENGTH_SHORT).show(); } }); d.run(); textView.setText(show); // startDetect.setClickable(true); } }); check.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // startDetect.setClickable(false); textView.setText(toDetcet.getReturntoMain()); // startDetect.setClickable(true); } }); addFile.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { // 添加照片 // 打开本地相册 Intent intent1 = new Intent(Intent.ACTION_PICK, android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI); startActivityForResult(intent1, 101); //startActivity(intent1); } }); String strLibraryName = "opencv_java3"; // 不需要添加前缀 libopencv_java3 { try { Log.e("loadLibrary", strLibraryName); System.loadLibrary(strLibraryName); //System.loadLibrary(Core.NATIVE_LIBRARY_NAME); // couldn't find "libopencv_java320.so" } catch (UnsatisfiedLinkError e) { Log.e("loadLibrary", "Native code library failed to load.\n" + e); } catch (Exception e) { Log.e("loadLibrary", "Exception: " + e); } } // frontfaceDetector = new Detector(this, R.raw.haarcascade_frontalface_alt, 6, 0.2F, 0.2F, new Scalar(255, 0, 0, 255)); } /** * 点击添加照片事件 * * @param v */ public void onClick(View v) { int bt_id = v.getId(); switch (bt_id) { /* case R.id.takePhoto: // 拍照 // 打开本地相机 Intent intent2 = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE); Uri imageUri = Uri.fromFile(new File(Environment.getExternalStorageDirectory(), CAMERAIMAGENAME)); intent2.putExtra(MediaStore.EXTRA_OUTPUT, imageUri); startActivityForResult(intent2, 102); break; */ case R.id.back: this.finish(); break; default: break; } } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); // 加判断 不选择照片或者不拍照时不闪退 //Log.e("data", String.valueOf(data)); //if (data == null) //return; bitmap = null; switch (requestCode) { // 选择图片库的图片 case 101: if (resultCode == RESULT_OK) { try { Uri uri = data.getData(); bitmap = MediaStore.Images.Media.getBitmap(this.getContentResolver(), uri); } catch (Exception e) { e.printStackTrace(); } } break; // 表示调用本地照相机拍照 case 102: if (resultCode == RESULT_OK) { //Bundle bundle = data.getExtras(); //bm = (Bitmap) bundle.get("data"); bitmap = BitmapFactory.decodeFile(Environment.getExternalStorageDirectory() + "/" + CAMERAIMAGENAME); } break; default: break; } Log.e("bitmap", String.valueOf(bitmap)); if (bitmap == null) { toast = Toast.makeText(MainActivity.this, "未选择图像", Toast.LENGTH_SHORT); toast.show(); return; } // 识别图片 并画框 /* Thread detect=new Thread(new Runnable() { @Override public void run() { } }); detect.run(); */ // 将照片剪裁 bitmap将被释放重新赋值 //int ibWidth = imageButton.getWidth(); // int ibHeight = imageButton.getHeight(); //resizeBitmap = imageButton.resizeBitmap(bitmap, ibWidth, ibHeight); //imageButton.setBitmap(resizeBitmap); //imageButton2.setBitmap(rectBitmap); } private void detect() { MainActivity.this.runOnUiThread(new Runnable() { @Override public void run() { toDetcet.initExecDetect(MainActivity.this,bitmap); // Toast.makeText(MainActivity.this, "initialize succeed", Toast.LENGTH_SHORT).show(); String show= toDetcet.startDetect(); // Toast.makeText(MainActivity.this, " succeed", Toast.LENGTH_SHORT).show(); textView.setText(show); } }); //textView.setText(toDetcet.getReturntoMain()); } } ``` 以下是activity_main.xml ``` <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <TextView android:id="@+id/tv_face" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="16dp" android:text="未检测到人脸" android:textColor="@color/colorAccent" app:layout_constraintBottom_toTopOf="@+id/ll1" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" /> <LinearLayout android:id="@+id/ll1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:orientation="horizontal" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent"> <com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton android:id="@+id/addPic" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="5dp" android:layout_weight="1" android:onClick="onClick" android:text=" 选择图片(CV) " android:textSize="16sp" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" /> <com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton android:id="@+id/startDetect" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="5dp" android:layout_weight="1" android:onClick="onClick" android:text=" 开始识别 " android:textSize="16sp" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" /> <com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton android:id="@+id/check" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="5dp" android:layout_weight="1" android:onClick="onClick" android:text=" 结果 " android:textSize="16sp" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" /> <com.qmuiteam.qmui.widget.roundwidget.QMUIRoundButton android:id="@+id/back" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginBottom="0dp" android:layout_weight="1" android:onClick="onClick" android:text=" 返回 " android:textSize="16sp" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintRight_toRightOf="parent" /> </LinearLayout> </LinearLayout> ``` 以下是execDetect.java ``` package com.RinGo.IMGfenlei; import android.content.Context; import android.graphics.Bitmap; import android.util.Log; import org.opencv.android.Utils; import org.opencv.core.Mat; import org.opencv.core.MatOfRect; import org.opencv.core.Rect; import org.opencv.core.Scalar; import org.opencv.imgproc.Imgproc; import org.opencv.objdetect.CascadeClassifier; import com.RinGo.IMGfenlei.R; import com.RinGo.IMGfenlei.Detector; import java.io.File; import java.io.FileOutputStream; import java.io.InputStream; public class execDetect { private Detector frontfaceDetector; private Detector smilefaceDetector; private Detector[] detectors=new Detector[10]; private Detector detector; private Bitmap bitmap; private Bitmap rectBitmap; private String returntoMain=""; private String[] detectorNames=new String[10]; private CascadeClassifier mFrontalFaceClassifier = null; //正脸 级联分类器 private CascadeClassifier mProfileFaceClassifier = null; //侧脸 级联分类器 private int smilefacenum=0; private Context mcontext; private int[] cascades=new int[10]; public void initExecDetect(Context _context,Bitmap _bitmap) { bitmap=_bitmap; mcontext=_context; cascades[0]=R.raw.haarcascade_frontalface_alt; detectors[0] = new Detector(_context,R.raw.haarcascade_frontalface_alt, 1, 0.2F, 0.2F, new Scalar(255, 0, 0, 255)); detectorNames[0]="正面人脸"; cascades[1]=R.raw.lbpcascade_frontalface; detectors[1] = new Detector(_context,R.raw.lbpcascade_frontalface, 1, 0.2F, 0.2F, new Scalar(255, 0, 0, 255)); detectorNames[1]="正面人脸2"; } public String startDetect() { // bitmapToMat Mat toMat = new Mat(); Utils.bitmapToMat(bitmap, toMat); // Mat copyMat = new Mat(); // toMat.copyTo(copyMat); // 复制 // togray Mat gray = new Mat(); MatOfRect mRect = new MatOfRect(); Imgproc.cvtColor(toMat, gray, Imgproc.COLOR_RGBA2GRAY); for (int id = 0; id < detectors.length; id++) { //detector = new Detector(mcontext,cascades[id], 3, 0.1F, 0.1F, new Scalar(255, 0, 0, 255)); try { int num = 0; mRect=new MatOfRect(); Rect[] object = detectors[id].detectObjectImage( gray, mRect); Log.e("objectLength", object.length + ""); num=object.length; /* for (Rect rect : object) { num++; } */ returntoMain =returntoMain+ String.format("检测到%1$d个" + detectorNames[id], num) + "\n"; } catch (Exception e) { e.printStackTrace(); } //textView.setText(String.format("检测到%1$d个人脸", facenum)); //Utils.matToBitmap(toMat, bitmap); } return returntoMain; } public String getReturntoMain() { return returntoMain; } } ``` 以下是Detector.java,定义了我的级联分类器的设置 ``` package com.RinGo.IMGfenlei; import android.content.Context; import org.opencv.core.Mat; import org.opencv.core.MatOfRect; import org.opencv.core.Rect; import org.opencv.core.Scalar; import org.opencv.core.Size; import org.opencv.objdetect.CascadeClassifier; import org.opencv.objdetect.Objdetect; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; /** * Created by think-hxr on 17-10-12. */ public class Detector { private CascadeClassifier mCascadeClassifier; private int mMinNeighbors; private float mRelativeObjectWidth; private float mRelativeObjectHeight; private Scalar mRectColor; /** * 构造方法 * * @param context 上下文 * @param id 级联分类器ID * @param minNeighbors 连续几帧确认目标 * @param relativeObjectWidth 最小宽度屏占比 * @param relativeObjectHeight 最小高度屏占比 * @param rectColor 画笔颜色 */ public Detector(Context context, int id, int minNeighbors, float relativeObjectWidth, float relativeObjectHeight, Scalar rectColor) { context = context.getApplicationContext(); mCascadeClassifier = createDetector(context, id); mMinNeighbors = minNeighbors; mRelativeObjectWidth = relativeObjectWidth; mRelativeObjectHeight = relativeObjectHeight; mRectColor = rectColor; } /** * 创建检测器 * * @param context 上下文 * @param id 级联分类器ID * @return 检测器 */ private CascadeClassifier createDetector(Context context, int id) { CascadeClassifier javaDetector; InputStream is = null; FileOutputStream os = null; try { is = context.getResources().openRawResource(id); File cascadeDir = context.getDir("cascade", Context.MODE_PRIVATE); File cascadeFile = new File(cascadeDir, id + ".xml"); os = new FileOutputStream(cascadeFile); byte[] buffer = new byte[4096]; int bytesRead; while ((bytesRead = is.read(buffer)) != -1) { os.write(buffer, 0, bytesRead); } javaDetector = new CascadeClassifier(cascadeFile.getAbsolutePath()); //javaDetector=new CascadeClassifier(); // javaDetector.load(cascadeFile.getAbsolutePath()); if (javaDetector.empty()) { javaDetector = null; } boolean delete = cascadeDir.delete(); return javaDetector; } catch (IOException e) { e.printStackTrace(); return null; } finally { try { if (null != is) { is.close(); } if (null != os) { os.close(); } } catch (IOException e) { e.printStackTrace(); } } } /** * 目标检测 视频 * * @param gray 灰度图像 * @param object 识别结果的容器 * @return 检测到的目标位置集合 */ public Rect[] detectObject(Mat gray, MatOfRect object) { // 使用Java人脸检测 mCascadeClassifier.detectMultiScale( gray, // 要检查的灰度图像 object, // 检测到的人脸 1.1, // 表示在前后两次相继的扫描中,搜索窗口的比例系数。默认为1.1即每次搜索窗口依次扩大10%; mMinNeighbors, // 默认是3 控制误检测,表示默认几次重叠检测到人脸,才认为人脸存在 Objdetect.CASCADE_SCALE_IMAGE, getSize(gray, mRelativeObjectWidth, mRelativeObjectHeight), // 目标最小可能的大小 gray.size()); // 目标最大可能的大小 return object.toArray(); } /** * 目标检测 图片 * * @param gray 灰度图像 * @param object 识别结果的容器 * @return */ public Rect[] detectObjectImage(Mat gray, MatOfRect object) { mCascadeClassifier.detectMultiScale(gray,object); return object.toArray(); } /** * 根据屏占比获取大小 * * @param gray gray * @param relativeObjectWidth 最小宽度屏占比 * @param relativeObjectHeight 最小高度屏占比 * @return 大小 */ private Size getSize(Mat gray, float relativeObjectWidth, float relativeObjectHeight) { Size size = gray.size(); int cameraWidth = gray.cols(); int cameraHeight = gray.rows(); int width = Math.round(cameraWidth * relativeObjectWidth); int height = Math.round(cameraHeight * relativeObjectHeight); size.width = 0 >= width ? 0 : (cameraWidth < width ? cameraWidth : width); // width [0, cameraWidth] size.height = 0 >= height ? 0 : (cameraHeight < height ? cameraHeight : height); // height [0, cameraHeight] return size; } /** * 获取画笔颜色 * * @return 颜色 */ public Scalar getRectColor() { return mRectColor; } } ```
android 关于libmp3lame音频格式的问题
我在网上找到的关于lame将android的arm格式音频转化为通用的mp3, 目前在5.0以下的版本运行没有问题,在5.0的android手机运行出现 java.lang.UnsatisfiedLinkError: No implementation found for void com.pocketdigi.utils.FLameUtils.initEncoder(int, int, int, int, int) (tried Java_com_pocketdigi_utils_FLameUtils_initEncoder and Java_com_pocketdigi_utils_FLameUtils_initEncoder__IIIII) 我单独简单的写了一个小的demo,可以在5.0手机运行,求大神给个解决方法,非常感谢。
django File "/home/tarena/.local/lib/python3.5/site-packages/django/utils/crypto.py", line 6, in <module> import secrets ImportError: No module named 'secrets'
提起django服务:python3 manage.py runserver时,显示import secrets ImportError ```python File "/home/tarena/.local/lib/python3.5/site-packages/django/utils/crypto.py", line 6, in <module> import secrets ImportError: No module named 'secrets' ``` 请问有谁知道怎么解决a
路过的大神们,谁知道webgl公用函数库的链接啊,比如:cuon-utils.js和webgl-debug.js的链接,谢谢
路过的大神们,谁知道webgl公用函数库的链接啊,比如:cuon-utils.js和webgl-debug.js的链接,谢谢
lstm加三层感知器的神经网络,预测行人坐标轨迹,loss不下降是怎么原因?
我用两层的lstm编码坐标,然后用三层感知器解码,预测后五帧的轨迹,用的是mse和adam,尝试了从0.00001到0.3的学习率,batch size也改过train loss一直在小幅度的波动,test loss一直不变,想请问出现这种情况是可能是什么原因? ``` import torch import torch.nn as nn import torch.utils.data as data import numpy as np import random from torch import optim from helper import AverageMeter, adjust_learning_rate class net(torch.nn.Module): def __init__(self): super(net, self).__init__() self.gru = nn.GRU(2, 128, 2) self.lstm = nn.LSTM(2, 128, 2) def forward(self, input1, hidden): next_h_list = [] out_list = [] for i in range(20): input_tr = input1[:,i,:].unsqueeze(0) output, next_h = self.lstm(input_tr, (hidden[i][0] , hidden[i][1])) next_h_list.append(next_h) out_list.append(output.squeeze(0)) output_tr = torch.stack(out_list, 1) return output_tr, next_h_list def init_hidden(self, batch_size): return [[torch.zeros(2, batch_size, 128, requires_grad=True).cuda() for _ in range(2)] for _ in range(20)] #这里的维度(2,5,128)是从外向内的,最里面是128维 class decoder(torch.nn.Module): def __init__(self): super(decoder, self).__init__() self.fc1 = torch.nn.Linear(128 , 2) def forward(self, input): de_list = [] for i in range(20): output = self.fc1(input[:,i,:]) de_list.append(output) out = torch.stack(de_list, 1) return out class Model: def init(self): self.lr = 0.1 self.weight_decay = 5e-3 self.n_epochs = 500 self.loss_list = [] self.time_window = 300 self.window_size = 1000 self.m1 = net().cuda() self.m2 = decoder().cuda() self.m1_optim = optim.Adam(self.m1.parameters(), lr = self.lr, weight_decay = self.weight_decay) self.m2_optim = optim.Adam(self.m1.parameters(), lr = self.lr, weight_decay = self.weight_decay) self.batch_size = 256 self.test_times = 5 self.dataload('data/GC.npz') def dataload(self, path): data = np.load(path) tr_X, tr_Y = data['train_X'], data['train_Y'] te_X, te_Y = data['test_X'], data['test_Y'] tr_input = torch.FloatTensor(tr_X) tr_target = torch.FloatTensor(tr_Y) self.tr_input = tr_input.cuda() self.tr_target = tr_target.cuda() self.te_input = torch.FloatTensor(te_X).cuda() self.te_target = torch.FloatTensor(te_Y).cuda() # data loader train = torch.utils.data.TensorDataset(tr_input, tr_target) self.train_loader = torch.utils.data.DataLoader(train, batch_size=self.batch_size, shuffle=True, num_workers=4) def run(self, tr_input, tr_target): batch_size = tr_input.size(0) encoder_hidden = self.m1.init_hidden(batch_size) #print('batch_size: ',batch_size) tr_final = tr_input[:,:,4] #选择第五帧 for i in range(4): output , hidden = self.m1(tr_input[:,:,i], encoder_hidden) re_list = [] for i in range(5): output , hidden = self.m1(tr_final, encoder_hidden) output_decoder = self.m2(output) tr_final = output_decoder re_list.append(output_decoder) predict = torch.stack(re_list, 2) #loss L2_loss = ((tr_target - predict) **2).sum() / 20 MSE_loss = ((tr_target - predict) **2).sum(3).sqrt().mean() self.loss = L2_loss return predict, L2_loss.item(), MSE_loss.item() def train(self, epoch): MSE_loss_meter = AverageMeter() L2_square_loss_meter = AverageMeter() adjust_learning_rate([self.m1_optim, self.m2_optim], self.lr, epoch) for i ,(tr_input, tr_target)in enumerate(self.train_loader): tr_input = tr_input.cuda() tr_target = tr_target.cuda() self.m1_optim.zero_grad() self.m2_optim.zero_grad() predict, L2_loss, MSE_loss = self.run(tr_input, tr_target) MSE_loss_meter.update(MSE_loss) L2_square_loss_meter.update(L2_loss) self.loss.backward() self.m1_optim.step() self.m2_optim.step() return MSE_loss_meter.avg, L2_square_loss_meter.avg def test(self): with torch.no_grad(): predi, L2_square_lo, MSE_lo = self.run(self.te_input, self.te_target) return MSE_lo, L2_square_lo def final(self, epoch): self.init() for i in range(1, epoch + 1): MSE_loss, L2_square_loss = self.train(epoch) print('----------------epoch------------------: ',i+1) print('mse: ', MSE_loss) print('l2: ', L2_square_loss) self.loss_list.append(MSE_loss) if i % self.test_times == 0: test_loss_MSE , test_loss_L2 = self.test() print('----TEST----\n' + 'MSE Loss:%s' % test_loss_MSE) print('----TEST----\n' + 'L2 Loss:%s' % test_loss_L2) def set_random_seed(random_seed=0): np.random.seed(random_seed) torch.manual_seed(random_seed) torch.cuda.manual_seed_all(random_seed) random.seed(random_seed) def main(): set_random_seed() M = Model() M.final(1000) if __name__ == '__main__': main() ```
Django已有的model表新增字段,执行migrate报错:django.db.utils.DatabaseError:ORA-00955: name is already used by an existing object,出现重名是啥情况。。。
Django已有的model表新增字段,执行migrate报错:django.db.utils.DatabaseError:ORA-00955: name is already used by an existing object,出现重名是啥情况。。。
<python从入门到实践>19章书中只给topic设定了owner,但是entry没有出现了报错django.db.utils.OperationalError: no such column: learning_logs_entry.owner_id
我用改topic的方法改了new_entry,也没有行通。 views.py ``` from django.shortcuts import render from django.http import HttpResponseRedirect from django.urls import reverse from .models import Topic,Entry from .forms import TopicForm,EntryForm from django.contrib.auth.decorators import login_required def index(request): #学习笔记的主页 return render(request,'learning_logs/index.html') @login_required def topics(request): #显示所有的主题 topics = Topic.objects.filter(owner=request.user).order_by('date_added') context = {'topics':topics} return render(request,'learning_logs/topics.html',context) @login_required def topic(request,topic_id): #显示单个主题及其所有的项目 topic = Topic.objects.filter(owner=request.user).get(id = topic_id) #确认请求的主题属于当前用户 if topic.owner != request.user: raise Http404 entries = topic.entry_set.order_by('-date_added') context = {'topic':topic,'entries':entries} return render(request,'learning_logs/topic.html',context) @login_required def new_topic(request): '''添加新主题''' if request.method != 'POST': #未提交数据 创建一个新表单 form = TopicForm() else: #POST提交的数据 对数据进行处理 form = TopicForm(request.POST) if form.is_valid(): new_topic = form.save(commit=False) new_topic.owner = request.user new_topic.save() return HttpResponseRedirect(reverse('learning_logs:topics')) context = {'form':form} return render(request, 'learning_logs/new_topic.html',context) @login_required def new_entry(request,topic_id): topic = Topic.objects.get(id=topic_id) if request.method != 'POST': form = EntryForm() else: form = EntryForm(data=request.POST) if form.is_valid(): return HttpResponseRedirect(reverse('learning_logs:topic',args=[topic_id])) context = {'topic':topic,'form':form} return render(request, 'learning_logs/new_entry.html',context) @login_required def edit_entry(request,entry_id): '''编辑现有的条目''' entry = Entry.objects.get(id=entry_id) topic = entry.topic if topic.owner != request.user: raise Http404 if request.method != 'POST': form = EntryForm(instance=entry) else: #POST提交的数据,对数据进行处理 form = EntryForm(instance=entry,data=request.POST) if form.is_valid(): form.save() return HttpResponseRedirect(reverse('learning_logs:topic',args=[topic.id])) context = {'entry':entry, 'topic':topic, 'form':form } return render(requ ``` models.py ``` from django.db import models from django.contrib.auth.models import User class Topic(models.Model): #用户学习主题 text = models.CharField(max_length= 200) date_added = models.DateTimeField(auto_now_add=True) owner = models.ForeignKey(User,on_delete=models.CASCADE) def __str__(self): #返回模型的字符串表示 return self.text class Entry(models.Model): #学到的有关某个主题的具体知识 topic = models.ForeignKey(Topic,on_delete=models.CASCADE) text = models.TextField() date_added = models.DateTimeField(auto_now_add= True) owner = models.ForeignKey(User, on_delete=models.CASCADE) class meta: verbose_name_plural ='entries' def __str__(self): #返回模型的字符串表示 if len(self.text) >= 50: return self.text[:50] + '...' else: return self.text[:] ```
HttpURLConnection 重复发送请求参数的问题
new Thread() { @Override public void run() { Looper.prepare(); Date date = new Date(); String timeNow = YYMMdd.timestr(date); String mystr = MD5utils.MD5(timeNow); String urlPath = "http://" + address + "/service/AfarPosService.svc/Sale/salelist/sa/" + mystr; URL url; try { url = new URL(urlPath); JSONObject ClientKey = new JSONObject(); JSONArray jsonArray = new JSONArray(liushuis); ClientKey.put("data", jsonArray); ClientKey.put("c_cardtype", c_cardtype); ClientKey.put("message", ""); ClientKey.put("content", ""); contentLiuShui = String.valueOf(ClientKey); Log.e("发送实时流水contentLiuShui", contentLiuShui + ""); conn = (HttpURLConnection) url.openConnection(); conn.setConnectTimeout(20000); conn.setReadTimeout(20000); conn.setChunkedStreamingMode(0); conn.setDoInput(true);// 设置是否从httpUrlConnection读入,默认情况下是true; conn.setDoOutput(true);//设置是否向httpUrlConnection输出,post请求,参数要放在http正文内,因此需要设为true, 默认情况下是false; conn.setUseCaches(false);//设置是否用缓存 Post 请求不能使用缓存 ,设置为false conn.setRequestMethod("POST");//设定请求的方法为"POST",默认是GET conn.setRequestProperty("ser-Agent", "Fiddler"); conn.setRequestProperty("Content-Type", "application/json"); OutputStream os = conn.getOutputStream();//此处getOutputStream会隐含的进行comm.connect(); Log.e("os", os + ""); os.write(contentLiuShui.getBytes()); os.close(); int code = conn.getResponseCode(); Log.e("发送实时流水code", code + ""); if (code == 200) { InputStream is = conn.getInputStream(); String json = NetUtils.readString(is); Log.e("返回实时流水json", json + ""); com.alibaba.fastjson.JSONObject jsonObject = com.alibaba.fastjson.JSONObject.parseObject(json); String panduan = (String) jsonObject.get("message"); String yichang = (String) jsonObject.get("content"); if (panduan.equals("0")) { } else if (panduan.equals("4") || panduan.equals("7")) { } else { Toast.makeText(PaymentMoneyActivity1.this, yichang, Toast.LENGTH_LONG).show(); } } else { Toast.makeText(PaymentMoneyActivity1.this, "与服务器连接失败", Toast.LENGTH_SHORT).show(); } } catch (Exception e) { Toast.makeText(PaymentMoneyActivity1.this, "网络连接超时,请检查网络", Toast.LENGTH_SHORT).show(); e.printStackTrace(); } finally { Toast.makeText(PaymentMoneyActivity1.this, "网络连接超时,zouazheloosg", Toast.LENGTH_SHORT).show(); if (conn != null) { conn.disconnect(); Log.e("断开了", "断开了耶!"); } } Looper.loop(); } }.start(); ``` ``` 现存问题: 第一次进行网络请求的时候(时间A,数据data1),如果网络不好超时了,再次接着请求该接口(时间B,数据data2),服务器会收到两次请求的数据:时间A的data1和时间B的data2! 注意:如果多次超时请求,最终后台服务器会接收到多次不同的data! 本人技术小白,还请大神能够指点出错误和解决的办法! 求加QQ在线讨论,在线等解救QQ:379077640
quartz与mysql使用同一个数据源,请求不到连接
最近在做项目合并 本来的quartz与mysql合并到同一个数据库 我将quartz的DataSource设置为原来的mysql数据源(BoneCP) 在服务器报错 ``` 2020-01-07 11:40:10.163 [schedulerFactoryBean_QuartzSchedulerThread] ERROR [org.quartz.core.ErrorLogger-2460] An error occurred while scanning for the next triggers to fire. org.quartz.JobPersistenceException: Failed to obtain DB connection from data source 'springNonTxDataSource.schedulerFactoryBean': java.sql.SQLException: Timed out waiting for a free available connection. at org.quartz.impl.jdbcjobstore.JobStoreCMT.getNonManagedTXConnection(JobStoreCMT.java:168) at org.quartz.impl.jdbcjobstore.JobStoreSupport.executeInNonManagedTXLock(JobStoreSupport.java:3774) at org.quartz.impl.jdbcjobstore.JobStoreSupport.acquireNextTriggers(JobStoreSupport.java:2759) at org.quartz.core.QuartzSchedulerThread.run(QuartzSchedulerThread.java:264) Caused by: java.sql.SQLException: Timed out waiting for a free available connection. at com.jolbox.bonecp.BoneCP.getConnection(BoneCP.java:503) at com.jolbox.bonecp.BoneCPDataSource.getConnection(BoneCPDataSource.java:114) at org.springframework.scheduling.quartz.LocalDataSourceJobStore$2.getConnection(LocalDataSourceJobStore.java:135) at org.quartz.utils.DBConnectionManager.getConnection(DBConnectionManager.java:108) at org.quartz.impl.jdbcjobstore.JobStoreCMT.getNonManagedTXConnection(JobStoreCMT.java:165) ... 3 common frames omitted ``` BoneCP设置由原来的2个分区2个最大连接 改为4个分区5个最大连接 还是报这个错 ![图片说明](https://img-ask.csdn.net/upload/202001/08/1578475058_741073.png) 另外 quartz.properties的配置数据源 直接写数据库配置能成功 但是如果写成${}这种形式就不能成功 ``` org.quartz.JobPersistenceException: Failed to obtain DB connection from data source 'myDS': java.sql.SQLException: Connections could not be acquired from the underlying database! at org.quartz.impl.jdbcjobstore.JobStoreSupport.getConnection(JobStoreSupport.java:777) at org.quartz.impl.jdbcjobstore.JobStoreTX.getNonManagedTXConnection(JobStoreTX.java:71) at org.quartz.impl.jdbcjobstore.JobStoreSupport.doCheckin(JobStoreSupport.java:3213) at org.quartz.impl.jdbcjobstore.JobStoreSupport$ClusterManager.manage(JobStoreSupport.java:3836) at org.quartz.impl.jdbcjobstore.JobStoreSupport$ClusterManager.initialize(JobStoreSupport.java:3821) at org.quartz.impl.jdbcjobstore.JobStoreSupport.schedulerStarted(JobStoreSupport.java:688) at org.quartz.core.QuartzScheduler.start(QuartzScheduler.java:580) at org.quartz.impl.StdScheduler.start(StdScheduler.java:142) at org.springframework.scheduling.quartz.SchedulerFactoryBean$1.run(SchedulerFactoryBean.java:708) Caused by: java.sql.SQLException: Connections could not be acquired from the underlying database! at com.mchange.v2.sql.SqlUtils.toSQLException(SqlUtils.java:106) at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:529) at com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.getConnection(AbstractPoolBackedDataSource.java:128) at org.quartz.utils.PoolingConnectionProvider.getConnection(PoolingConnectionProvider.java:247) at org.quartz.utils.DBConnectionManager.getConnection(DBConnectionManager.java:108) at org.quartz.impl.jdbcjobstore.JobStoreSupport.getConnection(JobStoreSupport.java:774) ... 8 common frames omitted Caused by: com.mchange.v2.resourcepool.CannotAcquireResourceException: A ResourcePool could not acquire a resource from its primary factory or source. at com.mchange.v2.resourcepool.BasicResourcePool.awaitAvailable(BasicResourcePool.java:1319) at com.mchange.v2.resourcepool.BasicResourcePool.prelimCheckoutResource(BasicResourcePool.java:557) at com.mchange.v2.resourcepool.BasicResourcePool.checkoutResource(BasicResourcePool.java:477) at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:525) ... 12 common frames omitted ```
python更新pip失败,困扰了我好久
更新pip老是出现下列一大串的文字,我在网上查了许多方法,都没用,有哪位大佬能说一下有什么方法解决这个问题。 这是使用管理员的运行 C:\Windows\system32>python -m pip install --upgrade pip WARNING: Retrying (Retry(total=4, connect=None, read=None, redirect=None, status=None)) after connection broken by 'ReadTimeoutError("HTTPSConnectionPool(host='pypi.org', port=443): Read timed out. (read timeout=15)")': /simple/pip/ Collecting pip Downloading https://files.pythonhosted.org/packages/54/0c/d01aa759fdc501a58f431eb594a17495f15b88da142ce14b5845662c13f3/pip-20.0.2-py2.py3-none-any.whl (1.4MB) |█████████████████████▌ | 962kB 2.9kB/s eta 0:02:44ERROR: Exception: Traceback (most recent call last): File "D:\Program Files\python\lib\site-packages\pip\_vendor\urllib3\response.py", line 397, in _error_catcher yield File "D:\Program Files\python\lib\site-packages\pip\_vendor\urllib3\response.py", line 479, in read data = self._fp.read(amt) File "D:\Program Files\python\lib\site-packages\pip\_vendor\cachecontrol\filewrapper.py", line 62, in read data = self.__fp.read(amt) File "D:\Program Files\python\lib\http\client.py", line 454, in read n = self.readinto(b) File "D:\Program Files\python\lib\http\client.py", line 498, in readinto n = self.fp.readinto(b) File "D:\Program Files\python\lib\socket.py", line 669, in readinto return self._sock.recv_into(b) File "D:\Program Files\python\lib\ssl.py", line 1241, in recv_into return self.read(nbytes, buffer) File "D:\Program Files\python\lib\ssl.py", line 1099, in read return self._sslobj.read(len, buffer) socket.timeout: The read operation timed out During handling of the above exception, another exception occurred: Traceback (most recent call last): File "D:\Program Files\python\lib\site-packages\pip\_internal\cli\base_command.py", line 188, in main status = self.run(options, args) File "D:\Program Files\python\lib\site-packages\pip\_internal\commands\install.py", line 345, in run resolver.resolve(requirement_set) File "D:\Program Files\python\lib\site-packages\pip\_internal\legacy_resolve.py", line 196, in resolve self._resolve_one(requirement_set, req) File "D:\Program Files\python\lib\site-packages\pip\_internal\legacy_resolve.py", line 359, in _resolve_one abstract_dist = self._get_abstract_dist_for(req_to_install) File "D:\Program Files\python\lib\site-packages\pip\_internal\legacy_resolve.py", line 305, in _get_abstract_dist_for abstract_dist = self.preparer.prepare_linked_requirement( File "D:\Program Files\python\lib\site-packages\pip\_internal\operations\prepare.py", line 195, in prepare_linked_requirement unpack_url( File "D:\Program Files\python\lib\site-packages\pip\_internal\download.py", line 1058, in unpack_url unpack_http_url( File "D:\Program Files\python\lib\site-packages\pip\_internal\download.py", line 920, in unpack_http_url from_path, content_type = _download_http_url(link, File "D:\Program Files\python\lib\site-packages\pip\_internal\download.py", line 1152, in _download_http_url _download_url(resp, link, content_file, hashes, progress_bar) File "D:\Program Files\python\lib\site-packages\pip\_internal\download.py", line 861, in _download_url hashes.check_against_chunks(downloaded_chunks) File "D:\Program Files\python\lib\site-packages\pip\_internal\utils\hashes.py", line 75, in check_against_chunks for chunk in chunks: File "D:\Program Files\python\lib\site-packages\pip\_internal\download.py", line 829, in written_chunks for chunk in chunks: File "D:\Program Files\python\lib\site-packages\pip\_internal\utils\ui.py", line 156, in iter for x in it: File "D:\Program Files\python\lib\site-packages\pip\_internal\download.py", line 794, in resp_read for chunk in resp.raw.stream( File "D:\Program Files\python\lib\site-packages\pip\_vendor\urllib3\response.py", line 531, in stream data = self.read(amt=amt, decode_content=decode_content) File "D:\Program Files\python\lib\site-packages\pip\_vendor\urllib3\response.py", line 496, in read raise IncompleteRead(self._fp_bytes_read, self.length_remaining) File "D:\Program Files\python\lib\contextlib.py", line 131, in __exit__ self.gen.throw(type, value, traceback) File "D:\Program Files\python\lib\site-packages\pip\_vendor\urllib3\response.py", line 402, in _error_catcher raise ReadTimeoutError(self._pool, None, 'Read timed out.') pip._vendor.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='files.pythonhosted.org', port=443): Read timed out. WARNING: You are using pip version 19.2.3, however version 20.0.2 is available. You should consider upgrading via the 'python -m pip install --upgrade pip' command.
请问"stats.h" 和 "utils.h" 头文件是哪里的啊?mingw里没有,darknet也没有,求助(抱拳了)
\#include "stats.h" // Stats structure definition \#include "utils.h" // Drawing and printing functions 真心求助,这两个头文件怎么找到,去哪儿下载鸭
android调起支付宝h5界面后取消支付返回,再次点击会调用onProgressChanged方法
在webview界面中点击h5界面的按钮,h5通过接口查询订单情况,如果有订单弹通知让用户去支付,如果没有订单,就调起支付宝h5界面去支付。 现在调起支付宝h5界面后取消支付返回,当前页面不做任何修改,然后再次点击按钮,这时候会弹一个窗口告诉用户已有订单让他去支付,但这个时候webview会调用onProgressChanged,却并没有加载新的网址出现,是什么情况? ``` goPay() { if (this.canRequsetFlag == false) { return } this.canRequsetFlag = false let param = {} tongji.order_pay(this.goodsId) param.commodity_no = this.goodsId param.amount = 1 if(this.currentRedPacketAllInfo.coupon_type){ param.coupon_type = this.currentRedPacketAllInfo.coupon_type param.coupon_id = this.currentRedPacketAllInfo.coupon_id param.coupon_code = this.currentRedPacketAllInfo.coupon_code } param.pay_way = 1 console.log(param) let jsonData = protocol.getJsonParamsCCB(protocol.buyProduct, param, utils.getUUID()); http.ajax('', jsonData, false, (data) => { this.checkWrapShow = false if(data=='0050008'){ this.showDialogNoPay=true this.canRequsetFlag = true return; } setTimeout(()=>{ if (isInApp()) { console.log('在app中') window.location.href=(data.pay_address) } else { let host = window.location.host window.location.href=(document.location.protocol + '//' + host + window.location.pathname + '#/' + 'paymentPage' + '?from=2&out_trade_no=' + data.order_num_pay + '&url=' + btoa(data.pay_address)) } this.canRequsetFlag = true },100) },()=>{ this.canRequsetFlag = true }) } <div class="btn-style okBtn base-b-group" @click="goPay">去支付</div> ``` 而且onProgressChanged是在ajax方法结果返回前调用的,有哪位大神指导一下?
django.db.utils.InternalError: (1050, "Table 'django_content_type' already exists") 迁移文件建立数据表的时候一直报错
django.db.utils.InternalError: (1050, "Table 'django_content_type' already exists") 在网上看到很多的方法,大概都是 先删除 所有的迁移文件, 再删除 数据库中对应的 Django_migrations 表里面的所有数据 之后再进行创建迁移文件然后再执行创建数据表的操作,但是报 没有应用啥啥啥的错误。。。 接着执行: python manage.py migrate booktest --fake 结果再执行 : python manage.py migrate 还是报 1050 的错误。。。。。。。。 下面附上详细报错信息,求网友大哥们解答~~!! (django_py3) huangdonglin@huangdonglin-virtual-machine:~/django_show/test2$ python manage.py migrate Operations to perform: Synchronize unmigrated apps: messages, staticfiles Apply all migrations: admin, booktest, sessions, auth, contenttypes Synchronizing apps without migrations: Creating tables... Running deferred SQL... Installing custom SQL... Running migrations: Rendering model states... DONE Applying contenttypes.0001_initial...Traceback (most recent call last): File "/home/huangdonglin/.virtualenvs/django_py3/lib/python3.6/site-packages/django/db/backends/utils.py", line 62, in execute return self.cursor.execute(sql) File "/home/huangdonglin/.virtualenvs/django_py3/lib/python3.6/site-packages/django/db/backends/mysql/base.py", line 124, in execute return self.cursor.execute(query, args) File "/home/huangdonglin/.virtualenvs/django_py3/lib/python3.6/site-packages/pymysql/cursors.py", line 170, in execute result = self._query(query) File "/home/huangdonglin/.virtualenvs/django_py3/lib/python3.6/site-packages/pymysql/cursors.py", line 328, in _query conn.query(q) File "/home/huangdonglin/.virtualenvs/django_py3/lib/python3.6/site-packages/pymysql/connections.py", line 517, in query self._affected_rows = self._read_query_result(unbuffered=unbuffered) File "/home/huangdonglin/.virtualenvs/django_py3/lib/python3.6/site-packages/pymysql/connections.py", line 732, in _read_query_result result.read() File "/home/huangdonglin/.virtualenvs/django_py3/lib/python3.6/site-packages/pymysql/connections.py", line 1075, in read first_packet = self.connection._read_packet() File "/home/huangdonglin/.virtualenvs/django_py3/lib/python3.6/site-packages/pymysql/connections.py", line 684, in _read_packet packet.check_error() File "/home/huangdonglin/.virtualenvs/django_py3/lib/python3.6/site-packages/pymysql/protocol.py", line 220, in check_error err.raise_mysql_exception(self._data) File "/home/huangdonglin/.virtualenvs/django_py3/lib/python3.6/site-packages/pymysql/err.py", line 109, in raise_mysql_exception raise errorclass(errno, errval) pymysql.err.InternalError: (1050, "Table 'django_content_type' already exists") The above exception was the direct cause of the following exception: Traceback (most recent call last): File "manage.py", line 10, in <module> execute_from_command_line(sys.argv) File "/home/huangdonglin/.virtualenvs/django_py3/lib/python3.6/site-packages/django/core/management/__init__.py", line 338, in execute_from_command_line utility.execute() File "/home/huangdonglin/.virtualenvs/django_py3/lib/python3.6/site-packages/django/core/management/__init__.py", line 330, in execute self.fetch_command(subcommand).run_from_argv(self.argv) File "/home/huangdonglin/.virtualenvs/django_py3/lib/python3.6/site-packages/django/core/management/base.py", line 390, in run_from_argv self.execute(*args, **cmd_options) File "/home/huangdonglin/.virtualenvs/django_py3/lib/python3.6/site-packages/django/core/management/base.py", line 441, in execute output = self.handle(*args, **options) File "/home/huangdonglin/.virtualenvs/django_py3/lib/python3.6/site-packages/django/core/management/commands/migrate.py", line 221, in handle executor.migrate(targets, plan, fake=fake, fake_initial=fake_initial) File "/home/huangdonglin/.virtualenvs/django_py3/lib/python3.6/site-packages/django/db/migrations/executor.py", line 110, in migrate self.apply_migration(states[migration], migration, fake=fake, fake_initial=fake_initial) File "/home/huangdonglin/.virtualenvs/django_py3/lib/python3.6/site-packages/django/db/migrations/executor.py", line 147, in apply_migration state = migration.apply(state, schema_editor) File "/home/huangdonglin/.virtualenvs/django_py3/lib/python3.6/site-packages/django/db/migrations/migration.py", line 115, in apply operation.database_forwards(self.app_label, schema_editor, old_state, project_state) File "/home/huangdonglin/.virtualenvs/django_py3/lib/python3.6/site-packages/django/db/migrations/operations/models.py", line 59, in database_forwards schema_editor.create_model(model) File "/home/huangdonglin/.virtualenvs/django_py3/lib/python3.6/site-packages/django/db/backends/base/schema.py", line 286, in create_model self.execute(sql, params or None) File "/home/huangdonglin/.virtualenvs/django_py3/lib/python3.6/site-packages/django/db/backends/base/schema.py", line 111, in execute cursor.execute(sql, params) File "/home/huangdonglin/.virtualenvs/django_py3/lib/python3.6/site-packages/django/db/backends/utils.py", line 79, in execute return super(CursorDebugWrapper, self).execute(sql, params) File "/home/huangdonglin/.virtualenvs/django_py3/lib/python3.6/site-packages/django/db/backends/utils.py", line 64, in execute return self.cursor.execute(sql, params) File "/home/huangdonglin/.virtualenvs/django_py3/lib/python3.6/site-packages/django/db/utils.py", line 97, in __exit__ six.reraise(dj_exc_type, dj_exc_value, traceback) File "/home/huangdonglin/.virtualenvs/django_py3/lib/python3.6/site-packages/django/utils/six.py", line 658, in reraise raise value.with_traceback(tb) File "/home/huangdonglin/.virtualenvs/django_py3/lib/python3.6/site-packages/django/db/backends/utils.py", line 62, in execute return self.cursor.execute(sql) File "/home/huangdonglin/.virtualenvs/django_py3/lib/python3.6/site-packages/django/db/backends/mysql/base.py", line 124, in execute return self.cursor.execute(query, args) File "/home/huangdonglin/.virtualenvs/django_py3/lib/python3.6/site-packages/pymysql/cursors.py", line 170, in execute result = self._query(query) File "/home/huangdonglin/.virtualenvs/django_py3/lib/python3.6/site-packages/pymysql/cursors.py", line 328, in _query conn.query(q) File "/home/huangdonglin/.virtualenvs/django_py3/lib/python3.6/site-packages/pymysql/connections.py", line 517, in query self._affected_rows = self._read_query_result(unbuffered=unbuffered) File "/home/huangdonglin/.virtualenvs/django_py3/lib/python3.6/site-packages/pymysql/connections.py", line 732, in _read_query_result result.read() File "/home/huangdonglin/.virtualenvs/django_py3/lib/python3.6/site-packages/pymysql/connections.py", line 1075, in read first_packet = self.connection._read_packet() File "/home/huangdonglin/.virtualenvs/django_py3/lib/python3.6/site-packages/pymysql/connections.py", line 684, in _read_packet packet.check_error() File "/home/huangdonglin/.virtualenvs/django_py3/lib/python3.6/site-packages/pymysql/protocol.py", line 220, in check_error err.raise_mysql_exception(self._data) File "/home/huangdonglin/.virtualenvs/django_py3/lib/python3.6/site-packages/pymysql/err.py", line 109, in raise_mysql_exception raise errorclass(errno, errval)
android studio里配置C++报错?
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:transformNativeLibsWithMergeJniLibsForDebug'. at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:103) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:73) at org.gradle.api.internal.tasks.execution.OutputDirectoryCreatingTaskExecuter.execute(OutputDirectoryCreatingTaskExecuter.java:51) at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:59) at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54) at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:59) at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:101) at org.gradle.api.internal.tasks.execution.FinalizeInputFilePropertiesTaskExecuter.execute(FinalizeInputFilePropertiesTaskExecuter.java:44) at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:91) at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:62) at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:59) at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54) at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43) at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34) at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.java:256) at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336) at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328) at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199) at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110) at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:249) at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:238) at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:123) at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.java:79) at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:104) at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:98) at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:663) at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:597) at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:98) at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63) at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55) at java.lang.Thread.run(Thread.java:745) Caused by: java.io.UncheckedIOException: java.nio.file.AccessDeniedException: C:\WINDOWS\Temp at com.android.builder.merge.LazyIncrementalFileMergerInputs.load(LazyIncrementalFileMergerInputs.java:88) at com.android.builder.merge.LazyIncrementalFileMergerInputs.lambda$fromNew$0(LazyIncrementalFileMergerInputs.java:59) at com.android.tools.build.apkzlib.utils.CachedSupplier.get(CachedSupplier.java:72) at com.android.builder.merge.LazyIncrementalFileMergerInput.lambda$new$2(LazyIncrementalFileMergerInput.java:138) at com.android.tools.build.apkzlib.utils.CachedSupplier.get(CachedSupplier.java:72) at com.android.builder.merge.LazyIncrementalFileMergerInput.open(LazyIncrementalFileMergerInput.java:225) at com.android.builder.merge.DelegateIncrementalFileMergerInput.open(DelegateIncrementalFileMergerInput.java:49) at com.google.common.collect.ImmutableList.forEach(ImmutableList.java:406) at com.android.builder.merge.IncrementalFileMerger.merge(IncrementalFileMerger.java:73) at com.android.build.gradle.internal.transforms.MergeJavaResourcesTransform.transform(MergeJavaResourcesTransform.java:411) at com.android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.java:239) at com.android.build.gradle.internal.pipeline.TransformTask$2.call(TransformTask.java:235) at com.android.builder.profile.ThreadRecorder.record(ThreadRecorder.java:102) at com.android.build.gradle.internal.pipeline.TransformTask.transform(TransformTask.java:230) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:73) at org.gradle.api.internal.project.taskfactory.IncrementalTaskAction.doExecute(IncrementalTaskAction.java:50) at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:39) at org.gradle.api.internal.project.taskfactory.StandardTaskAction.execute(StandardTaskAction.java:26) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:124) at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336) at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328) at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199) at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:113) at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:95) ... 33 more Caused by: java.nio.file.AccessDeniedException: C:\WINDOWS\Temp at sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:83) at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:97) at sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:102) at sun.nio.fs.WindowsDirectoryStream.<init>(WindowsDirectoryStream.java:86) at sun.nio.fs.WindowsFileSystemProvider.newDirectoryStream(WindowsFileSystemProvider.java:518) at java.nio.file.Files.newDirectoryStream(Files.java:457) at com.google.common.io.MoreFiles.deleteRecursively(MoreFiles.java:516) at com.android.tools.build.apkzlib.bytestorage.TemporaryFile.deleteFile(TemporaryFile.java:57) at com.android.tools.build.apkzlib.bytestorage.TemporaryFile.close(TemporaryFile.java:48) at com.android.tools.build.apkzlib.bytestorage.TemporaryDirectory$1.close(TemporaryDirectory.java:50) at com.android.tools.build.apkzlib.bytestorage.TemporaryDirectoryStorage.close(TemporaryDirectoryStorage.java:101) at com.android.tools.build.apkzlib.bytestorage.OverflowToDiskByteStorage.close(OverflowToDiskByteStorage.java:167) at com.android.tools.build.apkzlib.bytestorage.ChunkBasedByteStorage.close(ChunkBasedByteStorage.java:142) at com.android.tools.build.apkzlib.zip.ZFile.close(ZFile.java:1210) at com.android.builder.files.RelativeFiles.fromZip(RelativeFiles.java:125) at com.android.builder.merge.LazyIncrementalFileMergerInputs.load(LazyIncrementalFileMergerInputs.java:86) ... 61 more
android-AsyncTask更新列表
求助—— 在AsyncTask中调用MainActivity,更新了adapter,但是LogCat给出了onPostExecture的NullPointerException,我检查了列表,里面有值,不是空的啊。 **AsyncTask.java** protected void onPostExecute(List<MoviesCategory> result){ super.onPostExecute(result); //Here i have Error, i cheked result it's not null. //On AsyncTask i have Constructor when i get Activity. activity.mMoviesAdapter.addCategory(result); } **Adapter.java** List<MoviesCategory> mListMovies; public void addCategory(List<MoviesCategory> list){ mListMovies.addAll(list); notifyDataSetChanged(); } 我做的更新: 更新 FATAL EXCEPTION: main java.lang.NullPointerException at uz.afishamedia.Adapter.MoviesAdapter.addCategory(MoviesAdapter.java:49) at uz.afishamedia.Utils.LoadMovies.onPostExecute(LoadMovies.java:74) at uz.afishamedia.Utils.LoadMovies.onPostExecute(LoadMovies.java:1) at android.os.AsyncTask.finish(AsyncTask.java:631) at android.os.AsyncTask.access$600(AsyncTask.java:177) at android.os.AsyncTask$InternalHandler.handleMessage(AsyncTask.java:644) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:5191) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:511) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:795) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:562) at dalvik.system.NativeStart.main(Native Method)
python scrapy 爬虫图片新手求助
求问大神 我这个data她怎么了 报错: 2020-02-07 09:24:55 [scrapy.utils.log] INFO: Scrapy 1.8.0 started (bot: meizitu) 2020-02-07 09:24:55 [scrapy.utils.log] INFO: Versions: lxml 4.5.0.0, libxml2 2.9.5, cssselect 1.1.0, parsel 1.5.2, w3lib 1.21.0, Twisted 19.10.0, Python 3.7.3 (v3.7.3:ef4ec6ed12, Mar 25 2019, 22:22:05) [MSC v.1916 64 bit (AMD64)], pyOpenSSL 19.1.0 (OpenSSL 1.1.1d 10 Sep 2019), cryptography 2.8, Platform Windows-10-10.0.17763-SP0 2020-02-07 09:24:55 [scrapy.crawler] INFO: Overridden settings: {'BOT_NAME': 'meizitu', 'NEWSPIDER_MODULE': 'meizitu.spiders', 'ROBOTSTXT_OBEY': True, 'SPIDER_MODULES': ['meizitu.spiders']} 2020-02-07 09:24:55 [scrapy.extensions.telnet] INFO: Telnet Password: 0936097982b9bcc8 2020-02-07 09:24:55 [scrapy.middleware] INFO: Enabled extensions: ['scrapy.extensions.corestats.CoreStats', 'scrapy.extensions.telnet.TelnetConsole', 'scrapy.extensions.logstats.LogStats'] 2020-02-07 09:24:56 [scrapy.middleware] INFO: Enabled downloader middlewares: ['scrapy.downloadermiddlewares.robotstxt.RobotsTxtMiddleware', 'scrapy.downloadermiddlewares.httpauth.HttpAuthMiddleware', 'scrapy.downloadermiddlewares.downloadtimeout.DownloadTimeoutMiddleware', 'scrapy.downloadermiddlewares.defaultheaders.DefaultHeadersMiddleware', 'scrapy.downloadermiddlewares.useragent.UserAgentMiddleware', 'scrapy.downloadermiddlewares.retry.RetryMiddleware', 'scrapy.downloadermiddlewares.redirect.MetaRefreshMiddleware', 'scrapy.downloadermiddlewares.httpcompression.HttpCompressionMiddleware', 'scrapy.downloadermiddlewares.redirect.RedirectMiddleware', 'scrapy.downloadermiddlewares.cookies.CookiesMiddleware', 'scrapy.downloadermiddlewares.httpproxy.HttpProxyMiddleware', 'scrapy.downloadermiddlewares.stats.DownloaderStats'] 2020-02-07 09:24:56 [scrapy.middleware] INFO: Enabled spider middlewares: ['scrapy.spidermiddlewares.httperror.HttpErrorMiddleware', 'scrapy.spidermiddlewares.offsite.OffsiteMiddleware', 'scrapy.spidermiddlewares.referer.RefererMiddleware', 'scrapy.spidermiddlewares.urllength.UrlLengthMiddleware', 'scrapy.spidermiddlewares.depth.DepthMiddleware'] Unhandled error in Deferred: 2020-02-07 09:24:56 [twisted] CRITICAL: Unhandled error in Deferred: Traceback (most recent call last): File "e:\python3.7\lib\site-packages\scrapy\crawler.py", line 184, in crawl return self._crawl(crawler, *args, **kwargs) File "e:\python3.7\lib\site-packages\scrapy\crawler.py", line 188, in _crawl d = crawler.crawl(*args, **kwargs) File "e:\python3.7\lib\site-packages\twisted\internet\defer.py", line 1613, in unwindGenerator return _cancellableInlineCallbacks(gen) File "e:\python3.7\lib\site-packages\twisted\internet\defer.py", line 1529, in _cancellableInlineCallbacks _inlineCallbacks(None, g, status) --- <exception caught here> --- File "e:\python3.7\lib\site-packages\twisted\internet\defer.py", line 1418, in _inlineCallbacks result = g.send(result) File "e:\python3.7\lib\site-packages\scrapy\crawler.py", line 86, in crawl self.engine = self._create_engine() File "e:\python3.7\lib\site-packages\scrapy\crawler.py", line 111, in _create_engine return ExecutionEngine(self, lambda _: self.stop()) File "e:\python3.7\lib\site-packages\scrapy\core\engine.py", line 70, in __init__ self.scraper = Scraper(crawler) File "e:\python3.7\lib\site-packages\scrapy\core\scraper.py", line 71, in __init__ self.itemproc = itemproc_cls.from_crawler(crawler) File "e:\python3.7\lib\site-packages\scrapy\middleware.py", line 53, in from_crawler return cls.from_settings(crawler.settings, crawler) File "e:\python3.7\lib\site-packages\scrapy\middleware.py", line 34, in from_settings mwcls = load_object(clspath) File "e:\python3.7\lib\site-packages\scrapy\utils\misc.py", line 46, in load_object mod = import_module(module) File "e:\python3.7\lib\importlib\__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1006, in _gcd_import File "<frozen importlib._bootstrap>", line 983, in _find_and_load File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 677, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 724, in exec_module File "<frozen importlib._bootstrap_external>", line 860, in get_code File "<frozen importlib._bootstrap_external>", line 791, in source_to_code File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed builtins.SyntaxError: unexpected EOF while parsing (pipelines.py, line 22) 2020-02-07 09:24:56 [twisted] CRITICAL: Traceback (most recent call last): File "e:\python3.7\lib\site-packages\twisted\internet\defer.py", line 1418, in _inlineCallbacks result = g.send(result) File "e:\python3.7\lib\site-packages\scrapy\crawler.py", line 86, in crawl self.engine = self._create_engine() File "e:\python3.7\lib\site-packages\scrapy\crawler.py", line 111, in _create_engine return ExecutionEngine(self, lambda _: self.stop()) File "e:\python3.7\lib\site-packages\scrapy\core\engine.py", line 70, in __init__ self.scraper = Scraper(crawler) File "e:\python3.7\lib\site-packages\scrapy\core\scraper.py", line 71, in __init__ self.itemproc = itemproc_cls.from_crawler(crawler) File "e:\python3.7\lib\site-packages\scrapy\middleware.py", line 53, in from_crawler return cls.from_settings(crawler.settings, crawler) File "e:\python3.7\lib\site-packages\scrapy\middleware.py", line 34, in from_settings mwcls = load_object(clspath) File "e:\python3.7\lib\site-packages\scrapy\utils\misc.py", line 46, in load_object mod = import_module(module) File "e:\python3.7\lib\importlib\__init__.py", line 127, in import_module return _bootstrap._gcd_import(name[level:], package, level) File "<frozen importlib._bootstrap>", line 1006, in _gcd_import File "<frozen importlib._bootstrap>", line 983, in _find_and_load File "<frozen importlib._bootstrap>", line 967, in _find_and_load_unlocked File "<frozen importlib._bootstrap>", line 677, in _load_unlocked File "<frozen importlib._bootstrap_external>", line 724, in exec_module File "<frozen importlib._bootstrap_external>", line 860, in get_code File "<frozen importlib._bootstrap_external>", line 791, in source_to_code File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed File "E:\python_work\爬虫\meizitu\meizitu\pipelines.py", line 22 f.write(data) ^ SyntaxError: unexpected EOF while parsing 代码如下: pipeline ``` import requests class MeizituPipeline(object): def process_item(self, item, spider): print("main_title:",item['main_title']) print("main_image:", item['main_image']) print("main_tags:", item['main_tags']) print("main_meta:", item['main_meta']) print("page:", item['main_pagenavi']) url = requests.get(item['main_image']) print(url) try: with open(item['main_pagenavi'] +'.jpg','wb') as f: data = url.read() f.write(data) ``` image.py ``` import scrapy from scrapy.http import response from ..items import MeizituItem class ImageSpider(scrapy.Spider): #定义Spider的名字scrapy crawl meiaitu name = 'SpiderMain' #允许爬虫的域名 allowed_domains = ['www.mzitu.com/203554'] #爬取的首页列表 start_urls = ['https://www.mzitu.com/203554'] #负责提取response的信息 #response代表下载器从start_urls中的url的到的回应 #提取的信息 def parse(self,response): #遍历所有节点 for Main in response.xpath('//div[@class = "main"]'): item = MeizituItem() #匹配所有节点元素/html/body/div[2]/div[1]/div[3]/p/a content = Main.xpath('//div[@class = "content"]') item['main_title'] = content.xpath('./h2/text()') item['main_image'] = content.xpath('./div[@class="main-image"]/p/a/img') item['main_meta'] = content.xpath('./div[@class="main-meta"]/span/text()').extract() item['main_tags'] = content.xpath('./div[@class="main-tags"]/a/text()').extract() item['main_pagenavi'] = content.xpath('./div[@class="main_pagenavi"]/span/text()').extract_first() yield item new_links = response.xpath('.//div[@class="pagenavi"]/a/@href').extract() new_link =new_links[-1] yield scrapy.Request(new_link,callback=self.parse) ``` setting ``` BOT_NAME = 'meizitu' SPIDER_MODULES = ['meizitu.spiders'] NEWSPIDER_MODULE = 'meizitu.spiders' ROBOTSTXT_OBEY = True #配置默认请求头 DEFAULT_REQUEST_HEADERS = { "User-Agent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.108 Safari/537.36", 'Accept':'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8' } ITEM_PIPELINES = { 'meizitu.pipelines.MeizituPipeline':300, } IMAGES_STORE = 'E:\python_work\爬虫\meizitu' IMAGES_MIN_HEIGHT = 1050 IMAGES_MIN_WIDTH = 700 ```
Android5.0使用屏幕投射API截图问题
我是参考的这个[一种全新的截屏方式](http://blog.csdn.net/zdy0_2004/article/details/48979903 ""); 但是在截屏时要获取[屏幕截取]的权限,要用到startActivityForResult ```java MediaProjectionManager projectionManager = (MediaProjectionManager) getApplication().getSystemService(Context.MEDIA_PROJECTION_SERVICE); startActivityForResult(projectionManager.createScreenCaptureIntent(),1); ``` 但是每次就会出现如下的情况 ![报错](https://img-ask.csdn.net/upload/201603/25/1458898498_366210.png) 下面是我的MainActivity ```java package com.example.ttt; import java.io.File; import java.io.FileOutputStream; import java.io.IOException; import java.io.OutputStream; import java.nio.ByteBuffer; import java.util.concurrent.atomic.AtomicInteger; import android.annotation.SuppressLint; import android.app.Activity; import android.content.Context; import android.content.Intent; import android.graphics.Bitmap; import android.graphics.PixelFormat; import android.graphics.Point; import android.hardware.display.DisplayManager; import android.hardware.display.VirtualDisplay; import android.media.Image; import android.media.ImageReader; import android.media.projection.MediaProjection; import android.media.projection.MediaProjectionManager; import android.net.Uri; import android.os.Bundle; import android.os.Handler; import android.os.HandlerThread; import android.util.DisplayMetrics; import android.view.View; import android.view.View.OnClickListener; public class MainActivity extends Activity { private MediaProjectionManager projectionManager; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); findViewById(R.id.click).setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { projectionManager = (MediaProjectionManager) getApplication().getSystemService(Context.MEDIA_PROJECTION_SERVICE); startActivityForResult(projectionManager.createScreenCaptureIntent(),1); handleScreenShotIntent(); } }); } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { if(requestCode == 1){ ((MyApplication) getApplication()).setResult(resultCode); ((MyApplication) getApplication()).setIntent(data); } } private void handleScreenShotIntent() { try { onScreenshotTaskBegan(); final MediaProjection mProjection = projectionManager.getMediaProjection( ((MyApplication) getApplication()).getResult(), ((MyApplication) getApplication()).getIntent()); Point size = Utils.getScreenSize(this); final int mWidth = size.x; final int mHeight = size.y; final ImageReader mImageReader = ImageReader.newInstance(mWidth, mHeight, PixelFormat.RGBA_8888, 2); final VirtualDisplay display = mProjection.createVirtualDisplay("screen-mirror", mWidth, mHeight, DisplayMetrics.DENSITY_MEDIUM, DisplayManager.VIRTUAL_DISPLAY_FLAG_PRESENTATION, mImageReader.getSurface(), null, null); mImageReader.setOnImageAvailableListener(new ImageReader.OnImageAvailableListener() { @SuppressLint("NewApi") @Override public void onImageAvailable(ImageReader mImageReader) { Image image = null; try { image = mImageReader.acquireLatestImage(); if (image != null) { final Image.Plane[] planes = image.getPlanes(); if (planes.length > 0) { final ByteBuffer buffer = planes[0].getBuffer(); int pixelStride = planes[0].getPixelStride(); int rowStride = planes[0].getRowStride(); int rowPadding = rowStride - pixelStride * mWidth; // create bitmap Bitmap bmp = Bitmap.createBitmap(mWidth + rowPadding / pixelStride, mHeight, Bitmap.Config.ARGB_8888); bmp.copyPixelsFromBuffer(buffer); Bitmap croppedBitmap = Bitmap.createBitmap(bmp, 0, 0, mWidth, mHeight); saveBitmap(croppedBitmap);// 保存图片 if (croppedBitmap != null) { croppedBitmap.recycle(); } if (bmp != null) { bmp.recycle(); } } } } catch (Exception e) { e.printStackTrace(); // showErrorNotification(Utils.getStackTrace(e)); } finally { if (image != null) { image.close(); } if (mImageReader != null) { mImageReader.close(); } if (display != null) { display.release(); } mImageReader.setOnImageAvailableListener(null, null); mProjection.stop(); onScreenshotTaskOver(); } } }, getBackgroundHandler()); } catch (Exception e) { e.printStackTrace(); } } private void saveBitmap(Bitmap bmp) throws IOException { File childFolder = SettingHelper.getOutputFoler(); File imageFile = new File(childFolder.getAbsolutePath() + "/" + SettingHelper.getOutputScreenshotFileName()); OutputStream fOut = new FileOutputStream(imageFile); bmp.compress(Bitmap.CompressFormat.JPEG, 80, fOut);// 将bg输出至文件 fOut.flush(); fOut.close(); // do not forget to close the stream this.sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, Uri.fromFile(imageFile))); } static AtomicInteger oneScreenshot = new AtomicInteger(0); private boolean isAlreadyOneScreenshotTask() { return oneScreenshot.get() == 1; } private synchronized void onScreenshotTaskBegan() { oneScreenshot.set(1); } private synchronized void onScreenshotTaskOver() { oneScreenshot.set(0); } // 在后台线程里保存文件 Handler backgroundHandler; private Handler getBackgroundHandler() { if (backgroundHandler == null) { HandlerThread backgroundThread = new HandlerThread("easyscreenshot", android.os.Process.THREAD_PRIORITY_BACKGROUND); backgroundThread.start(); backgroundHandler = new Handler(backgroundThread.getLooper()); } return backgroundHandler; } } ``` MyApplication: ```java package com.example.ttt; import android.app.Application; import android.content.Intent; import android.media.projection.MediaProjectionManager; public class MyApplication extends Application { private int result; private Intent intent; private MediaProjectionManager mMediaProjectionManager; public int getResult() { return result; } public Intent getIntent() { return intent; } public MediaProjectionManager getMediaProjectionManager() { return mMediaProjectionManager; } public void setResult(int result1) { this.result = result1; } public void setIntent(Intent intent1) { this.intent = intent1; } public void setMediaProjectionManager(MediaProjectionManager mMediaProjectionManager) { this.mMediaProjectionManager = mMediaProjectionManager; } } ```
openstack启动实例报错No valid host was found
计算节点的nova错误日志: ``` 2020-02-11 17:05:07.817 1295 ERROR nova.virt.libvirt.guest [req-740339df-c3c4-450b-9787-9c7336c461a3 a7756266208f439bbb8324fb22853932 e7af6fe8f68647ab8010beaa7cb440ed - - -] Error launching a defined domain with XML: <domain type='kvm'> 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [req-740339df-c3c4-450b-9787-9c7336c461a3 a7756266208f439bbb8324fb22853932 e7af6fe8f68647ab8010beaa7cb440ed - - -] [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] Instance failed to spawn 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] Traceback (most recent call last): 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] File "/usr/lib/python2.7/site-packages/nova/compute/manager.py", line 2229, in _build_resources 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] yield resources 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] File "/usr/lib/python2.7/site-packages/nova/compute/manager.py", line 2075, in _build_and_run_instance 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] block_device_info=block_device_info) 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] File "/usr/lib/python2.7/site-packages/nova/virt/libvirt/driver.py", line 2779, in spawn 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] block_device_info=block_device_info) 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] File "/usr/lib/python2.7/site-packages/nova/virt/libvirt/driver.py", line 4923, in _create_domain_and_network 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] xml, pause=pause, power_on=power_on) 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] File "/usr/lib/python2.7/site-packages/nova/virt/libvirt/driver.py", line 4854, in _create_domain 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] guest.launch(pause=pause) 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] File "/usr/lib/python2.7/site-packages/nova/virt/libvirt/guest.py", line 142, in launch 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] self._encoded_xml, errors='ignore') 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] File "/usr/lib/python2.7/site-packages/oslo_utils/excutils.py", line 220, in __exit__ 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] self.force_reraise() 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] File "/usr/lib/python2.7/site-packages/oslo_utils/excutils.py", line 196, in force_reraise 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] six.reraise(self.type_, self.value, self.tb) 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] File "/usr/lib/python2.7/site-packages/nova/virt/libvirt/guest.py", line 137, in launch 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] return self._domain.createWithFlags(flags) 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] File "/usr/lib/python2.7/site-packages/eventlet/tpool.py", line 186, in doit 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] result = proxy_call(self._autowrap, f, *args, **kwargs) 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] File "/usr/lib/python2.7/site-packages/eventlet/tpool.py", line 144, in proxy_call 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] rv = execute(f, *args, **kwargs) 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] File "/usr/lib/python2.7/site-packages/eventlet/tpool.py", line 125, in execute 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] six.reraise(c, e, tb) 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] File "/usr/lib/python2.7/site-packages/eventlet/tpool.py", line 83, in tworker 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] rv = meth(*args, **kwargs) 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] File "/usr/lib64/python2.7/site-packages/libvirt.py", line 1110, in createWithFlags 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] if ret == -1: raise libvirtError ('virDomainCreateWithFlags() failed', dom=self) 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] libvirtError: internal error: process exited while connecting to monitor: 2020-02-11T09:05:07.623239Z qemu-kvm: -drive file=/var/lib/nova/instances/8020d30b-33ec-4836-8f61-f23516aa2508/disk,format=qcow2,if=none,id=drive-virtio-disk0,cache=none: Could not open '/var/lib/nova/instances/8020d30b-33ec-4836-8f61-f23516aa2508/disk': Permission denied 2020-02-11 17:05:07.818 1295 ERROR nova.compute.manager [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] ``` 控制节点的nova-conductor.log ``` 2020-02-11 17:05:08.365 958 ERROR nova.scheduler.utils [req-740339df-c3c4-450b-9787-9c7336c461a3 a7756266208f439bbb8324fb22853932 e7af6fe8f68647ab8010beaa7cb440ed - - -] [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] Error from last host: compute (node compute): [u'Traceback (most recent call last):\n', u' File "/usr/lib/python2.7/site-packages/nova/compute/manager.py", line 1937, in _do_build_and_run_instance\n filter_properties)\n', u' File "/usr/lib/python2.7/site-packages/nova/compute/manager.py", line 2127, in _build_and_run_instance\n instance_uuid=instance.uuid, reason=six.text_type(e))\n', u"RescheduledException: Build of instance 8020d30b-33ec-4836-8f61-f23516aa2508 was re-scheduled: internal error: process exited while connecting to monitor: 2020-02-11T09:05:07.623239Z qemu-kvm: -drive file=/var/lib/nova/instances/8020d30b-33ec-4836-8f61-f23516aa2508/disk,format=qcow2,if=none,id=drive-virtio-disk0,cache=none: Could not open '/var/lib/nova/instances/8020d30b-33ec-4836-8f61-f23516aa2508/disk': Permission denied\n"] 2020-02-11 17:05:08.450 958 WARNING nova.scheduler.utils [req-740339df-c3c4-450b-9787-9c7336c461a3 a7756266208f439bbb8324fb22853932 e7af6fe8f68647ab8010beaa7cb440ed - - -] [instance: 8020d30b-33ec-4836-8f61-f23516aa2508] Setting instance to ERROR state. ``` dashboard上报错 ![图片说明](https://img-ask.csdn.net/upload/202002/11/1581412785_788625.png) ![图片说明](https://img-ask.csdn.net/upload/202002/11/1581413291_261638.png) 我的网络配置是 ![图片说明](https://img-ask.csdn.net/upload/202002/11/1581412842_430142.png) ![图片说明](https://img-ask.csdn.net/upload/202002/11/1581412854_59896.png) 不知道有没有路过的大师指导这是什么原因啊,在网上找了好多方法没有解决。万分感谢!
终于明白阿里百度这样的大公司,为什么面试经常拿ThreadLocal考验求职者了
点击上面↑「爱开发」关注我们每晚10点,捕获技术思考和创业资源洞察什么是ThreadLocalThreadLocal是一个本地线程副本变量工具类,各个线程都拥有一份线程私有的数
程序员必须掌握的核心算法有哪些?
由于我之前一直强调数据结构以及算法学习的重要性,所以就有一些读者经常问我,数据结构与算法应该要学习到哪个程度呢?,说实话,这个问题我不知道要怎么回答你,主要取决于你想学习到哪些程度,不过针对这个问题,我稍微总结一下我学过的算法知识点,以及我觉得值得学习的算法。这些算法与数据结构的学习大多数是零散的,并没有一本把他们全部覆盖的书籍。下面是我觉得值得学习的一些算法以及数据结构,当然,我也会整理一些看过...
《奇巧淫技》系列-python!!每天早上八点自动发送天气预报邮件到QQ邮箱
此博客仅为我业余记录文章所用,发布到此,仅供网友阅读参考,如有侵权,请通知我,我会删掉。 补充 有不少读者留言说本文章没有用,因为天气预报直接打开手机就可以收到了,为何要多此一举发送到邮箱呢!!!那我在这里只能说:因为你没用,所以你没用!!! 这里主要介绍的是思路,不是天气预报!不是天气预报!!不是天气预报!!!天气预报只是用于举例。请各位不要再刚了!!! 下面是我会用到的两个场景: 每日下
面试官问我:什么是消息队列?什么场景需要他?用了会出现什么问题?
你知道的越多,你不知道的越多 点赞再看,养成习惯 GitHub上已经开源 https://github.com/JavaFamily 有一线大厂面试点脑图、个人联系方式,欢迎Star和完善 前言 消息队列在互联网技术存储方面使用如此广泛,几乎所有的后端技术面试官都要在消息队列的使用和原理方面对小伙伴们进行360°的刁难。 作为一个在互联网公司面一次拿一次Offer的面霸,打败了无数
8年经验面试官详解 Java 面试秘诀
    作者 | 胡书敏 责编 | 刘静 出品 | CSDN(ID:CSDNnews) 本人目前在一家知名外企担任架构师,而且最近八年来,在多家外企和互联网公司担任Java技术面试官,前后累计面试了有两三百位候选人。在本文里,就将结合本人的面试经验,针对Java初学者、Java初级开发和Java开发,给出若干准备简历和准备面试的建议。   Java程序员准备和投递简历的实
究竟你适不适合买Mac?
我清晰的记得,刚买的macbook pro回到家,开机后第一件事情,就是上了淘宝网,花了500元钱,找了一个上门维修电脑的师傅,上门给我装了一个windows系统。。。。。。 表砍我。。。 当时买mac的初衷,只是想要个固态硬盘的笔记本,用来运行一些复杂的扑克软件。而看了当时所有的SSD笔记本后,最终决定,还是买个好(xiong)看(da)的。 已经有好几个朋友问我mba怎么样了,所以今天尽量客观
程序员一般通过什么途径接私活?
二哥,你好,我想知道一般程序猿都如何接私活,我也想接,能告诉我一些方法吗? 上面是一个读者“烦不烦”问我的一个问题。其实不止是“烦不烦”,还有很多读者问过我类似这样的问题。 我接的私活不算多,挣到的钱也没有多少,加起来不到 20W。说实话,这个数目说出来我是有点心虚的,毕竟太少了,大家轻喷。但我想,恰好配得上“一般程序员”这个称号啊。毕竟苍蝇再小也是肉,我也算是有经验的人了。 唾弃接私活、做外
大学四年自学走来,这些珍藏的「实用工具/学习网站」我全贡献出来了
知乎高赞:文中列举了互联网一线大厂程序员都在用的工具集合,涉及面非常广,小白和老手都可以进来看看,或许有新收获。
《阿里巴巴开发手册》读书笔记-编程规约
Java编程规约命名风格 命名风格 类名使用UpperCamelCase风格 方法名,参数名,成员变量,局部变量都统一使用lowerCamelcase风格 常量命名全部大写,单词间用下划线隔开, 力求语义表达完整清楚,不要嫌名字长 ...
Python爬虫爬取淘宝,京东商品信息
小编是一个理科生,不善长说一些废话。简单介绍下原理然后直接上代码。 使用的工具(Python+pycharm2019.3+selenium+xpath+chromedriver)其中要使用pycharm也可以私聊我selenium是一个框架可以通过pip下载 pip install selenium -i https://pypi.tuna.tsinghua.edu.cn/simple/ 
阿里程序员写了一个新手都写不出的低级bug,被骂惨了。
你知道的越多,你不知道的越多 点赞再看,养成习惯 本文 GitHub https://github.com/JavaFamily 已收录,有一线大厂面试点思维导图,也整理了很多我的文档,欢迎Star和完善,大家面试可以参照考点复习,希望我们一起有点东西。 前前言 为啥今天有个前前言呢? 因为你们的丙丙啊,昨天有牌面了哟,直接被微信官方推荐,知乎推荐,也就仅仅是还行吧(心里乐开花)
Java工作4年来应聘要16K最后没要,细节如下。。。
前奏: 今天2B哥和大家分享一位前几天面试的一位应聘者,工作4年26岁,统招本科。 以下就是他的简历和面试情况。 基本情况: 专业技能: 1、&nbsp;熟悉Sping了解SpringMVC、SpringBoot、Mybatis等框架、了解SpringCloud微服务 2、&nbsp;熟悉常用项目管理工具:SVN、GIT、MAVEN、Jenkins 3、&nbsp;熟悉Nginx、tomca
Python爬虫精简步骤1 获取数据
爬虫的工作分为四步: 1.获取数据。爬虫程序会根据我们提供的网址,向服务器发起请求,然后返回数据。 2.解析数据。爬虫程序会把服务器返回的数据解析成我们能读懂的格式。 3.提取数据。爬虫程序再从中提取出我们需要的数据。 4.储存数据。爬虫程序把这些有用的数据保存起来,便于你日后的使用和分析。 这一篇的内容就是:获取数据。 首先,我们将会利用一个强大的库——requests来获取数据。 在电脑上安装
Python绘图,圣诞树,花,爱心 | Turtle篇
1.画圣诞树 import turtle screen = turtle.Screen() screen.setup(800,600) circle = turtle.Turtle() circle.shape('circle') circle.color('red') circle.speed('fastest') circle.up() square = turtle.Turtle()
作为一个程序员,CPU的这些硬核知识你必须会!
CPU对每个程序员来说,是个既熟悉又陌生的东西? 如果你只知道CPU是中央处理器的话,那可能对你并没有什么用,那么作为程序员的我们,必须要搞懂的就是CPU这家伙是如何运行的,尤其要搞懂它里面的寄存器是怎么一回事,因为这将让你从底层明白程序的运行机制。 随我一起,来好好认识下CPU这货吧 把CPU掰开来看 对于CPU来说,我们首先就要搞明白它是怎么回事,也就是它的内部构造,当然,CPU那么牛的一个东
破14亿,Python分析我国存在哪些人口危机!
2020年1月17日,国家统计局发布了2019年国民经济报告,报告中指出我国人口突破14亿。 猪哥的朋友圈被14亿人口刷屏,但是很多人并没有看到我国复杂的人口问题:老龄化、男女比例失衡、生育率下降、人口红利下降等。 今天我们就来分析一下我们国家的人口数据吧! 更多有趣分析教程,扫描下方二维码关注vx公号「裸睡的猪」 即可查看! 一、背景 1.人口突破14亿 2020年1月17日,国家统计局发布
听说想当黑客的都玩过这个Monyer游戏(1~14攻略)
第零关 进入传送门开始第0关(游戏链接) 请点击链接进入第1关: 连接在左边→ ←连接在右边 看不到啊。。。。(只能看到一堆大佬做完的留名,也能看到菜鸡的我,在后面~~) 直接fn+f12吧 &lt;span&gt;连接在左边→&lt;/span&gt; &lt;a href="first.php"&gt;&lt;/a&gt; &lt;span&gt;←连接在右边&lt;/span&gt; o
在家远程办公效率低?那你一定要收好这个「在家办公」神器!
相信大家都已经收到国务院延长春节假期的消息,接下来,在家远程办公可能将会持续一段时间。 但是问题来了。远程办公不是人在电脑前就当坐班了,相反,对于沟通效率,文件协作,以及信息安全都有着极高的要求。有着非常多的挑战,比如: 1在异地互相不见面的会议上,如何提高沟通效率? 2文件之间的来往反馈如何做到及时性?如何保证信息安全? 3如何规划安排每天工作,以及如何进行成果验收? ......
作为一个程序员,内存和磁盘的这些事情,你不得不知道啊!!!
截止目前,我已经分享了如下几篇文章: 一个程序在计算机中是如何运行的?超级干货!!! 作为一个程序员,CPU的这些硬核知识你必须会! 作为一个程序员,内存的这些硬核知识你必须懂! 这些知识可以说是我们之前都不太重视的基础知识,可能大家在上大学的时候都学习过了,但是嘞,当时由于老师讲解的没那么有趣,又加上这些知识本身就比较枯燥,所以嘞,大家当初几乎等于没学。 再说啦,学习这些,也看不出来有什么用啊!
别低估自己的直觉,也别高估自己的智商
所有群全部吵翻天,朋友圈全部沦陷,公众号疯狂转发。这两周没怎么发原创,只发新闻,可能有人注意到了。我不是懒,是文章写了却没发,因为大家的关注力始终在这次的疫情上面,发了也没人看。当然,我...
这个世界上人真的分三六九等,你信吗?
偶然间,在知乎上看到一个问题 一时间,勾起了我深深的回忆。 以前在厂里打过两次工,做过家教,干过辅导班,做过中介。零下几度的晚上,贴过广告,满脸、满手地长冻疮。   再回首那段岁月,虽然苦,但让我学会了坚持和忍耐。让我明白了,在这个世界上,无论环境多么的恶劣,只要心存希望,星星之火,亦可燎原。   下文是原回答,希望能对你能有所启发。   如果我说,这个世界上人真的分三六九等,
为什么听过很多道理,依然过不好这一生?
记录学习笔记是一个重要的习惯,不希望学习过的东西成为过眼云烟。做总结的同时也是一次复盘思考的过程。 本文是根据阅读得到 App上《万维钢·精英日课》部分文章后所做的一点笔记和思考。学习是一个系统的过程,思维模型的建立需要相对完整的学习和思考过程。以下观点是在碎片化阅读后总结的一点心得总结。
B 站上有哪些很好的学习资源?
哇说起B站,在小九眼里就是宝藏般的存在,放年假宅在家时一天刷6、7个小时不在话下,更别提今年的跨年晚会,我简直是跪着看完的!! 最早大家聚在在B站是为了追番,再后来我在上面刷欧美新歌和漂亮小姐姐的舞蹈视频,最近两年我和周围的朋友们已经把B站当作学习教室了,而且学习成本还免费,真是个励志的好平台ヽ(.◕ฺˇд ˇ◕ฺ;)ノ 下面我们就来盘点一下B站上优质的学习资源: 综合类 Oeasy: 综合
如何优雅地打印一个Java对象?
你好呀,我是沉默王二,一个和黄家驹一样身高,和刘德华一样颜值的程序员。虽然已经写了十多年的 Java 代码,但仍然觉得自己是个菜鸟(请允许我惭愧一下)。 在一个月黑风高的夜晚,我思前想后,觉得再也不能这么蹉跎下去了。于是痛下决心,准备通过输出的方式倒逼输入,以此来修炼自己的内功,从而进阶成为一名真正意义上的大神。与此同时,希望这些文章能够帮助到更多的读者,让大家在学习的路上不再寂寞、空虚和冷。 ...
雷火神山直播超两亿,Web播放器事件监听是怎么实现的?
Web播放器解决了在手机浏览器和PC浏览器上播放音视频数据的问题,让视音频内容可以不依赖用户安装App,就能进行播放以及在社交平台进行传播。在视频业务大数据平台中,播放数据的统计分析非常重要,所以Web播放器在使用过程中,需要对其内部的数据进行收集并上报至服务端,此时,就需要对发生在其内部的一些播放行为进行事件监听。 那么Web播放器事件监听是怎么实现的呢? 01 监听事件明细表 名
3万字总结,Mysql优化之精髓
本文知识点较多,篇幅较长,请耐心学习 MySQL已经成为时下关系型数据库产品的中坚力量,备受互联网大厂的青睐,出门面试想进BAT,想拿高工资,不会点MySQL优化知识,拿offer的成功率会大大下降。 为什么要优化 系统的吞吐量瓶颈往往出现在数据库的访问速度上 随着应用程序的运行,数据库的中的数据会越来越多,处理时间会相应变慢 数据是存放在磁盘上的,读写速度无法和内存相比 如何优化 设计
Linux 命令(122)—— watch 命令
1.命令简介 2.命令格式 3.选项说明 4.常用示例 参考文献 [1] watch(1) manual
Linux 命令(121)—— cal 命令
1.命令简介 2.命令格式 3.选项说明 4.常用示例 参考文献 [1] cal(1) manual
记jsp+servlet+jdbc实现的新闻管理系统
1.工具:eclipse+SQLyog 2.介绍:实现的内容就是显示新闻的基本信息,然后一个增删改查的操作。 3.数据库表设计 列名 中文名称 数据类型 长度 非空 newsId 文章ID int 11 √ newsTitle 文章标题 varchar 20 √ newsContent 文章内容 text newsStatus 是否审核 varchar 10 news...
Python新型冠状病毒疫情数据自动爬取+统计+发送报告+数据屏幕(三)发送篇
今天介绍的项目是使用 Itchat 发送统计报告 项目功能设计: 定时爬取疫情数据存入Mysql 进行数据分析制作疫情报告 使用itchat给亲人朋友发送分析报告(本文) 基于Django做数据屏幕 使用Tableau做数据分析 来看看最终效果 目前已经完成,预计2月12日前更新 使用 itchat 发送数据统计报告 itchat 是一个基于 web微信的一个框架,但微信官方并不允
相关热词 c#导入fbx c#中屏蔽键盘某个键 c#正态概率密度 c#和数据库登陆界面设计 c# 高斯消去法 c# codedom c#读取cad文件文本 c# 控制全局鼠标移动 c# temp 目录 bytes初始化 c#
立即提问