创建了一个新的数据库和新的表,show tables显示表已存在,但是select查询或desc都显示表不存在。

求解答
刚刚安装的MySQL 8.0.16版本 创建了一个新的数据库和新的表,show tables显示表已存在,但是select查询或desc都显示表不存在
Server version: 8.0.16 MySQL Community Server
系统MacOS

mysql> show databases;
+--------------------+
| Database           |
+--------------------+
| e                  |
| information_schema |
| mysql              |
| performance_schema |
| sys                |
+--------------------+
5 rows in set (0.00 sec)

mysql> create database t;
Query OK, 1 row affected (0.00 sec)

mysql> CREATE TABLE ‘test_0’(
    -> ‘id’ int(11) unsigned NOT NULL AUTO_INCREMENT, 
    -> ‘name’ varchar(80) NOT NULL,
    -> PRIMARY KEY (‘id’)
    -> );
ERROR 1046 (3D000): No database selected
mysql> use t
Database changed
mysql> CREATE TABLE ‘test_0’(
    -> ‘id’ int(11) unsigned NOT NULL AUTO_INCREMENT, 
    -> ‘name’ varchar(80) NOT NULL,
    -> PRIMARY KEY (‘id’)
    -> );
Query OK, 0 rows affected (0.02 sec)

mysql> show tables;
+--------------+
| Tables_in_t  |
+--------------+
| ‘test_0’     |
+--------------+
1 row in set (0.00 sec)

mysql> desc test_0;
ERROR 1146 (42S02): Table 't.test_0' doesn't exist
mysql> 

1个回答

