SQL中的查看用户权限show grants出现错误
exec sp_addlogin U4,666;
use school exec sp_adduser U4;
grant select on student to U4;
grant select(Teac_id,Teac_name) on Teacher to U4;
show grants for U4;

前面都正常,但是最后一句出现错误,关键字 'for' 附近有语法错误。

Csdn user default icon
未捕获的异常:错误:指定为定义者的用户('skip-grants user'@'skip-grants host')不存在

<div class="post-text" itemprop="text"> <p>I have an update query in my application . When that query gets executed, an uncaught exception is thrown. Can anyone explain me why that exception occurs and how to resolve it.</p> <blockquote> <p>Uncaught Exception: Error: The user specified as a definer ('skip-grants user'@'skip-grants host') does not exist</p> </blockquote> </div>


![图片说明](https://img-ask.csdn.net/upload/201712/22/1513941480_492363.jpg) 如图所示,插入数据时出现错误,网上有类似的博客文章,但是和我的问题大相径庭。 出错翻译: “错误1449(HY000):用户指定为定义者('skip-grants user''skip-grants host')不存在“ 求指导。

exp oracle 11g 数据库导出,导出失败,报错遇到 ORACLE 错误 1455

![图片说明](https://img-ask.csdn.net/upload/201801/17/1516179698_672707.png) 网上的命令都用过了, exp ecology/test@ecology file=D:\ecology.dmp INDEXES=n STATISTICS=none; exp ecology/test@ecology file=D:\ecology.dmp log=D:\ecology.log grants=y exp ecology/test@ecology file=D:\ecology.dmp TRIGGERS=n 这些没效

go-sql-driver / mysql使用主机名而不是IP

<div class="post-text" itemprop="text"> <p>I have <em>server1</em> and <em>server2</em>. On <em>server1</em> I have a Go app, trying to connect to MySQL on <em>server2</em>.</p> <p>Here are the IPs: <em>server1</em>; <em>server2</em></p> <p>I get the following error:</p> <pre><code>Error 1045: Access denied for user 'root'@'server1' (using password: NO) </code></pre> <p>This is the connection string i am using:</p> <pre><code>root:@( </code></pre> <p>The password for root is empty string. I also tried 'root@' (without the column) with the same result. I don't think this is important, but I figured I should mention it. </p> <p>This is what I have in <em>server2</em>. I have privileges for <em>server1</em>, but only by IP. The connection comes from <em>server1</em> by hostname instead. </p> <pre><code>+------------------------------------------------------+ | Grants for root@ | +------------------------------------------------------+ | GRANT ALL PRIVILEGES ON *.* TO 'root'@'' | +------------------------------------------------------+ </code></pre> <p>The question is how do I make it connect using its IP not its hostname? I don't have much control over <em>server2</em> to add more privileges.</p> <p>And for completeness this are the privileges for hostname:</p> <pre><code>SHOW GRANTS FOR 'root'@'server1' ERROR 1141 (42000) at line 1: There is no such grant defined for user 'root' on host 'server1' </code></pre> <p>Link to the driver: <a href="https://github.com/go-sql-driver/mysql" rel="nofollow noreferrer">https://github.com/go-sql-driver/mysql</a></p> <p>Thanks</p> </div>


<div class="post-text" itemprop="text"> <p>I want to create a table 2x2 table, first row labels and second with the information which i am getting from my sql table. I want to display the Name of the business on the left and the information on the right. I want to keep it a 2x2, so there will be multiple names on the left in button style, which when clicked on will display the relevant information on the right. So it will look something like this. </p> <pre><code>|--------------------|---------------------| | NAME | INFO | |--------------------|---------------------| | BusinessName1 | their info | | BusinessName2 | | | BusinessName3 | | |--------------------|---------------------| </code></pre> <p>The problem is that i want to able to click on the businessName and display their info on the right. I have the AJAX and php working for the retrieving and displaying the businessName, just not sure how to make the BusinessName buttons work to display the relevant information on the right.</p> <p>The table the information is stored in is called, business, with columns, name and info.</p> <p>Here is the code i have so far to get the name and paste it in a table:</p> <p>Main.php</p> <pre><code>//script for sending value 'business' to getTable.php. which will return the list of all business //names in button form. &lt;script type='text/javascript'&gt; function showTable(str) { if (str=="") { document.getElementById("txtHint").innerHTML=""; return; } if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 &amp;&amp; xmlhttp.status==200) { document.getElementById("txtHint").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","getTable.php?q="+str,true); xmlhttp.send(); } &lt;/script&gt; &lt;?php ob_start(); ?&gt; //using templates //menu bar, onclick of button 'Business Basics' will run showTable script and pass value 'business' to it. &lt;table width="829" border="1" cellspacing="5" cellpadding="2" align="center"&gt; &lt;tr&gt; &lt;th scope="col" align="center"&gt;&lt;button onclick="showTable(this.value)" value="business"&gt; Business Basics &lt;/button&gt;&lt;/th&gt; &lt;th scope="col" align="center"&gt;&lt;a href="" &gt; Co-working spaces&lt;/a&gt;&lt;/th&gt; &lt;th scope="col" align="center"&gt;&lt;a href=""&gt; Events&lt;/a&gt;&lt;/th&gt; &lt;th scope="col" align="center"&gt;&lt;a href=""&gt; Entrepreneur organisations&lt;/a&gt;&lt;/th&gt; &lt;/tr&gt; &lt;tr&gt; &lt;th scope="col" align="center"&gt;&lt;a href=""&gt; Free/Cheap resoucres&lt;/a&gt;&lt;/th&gt; &lt;th scope="col" align="center"&gt;&lt;a href=""&gt; Government Grants&lt;/a&gt;&lt;/th&gt; &lt;th scope="col" align="center"&gt;&lt;a href=""&gt; Government websites&lt;/a&gt;&lt;/th&gt; &lt;th scope="col" align="center"&gt;&lt;a href=""&gt; Internships&lt;/a&gt;&lt;/th&gt; &lt;/tr&gt; &lt;/table&gt; &lt;h1&gt; Some stuff&lt;/h1&gt; //table where the info will be displayed, 'txtHint' is where the business names are being //displayed and 'txtHint2' is where i want the relevant info to be displayed. &lt;table width="100%" width="830" border="1" cellpadding="2" cellspacing="5" align="center"&gt; &lt;tr&gt; &lt;th scope="col" align="center" width="50%"&gt; Pick one &lt;/th&gt; &lt;th scope="col" align="center" width="50%"&gt; More Information &lt;/th&gt; &lt;/tr&gt; &lt;tr&gt; &lt;th scope="col" align="left" width="50%"&gt; &lt;div id="txtHint"&gt;&lt;b&gt;Pick a category!&lt;/b&gt;&lt;/div&gt;&lt;/th&gt; &lt;th scope="col" align="left" width="50%"&gt; &lt;div id="txtHint2"&gt;&lt;b&gt;more info over here&lt;/b&gt;&lt;/div&gt; &lt;/th&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre> <p>getTable.php</p> <pre><code>&lt;?php $q=$_GET["q"]; $count = 0; $con = mysqli_connect('localhost','root','root','bregu'); if (!$con) { die('Could not connect: ' . mysqli_error($con)); } $result = mysqli_query($con,"SELECT * FROM `".$q."`"); //$q is the value 'business' while($row = mysqli_fetch_array($result)) { echo '&lt;lo&gt;&lt;button value="name" type="submit"&gt;'.$row['name'].'&lt;/lo&gt;&lt;br&gt;'; $count++; } mysqli_close($con); ?&gt; </code></pre> <p>This is what i have so far. which will return a list of business names as separate buttons. Now i could use some help either theory or coded which will allow me to click on the business name and display their information on the right in the table.</p> </div>


<div class="post-text" itemprop="text"> <p>I made some projects with using mysql and there was no problem. Today my friend show me how to create user in mysql by :</p> <pre><code>Create database cc; use cc CREATE USER 'testing'@'localhost' IDENTIFIED BY 'pass'; GRANT ALL ON cc.* TO 'testing'@'localhost'; </code></pre> <p>Now I tried to use my project but I got following error :</p> <pre><code>Connection failed: Access denied for user ''@'localhost' to database 'login' </code></pre> <p>I deleted previously created user :</p> <pre><code>drop user 'testing'@'localhost'; </code></pre> <p>I managed to delete that user, I checked user with :</p> <pre><code>select User from mysql.user; </code></pre> <p>testing account was gone but now I have 3 root accounts, I didn't understand why. Since I deleted that "testing" account, I tried my project again and I got the same error. Why I can't use default <code>'root'</code> account anymore? </p> <p>EDIT :</p> <p>Error part of php code :</p> <pre><code>$servername = "localhost"; $username = "root"; $password = ""; $dbname = "login"; // Error is in following line $conn = mysqli_connect ( $servername, $username, $password, $dbname ); </code></pre> <p>I also tried this :</p> <pre><code>GRANT ALL ON login.* TO 'root'@'localhost'; show grants; </code></pre> <p>Result is :</p> <pre><code>GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION GRANT ALL PRIVILEGES ON login.* TO 'root'@'localhost' </code></pre> <p>It seems like 'root' has access to everything. Why am I getting error?</p> <p>EDIT 2:</p> <pre><code>&lt;?php $servername = "localhost"; $username = "root"; $password = ""; $dbname = "login"; $username = $_POST['username']; $pass = $_POST['password']; // Create connection $conn = mysqli_connect ( $servername, $username, $password, $dbname ); // Check connection if (! $conn) { die ( "Connection failed: " . mysqli_connect_error () ); } </code></pre> </div>


<div class="post-text" itemprop="text"> <p>I'm having problems with the following SQL Query I want to execute:</p> <pre><code>LOAD DATA INFILE 'thelocationofmyfile.csv' INTO TABLE test_import FIELDS TERMINATED BY ';' LINES TERMINATED BY ' ' IGNORE 1 LINES ( ArtID, ArtNamePharmLang, ArtNameFr, ArtNameNl, PubPrice, PercentageRebate, RebateAmount, SellingPrice, Localisation, CnkNr, EanNr, SoldQty, MinThd, MaxThd, QtyInStock, DateLastSale, VatRate, SupplierManufName, BuyPrice, InvCatCode, ArtType, ApbCatCode, ApbLegCode, PharmApbNr ); </code></pre> <p>I want to load the data of an excel file into a table in my database. When I run this locally everything works. But when I do this on the server I get the following error:</p> <pre><code>Uncaught exception 'PDOException' with message 'SQLSTATE[28000]: Invalid authorization specification: 1045 Access denied for user 'myuser'@'localhost' (using password: YES)' </code></pre> <p>I'm trying to do this in PHP (in Zend Framework). When I contacted the hosting they said I needed the <strong>FILE</strong> permission to do this. But this is bad practice and not adviced. </p> <p>I also tried to do this in a shell script like this:</p> <pre><code>#!/bin/bash /usr/bin/mysql --host=localhost --user=theuser --password=password --database=db_database&lt;&lt;EOFMYSQL LOAD DATA INFILE 'locationofmyfile.csv' INTO TABLE test_import FIELDS TERMINATED BY ';' LINES TERMINATED BY ' ' IGNORE 1 LINES ( ArtID, ArtNamePharmLang, ArtNameFr, ArtNameNl, PubPrice, PercentageRebate, RebateAmount, SellingPrice, Localisation, CnkNr, EanNr, SoldQty, MinThd, MaxThd, QtyInStock, DateLastSale, VatRate, SupplierManufName, BuyPrice, InvCatCode, ArtType, ApbCatCode, ApbLegCode, PharmApbNr ); EOFMYSQL </code></pre> <p>But I got the same error:</p> <pre><code>ERROR 1045 (28000) at line 1: Access denied for user 'user'@'localhost' (using password: YES) </code></pre> <p><strong>UPDATE:</strong></p> <p>I've tried to add LOCAL like this:</p> <pre><code>LOAD DATA LOCAL INFILE 'thelocationofmyfile.csv' </code></pre> <p>But then I get this error:</p> <pre><code>ERROR 1148 (42000) at line 1: The used command is not allowed with this MySQL version </code></pre> <p>Also tried to add --local-infile=1 like this but got same error</p> <pre><code>/usr/local/bin/mysql --host= --user=theuser --local-infile=1 --password=password --database=db_database </code></pre> <p><strong>SECOND UPDATE:</strong></p> <p>My config file <strong>my.cnf</strong> looks like this:</p> <pre><code>[mysqld] local-infile=0 max_connections = 50 connect_timeout = 5 wait_timeout = 300 max_allowed_packet = 16M thread_cache_size = 128 sort_buffer_size = 4M bulk_insert_buffer_size = 16M tmp_table_size = 16M max_heap_table_size = 16M key_buffer_size = 32M open-files-limit = 2000 table_cache = 400 myisam_sort_buffer_size = 8M concurrent_insert = 2 read_buffer_size = 2M read_rnd_buffer_size = 1M query_cache_limit = 1M query_cache_size = 32M innodb_log_file_size = 48M max_allowed_packet = 32M </code></pre> <p>The location where my connection is established doesn't really matter because I'm testing it with a shell script where I make the connection. </p> <p>I don't get an error when I run</p> <pre><code>/usr/bin/mysql --host=localhost --user=theuser --password=password --database=db_database&lt;&lt;EOFMYSQL show tables; EOFMYSQL </code></pre> <p>(just a list of all the tables in my database)</p> <p>When I run <code>SHOW GRANTS;</code> I get :</p> <pre><code>+------------------------------------------------------------------------------------------------------------------------+ | Grants for theuser@localhost | +------------------------------------------------------------------------------------------------------------------------+ | GRANT USAGE ON *.* TO 'theuser'@'localhost' IDENTIFIED BY PASSWORD '*password' | | GRANT ALL PRIVILEGES ON `mydomain\_live`.* TO 'theuser'@'localhost' | | GRANT ALL PRIVILEGES ON `mydomain\_staging`.* TO 'theuser'@'localhost' WITH GRANT OPTION | +------------------------------------------------------------------------------------------------------------------------+ 3 rows in set (0.01 sec) </code></pre> </div>

安卓开发JDBC连接数据库No static method metafactory错误怎么解决?

直接上代码 JdbcUtil类 ``` package com.example.myapplication; import java.io.File; import java.io.FileInputStream; import java.sql.Connection; import java.sql.DriverManager; import java.util.Properties; public class JdbcUtil { private static JdbcUtil instance; public static JdbcUtil getInstance(){ if (instance ==null){ instance = new JdbcUtil(); } return instance; } public Connection getConnection(String dbName,String name,String password) { try { new com.mysql.cj.jdbc.Driver(); String url = "jdbc:mysql://localhost:3306/"+dbName; return DriverManager.getConnection(url,name,password); } catch (Exception e) { return null; } } public Connection getConnection(String file){ File f = new File(file); if(!f.exists()){ return null; }else { Properties pro = new Properties(); try { Class.forName("com.mysql.jdbc.Driver"); pro.load(new FileInputStream(f)); String url = pro.getProperty("url"); String name = pro.getProperty("name"); String password = pro.getProperty("password"); return DriverManager.getConnection(url,name,password); }catch (Exception e){ return null; } } } } ``` UserDao类 ``` package com.example.myapplication; import android.util.Log; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import static android.content.ContentValues.TAG; public class UserDao { JdbcUtil jdbcUtil = JdbcUtil.getInstance(); //第一个参数为数据库名称,第二个参数为数据库账号 第三个参数为数据库密码 Connection conn = jdbcUtil.getConnection("test","root","LHMbdbqandr2015"); //注册 public boolean register(String name,String password){ if (conn==null){ Log.i(TAG,"register:conn is null"); return false; }else { //进行数据库操作 String sql = "insert into user(name,password) values(?,?)"; try { PreparedStatement pre = conn.prepareStatement(sql); pre.setString(1,name); pre.setString(2,password); return pre.execute(); } catch (SQLException e) { return false; }finally { try { conn.close(); } catch (SQLException e) { e.printStackTrace(); } } } } //登录 public boolean login(String name,String password){ if (conn==null){ Log.i(TAG,"register:conn is null"); return false; }else { String sql = "select * from user where name=? and password=?"; try { PreparedStatement pres = conn.prepareStatement(sql); pres.setString(1,name); pres.setString(2,password); ResultSet res = pres.executeQuery(); boolean t = res.next(); return t; } catch (SQLException e) { return false; } } } } ``` MainActivity文件 ``` package com.example.myapplication; import android.Manifest; import android.content.Intent; import android.content.pm.PackageManager; import android.os.Build; import android.os.Bundle; import android.os.Looper; import android.os.Trace; import android.util.Log; import android.view.View; import android.widget.EditText; import android.widget.Toast; import androidx.appcompat.app.AppCompatActivity; public class MainActivity extends AppCompatActivity { private static final String TAG="MainActivity"; private EditText name; private EditText password; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); name = findViewById(R.id.name); password = findViewById(R.id.password); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { if (checkSelfPermission(Manifest.permission.INTERNET) != PackageManager.PERMISSION_GRANTED) { // TODO: Consider calling // Activity#requestPermissions requestPermissions(new String[]{Manifest.permission.INTERNET},1); // here to request the missing permissions, and then overriding // public void onRequestPermissionsResult(int requestCode, String[] permissions, // int[] grantResults) // to handle the case where the user grants the permission. See the documentation // for Activity#requestPermissions for more details. return; } } } //用户根据点击事件来找到相应的功能 public void fun(View v){ switch (v.getId()){ case R.id.register: new Thread(new Runnable() { @Override public void run() { String n = name.getText().toString().trim(); String psw = password.getText().toString().trim(); UserDao ud = new UserDao(); boolean result =ud.register(n,psw); if (!result){ Looper.prepare(); Toast toast = Toast.makeText(MainActivity.this,"注册成功!",Toast.LENGTH_SHORT); toast.show(); Looper.loop(); } Log.i(TAG,"fun"+result); //以上为jdbc注册 } }).start(); break; case R.id.login: new Thread(new Runnable() { @Override public void run() { String n = name.getText().toString().trim(); String psw = password.getText().toString().trim(); if (n.equals("")||psw.equals("")){ Looper.prepare(); Toast toast = Toast.makeText(MainActivity.this,"输入不能为空!",Toast.LENGTH_SHORT); toast.show(); Looper.loop(); } UserDao ud = new UserDao(); Boolean result = ud.login(n,psw); if (!result){ Looper.prepare(); Toast toast=Toast.makeText(MainActivity.this,"用户名不存在或密码错误!",Toast.LENGTH_SHORT); toast.show(); Looper.loop(); }else{ Looper.prepare(); Toast toast=Toast.makeText(MainActivity.this,"登录成功",Toast.LENGTH_SHORT); toast.show(); //一下代码为跳转界面 // Intent intent=new Intent(MainActivity.this,info.class); //intent.putExtra("name",n); // startActivity(intent); Looper.loop(); } //以上为jdbc登录 } }).start(); } } } ``` 现在遇到的问题如下 ``` 11/14 01:40:49: Launching 'app' on Nexus 5X API 29 x86. $ adb shell am start -n "com.example.myapplication/com.example.myapplication.MainActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER Waiting for process to come online... Connected to process 23852 on device 'emulator-5554'. Capturing and displaying logcat messages from application. This behavior can be disabled in the "Logcat output" section of the "Debugger" settings page. I/e.myapplicatio: Not late-enabling -Xcheck:jni (already on) E/e.myapplicatio: Unknown bits set in runtime_flags: 0x8000 W/e.myapplicatio: Unexpected CPU variant for X86 using defaults: x86 D/libEGL: Emulator has host GPU support, qemu.gles is set to 1. W/libc: Unable to set property "qemu.gles" to "1": connection failed; errno=13 (Permission denied) W/RenderThread: type=1400 audit(0.0:129): avc: denied { write } for name="property_service" dev="tmpfs" ino=8368 scontext=u:r:untrusted_app:s0:c130,c256,c512,c768 tcontext=u:object_r:property_socket:s0 tclass=sock_file permissive=0 app=com.example.myapplication D/libEGL: loaded /vendor/lib/egl/libEGL_emulation.so D/libEGL: loaded /vendor/lib/egl/libGLESv1_CM_emulation.so D/libEGL: loaded /vendor/lib/egl/libGLESv2_emulation.so W/e.myapplicatio: Accessing hidden method Landroid/view/View;->computeFitSystemWindows(Landroid/graphics/Rect;Landroid/graphics/Rect;)Z (greylist, reflection, allowed) Accessing hidden method Landroid/view/ViewGroup;->makeOptionalFitsSystemWindows()V (greylist, reflection, allowed) D/: HostConnection::get() New Host Connection established 0xd7d24f50, tid 23910 D/: HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_host_composition_v1 ANDROID_EMU_host_composition_v2 ANDROID_EMU_vulkan ANDROID_EMU_deferred_vulkan_commands ANDROID_EMU_vulkan_null_optional_strings ANDROID_EMU_vulkan_create_resources_with_requirements ANDROID_EMU_YUV420_888_to_NV21 ANDROID_EMU_YUV_Cache GL_OES_EGL_image_external_essl3 GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_gles_max_version_3_1 W/OpenGLRenderer: Failed to choose config with EGL_SWAP_BEHAVIOR_PRESERVED, retrying without... D/eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 0 0 D/EGL_emulation: eglCreateContext: 0xe3340b60: maj 3 min 1 rcv 4 D/EGL_emulation: eglMakeCurrent: 0xe3340b60: ver 3 1 (tinfo 0xe338bc10) E/eglCodecCommon: glUtilsParamSize: unknow param 0x000082da glUtilsParamSize: unknow param 0x000082da W/Gralloc3: mapper 3.x is not supported D/: createUnique: call D/: HostConnection::get() New Host Connection established 0xd7d26ad0, tid 23910 HostComposition ext ANDROID_EMU_CHECKSUM_HELPER_v1 ANDROID_EMU_native_sync_v2 ANDROID_EMU_native_sync_v3 ANDROID_EMU_dma_v1 ANDROID_EMU_direct_mem ANDROID_EMU_host_composition_v1 ANDROID_EMU_host_composition_v2 ANDROID_EMU_vulkan ANDROID_EMU_deferred_vulkan_commands ANDROID_EMU_vulkan_null_optional_strings ANDROID_EMU_vulkan_create_resources_with_requirements ANDROID_EMU_YUV420_888_to_NV21 ANDROID_EMU_YUV_Cache GL_OES_EGL_image_external_essl3 GL_OES_vertex_array_object GL_KHR_texture_compression_astc_ldr ANDROID_EMU_gles_max_version_3_1 D/eglCodecCommon: allocate: Ask for block of size 0x1000 D/eglCodecCommon: allocate: ioctl allocate returned offset 0x3ffff6000 size 0x2000 D/EGL_emulation: eglMakeCurrent: 0xe3340b60: ver 3 1 (tinfo 0xe338bc10) D/eglCodecCommon: setVertexArrayObject: set vao to 0 (0) 0 0 I/AssistStructure: Flattened final assist data: 1788 bytes, containing 1 windows, 10 views W/e.myapplicatio: Accessing hidden method Ljava/lang/invoke/LambdaMetafactory;->metafactory(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite; (blacklist, linking, denied) E/AndroidRuntime: FATAL EXCEPTION: Thread-2 Process: com.example.myapplication, PID: 23852 java.lang.NoSuchMethodError: No static method metafactory(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodType;Ljava/lang/invoke/MethodHandle;Ljava/lang/invoke/MethodType;)Ljava/lang/invoke/CallSite; in class Ljava/lang/invoke/LambdaMetafactory; or its super classes (declaration of 'java.lang.invoke.LambdaMetafactory' appears in /apex/com.android.runtime/javalib/core-oj.jar) at com.mysql.cj.conf.ConnectionUrl.buildConnectionStringCacheKey(ConnectionUrl.java:246) at com.mysql.cj.conf.ConnectionUrl.getConnectionUrlInstance(ConnectionUrl.java:185) at com.mysql.cj.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:204) at java.sql.DriverManager.getConnection(DriverManager.java:580) at java.sql.DriverManager.getConnection(DriverManager.java:218) at com.example.myapplication.JdbcUtil.getConnection(JdbcUtil.java:22) at com.example.myapplication.UserDao.<init>(UserDao.java:15) at com.example.myapplication.MainActivity$1.run(MainActivity.java:53) at java.lang.Thread.run(Thread.java:919) D/EGL_emulation: eglMakeCurrent: 0xe3340b60: ver 3 1 (tinfo 0xe338bc10) D/AutofillManager: onActivityFinishing(): calling cancelLocked() Process 23852 terminated. ``` 在网上百度了很多方法都没有解决,起初以为是驱动的问题,但是换了一个仍然不好用,求求大神赐教

MySQL Workbench中的数据库权限不一致?

<div class="post-text" itemprop="text"> <p>I am trying to add another user, in addition to <code>root</code> to my database. So, I did the following in MySQL Workbench:</p> <p><img src="https://i.stack.imgur.com/WnbtV.png" alt="enter image description here"></p> <ul> <li><p>clicked on the tab called "Management" shown in picture, and then clicked on "Users and Priveleges".</p></li> <li><p>Then I clicked "add account" in the lower left hand corner, and entered a user name and password, and of course it shows up in the pane on the LHS.</p></li> </ul> <p>However, then I go into the tab called "Schemas", also shown in the piccutre above, and I click on the "i" with a circle around it, as shown in the picture below. </p> <p><img src="https://i.stack.imgur.com/uDiR7.png" alt="enter image description here"></p> <ul> <li>Then, I click on the tab that says "Grants" and see if I'm there. but I'm not. How do I add my username? </li> </ul> <p>I refreshed everything multiple times, so that isn't an issue. </p> <p>The way I got to this problem was: I tried to access the DB using python mysql package, I get the common error:</p> <pre><code>_mysql_exceptions.OperationalError: (1044, "Access denied for user... </code></pre> <p>...which is why I went and added a user and tried to check the grants.</p> <p>How do I change the permissions? Thanks.</p> </div>

用户''@ localhost'拒绝访问

<div class="post-text" itemprop="text"> <p>Hi guys i've been stuck on this issue for the past hour. I've read online that i have to change the privileges for the user on mysql. I have done this and the user has been granted all privileges yet i still get the error! when i enter <code>SHOW GRANTS FOR 'root'@'localhost';</code> it returns with</p> <p><code>+---------------------------------------------------------------------+ | Grants for root@localhost | +---------------------------------------------------------------------+ | GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' WITH GRANT OPTION | | GRANT PROXY ON ''@'' TO 'root'@'localhost' WITH GRANT OPTION | +---------------------------------------------------------------------+</code> Any help would be much appreciated i just cant seem to find anything that works.</p> </div>

golang —使用用户和密码连接到PostgreSQL时无法创建用户

<div class="post-text" itemprop="text"> <p>I'm trying out the Chitchat go app from the book Go Web Programming. The original version works. When I use a user &amp; password to access postgresql, it can connect to db but fails to create a new User, as shown below:</p> <pre><code>func db() (database *sql.DB) { database, err := sql.Open("postgres", "dbname=chitchat user=tom password=tomahawk sslmode=disable") if err != nil { log.Fatal(err) fmt.Println("Db connection failed") } return } </code></pre> <p>Here's the full code on <a href="https://github.com/mjwong/chitchat" rel="nofollow">Github</a>.</p> <p>However, I've found a temporary solution but it requires granting access to all the sequences in the chitchat database. Even after I've applied a </p> <pre><code>GRANT ALL PRIVILEGES ON DATABASE chitchat to tom; </code></pre> <p>it still requires manual grants to each of the table sequences. Here're the steps taken:</p> <p>1) Grant access to database</p> <pre><code>GRANT all privileges on database chitchat to tom; </code></pre> <p>2) List all sequences in chitchat database</p> <pre><code>SELECT c.relname FROM pg_class c WHERE c.relkind = 'S'; </code></pre> <p>3) Grant access to each of them</p> <pre><code>GRANT all privileges on sequence users_id_seq to tom; GRANT all privileges on sequence threads_id_seq to tom; GRANT all privileges on sequence posts_id_seq to tom; GRANT all privileges on sequence sessions_id_seq to tom; </code></pre> <p>Is there a better way? Thanks in advance.</p> </div>


手机和单反相机连接,发现单反相机根目录的uri如下:content://com.android.mtp.documents/document;但是直接通过contentresolver.query方法报异常: **No persistable permission grants found for UID 10228 and Uri 0 @ content://com.android.mtp.documents/document**


<div class="post-text" itemprop="text"> <p>I am trying to find security flaws in a MySQL page. It is an assignment for a class learning about SQL. Through a textbox, they will be given access to a database to submit queries and see if it returns the correct data sets. I want to find out if there's anything malicious they could do.</p> <p>This is the result of a <code>SHOW GRANTS</code> query:</p> <pre><code>Grants for user@localhost GRANT USAGE ON *.* TO 'user'@'localhost' IDENTIFIED BY PASSWORD 'the password' GRANT SELECT ON `server\_dir`.* TO 'user'@'localhost' GRANT SELECT ON `server\_dir\_ans`.* TO 'user'@'localhost' </code></pre> <p>Can someone explain what these <code>GRANT</code> statements mean? What is <code>*.*</code> and <code>GRANT USAGE</code>? What else can I do to this site to break it?</p> <p>The site itself is written in PHP.</p> <p>In response to The Rook, when I execute:</p> <pre><code>UPDATE mysql.user set Password = password("hacked"); FLUSH PRIVILEGES; </code></pre> <p>I get back:</p> <pre><code>Error Number: 1142. UPDATE command denied to user 'user'@'localhost' for table 'user' Error Number: 1227. Access denied; you need the RELOAD privilege for this operation </code></pre> <p>As I thought, it appears that the user lacks permissions necessary to do this. Or am I misunderstanding something?</p> </div>


<div class="post-text" itemprop="text"> <p>I keep on getting this error : Warning: mysqli_connect(): (HY000/1045): Access denied for user '12345'@'localhost' (using password: YES). I have already tried to create a new user, using a password, using no password, granting privileges to new user. I can login to the mysql database using these credentials. I can run every command with them in MySQL, just not connect to PHP. If it matters, this is my php code</p> <pre><code>&lt;? php $dbServername = "localhost"; $dbUsername = "12345"; $dbPassword = "12345"; $dbName = "loginsystem"; $conn = mysqli_connect($dbServername, $dbUsername, $dbPassword, $dbName); When showing grants for user: '12345'@'localhost': mysql&gt; SHOW GRANTS FOR '12345'@'localhost'; +-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Grants for 12345@localhost | +-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, RELOAD, SHUTDOWN, PROCESS, FILE, REFERENCES, INDEX, ALTER, SHOW DATABASES, SUPER, CREATE TEMPORARY TABLES, LOCK TABLES, EXECUTE, REPLICATION SLAVE, REPLICATION CLIENT, CREATE VIEW, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, CREATE USER, EVENT, TRIGGER, CREATE TABLESPACE, CREATE ROLE, DROP ROLE ON *.* TO `12345`@`localhost` | | GRANT BACKUP_ADMIN,BINLOG_ADMIN,CONNECTION_ADMIN,ENCRYPTION_KEY_ADMIN,GROUP_REPLICATION_ADMIN,PERSIST_RO_VARIABLES_ADMIN,REPLICATION_SLAVE_ADMIN,RESOURCE_GROUP_ADMIN,RESOURCE_GROUP_USER,ROLE_ADMIN,SET_USER_ID,SYSTEM_VARIABLES_ADMIN,XA_RECOVER_ADMIN ON *.* TO `12345`@`localhost` | +-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ 2 rows in set (0.00 sec) </code></pre> <p>/etc/my.cnf file (INSIDE MYSQL) :</p> <pre><code>[mysqld_safe] [mysqld] secure_file_priv="/Users/Steven/" </code></pre> <p>/etc/my.cnf file (INSIDE xAMPP):</p> <pre><code>#password = your_password port = 3306 socket = /Applications/XAMPP/xamppfiles/var/mysql/mysql.sock # Here follows entries for some specific programs # The MySQL server [mysqld] user = mysql port=3307 socket = /Applications/XAMPP/xamppfiles/var/mysql/mysql.sock skip-external-locking key_buffer = 16M max_allowed_packet = 1M table_open_cache = 64 sort_buffer_size = 512K net_buffer_length = 8K read_buffer_size = 256K read_rnd_buffer_size = 512K myisam_sort_buffer_size = 8M innodb_force_recovery = 1 </code></pre> <blockquote> <p>Oh I forgot to mention I did flush privileges and restarts of server.</p> </blockquote> </div>

Apache 2.4上的嵌套RewriteRules导致500错误

<div class="post-text" itemprop="text"> <p>I have a site running on cPanel, where wordpress is installed in the root. I also have a custom application I have written which is located in a subfolder named 'gallery'. Within the gallery subfolder is an 'admin' folder. The root folder of gallery (no rewrite) controls the display of information, where the root of 'gallery/admin' grants the user administrative access to the application. The path structure is redirected and handled (custom MVC framework), which is primarily directed by the following .htaccess directives :</p> <p>Require all granted</p> <pre><code>RewriteEngine On RewriteCond %{REQUEST_URI} !\.(jpg|png|bmp|gif|css|js|map|ttf|woff|woff2|svg|eot)$ RewriteRule ^(.*)$ controller.php?page=$1 [NC,L,QSA] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^(.*)$ controller.php?page=error&amp;rewritten=1&amp;missing=$1 [NC,L,QSA] </code></pre> <p>The .htaccess for wordpress is customized for compression, expiring/caching of different types, in addition to handling traditional wordpress stuff and is as follows (pasting in full) :</p> <pre><code>Options -Indexes # BEGIN WordPress # Expires Caching (Leverage Browser Caching) &lt;IfModule mod_expires.c&gt; ExpiresActive On ExpiresByType image/jpg "access 2 week" ExpiresByType image/jpeg "access 2 week" ExpiresByType image/gif "access 2 week" ExpiresByType image/png "access 2 week" ExpiresByType text/css "access 2 week" ExpiresByType application/pdf "access 2 week" ExpiresByType text/x-javascript "access 2 week" ExpiresByType application/x-shockwave-flash "access 2 week" ExpiresByType image/x-icon "access 2 week" ExpiresDefault "access 2 week" &lt;/IfModule&gt; # Enable GZIP Compression (compress text, html, javascript, css, xml and so on) ## &lt;ifModule mod_gzip.c&gt; mod_gzip_on Yes mod_gzip_dechunk Yes mod_gzip_item_include file \.(html?|txt|css|js|pl)$ mod_gzip_item_include handler ^cgi-script$ mod_gzip_item_include mime ^text/.* mod_gzip_item_include mime ^application/x-javascript.* mod_gzip_item_exclude mime ^image/.* mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.* &lt;/ifModule&gt; &lt;IfModule mod_deflate.c&gt; AddOutputFilterByType DEFLATE text/plain AddOutputFilterByType DEFLATE text/html #AddOutputFilterByType DEFLATE text/xml AddOutputFilterByType DEFLATE text/css AddOutputFilterByType DEFLATE application/javascript AddOutputFilterByType DEFLATE application/x-javascript &lt;/IfModule&gt; &lt;IfModule mod_rewrite.c&gt; RewriteEngine On RewriteCond %{HTTP_HOST} !^www\.example\.org RewriteRule (.*) http://www.example.org/$1 [R=301,L] #RewriteBase / RewriteRule ^index\.php$ - [L] RewriteRule ^sitemap.xml /sitemap.php?p=xml [L] RewriteRule ^sitemap.xsl /sitemap.php?p=xsl [L] RewriteRule ^sitemap.css /sitemap.php?p=css [L] RewriteRule ^sitemap.js /sitemap.php?p=js [L] RewriteRule ^robots.txt /sitemap.php?p=txt [L] RewriteRule ^gallery - [L] RewriteRule ^controller\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] &lt;/IfModule&gt; # END WordPress </code></pre> <p>The reason behind the double check <code>RewriteCond %{REQUEST_FILENAME} !-f</code> was because of another issue I had when trying to handle only files of a specific type where the file does not exist physically. (pretty 404 not found page when jpg/etc are missing).</p> <p>As you can see, <code>controller.php</code> does all the grunt work for authentication, etc. If I comment out any of the lines containing <code>^(.*)$ controller.php?</code> I don't get 500 errors unless I call the controller directly and let it redirect based on the application root path.</p> <p>This works flawlessly on my Debian 8, and Ubuntu 11 boxes, as well as on Windows 10. The admin is based on the open source project <a href="https://github.com/microvb/otp-thing" rel="nofollow">otp-thing</a> and works well. Just am having some trouble handling the redirects when the almighty wordpress is in the root of the site.</p> <p>There doesn't appear to be any code issues (if so, they would have cropped up in other tests on Debian 8, Ubuntu 11, and especially Windows 10).</p> <p>The server software running on this build of cPanel are as follows :</p> <pre><code>Server version: Apache/2.4.18 (Unix) Server built: Mar 1 2016 10:43:46 Cpanel::Easy::Apache v3.32.10 rev9999 Server's Module Magic Number: 20120211:52 Server loaded: APR 1.5.2, APR-UTIL 1.5.4 Compiled using: APR 1.5.2, APR-UTIL 1.5.4 Architecture: 64-bit Server MPM: prefork threaded: no forked: yes (variable process count) Server compiled with.... -D APR_HAS_SENDFILE -D APR_HAS_MMAP -D APR_HAVE_IPV6 (IPv4-mapped addresses disabled) -D APR_USE_SYSVSEM_SERIALIZE -D APR_USE_PTHREAD_SERIALIZE -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT -D APR_HAS_OTHER_CHILD -D AP_HAVE_RELIABLE_PIPED_LOGS -D DYNAMIC_MODULE_LIMIT=256 -D HTTPD_ROOT="/usr/local/apache" -D SUEXEC_BIN="/usr/local/apache/bin/suexec" -D DEFAULT_PIDLOG="logs/httpd.pid" -D DEFAULT_SCOREBOARD="logs/apache_runtime_status" -D DEFAULT_ERRORLOG="logs/error_log" -D AP_TYPES_CONFIG_FILE="conf/mime.types" -D SERVER_CONFIG_FILE="conf/httpd.conf" </code></pre> <p>And PHP</p> <pre><code>PHP 5.6.18 (cli) (built: Mar 1 2016 10:47:52) Copyright (c) 1997-2016 The PHP Group Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies with the ionCube PHP Loader v4.7.5, Copyright (c) 2002-2014, by ionCube Ltd., and with Zend Guard Loader v3.3, Copyright (c) 1998-2014, by Zend Technologies </code></pre> <p>Also, if you look at the project source for otp-thing, you will notice some of the nested directories intentionally block public access (app/cache, app/templates_c, etc)</p> <p>The error that is reported by Apache in <code>/usr/local/apache/error_log</code> is :</p> <blockquote> <p>[Thu Aug 25 21:33:21.323468 2016] [core:error] [pid 15805] [client XX.XX.XX.XX:XXXXX] AH00124: Request exceeded the limit of 10 internal redirects due to probable configuration error. Use 'LimitInternalRecursion' to increase the limit if necessary. Use 'LogLevel debug' to get a backtrace.</p> </blockquote> <p><strong>The message is identical if I comment out any combination of the <code>RewriteRule</code> lines from the <code>gallery/admin/.htaccess</code> file.</strong></p> <p>I have tried adding had paths preceding 'controller.php', however this exacerbates the problem, but overall, no change to the issue at hand here.</p> <p>What can I do to make sure that all this stuff works, or even as a workaround, how can I move the htaccess rules for otp-thing into the wordpress htaccess file as above by merging them (how can the directives be adjusted).</p> </div>


<div class="post-text" itemprop="text"> <p>I'm trying to make my First API, I never did and API before. I did read a couple of documentations but couldn't find something simple enough to describe the authentication process.</p> <p>How do I authenticate a user through an API? like how can I give app developers a way so that they make a login form that grants their users access to their info on my database, and for me to provide data based on the user logged in.</p> <p>I'm confused with the idea of authenticating users through an API, how can they send they passwords securely?</p> </div>

错误400 OAuth2 Google云存储-Go Lang

<div class="post-text" itemprop="text"> <pre><code>// datastore1 package main import ( "fmt" "io/ioutil" "log" "time" "golang.org/x/net/context" "golang.org/x/oauth2/google" "google.golang.org/cloud" "google.golang.org/cloud/datastore" ) const ( // ScopeDatastore grants permissions to view and/or manage datastore entities copeDatastore = "https://www.googleapis.com/auth/datastore" // ScopeUserEmail grants permission to view the user's email address. // It is required to access the datastore. ScopeUserEmail = "https://www.googleapis.com/auth/userinfo.email" ) type ehrEntity struct { email *datastore.Key firstname string lastname string address string age int8 dateofbirth time.Time sex bool } func getCtx() *datastore.Client { // Initialize an authorized transport with Google Developers Console // JSON key. Read the google package examples to learn more about // different authorization flows you can use. // http://godoc.org/golang.org/x/oauth2/google jsonKey, err := ioutil.ReadFile("filename.json") opts, err := google.JWTConfigFromJSON( jsonKey, datastore.ScopeDatastore, datastore.ScopeUserEmail, ) if err != nil { log.Fatal(err) } ctx := context.Background() client, err := datastore.NewClient(ctx, "xxxx", cloud.WithTokenSource(opts.TokenSource(ctx))) if err != nil { log.Fatal(err) } // Use the context (see other examples) return client } func ExampleGet() { ctx := context.Background() client, err := datastore.NewClient(ctx, "xxxx") if err != nil { log.Fatal(err) } key := datastore.NewKey(ctx, "User", "tluu@abc.com", 0, nil) ehr := ehrEntity{ nil, "tri", "luu", "addr1", 20, time.Date(2009, time.January, 10, 23, 0, 0, 0, time.UTC), false} if err := client.Get(ctx, key, ehr); err != nil { log.Fatal(err) } } func main() { getCtx() fmt.Println("Pass authentication") ExampleGet() } </code></pre> <p>When I run go file, It return error follow:</p> <p>Pass authentication (Pass getCtx() function).</p> <p>Error in ExampleGet() May be at </p> <pre><code>ctx := context.Background() client, err := datastore.NewClient(ctx, "xxxx") if err != nil { log.Fatal(err) } </code></pre> <p>Error: 2016/01/09 22:08:43 Post <a href="https://www.googleapis.com/datastore/v1beta2/datasets/xxxx/lookup" rel="nofollow">https://www.googleapis.com/datastore/v1beta2/datasets/xxxx/lookup</a>: oauth2: cannot fetch token: 400 Bad Request Response: { "error" : "invalid_grant" }</p> <p>How to resolve this error?</p> </div>


win10,64位配置了一个apache2.4.17+php7.0.0+mysql5.7.10的环境,改默认端口为8080,测试是否配置成功时编写了两个php代码, 一个用来测试php和apache的文件info.php,用localhost:8080和127.0.0.1:8080均能正常显示信息,如下图 ![图片说明](https://img-ask.csdn.net/upload/201709/03/1504421804_153640.png) 另一个用来测mysql的文件sql.php如下,密码和用户和mysql吻合,但用localhost和127.0.0.1两者均打不开,一直显示正待等待响应,不知道为啥..... <?php $con=mysqli_connect('localhost:8080','root','password'); if(!$con) echo "失败!"; else echo "成功!"; mysqli_close($con); ?> ![图片说明](https://img-ask.csdn.net/upload/201709/03/1504421816_742069.png) 并且,local host和127.0.0.1有时候都能正常打开,有时候只能某一个正常工作,有时候两个都开不了(都是在apache正常工作时).....也不知道为啥.... 求大神解惑~十分感谢! 更多 0


<div class="post-text" itemprop="text"> <p>i'm try to create download link in my form so people can download the files in the upload folder.I'm used code below</p> <pre><code>&lt;?php $path = $_SERVER['DOCUMENT_ROOT']."/content/uploads/"; // change the path to fit your websites document structure $fullPath = $path.basename($_REQUEST['download_file']); if (is_readable ($fullPath)) { $fsize = filesize($fullPath); $path_parts = pathinfo($fullPath); $ext = strtolower($path_parts["extension"]); switch ($ext) { case "pdf"||"docx"||"doc"||"jpg"||"jpeg": header(("Content-type: lappication/pdf")||("Content-type: application/msword")||("Content-type: image/jpeg")); // add here more headers for diff. extensions header("Content-Disposition: attachment; filename=\"".$path_parts["basename"]."\""); // use 'attachment' to force a download break; default; header("Content-type: application/octet-stream"); header("Content-Disposition: filename=\"".$path_parts["basename"]."\""); } header("Content-length: $fsize"); header("Cache-control: private"); //use this to open files directly readfile($fullPath); exit; } else { die("Invalid request"); } </code></pre> <p>and then i test by put download link in my form</p> <pre><code>&lt;h2&gt;Forms Available&lt;/h2&gt; &lt;a href="content/grants/download.php?download_file=some.pdf"&gt;Download here&lt;/a&gt; &lt;a href="content/grants/download.php?download_file="&gt;Download here&lt;/a&gt; &lt;a href="content/grants/download.php?download_file=IntroLetter.docx"&gt;Download here&lt;/a&gt; &lt;a href="content/grants/download.php?download_file=Conference Grant Application Form.doc"&gt;Download here&lt;/a&gt; </code></pre> <p>from that 4 download link. the first 1 return "invalid request" which i know because that file doesn't exist. second link pop up download box to download empty file. which i bet because it really empty. for third and fourth link that file really exist in the folder but it return</p> <p>Internal Server Error</p> <p>The server encountered an internal error or misconfiguration and was unable to complete your request.</p> <p>Please contact the server administrator, webmaster@miitresearch-postgraduates.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.</p> <p>More information about this error may be available in the server error log.</p> <p>Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request</p> <p>what could be the problem? TQ :)</p> </div>


大学四年,看课本是不可能一直看课本的了,对于学习,特别是自学,善于搜索网上的一些资源来辅助,还是非常有必要的,下面我就把这几年私藏的各种资源,网站贡献出来给你们。主要有:电子书搜索、实用工具、在线视频学习网站、非视频学习网站、软件下载、面试/求职必备网站。 注意:文中提到的所有资源,文末我都给你整理好了,你们只管拿去,如果觉得不错,转发、分享就是最大的支持了。 一、电子书搜索 对于大部分程序员...


今年,我也32了 ,为了不给大家误导,咨询了猎头、圈内好友,以及年过35岁的几位老程序员……舍了老脸去揭人家伤疤……希望能给大家以帮助,记得帮我点赞哦。 目录: 你以为的人生 一次又一次的伤害 猎头界的真相 如何应对互联网行业的「中年危机」 一、你以为的人生 刚入行时,拿着傲人的工资,想着好好干,以为我们的人生是这样的: 等真到了那一天,你会发现,你的人生很可能是这样的: ...




ArrayList源码分析 前言: 写这篇博客的主要原因是,在我上一次参加千牵科技Java实习生面试时,有被面试官问到ArrayList为什么查找的速度较快,插入和删除的速度较慢?当时我回答得不好,很大的一部分原因是因为我没有阅读过ArrayList源码,虽然最后收到Offer了,但我拒绝了,打算寒假学得再深入些再广泛些,下学期开学后再去投递其他更好的公司。为了更加深入理解ArrayList,也为



String s = new String(" a ") 到底产生几个对象?

老生常谈的一个梗,到2020了还在争论,你们一天天的,哎哎哎,我不是针对你一个,我是说在座的各位都是人才! 上图红色的这3个箭头,对于通过new产生一个字符串(”宜春”)时,会先去常量池中查找是否已经有了”宜春”对象,如果没有则在常量池中创建一个此字符串对象,然后堆中再创建一个常量池中此”宜春”对象的拷贝对象。 也就是说准确答案是产生了一个或两个对象,如果常量池中原来没有 ”宜春” ,就是两个。...

技术大佬:我去,你写的 switch 语句也太老土了吧

昨天早上通过远程的方式 review 了两名新来同事的代码,大部分代码都写得很漂亮,严谨的同时注释也很到位,这令我非常满意。但当我看到他们当中有一个人写的 switch 语句时,还是忍不住破口大骂:“我擦,小王,你丫写的 switch 语句也太老土了吧!” 来看看小王写的代码吧,看完不要骂我装逼啊。 private static String createPlayer(PlayerTypes p...

和黑客斗争的 6 天!

互联网公司工作,很难避免不和黑客们打交道,我呆过的两家互联网公司,几乎每月每天每分钟都有黑客在公司网站上扫描。有的是寻找 Sql 注入的缺口,有的是寻找线上服务器可能存在的漏洞,大部分都...


loonggg读完需要3分钟速读仅需 1 分钟大家好,我是你们的校长。我之前讲过,这年头,只要肯动脑,肯行动,程序员凭借自己的技术,赚钱的方式还是有很多种的。仅仅靠在公司出卖自己的劳动时...






提到“程序员”,多数人脑海里首先想到的大约是:为人木讷、薪水超高、工作枯燥…… 然而,当离开工作岗位,撕去层层标签,脱下“程序员”这身外套,有的人生动又有趣,马上展现出了完全不同的A/B面人生! 不论是简单的爱好,还是正经的副业,他们都干得同样出色。偶尔,还能和程序员的特质结合,产生奇妙的“化学反应”。 @Charlotte:平日素颜示人,周末美妆博主 大家都以为程序媛也个个不修边幅,但我们也许...






私下里,有不少读者问我:“二哥,如何才能写出一份专业的技术简历呢?我总感觉自己写的简历太烂了,所以投了无数份,都石沉大海了。”说实话,我自己好多年没有写过简历了,但我认识的一个同行,他在阿里,给我说了一些他当年写简历的方法论,我感觉太牛逼了,实在是忍不住,就分享了出来,希望能够帮助到你。 01、简历的本质 作为简历的撰写者,你必须要搞清楚一点,简历的本质是什么,它就是为了来销售你的价值主张的。往深...


最近接手了一个springboot项目,不是不熟悉这个框架,启动时打印的信息吸引了我。 这不是我熟悉的常用springboot的打印信息啊,我打开自己的项目: 还真是的,不用默认的感觉也挺高大上的。一时兴起,就去研究了一下源代码,还正是有些收获,稍后我会总结一下。正常情况下做为一个老程序员,是不会对这种小儿科感兴趣的,不就是一个控制台打印嘛。哈哈! 于是出于最初的好奇,研究了项目的源代码。看到


即将毕业的应届毕业生一枚,现在只拿到了两家offer,但最近听到一些消息,其中一个offer,我这个组据说客户很少,很有可能整组被裁掉。 想问大家: 如果我刚入职这个组就被裁了怎么办呢? 大家都是什么时候知道自己要被裁了的? 面试软技能指导: BQ/Project/Resume 试听内容: 除了刷题,还有哪些技能是拿到offer不可或缺的要素 如何提升面试软实力:简历, 行为面试,沟通能...

离职半年了,老东家又发 offer,回不回?

有小伙伴问松哥这个问题,他在上海某公司,在离职了几个月后,前公司的领导联系到他,希望他能够返聘回去,他很纠结要不要回去? 俗话说好马不吃回头草,但是这个小伙伴既然感到纠结了,我觉得至少说明了两个问题:1.曾经的公司还不错;2.现在的日子也不是很如意。否则应该就不会纠结了。 老实说,松哥之前也有过类似的经历,今天就来和小伙伴们聊聊回头草到底吃不吃。 首先一个基本观点,就是离职了也没必要和老东家弄的苦...






当HR压你价,说你只值7K时,你可以流畅地回答,记住,是流畅,不能犹豫。 礼貌地说:“7K是吗?了解了。嗯~其实我对贵司的面试官印象很好。只不过,现在我的手头上已经有一份11K的offer。来面试,主要也是自己对贵司挺有兴趣的,所以过来看看……”(未完) 这段话主要是陪HR互诈的同时,从公司兴趣,公司职员印象上,都给予对方正面的肯定,既能提升HR的好感度,又能让谈判气氛融洽,为后面的发挥留足空间。...


HashMap底层实现原理,红黑树,B+树,B树的结构原理 Spring的AOP和IOC是什么?它们常见的使用场景有哪些?Spring事务,事务的属性,传播行为,数据库隔离级别 Spring和SpringMVC,MyBatis以及SpringBoot的注解分别有哪些?SpringMVC的工作原理,SpringBoot框架的优点,MyBatis框架的优点 SpringCould组件有哪些,他们...





你打算用Java 8一辈子都不打算升级到Java 14,真香



编程语言层出不穷,从最初的机器语言到如今2500种以上的高级语言,程序员们大呼“学到头秃”。程序员一边面临编程语言不断推陈出新,一边面临由于许多代码已存在,程序员编写新应用程序时存在重复“搬砖”的现象。 无代码/低代码编程应运而生。无代码/低代码是一种创建应用的方法,它可以让开发者使用最少的编码知识来快速开发应用程序。开发者通过图形界面中,可视化建模来组装和配置应用程序。这样一来,开发者直...

面试了一个 31 岁程序员,让我有所触动,30岁以上的程序员该何去何从?





已经连续五年参加大厂校招、社招的技术面试工作,简历看的不下于万份 这篇文章会用实例告诉你,什么是差的程序员简历! 疫情快要结束了,各个公司也都开始春招了,作为即将红遍大江南北的新晋UP主,那当然要为小伙伴们做点事(手动狗头)。 就在公众号里公开征简历,义务帮大家看,并一一点评。《启舰:春招在即,义务帮大家看看简历吧》 一石激起千层浪,三天收到两百多封简历。 花光了两个星期的所有空闲时...