符号用错了,你现在的表名是‘test_0’不是test_0,mysql的表名跟字段名的特列符号是反引号 `

https://blog.csdn.net/wo541075754/article/details/52290000

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
为什么运行查询和删除数据库时闪退?
MainActivity ``` package com.example.administrator.diary; import android.content.Context; import android.content.Intent; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.support.v7.app.AppCompatActivity; import android.os.Bundle; import android.view.View; import android.widget.Button; public class MainActivity extends AppCompatActivity { private Button mm_login,yk_login; static final String db_pass="passwordDB"; static final String tb_pass="passwordTB"; SQLiteDatabase db; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); //调用创建数据库方法 CREATE(); //调用按钮监听器方法 init(); //游客跳转 yk_login.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { //为了跳转到日记界面,并实现日记功能 Intent YD=new Intent(MainActivity.this,DiaryActivity.class); startActivity(YD); } }); } //打开或创建数据库 public void CREATE(){ db = openOrCreateDatabase(db_pass, Context.MODE_PRIVATE, null); String createTable = " CREATE TABLE IF NOT EXISTS " + tb_pass + "(password_id VARCHAR (4) PRIMARY KEY)"; db.execSQL(createTable); } //获取activity_main的控件 public void init(){ mm_login=findViewById(R.id.but_mm_login); yk_login=findViewById(R.id.but_yk_login); //获取数据库数据项 Cursor cur=db.rawQuery("SELECT * FROM passwordTB",null); int amount=cur.getCount(); //数据库为0则表示没有密码存在数据库,密码跳转到注册密码界面,游客可直接登录日记界面 if (amount==0){ mm_login.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { //为了跳转到注册界面,并实现注册功能 Intent MR=new Intent(MainActivity.this,RegisterActivity.class); startActivity(MR); } }); yk_login.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { //为了跳转到日记界面,并实现日记功能 Intent YD=new Intent(MainActivity.this,DiaryActivity.class); startActivity(YD); } }); } else{//数据项不为0,则有密码已存在 mm_login.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { //为了跳转到密码输入界面,并实现密码输入功能 Intent MS=new Intent(MainActivity.this,SendActivity.class); startActivity(MS); } }); //游客按钮隐藏 yk_login.setVisibility(Button.INVISIBLE); } } } ``` 登录代码 ``` package com.example.administrator.diary; import android.content.Context; import android.content.Intent; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.Button; import android.widget.EditText; import android.widget.Toast; public class SendActivity extends AppCompatActivity { Button log; EditText onesend,twosend; static final String db_pass="passwordDB"; static final String tb_pass="passwordTB"; SQLiteDatabase db; String f_send; String s_send; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_send); //获取控件地址 log=findViewById(R.id.btn_log); onesend=findViewById(R.id.send); twosend=findViewById(R.id.resend); //获取密码 f_send = onesend.getText().toString(); s_send = twosend.getText().toString(); //打开或创建数据库 db=openOrCreateDatabase(db_pass, Context.MODE_PRIVATE,null); String createTable=" CREATE TABLE IF NOT EXISTS "+tb_pass+"(password VARCHAR (4))"; db.execSQL(createTable); //调用登录按钮方法 login(); } //对比输入密码和设置密码是否相同 private void check(){ //读取数据库中设置的密码 Cursor c=db.rawQuery("SELECT password FROM passwordTB",null); String p=c.getString(0); //判断是否相同 if (f_send.equals(p)&&s_send.equals(p)){ Toast.makeText(SendActivity.this,"登录成功",Toast.LENGTH_SHORT).show(); //判断相同后跳转到日记界面 Intent SD=new Intent(SendActivity.this,DiaryActivity.class); startActivity(SD); } //不同提醒用户 else Toast.makeText(SendActivity.this,"密码输入不对,请重新输入",Toast.LENGTH_SHORT).show(); } //登录按钮功能 private void login(){ log.setOnClickListener(new View.OnClickListener() { @Override //监听器 public void onClick(View v) { //调用检验密码方法 check(); } }); } } ``` 删除数据库代码 ``` package com.example.administrator.diary; import android.content.Context; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.os.Bundle; import android.support.v7.app.AppCompatActivity; import android.view.View; import android.widget.Button; import android.widget.Toast; public class DiaryActivity extends AppCompatActivity { private Button de; static final String db_pass="passwordDB"; static final String tb_pass="passwordTB"; SQLiteDatabase db; Cursor cursor; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_diary); //获取控件位置 de=findViewById(R.id.delete); //打开或创建数据库 db=openOrCreateDatabase(db_pass, Context.MODE_PRIVATE,null); String createTable=" CREATE TABLE IF NOT EXISTS "+tb_pass+"(password VARCHAR (4))"; db.execSQL(createTable); Ondelete(); } //删除密码按钮方法 private void Ondelete(){ de.setOnClickListener(new View.OnClickListener() { @Override //监听器 public void onClick(View v) { //删除数据表方法 String sql = "delete from passwordTB where id = 0"; db.execSQL(sql); Toast.makeText(DiaryActivity.this,"删除成功",Toast.LENGTH_SHORT).show(); } }); } } ``` 建表插表代码 ``` //打开或创建数据库 db=openOrCreateDatabase(db_pass, Context.MODE_PRIVATE,null); String createTable=" CREATE TABLE IF NOT EXISTS "+tb_pass+"(password VARCHAR (4))"; db.execSQL(createTable); compare(); zc(); } //添加新密码到数据库中 private void addData(String password){ ContentValues cv=new ContentValues(1); cv.put(" password",password); db.insert(tb_pass,null,cv); } ``` 闪退后报错 ``` 2020-02-04 17:22:49.787 15729-15729/com.example.administrator.diary E/SQLiteLog: (1) no such column: id 2020-02-04 17:22:49.787 15729-15729/com.example.administrator.diary D/AndroidRuntime: Shutting down VM 2020-02-04 17:22:49.788 15729-15729/com.example.administrator.diary E/AndroidRuntime: FATAL EXCEPTION: main Process: com.example.administrator.diary, PID: 15729 android.database.sqlite.SQLiteException: no such column: id (code 1 SQLITE_ERROR): , while compiling: delete from passwordTB where id = 0 at android.database.sqlite.SQLiteConnection.nativePrepareStatement(Native Method) at android.database.sqlite.SQLiteConnection.acquirePreparedStatement(SQLiteConnection.java:985) at android.database.sqlite.SQLiteConnection.prepare(SQLiteConnection.java:592) at android.database.sqlite.SQLiteSession.prepare(SQLiteSession.java:590) at android.database.sqlite.SQLiteProgram.<init>(SQLiteProgram.java:61) at android.database.sqlite.SQLiteStatement.<init>(SQLiteStatement.java:33) at android.database.sqlite.SQLiteDatabase.executeSql(SQLiteDatabase.java:1802) at android.database.sqlite.SQLiteDatabase.execSQL(SQLiteDatabase.java:1730) at com.example.administrator.diary.DiaryActivity$1.onClick(DiaryActivity.java:39) at android.view.View.performClick(View.java:6913) at android.view.View.performClickInternal(View.java:6890) at android.view.View.access$3200(View.java:792) at android.view.View$PerformClick.run(View.java:27158) at android.os.Handler.handleCallback(Handler.java:873) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:209) at android.app.ActivityThread.main(ActivityThread.java:7021) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:486) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:872) ``` 程序可以运行,但点击登录按钮或删除按钮后都会返回到mainactivity的界面,再按一次登录或删除就崩溃了,而且还没有达到删除数据库的目的,有大神知道是哪里出问题了吗?
查询页面,每次点击都会调取一次数据库,导致数据库重复调用
![图片说明](https://img-ask.csdn.net/upload/201911/28/1574938692_788093.png) 如图,现在的逻辑如下: ``` def dianji() 查询按钮.点击事件(duqu) 查询按钮.点击事件(show) (等于点击查询按钮的时候,同时执行两个方法) def luru() 写入数据库(用的sqlit3) def duqu() 读取数据库 def show() 从duqu函数里面调用数据,写进表格中 ``` 现在的问题就是,每次点击查询的时候,show和duqu都会执行一次,虽然数据库只有一组数据,但是每次点击,show这个函数都会把数据库里面仅有的一条数据重复读取,再次写入。 正确情况应该是我在艺人录入页面点击提交,然后点击查询才会多出来一条新数据,但是现在不管你点不点提交,数据库里面的数据总是给调一下并显示。(当然,只是显示,重启后写入的就没有了,但是也糟心啊) 现在不知道该咋整了。。。。新手,希望大佬可以文字描述一下。
Brilliant Programmers Show 代码程序编写
Problem Description   Hunan TV holds many talent shows every year, such as Happy Girls and Super Boys which attract the attention of the whole country. This year Hunan University held a new type of talent show called Brilliant Programmers. Millions of programmers had registered online and only top N most brilliant programmers got the opportunity to compete on site. The organizer had hold ten rounds of qualification contest and programmers were ranked by their total scores. The programmers who ranked after N were eliminated.   The final show continued for a very long time. Initially programmers were ranked by their qualification scores. The rule was special: A challenge may be happen between exactly two adjacent ranked programmers at any time and the lower ranked one tries to solve the other’s problem. If the challenger successfully solves this problem, their ranks exchange. Otherwise their ranks remain unchanged. It is guaranteed that a programmer never involved in two challenges at the same time. The top ranked programmer at last is the champion.   The show was over but… The hard disk which logs the whole progress was burned out. After data rescue, the number of successful challenges of each programmer was recovered but the final rank was disappeared forever. During the rescue some errors may occur, which lead to some wrong recovered numbers. Is the show possible at all? If it is possible, can you help to find the champion from the very limited information? Input   There are multiple test cases.   Each test case is described in two lines. The first line contains one integer N: the number of programmers. The second line contains a sequence of integers Ai that gives the number of successful challenges of the programmer initially ranked i-th. 1 <= N <= 106, 0 <= Ai <= 109   The input will finish with the end of file. Output   For each case the output contains only one line.   If it is an impossible show, output “Bad Rescue”. Otherwise if the champion is uniquely determined, output the initial rank of the champion. Output “Unknown” if the champion is not sure. Sample Input 2 0 1 3 0 1 5 3 0 1 1 Sample Output 2 Bad Rescue Unknown
数据库更新后,调用DataAdapter,DataSet和DataGridView显示数据库
``` public void ComonDataView_order_info() { try { DBConnect(); //连接数据库成功后的操作 //创建DataAdapter对象 SqlDataAdapter order_info_da = new SqlDataAdapter("select * from 订单详情", sqlCon); //创建数据集(也可以直接利用.NET的DataSet 数据适配器控件) DataSet order_info_ds = new DataSet(); order_info_da.AcceptChangesDuringFill = true; //Fill方法填充 order_info_da.Fill(order_info_ds); order_info_da.Update(order_info_ds); //将DataSet数据集绑定到DataGridView dataGridView1.AllowUserToAddRows = true; dataGridView1.DataSource = order_info_ds.Tables[0]; dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells; //绑定数据源 dataGridView1.DataSource = order_info_ds.Tables[0].DefaultView; } catch (SystemException ex) { //连接数据库失败提示 MessageBox.Show("错误:" + ex.Message, "错误提示", MessageBoxButtons.OKCancel, MessageBoxIcon.Information); } finally { //如果处于与数据库连接状态 if (sqlCon.State == ConnectionState.Open) { //关闭SQL连接 sqlCon.Close(); //释放所占用的资源 sqlCon.Dispose(); } } } ``` 如何实现每调用一次ComonDataView_order_info(),DataGridView就显示一次新的数据库内容? 为什么每插入一次数据,调用一次函数,但是只显示最后一次,其他时候都没有显示?
Druid连接SqlServer报错,为啥都连接了sqlserver还执行SHOW TABLES?
SpringBoot + Guns脚手架改成使用sqlserver,在最后时刻报错了,原因是sqlserver执行了mysql的语句SHOW TABLES,druid内部会执行这一句吗?mysql转sqlserver该如何实现? ``` 2019-12-09 15:04:10.196 INFO 3788 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/mgr/add]}" onto public cn.stylefeng.roses.core.reqres.response.ResponseData com.jsnjfz.manage.modular.system.controller.UserMgrController.add(com.jsnjfz.manage.modular.system.transfer.UserDto,org.springframework.validation.BindingResult) 2019-12-09 15:04:10.196 INFO 3788 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/mgr/delete]}" onto public cn.stylefeng.roses.core.reqres.response.ResponseData com.jsnjfz.manage.modular.system.controller.UserMgrController.delete(java.lang.Integer) 2019-12-09 15:04:10.196 INFO 3788 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/mgr/list]}" onto public java.lang.Object com.jsnjfz.manage.modular.system.controller.UserMgrController.list(java.lang.String,java.lang.String,java.lang.String,java.lang.Integer) 2019-12-09 15:04:10.196 INFO 3788 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/mgr/reset]}" onto public cn.stylefeng.roses.core.reqres.response.ResponseData com.jsnjfz.manage.modular.system.controller.UserMgrController.reset(java.lang.Integer) 2019-12-09 15:04:10.196 INFO 3788 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/mgr/user_info]}" onto public java.lang.String com.jsnjfz.manage.modular.system.controller.UserMgrController.userInfo(org.springframework.ui.Model) 2019-12-09 15:04:10.196 INFO 3788 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/mgr/freeze]}" onto public cn.stylefeng.roses.core.reqres.response.ResponseData com.jsnjfz.manage.modular.system.controller.UserMgrController.freeze(java.lang.Integer) 2019-12-09 15:04:10.196 INFO 3788 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/mgr/view/{userId}]}" onto public com.jsnjfz.manage.modular.system.model.User com.jsnjfz.manage.modular.system.controller.UserMgrController.view(java.lang.Integer) 2019-12-09 15:04:10.196 INFO 3788 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/mgr/setRole]}" onto public cn.stylefeng.roses.core.reqres.response.ResponseData com.jsnjfz.manage.modular.system.controller.UserMgrController.setRole(java.lang.Integer,java.lang.String) 2019-12-09 15:04:10.196 INFO 3788 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/mgr/user_chpwd]}" onto public java.lang.String com.jsnjfz.manage.modular.system.controller.UserMgrController.chPwd() 2019-12-09 15:04:10.196 INFO 3788 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/mgr/changePwd]}" onto public java.lang.Object com.jsnjfz.manage.modular.system.controller.UserMgrController.changePwd(java.lang.String,java.lang.String,java.lang.String) 2019-12-09 15:04:10.196 INFO 3788 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/mgr/edit]}" onto public cn.stylefeng.roses.core.reqres.response.ResponseData com.jsnjfz.manage.modular.system.controller.UserMgrController.edit(com.jsnjfz.manage.modular.system.transfer.UserDto,org.springframework.validation.BindingResult) throws javax.naming.NoPermissionException 2019-12-09 15:04:10.212 INFO 3788 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/mgr/role_assign/{userId}]}" onto public java.lang.String com.jsnjfz.manage.modular.system.controller.UserMgrController.roleAssign(java.lang.Integer,org.springframework.ui.Model) 2019-12-09 15:04:10.212 INFO 3788 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/mgr/user_add]}" onto public java.lang.String com.jsnjfz.manage.modular.system.controller.UserMgrController.addView() 2019-12-09 15:04:10.212 INFO 3788 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/mgr/user_edit/{userId}]}" onto public java.lang.String com.jsnjfz.manage.modular.system.controller.UserMgrController.userEdit(java.lang.Integer,org.springframework.ui.Model) 2019-12-09 15:04:10.212 INFO 3788 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/mgr/upload],methods=[POST]}" onto public java.lang.String com.jsnjfz.manage.modular.system.controller.UserMgrController.upload(org.springframework.web.multipart.MultipartFile) 2019-12-09 15:04:10.212 INFO 3788 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/mgr/unfreeze]}" onto public cn.stylefeng.roses.core.reqres.response.ResponseData com.jsnjfz.manage.modular.system.controller.UserMgrController.unfreeze(java.lang.Integer) 2019-12-09 15:04:10.212 INFO 3788 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController.error(javax.servlet.http.HttpServletRequest) 2019-12-09 15:04:10.212 INFO 3788 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse) 2019-12-09 15:04:10.212 INFO 3788 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/code/generate],methods=[POST]}" onto public java.lang.Object cn.stylefeng.guns.generator.modular.controller.CodeController.generate(cn.stylefeng.guns.generator.executor.model.GenQo) 2019-12-09 15:04:10.212 INFO 3788 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/code]}" onto public java.lang.String cn.stylefeng.guns.generator.modular.controller.CodeController.blackboard(org.springframework.ui.Model) 2019-12-09 15:04:10.353 INFO 3788 --- [ restartedMain] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler] 2019-12-09 15:04:10.353 INFO 3788 --- [ restartedMain] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/static/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler] 2019-12-09 15:04:10.353 INFO 3788 --- [ restartedMain] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/swagger-ui.html] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler] 2019-12-09 15:04:10.415 INFO 3788 --- [ restartedMain] .m.m.a.ExceptionHandlerExceptionResolver : Detected @ExceptionHandler methods in globalExceptionHandler 2019-12-09 15:04:10.415 INFO 3788 --- [ restartedMain] .m.m.a.ExceptionHandlerExceptionResolver : Detected @ExceptionHandler methods in defaultControllerExceptionHandler 2019-12-09 15:04:11.071 INFO 3788 --- [ restartedMain] o.s.b.d.a.OptionalLiveReloadServer : LiveReload server is running on port 35729 2019-12-09 15:04:11.114 INFO 3788 --- [ restartedMain] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup 2019-12-09 15:04:11.161 INFO 3788 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8001 (http) with context path '' 2019-12-09 15:04:11.161 INFO 3788 --- [ restartedMain] c.jsnjfz.manage.WebstackGunsApplication : Started WebstackGunsApplication in 71.82 seconds (JVM running for 72.932) JDBC Connection [com.alibaba.druid.proxy.jdbc.ConnectionProxyImpl@7a595887] will not be managed by Spring 2019-12-09 15:08:40.389 ERROR 3788 --- [ restartedMain] o.s.boot.SpringApplication : Application run failed com.baomidou.mybatisplus.exceptions.MybatisPlusException: java.lang.reflect.InvocationTargetException at com.baomidou.mybatisplus.MybatisSqlSessionTemplate$SqlSessionInterceptor.invoke(MybatisSqlSessionTemplate.java:405) at com.sun.proxy.$Proxy86.selectList(Unknown Source) at com.baomidou.mybatisplus.MybatisSqlSessionTemplate.selectList(MybatisSqlSessionTemplate.java:195) at com.baomidou.mybatisplus.mapper.SqlRunner.selectObjs(SqlRunner.java:140) at cn.stylefeng.roses.core.db.DbInitializer.initTable(DbInitializer.java:97) at cn.stylefeng.roses.core.db.DbInitializer.dbInit(DbInitializer.java:71) at cn.stylefeng.roses.core.db.listener.InitTableListener.onApplicationEvent(InitTableListener.java:42) at cn.stylefeng.roses.core.db.listener.InitTableListener.onApplicationEvent(InitTableListener.java:32) at org.springframework.context.event.SimpleApplicationEventMulticaster.doInvokeListener(SimpleApplicationEventMulticaster.java:172) at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:165) at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:139) at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:400) at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:354) at org.springframework.boot.context.event.EventPublishingRunListener.running(EventPublishingRunListener.java:103) at org.springframework.boot.SpringApplicationRunListeners.running(SpringApplicationRunListeners.java:78) at org.springframework.boot.SpringApplication.run(SpringApplication.java:343) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1255) at org.springframework.boot.SpringApplication.run(SpringApplication.java:1243) at com.jsnjfz.manage.WebstackGunsApplication.main(WebstackGunsApplication.java:36) 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.springframework.boot.devtools.restart.RestartLauncher.run(RestartLauncher.java:49) Caused by: java.lang.reflect.InvocationTargetException: null 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 com.baomidou.mybatisplus.MybatisSqlSessionTemplate$SqlSessionInterceptor.invoke(MybatisSqlSessionTemplate.java:401) ... 23 common frames omitted Caused by: org.apache.ibatis.exceptions.PersistenceException: ### Error querying database. Cause: java.sql.SQLException: sql injection violation, syntax error: syntax error, error in :'SHOW TABLES', expect IDENTIFIER, actual IDENTIFIER pos 4, line 1, column 1, token IDENTIFIER SHOW : SHOW TABLES ### The error may involve com.baomidou.mybatisplus.mapper.SqlRunner.SelectObjs ### The error occurred while executing a query ### SQL: SHOW TABLES ### Cause: java.sql.SQLException: sql injection violation, syntax error: syntax error, error in :'SHOW TABLES', expect IDENTIFIER, actual IDENTIFIER pos 4, line 1, column 1, token IDENTIFIER SHOW : SHOW TABLES at org.apache.ibatis.exceptions.ExceptionFactory.wrapException(ExceptionFactory.java:30) at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:150) at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:141) ... 28 common frames omitted Caused by: java.sql.SQLException: sql injection violation, syntax error: syntax error, error in :'SHOW TABLES', expect IDENTIFIER, actual IDENTIFIER pos 4, line 1, column 1, token IDENTIFIER SHOW : SHOW TABLES at com.alibaba.druid.wall.WallFilter.checkInternal(WallFilter.java:798) at com.alibaba.druid.wall.WallFilter.connection_prepareStatement(WallFilter.java:251) at com.alibaba.druid.filter.FilterChainImpl.connection_prepareStatement(FilterChainImpl.java:568) at com.alibaba.druid.proxy.jdbc.ConnectionProxyImpl.prepareStatement(ConnectionProxyImpl.java:342) at com.alibaba.druid.pool.DruidPooledConnection.prepareStatement(DruidPooledConnection.java:349) at org.apache.ibatis.executor.statement.PreparedStatementHandler.instantiateStatement(PreparedStatementHandler.java:87) at org.apache.ibatis.executor.statement.BaseStatementHandler.prepare(BaseStatementHandler.java:88) at org.apache.ibatis.executor.statement.RoutingStatementHandler.prepare(RoutingStatementHandler.java:59) 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.apache.ibatis.plugin.Invocation.proceed(Invocation.java:49) at com.baomidou.mybatisplus.plugins.PaginationInterceptor.intercept(PaginationInterceptor.java:112) at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:61) at com.sun.proxy.$Proxy114.prepare(Unknown Source) 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.apache.ibatis.plugin.Invocation.proceed(Invocation.java:49) at cn.stylefeng.roses.core.datascope.DataScopeInterceptor.intercept(DataScopeInterceptor.java:46) at org.apache.ibatis.plugin.Plugin.invoke(Plugin.java:61) at com.sun.proxy.$Proxy114.prepare(Unknown Source) at org.apache.ibatis.executor.SimpleExecutor.prepareStatement(SimpleExecutor.java:85) at org.apache.ibatis.executor.SimpleExecutor.doQuery(SimpleExecutor.java:62) at org.apache.ibatis.executor.BaseExecutor.queryFromDatabase(BaseExecutor.java:326) at org.apache.ibatis.executor.BaseExecutor.query(BaseExecutor.java:156) at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:109) at org.apache.ibatis.executor.CachingExecutor.query(CachingExecutor.java:83) 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.apache.ibatis.plugin.Plugin.invoke(Plugin.java:63) at com.sun.proxy.$Proxy113.query(Unknown Source) at org.apache.ibatis.session.defaults.DefaultSqlSession.selectList(DefaultSqlSession.java:148) ... 29 common frames omitted Caused by: com.alibaba.druid.sql.parser.ParserException: syntax error, error in :'SHOW TABLES', expect IDENTIFIER, actual IDENTIFIER pos 4, line 1, column 1, token IDENTIFIER SHOW at com.alibaba.druid.sql.parser.SQLParser.printError(SQLParser.java:284) at com.alibaba.druid.sql.parser.SQLStatementParser.parseStatementList(SQLStatementParser.java:426) at com.alibaba.druid.sql.parser.SQLStatementParser.parseStatementList(SQLStatementParser.java:83) at com.alibaba.druid.wall.WallProvider.checkInternal(WallProvider.java:624) at com.alibaba.druid.wall.WallProvider.check(WallProvider.java:578) at com.alibaba.druid.wall.WallFilter.checkInternal(WallFilter.java:785) ... 65 common frames omitted 2019-12-09 15:08:40.394 INFO 3788 --- [ restartedMain] ConfigServletWebServerApplicationContext : Closing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@e8fcbe7: startup date [Mon Dec 09 15:02:59 CST 2019]; root of context hierarchy 2019-12-09 15:08:40.395 INFO 3788 --- [ restartedMain] o.s.j.e.a.AnnotationMBeanExporter : Unregistering JMX-exposed beans on shutdown 2019-12-09 15:08:40.395 INFO 3788 --- [ restartedMain] com.alibaba.druid.pool.DruidDataSource : {dataSource-1} closed 2019-12-09 15:08:40.395 INFO 3788 --- [ restartedMain] o.s.c.ehcache.EhCacheManagerFactoryBean : Shutting down EhCache CacheManager ```
高分悬赏提问,Java语言程序来编写,怎么统计输入的字符串中每个字符出现的频率百分比?
高分悬赏提问,Java语言程序来编写,怎么统计输入的字符串中每个字符出现的频率百分比? show me your code please
请大佬指点迷津,请ocx中启动另一个进程作为子窗口,在子窗口中切换中英文输入模式(CTRL + SPACE),不起作用?
1.问题描述:MFC应用程序中,嵌入一个ocx控件,在控件中启动另一个进程,并作为子窗口;在子窗口中切换中英文模式,不起作用! 2.ocx控件中的Oncreate函数中,启动进程代码: ``` if (COleControl::OnCreate(lpCreateStruct) == -1) return -1; m_hWndMain = GetSafeHwnd(); // 启动进程 ZeroMemory(&m_sei, sizeof(SHELLEXECUTEINFO));//使用前最好清空 m_sei.cbSize = sizeof(SHELLEXECUTEINFO);//管理员权限执行cmd,最基本的使用与 ShellExecute 类似 m_sei.fMask = SEE_MASK_NOCLOSEPROCESS; m_sei.lpVerb = TEXT("runas"); m_sei.lpFile = m_strAllPath; m_sei.lpDirectory = m_strAllPath; m_sei.lpParameters = GetVisitPara(); // 构造CEF需要访问的参数 m_sei.nShow = SW_HIDE; if(!ShellExecuteEx(&m_sei)) { AfxMessageBox(_T("初始化失败,启动MxvWebClient失败,请确认安装盘是否正确!")); return FALSE; } m_nPid = GetProcessId(m_sei.hProcess); GetWindowRect(&g_winRect); ``` 通过进程的名称找到句柄m_hWndFind,并设置父子关系;相关代码: ``` ::SetParent(m_hWndFind, m_hWndMain); long nNewType = GetWindowLong(m_hWndFind, GWL_STYLE) &~WS_POPUP &~WS_BORDER & ~WS_CAPTION & ~WS_THICKFRAME /*| WS_CHILD*/ ; ::SetWindowLong(m_hWndFind, GWL_STYLE, nNewType); //先改变大小,再发送消息 ::MoveWindow(m_hWndFind, 0, 0, g_winRect.Width(), g_winRect.Height(), FALSE); ::ShowWindow(m_hWndFind, SW_SHOW); ``` 3.在ocx控件中的进程的输入框中,切换中英文输入模式,按键CTRL+SPACE,不能切换
Boomerang 的计算
Problem Description Australia original inhabitants used to hunt by a weapon called "boomerang". When a boomerang is thrown out, it rotates, hits the target, and then return to the thrower. ZXX is the best boomerang thrower in Australia. His skill is so wonderful that his boomerang can do any rotation he wants in the air. He travels around to show his skill and make money. One of his classic show is to throw out the boomerang, and it will pass through between two very close pillars. Of course the boomerang must fly parallel to the ground. If not so, everybody can do it. ZXX always puts the two pillars as close as possible to show his skill, but he wants you to figure out the smallest distance between two pillars which allows his boomerang to go through. To simplify the problem, you can consider the boomerang as a simple polygon in a 2D plane, and each of its edge is parallel to x-axis or y-axis. Each interior angle is either 90 degrees or 270 degrees. Two pillars can be considered as two points. This illustration simply shows how a boomerang passes through two pillars: Input The input consists of several test cases (less than 500).Each test case begins with an integer n (4<=n<=8), representing the number of vertices of a polygon. Next n lines give coordinates of n vertices in order. Each line contains two integers xi, yi(|xi|, |yi|<=100000). For each test case there are no two vertices is in the same place. Input ends with n=0. Output For each test case, print a single real number w, representing the minimum distance to ensure the boomerang can pass through. The answer should be rounded to 2 digits after the decimal point. Sample Input 6 0 0 100 0 100 1 1 1 1 100 0 100 8 0 0 30 0 30 30 20 30 20 10 10 10 10 30 0 30 0 Sample Output 1.41 14.14
vue中双重循环与复杂对象的解析问题
vue中双重循环复杂对象过程中找不到深层对象属性,并且不会显示数据,加上 ``` this.$forceUpdate(); ``` 可以正常显示,但是还是会报错找不到对应的属性 * 错误截图 ![错误信息](https://img-ask.csdn.net/upload/202002/08/1581153946_722751.png) * 完整代码 ```vue <template> <div> <el-row v-for="(group,groupIndex) in groups" v-bind:groupIndex="group.index" :key="group.gid" type="text"> <el-button type="text" @click="isShow(groupIndex)">{{group.name}}</el-button> <div v-if="group.show"> <div class="friend" v-for="(friendInfo) in groups[groupIndex].friends" :key="friendInfo.fid"> <el-image style="width: 100px; height: 100px" :src="friendInfo.userInfo.icon"></el-image> {{friendInfo.comments}} <span> {{friendInfo.userInfo.sign}}</span> </div> </div> </el-row> <br/> </div> </template> <script> export default { name: 'FriendList', methods: { isShow: function (index) { if (!this.groups[index].show) { this.getFriends(this.groups[index].gid); } this.groups[index].show = !this.groups[index].show; }, getUserInfo: function (uid,groupIndex,friendsIndex) { console.log("getUserInfo"); this.$axios.get('http://192.168.43.3:9000/user/id/' + uid).then(res => { this.groups[groupIndex].friends[friendsIndex].userInfo= res.data.data; this.$forceUpdate(); console.log(this.groups[groupIndex].friends[friendsIndex].userInfo.icon); }).catch(err => { console.log(err); this.$alert(res.data.message, '通知'); }) }, checkLogin: function () { if (this.uid == null) { this.$alert('很抱歉,您还没有登录!', '通知'); window.location = 'http://127.0.0.1:8010/login'; } }, getGroups: function () { this.$axios.get('http://192.168.43.3:9004/group/user/' + this.uid).then((res => { if (res.data.flag) { this.groups = res.data.data; } else { this.$alert(res.data.message, '通知'); } })).catch(error => { console.log(error.message); this.$alert('网络错误,请稍后再试!', '通知'); }); }, getFriends: function (groupId) { this.$axios.get('http://192.168.43.3:9004/friend/group/' + groupId).then((res => { if (res.data.flag) { for (let i = 0; i < this.groups.length; i++) { if (groupId === this.groups[i].gid) { this.groups[i].friends = res.data.data; this.$forceUpdate(); let len = this.groups[i].friends.length; for (let j = 0; j < len; j++) { this.groups[i].friends[j].userInfo = this.getUserInfo(this.groups[i].friends[j].friend,i,j); } } } } else { this.$alert(res.data.message, '通知'); } })).catch(error => { console.log(error.message); this.$alert('网络错误,请稍后再试!', '通知'); }); } }, data: function () { return { uid: JSON.parse(sessionStorage.userInfo).uid, groups: [{ 'show': false, 'gid': '', 'userId': '', index: '', 'name': '', 'createTime': '', friends: [{ 'fid': '', 'user': '', 'friend': '', 'groupId': '', 'createTime': '', index:'', 'comments': '', userInfo: { 'uid': '', 'nickname': '', 'icon': '', 'sign': '' } }] }] } }, mounted() { this.checkLogin(); this.getGroups(); } } </script> ```
【小白求助】安卓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; } } ```
Play the Dice 骰子的问题
Problem Description There is a dice with n sides, which are numbered from 1,2,...,n and have the equal possibility to show up when one rolls a dice. Each side has an integer ai on it. Now here is a game that you can roll this dice once, if the i-th side is up, you will get ai yuan. What's more, some sids of this dice are colored with a special different color. If you turn this side up, you will get once more chance to roll the dice. When you roll the dice for the second time, you still have the opportunity to win money and rolling chance. Now you need to calculate the expectations of money that we get after playing the game once. Input Input consists of multiple cases. Each case includes two lines. The first line is an integer n (2<=n<=200), following with n integers ai(0<=ai<200) The second line is an integer m (0<=m<=n), following with m integers bi(1<=bi<=n), which are the numbers of the special sides to get another more chance. Output Just a real number which is the expectations of the money one can get, rounded to exact two digits. If you can get unlimited money, print inf. Sample Input 6 1 2 3 4 5 6 0 4 0 0 0 0 1 3 Sample Output 3.50 0.00
Proving Equivalences 等价的问题
Problem Description Consider the following exercise, found in a generic linear algebra textbook. Let A be an n × n matrix. Prove that the following statements are equivalent: 1. A is invertible. 2. Ax = b has exactly one solution for every n × 1 matrix b. 3. Ax = b is consistent for every n × 1 matrix b. 4. Ax = 0 has only the trivial solution x = 0. The typical way to solve such an exercise is to show a series of implications. For instance, one can proceed by showing that (a) implies (b), that (b) implies (c), that (c) implies (d), and finally that (d) implies (a). These four implications show that the four statements are equivalent. Another way would be to show that (a) is equivalent to (b) (by proving that (a) implies (b) and that (b) implies (a)), that (b) is equivalent to (c), and that (c) is equivalent to (d). However, this way requires proving six implications, which is clearly a lot more work than just proving four implications! I have been given some similar tasks, and have already started proving some implications. Now I wonder, how many more implications do I have to prove? Can you help me determine this? Input On the first line one positive number: the number of testcases, at most 100. After that per testcase: * One line containing two integers n (1 ≤ n ≤ 20000) and m (0 ≤ m ≤ 50000): the number of statements and the number of implications that have already been proved. * m lines with two integers s1 and s2 (1 ≤ s1, s2 ≤ n and s1 ≠ s2) each, indicating that it has been proved that statement s1 implies statement s2. Output Per testcase: * One line with the minimum number of additional implications that need to be proved in order to prove that all statements are equivalent. Sample Input 2 4 0 3 2 1 2 1 3 Sample Output 4 2
keil C51 数码管的动态显示 延时问题
我在写数码管动态显示的时候发现意义相同的两个代码写出来显示的结果却不同,代码如下: ``` void display_SEG(unsigned int t) { Y_SEG_show(1, 2); while(t--); Y_SEG_show(2, 0); while(t--); Y_SEG_show(3, 1); while(t--); Y_SEG_show(4, 8); while(t--); Y_SEG_show(5, 16); while(t--); Y_SEG_show(6, 16); while(t--); Y_SEG_show(7, i/10); while(t--); Y_SEG_show(8, i%10); while(t--); } ``` t=500;上面这个运行起来延时时间明显过长,从而达不到余辉效应。 ``` void delay_SEG(unsigned char t) { while(t--); } void display_SEG() { Y_SEG_show(1, 2); delay_SEG(500); Y_SEG_show(2, 0); delay_SEG(500); Y_SEG_show(3, 1); delay_SEG(500); Y_SEG_show(4, 8); delay_SEG(500); Y_SEG_show(5, 16); delay_SEG(500); Y_SEG_show(6, 16); delay_SEG(500); Y_SEG_show(7, i/10); delay_SEG(500); Y_SEG_show(8, i%10); delay_SEG(500); } ``` 当定义一个延时函数放进去时,却可以达到效果,可用的不都是while(500--)的延迟吗,为什么会有这个差别。求解答
eclipse连接数据库出错
问题如下: eclipse能加载数据库驱动,却不能连接 ![图片说明](https://img-ask.csdn.net/upload/201910/31/1572530581_866255.png) eclipse、mysql环境配置都没问题 数据库版本是8.0以上 驱动程序mysql-connector-java-8.0.16放的位置也没错 mysql可以用控制台操作 mysql服务已启动 用户名是root 密码123456 ``` C:\Users\HP>mysql -uroot -p Enter password: ****** Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 23 Server version: 8.0.17 MySQL Community Server - GPL ``` 创建好了database student ``` mysql> show databases; +--------------------+ | Database | +--------------------+ | information_schema | | mysql | | performance_schema | | register | | student | | sys | +--------------------+ 6 rows in set (0.00 sec) ``` 搞了半天头都大了,这块搞不定下面的javaweb根本没法学,求大佬指导。
谁能帮我解释下这段mysql是做什么的?怎么查询数据库名为[ShFTZNQI]的相关跟踪语句?为什么这段查询会很慢
```mysql -- 临时开启慢查询日志 show variables like '%quer%'; set global slow_query_log=1; -- 临时开启慢查询时间 show variables like 'long_query_time'; set global long_query_time=1; -- 设置慢查询存储的方式 show variables like 'log_output'; set global log_output = 'FILE'; set global log_output = 'TABLE'; -- 设置查看日志 SELECT * FROM mysql.slow_log; SELECT * FROM mysql.general_log; select sleep(30); explain select ID from new_table; 清空sql日志 SET GLOBAL slow_query_log = 'OFF'; ALTER TABLE mysql.slow_log RENAME mysql.slow_log_drop; CREATE TABLE mysql.slow_log LIKE mysql.slow_log_drop; SET GLOBAL slow_query_log = 'ON'; DROP TABLE mysql.slow_log_drop; SELECT * FROM mysql.slow_log order by start_time desc ```
从模块中调用的函数中有用到globals(),如何获取主文件中的全局变量值?
比如说模块为: m1.py: ``` class a: @classmethod def show_key(cls): print(globals().keys()) ``` main.py ``` from m1 import a class b(a): pass def main(): a.show_key() print(globals().keys()) if __name__ == '__main__': main() ``` 好像a.show_key( ) 中就只能显示a,但print(globals().keys())中可以显示啊a, b. 想请问,模块(m1)中怎样写,才能达到:main.py里调用该函数时,该函数能吧整个正在运行的程序中(包括所有其他被import到main.oy里面的模块)所有的全局变量的keys都打印出来呀?
求查改代码,数据库和vs2010的
我从网上复制了一个增删查改的例子,但是只有增和删。没有查和改,, 我设置第5个button,求大神写下里面的改代码。, 另外查代码例子说(// 查询数据还是运用SQL语句较好。使用 SqlCommand对象即可) 什么意思?,是说查询只能在数据库里面查,VS2010不能查询吗? 以下是网上的代码,可以运行。。 using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Data.SqlClient; namespace TEXT6 { public partial class Form1 : Form { SqlConnection con = new SqlConnection("Server=.;Database=student1;integrated security=SSPI");//创建一个数据库连接,·代表服务器在本地 SqlDataAdapter da;//创建一个数据容器 DataSet ds;//建一个接受数据库返回结果集的容器 SqlCommandBuilder cb; string tablename = "student1"; public Form1() { InitializeComponent(); } private void button1_Click(object sender, EventArgs e) { da = new SqlDataAdapter("select * from " + tablename, con); ds = new DataSet(); da.Fill(ds, tablename); dataGridView1.DataSource = ds.Tables[tablename]; } private void button2_Click(object sender, EventArgs e) { DataRow dr = ds.Tables[tablename].NewRow(); dr[0] = textBox1.Text;//给第一个字段赋值 dr[1] = textBox2.Text;//给第二个字段赋值 dr[2] = textBox3.Text; dr[3] = textBox4.Text; ds.Tables[tablename].Rows.Add(dr);//将新行添加到表中 // 调用提交更新程序 } private void button3_Click(object sender, EventArgs e) { string message = "是否真的要删除该行,并不可恢复?"; string caption = "警告提示"; DialogResult result; int w = dataGridView1.CurrentCell.RowIndex; //当前鼠标点击的所在行 result = MessageBox.Show(this, message, caption, MessageBoxButtons.YesNo, MessageBoxIcon.Warning); if (result == DialogResult.Yes) { DataRowCollection dr = ds.Tables[tablename].Rows; dr[w].Delete(); } } private void button4_Click(object sender, EventArgs e) { SqlCommandBuilder cb = new SqlCommandBuilder(da); da.Update(ds, tablename); MessageBox.Show("更新成功!"); ds.Tables[tablename].AcceptChanges(); } private void textBox1_TextChanged(object sender, EventArgs e) { } private void textBox2_TextChanged(object sender, EventArgs e) { } private void button5_Click(object sender, EventArgs e) { } } } button5是我另外拖进去的,但是我不会写代码,,改的代码怎么写,,大神求教!!!
找出一个整形数组中的元素的最大值
程序没有编译错误,能够正常运行,但是输出结果与题目要求不符合,代码检查过很多遍,没有错误。 运行时,我用空格,逗号,tab来隔开各个输入的数组元素,但是无论输入什么,最后的结果都是1,想请大家帮我看看,感激不尽 ```#include<iostream> using namespace std; class Array_max { public: void set_value(); void max_value(); void show_value(); private: int array[10]; int max; }; void Array_max::set_value() { int i; for(i=0;i<10;i++); cin>>array[i]; } void Array_max::max_value() { int i; max=array[0]; for(i=0;i<10;i++); { if (array[i]>max ) max=array[i]; } } void Array_max::show_value() { cout<<"max="<<max<<endl; } int main() { Array_max arraymax1; arraymax1.set_value(); arraymax1.max_value(); arraymax1.show_value(); return 0; } 旁边附上运行结果 ```![图片说明](https://img-ask.csdn.net/upload/202002/01/1580564262_877665.png) 请大家有空帮我看看,谢谢
这个利用sqlite写的数据库为什么退出应用后再进去数据库就无法找到了啊
package com.sample.Sample_8_4; import android.app.Activity; import android.app.AlertDialog; import android.content.ContentValues; import android.content.DialogInterface; import android.database.Cursor; import android.database.sqlite.SQLiteDatabase; import android.os.Bundle; import android.view.View; import android.view.View.OnClickListener; import android.widget.Button; import android.widget.Toast; public class Sample_8_4 extends Activity { private Button baseButton; private Button tableButton; private Button btn_sqlmod, btn_cvmod, btn_qur; private final String dbName = "mydb"; private final String tableName = "users"; private SQLiteDatabase db = null; private int i = 1; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); this.setContentView(R.layout.main); baseButton = (Button) findViewById(R.id.base); // 实例化Button对象 baseButton.setOnClickListener(new OnClickListener() { // 为Button对象添加监听 public void onClick(View v) { db = openOrCreateDatabase(dbName, MODE_PRIVATE, null); // 创建名为“mydb”的数据库 db.endTransaction(); Toast.makeText(getApplicationContext(), "创建数据库成功", 1000) .show(); } }); tableButton = (Button) findViewById(R.id.table); // 实例化Button对象 tableButton.setOnClickListener(new OnClickListener() { // 为Button对象添加监听 public void onClick(View v) { if (db != null) { creatTable(); // 开始创建数据库表 } else { Toast.makeText(getApplicationContext(), "没有数据库", 1000).show(); } } }); btn_sqlmod = (Button) findViewById(R.id.sql_mod); btn_sqlmod.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub if (db != null) { sql_executeData(); } else { Toast.makeText(getApplicationContext(), "没有数据库", 1000) .show(); } } }); btn_cvmod = (Button) findViewById(R.id.cv_mod); btn_cvmod.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub if (db != null) { cv_executeData(); } else { Toast.makeText(getApplicationContext(), "没有数据库", 1000) .show(); } } }); btn_qur = (Button) findViewById(R.id.que); btn_qur.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { // TODO Auto-generated method stub if (db != null) { queryData(); } else { Toast.makeText(getApplicationContext(), "没有数据库", 1000) .show(); } } }); } public void creatTable() { // 创建表的SQL语句,创建一个名为users的表,该表有id,uname和pwd三个字段 String sql = "CREATE TABLE IF NOT EXISTS " + tableName + " (id INTEGER PRIMARY KEY AUTOINCREMENT, uname VARCHAR(50), pwd VARCHAR(50));"; db.execSQL(sql); // 执行sql语句 db.endTransaction(); // 查询sqlite_master表中类型为table的记录的name字段 Cursor cursor = db.query("sqlite_master", new String[] { "name" }, "type = ?", new String[] { "table" }, null, null, null, null); String tables = ""; if (cursor.getCount() != 0) { // 判断查询结果的条数是否为0 cursor.moveToFirst(); // 游标指向第一条记录 for (int i = 0; i < cursor.getCount(); i += 1) { tables = tables + cursor.getString(0) + " "; // 累加字符串 cursor.moveToNext(); // 游标下移 } } // 把累加的结果显示在一个信息框中 new AlertDialog.Builder(Sample_8_4.this).setTitle("Message") .setMessage(tables) .setNegativeButton("确定", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { } }).show(); } public void sql_executeData() { String sql; for (; i < 4; i++) { sql = "insert into " + tableName + " values ('" + i + "','a','123456')"; // 添加一条记录 db.execSQL(sql); db.endTransaction(); } sql = "update " + tableName + " set pwd='654321' where id='1'"; // 修改一条记录 db.execSQL(sql); db.endTransaction(); sql = "delete from " + tableName + " where id='2'"; // 删除一条记录 db.execSQL(sql); db.endTransaction(); Toast.makeText(getApplicationContext(), "使用SQL语句修改数据成功", 1000).show(); } public void cv_executeData() { ContentValues cv = new ContentValues(); // 实例化ContentValues对象 cv.put("uname", "b"); // 插入字段值 cv.put("pwd", "987654"); // 插入字段值 db.insert(tableName, null, cv); // 执行insert方法 db.insert(tableName, null, cv); // 执行insert方法 db.insert(tableName, null, cv); // 执行insert方法 cv = new ContentValues(); // 实例化ContentValues对象 cv.put("pwd", "456789"); // 插入字段值 db.update(tableName, cv, "id=?", new String[] { "4" }); // 执行update方法 db.delete(tableName, "id=?", new String[] { "5" }); // 执行delete操作 Toast.makeText(getApplicationContext(), "使用Android语句修改数据成功", 1000) .show(); } public void queryData() { Cursor cursor = db.query(tableName, null, null, null, null, null, null, null); // 执行query操作获得Cursor对象 String str = ""; if (cursor.getCount() != 0) { // 判断返回的记录条数 cursor.moveToFirst(); // 游标指向第一条记录 for (int i = 0; i < cursor.getCount(); i += 1) { str = str + cursor.getString(0) + " " + cursor.getString(1) + " " + cursor.getString(2) + "\n"; // 获取一条记录的每个字段的值 cursor.moveToNext(); // 游标指向下一条记录 } } // 在信息框上显示所有记录信息 new AlertDialog.Builder(Sample_8_4.this).setTitle("Message") .setMessage(str) .setNegativeButton("确定", new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { } }).show(); } }
130 个相见恨晚的超实用网站,一次性分享出来
相见恨晚的超实用网站 持续更新中。。。
我花了一夜用数据结构给女朋友写个H5走迷宫游戏
起因 又到深夜了,我按照以往在csdn和公众号写着数据结构!这占用了我大量的时间!我的超越妹妹严重缺乏陪伴而 怨气满满! 而女朋友时常埋怨,认为数据结构这么抽象难懂的东西没啥作用,常会问道:天天写这玩意,有啥作用。而我答道:能干事情多了,比如写个迷宫小游戏啥的! 当我码完字准备睡觉时:写不好别睡觉! 分析 如果用数据结构与算法造出东西来呢? ...
对计算机专业来说学历真的重要吗?
我本科学校是渣渣二本,研究生学校是985,现在毕业五年,校招笔试、面试,社招面试参加了两年了,就我个人的经历来说下这个问题。 这篇文章很长,但绝对是精华,相信我,读完以后,你会知道学历不好的解决方案,记得帮我点赞哦。 先说结论,无论赞不赞同,它本质就是这样:对于技术类工作而言,学历五年以内非常重要,但有办法弥补。五年以后,不重要。 目录: 张雪峰讲述的事实 我看到的事实 为什么会这样 ...
字节跳动视频编解码面经
三四月份投了字节跳动的实习(图形图像岗位),然后hr打电话过来问了一下会不会opengl,c++,shador,当时只会一点c++,其他两个都不会,也就直接被拒了。 七月初内推了字节跳动的提前批,因为内推没有具体的岗位,hr又打电话问要不要考虑一下图形图像岗,我说实习投过这个岗位不合适,不会opengl和shador,然后hr就说秋招更看重基础。我当时想着能进去就不错了,管他哪个岗呢,就同意了面试...
win10系统安装教程(U盘PE+UEFI安装)
一、准备工作 u盘,电脑一台,win10原版镜像(msdn官网) 二、下载wepe工具箱 极力推荐微pe(微pe官方下载) 下载64位的win10 pe,使用工具箱制作启动U盘打开软件, 选择安装到U盘(按照操作无需更改) 三、重启进入pe系统 1、关机后,将U盘插入电脑 2、按下电源后,按住F12进入启动项选择(技嘉主板是F12) 选择需要启...
程序员必须掌握的核心算法有哪些?
由于我之前一直强调数据结构以及算法学习的重要性,所以就有一些读者经常问我,数据结构与算法应该要学习到哪个程度呢?,说实话,这个问题我不知道要怎么回答你,主要取决于你想学习到哪些程度,不过针对这个问题,我稍微总结一下我学过的算法知识点,以及我觉得值得学习的算法。这些算法与数据结构的学习大多数是零散的,并没有一本把他们全部覆盖的书籍。下面是我觉得值得学习的一些算法以及数据结构,当然,我也会整理一些看过...
Python——画一棵漂亮的樱花树(不同种樱花+玫瑰+圣诞树喔)
最近翻到一篇知乎,上面有不少用Python(大多是turtle库)绘制的树图,感觉很漂亮,我整理了一下,挑了一些我觉得不错的代码分享给大家(这些我都测试过,确实可以生成) one 樱花树 动态生成樱花 效果图(这个是动态的): 实现代码 import turtle as T import random import time # 画樱花的躯干(60,t) def Tree(branch, ...
大学四年自学走来,这些私藏的实用工具/学习网站我贡献出来了
大学四年,看课本是不可能一直看课本的了,对于学习,特别是自学,善于搜索网上的一些资源来辅助,还是非常有必要的,下面我就把这几年私藏的各种资源,网站贡献出来给你们。主要有:电子书搜索、实用工具、在线视频学习网站、非视频学习网站、软件下载、面试/求职必备网站。 注意:文中提到的所有资源,文末我都给你整理好了,你们只管拿去,如果觉得不错,转发、分享就是最大的支持了。 一、电子书搜索 对于大部分程序员...
《奇巧淫技》系列-python!!每天早上八点自动发送天气预报邮件到QQ邮箱
将代码部署服务器,每日早上定时获取到天气数据,并发送到邮箱。 也可以说是一个小人工智障。 思路可以运用在不同地方,主要介绍的是思路。
致 Python 初学者
欢迎来到“Python进阶”专栏!来到这里的每一位同学,应该大致上学习了很多 Python 的基础知识,正在努力成长的过程中。在此期间,一定遇到了很多的困惑,对未来的学习方向感到迷茫。我非常理解你们所面临的处境。我从2007年开始接触 python 这门编程语言,从2009年开始单一使用 python 应对所有的开发工作,直至今天。回顾自己的学习过程,也曾经遇到过无数的困难,也曾经迷茫过、困惑过。开办这个专栏,正是为了帮助像我当年一样困惑的 Python 初学者走出困境、快速成长。希望我的经验能真正帮到你
Ol4网格生成以及优化
概述 先描述一下大致场景:以0.05为单元格大小生成网格,并在地图上绘制,绘制的时候需要区分海陆。本文以此需求为契机,简单描述一下该需求的实现以及如何来优化。 效果 实现 优化前 var source = new ol.source.Vector({ features: [] }); var vector = new ol.layer.Vector({ source...
11月19日科技资讯|华为明日发布鸿蒙整体战略;京东宣告全面向技术转型;Kotlin 1.3.60 发布
「极客头条」—— 技术人员的新闻圈! CSDN 的读者朋友们早上好哇,「极客头条」来啦,快来看今天都有哪些值得我们技术人关注的重要新闻吧。扫描上方二维码进入 CSDN App 可以收听御姐萌妹 Style 的人工版音频哟。 一分钟速览新闻点! 6G 专家组成员:速率是 5G 的 10 至 100 倍,预计 2030 年商用 雷军:很多人多次劝我放弃WPS,能坚持下来并不是纯粹的商业决定 ...
C语言魔塔游戏
很早就很想写这个,今天终于写完了。 游戏截图: 编译环境: VS2017 游戏需要一些图片,如果有想要的或者对游戏有什么看法的可以加我的QQ 2985486630 讨论,如果暂时没有回应,可以在博客下方留言,到时候我会看到。 下面我来介绍一下游戏的主要功能和实现方式 首先是玩家的定义,使用结构体,这个名字是可以自己改变的 struct gamerole { char n...
iOS Bug 太多,苹果终于坐不住了!
开源的 Android 和闭源的 iOS,作为用户的你,更偏向哪一个呢? 整理 | 屠敏 出品 | CSDN(ID:CSDNnews) 毋庸置疑,当前移动设备操作系统市场中,Android 和 iOS 作为两大阵营,在相互竞争的同时不断演进。不过一直以来,开源的 Android 吸引了无数的手机厂商涌入其中,为其生态带来了百花齐放的盛景,但和神秘且闭源的 iOS 系统相比,不少网友...
Python语言高频重点汇总
Python语言高频重点汇总 GitHub面试宝典仓库 回到首页 目录: Python语言高频重点汇总 目录: 1. 函数-传参 2. 元类 3. @staticmethod和@classmethod两个装饰器 4. 类属性和实例属性 5. Python的自省 6. 列表、集合、字典推导式 7. Python中单下划线和双下划线 8. 格式化字符串中的%和format 9. 迭代器和生成器 10...
究竟你适不适合买Mac?
我清晰的记得,刚买的macbook pro回到家,开机后第一件事情,就是上了淘宝网,花了500元钱,找了一个上门维修电脑的师傅,上门给我装了一个windows系统。。。。。。 表砍我。。。 当时买mac的初衷,只是想要个固态硬盘的笔记本,用来运行一些复杂的扑克软件。而看了当时所有的SSD笔记本后,最终决定,还是买个好(xiong)看(da)的。 已经有好几个朋友问我mba怎么样了,所以今天尽量客观...
Python爬虫爬取淘宝,京东商品信息
小编是一个理科生,不善长说一些废话。简单介绍下原理然后直接上代码。 使用的工具(Python+pycharm2019.3+selenium+xpath+chromedriver)其中要使用pycharm也可以私聊我selenium是一个框架可以通过pip下载 pip installselenium -ihttps://pypi.tuna.tsinghua.edu.cn/simple/ ...
程序员写了一个新手都写不出的低级bug,被骂惨了。
这种新手都不会范的错,居然被一个工作好几年的小伙子写出来,差点被当场开除了。
Java工作4年来应聘要16K最后没要,细节如下。。。
前奏: 今天2B哥和大家分享一位前几天面试的一位应聘者,工作4年26岁,统招本科。 以下就是他的简历和面试情况。 基本情况: 专业技能: 1、&nbsp;熟悉Sping了解SpringMVC、SpringBoot、Mybatis等框架、了解SpringCloud微服务 2、&nbsp;熟悉常用项目管理工具:SVN、GIT、MAVEN、Jenkins 3、&nbsp;熟悉Nginx、tomca...
2020年,冯唐49岁:我给20、30岁IT职场年轻人的建议
点击“技术领导力”关注∆每天早上8:30推送 作者|Mr.K 编辑| Emma 来源|技术领导力(ID:jishulingdaoli) 前天的推文《冯唐:职场人35岁以后,方法论比经验重要》,收到了不少读者的反馈,觉得挺受启发。其实,冯唐写了不少关于职场方面的文章,都挺不错的。可惜大家只记住了“春风十里不如你”、“如何避免成为油腻腻的中年人”等不那么正经的文章。 本文整理了冯...
程序员该看的几部电影
1、骇客帝国(1999) 概念:在线/离线,递归,循环,矩阵等 剧情简介: 不久的将来,网络黑客尼奥对这个看似正常的现实世界产生了怀疑。 他结识了黑客崔妮蒂,并见到了黑客组织的首领墨菲斯。 墨菲斯告诉他,现实世界其实是由一个名叫“母体”的计算机人工智能系统控制,人们就像他们饲养的动物,没有自由和思想,而尼奥就是能够拯救人类的救世主。 可是,救赎之路从来都不会一帆风顺,到底哪里才是真实的世界?如何...
蓝桥杯知识点汇总:基础知识和常用算法
文章目录基础语法部分:算法竞赛常用API:算法部分数据结构部分 此系列包含蓝桥杯绝大部分所考察的知识点,以及真题题解~ 基础语法部分: 备战蓝桥杯java(一):一般输入输出 和 快速输入输(BufferedReader&amp;BufferedWrite) 备战蓝桥杯java(二):java编程规范和常用数据类型 备战蓝桥杯java(三):常用功能符以及循环结构和分支结构 备战蓝桥杯java(四...
作为一个程序员,CPU的这些硬核知识你必须会!
CPU对每个程序员来说,是个既熟悉又陌生的东西? 如果你只知道CPU是中央处理器的话,那可能对你并没有什么用,那么作为程序员的我们,必须要搞懂的就是CPU这家伙是如何运行的,尤其要搞懂它里面的寄存器是怎么一回事,因为这将让你从底层明白程序的运行机制。 随我一起,来好好认识下CPU这货吧 把CPU掰开来看 对于CPU来说,我们首先就要搞明白它是怎么回事,也就是它的内部构造,当然,CPU那么牛的一个东...
@程序员,如何花式构建线程?
作者 |曾建责编 | 郭芮出品 | CSDN(ID:CSDNnews)在项目和业务的开发中,我们难免要经常使用线程来进行业务处理,使用线程可以保证我们的业务在相互处理之间可以保证原子性...
破14亿,Python分析我国存在哪些人口危机!
一、背景 二、爬取数据 三、数据分析 1、总人口 2、男女人口比例 3、人口城镇化 4、人口增长率 5、人口老化(抚养比) 6、各省人口 7、世界人口 四、遇到的问题 遇到的问题 1、数据分页,需要获取从1949-2018年数据,观察到有近20年参数:LAST20,由此推测获取近70年的参数可设置为:LAST70 2、2019年数据没有放上去,可以手动添加上去 3、将数据进行 行列转换 4、列名...
实现简单的轮播图(单张图片、多张图片)
前言 刚学js没多久,这篇博客就当做记录了,以后还会完善的,希望大佬们多多指点。ps:下面出现的都是直接闪动,没有滑动效果的轮播图。 单张图片的替换 · ...
强烈推荐10本程序员在家读的书
很遗憾,这个春节注定是刻骨铭心的,新型冠状病毒让每个人的神经都是紧绷的。那些处在武汉的白衣天使们,尤其值得我们的尊敬。而我们这些窝在家里的程序员,能不外出就不外出,就是对社会做出的最大的贡献。 有些读者私下问我,窝了几天,有点颓丧,能否推荐几本书在家里看看。我花了一天的时间,挑选了 10 本我最喜欢的书,你可以挑选感兴趣的来读一读。读书不仅可以平复恐惧的压力,还可以对未来充满希望,毕竟苦难终将会...
Linux自学篇——linux命令英文全称及解释
man: Manual 意思是手册,可以用这个命令查询其他命令的用法。 pwd:Print working directory 意思是密码。 su:Swith user 切换用户,切换到root用户 cd:Change directory 切换目录 ls:List files 列出目录下的文件 ps:Process Status 进程状态 mkdir:Make directory ...
Python实战:抓肺炎疫情实时数据,画2019-nCoV疫情地图
今天,群里白垩老师问如何用python画武汉肺炎疫情地图。白垩老师是研究海洋生态与地球生物的学者,国家重点实验室成员,于不惑之年学习python,实为我等学习楷模。先前我并没有关注武汉肺炎的具体数据,也没有画过类似的数据分布图。于是就拿了两个小时,专门研究了一下,遂成此文。
疫情数据接口api
返回json示例 { "errcode":0,//0标识接口正常 "data":{ "date":"2020-01-30 07:47:23",//实时更新时间 "diagnosed":7736,//确诊人数 "suspect":12167,//疑是病例人数 "death":170,//死亡人数 "cur...
相关热词 c# 识别回车 c#生成条形码ean13 c#子控制器调用父控制器 c# 写大文件 c# 浏览pdf c#获取桌面图标的句柄 c# list反射 c# 句柄 进程 c# 倒计时 线程 c# 窗体背景色
立即提问