调用方使用try-catch捕获异常时为何被调用方法还需throws异常?

有个问题想不明白,throws是为了可以使被调用方法的异常向上抛,上层调用必须要有try-catch语句捕获throws异常,那么问题来了,假如我上层调用中有写try-catch捕获异常,我为啥还需要在被调用方法声明中加throws?不是反正都会被捕获吗,加不加throws就无所谓了。

追问:为什么代码1中ThrowsTest类没有throws ArithmeticException不会报错,代码2中没有throws MyException就编译不过了呢?

//代码1
package trycatch;

public class ThrowsTest {
    public static void main(String args[]) {
        int num1 = 25;
        int num2 = 0;
        int result;
        if(num2 == 0) {
            throw new ArithmeticException("这都不会!");
        }
        result = num1/num2;
        System.out.println("结束了" + result);
    }
}

//代码2
package trycatch;


public class TryCatch {

public static void main(String args[]) {
    int i = 1;
    if(i == 1) {
        throw new MyException("出错了!");
    }   
 }

}

class MyException extends Exception {
    /**
     * 
     */
    private static final long serialVersionUID = 1L;

    public MyException(String message) {
        super(message);
    }
}

2个回答

首先你要抛异常(指明异常),上级方法才能抓,否则会报错而不是报异常

qq_43345230
DariusEle 回复weiwei_baby: 如果有帮助的话可以给个采纳不
4 个月之前 回复
weiwei_baby
weiwei_baby 回复DariusEle: 懂了,感谢!
4 个月之前 回复
qq_43345230
DariusEle 回复weiwei_baby: 不是上级方法报错 而是代码执行到这里发现有异常但是没抓抛异常就会报错
4 个月之前 回复
weiwei_baby
weiwei_baby 被调用方法不抛异常,上层调用时直接try-catch也不会报错吧?
4 个月之前 回复

问题是,你的方法怎么知道谁调他,怎么知道调他的方法有没有try。当然,根本问题是,你的方法中可能会存在异常,那么你就得对异常进行处理,无论是抛还是抓,都是处理异常的一种方式,调用者是否处理异常和怎么处理异常,与这个方法对异常的处理并没有啥联系

espen_tian
光影星魂 回复weiwei_baby: throws只能用在方法声明时,如果有throws,那么调用方是必须处理的,这是在编译器就要处理的,还是那句话,或抓或抛,但是都得有个处理
4 个月之前 回复
weiwei_baby
weiwei_baby 明白了,感谢!我之前说的throws异常是指方法声明的时候,不是说运行的时候,我的意思是如果方法声明了throws异常,运行的时候别人调用他,他当时也是正常运行的,只不过调用方没写try-catch,其实这样也是没问题的,程序不会报错。
4 个月之前 回复
espen_tian
光影星魂 回复光影星魂: b中throws了一个异常,然后你在A中要进行处理,或抓或抛,当你在A中throws了以后,在另一个方法C中调用了A,这个情况不就跟A调用B一样了吗
4 个月之前 回复
espen_tian
光影星魂 回复weiwei_baby: 你能这么想,说明你对异常这基本已经理解了,只不过没转过弯。你写了个A方法,调用了api中的一个方法B,
4 个月之前 回复
espen_tian
光影星魂 回复weiwei_baby: throws就是说我这个方法可能有异常,但是我没有处理,就是把问题扔出去了,至于你调用者要怎么处理,是抓是抛。。。
4 个月之前 回复
weiwei_baby
weiwei_baby 那可不可以这么理解,其实加throws的作用是告诉调用方本方法可能会出现这些异常,希望调用方进行处理,如果不catch的话其实也不影响?还是说被调用方法throws了异常那调用者必须catch该异常,否则会报错?
4 个月之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
vc调用matlab生成的com组件返回值不成功

大虾们好,谁能帮帮我。我在设置好vc和matlab环境之后,先通过简单的程序进行了测试,可以实现调用,eg:function z=add(x+y),不论输入参数是数组还是标量都能成功。但是在将复杂的matlab程序做成com组件之后,用vc调用。得不到正确的结果。下面我将贴出简单的程序和复杂的多输入程序给大虾们帮我分析。 function z=add(x+y) ‘inline code’ HRESULT hr; hr=CoCreateInstance(CLSID_add1,NULL,CLSCTX_ALL,IID_Iadd1,(void **)&p_Test); if(FAILED(hr)) { AfxMessageBox("failed"); return; } VARIANT x,y,z; SAFEARRAYBOUND xBound[1],yBound[1]; SAFEARRAY *xArrayPr,*yArrayPr,*zArrayPr; double HUGEP *xdata,*ydata,*zdata; xBound[0].cElements=3,xBound[0].lLbound=0; xArrayPr=SafeArrayCreate(VT_R8,1,xBound); yBound[0].cElements=3,yBound[0].lLbound=0; yArrayPr=SafeArrayCreate(VT_R8,1,yBound); HRESULT hr1,hr2; hr1=SafeArrayAccessData(xArrayPr,(void HUGEP**)&xdata); hr2=SafeArrayAccessData(yArrayPr,(void HUGEP**)&ydata); for(int i=0;i<3;i++) { xdata[i]=(double)i;ydata[i]=(double)i+10; } SafeArrayUnaccessData(xArrayPr); SafeArrayUnaccessData(yArrayPr); VariantInit(&x); x.vt=VT_R8|VT_ARRAY; x.parray=xArrayPr; VariantInit(&y); y.vt=VT_R8|VT_ARRAY; y.parray=yArrayPr; hr=p_Test->add(1,&z,x,y); LONG zBoundL,zBoundU; zArrayPr=z.parray; SafeArrayGetLBound(zArrayPr,2,&zBoundL); SafeArrayGetUBound(zArrayPr,2,&zBoundU); double z0[3]; HRESULT hr3=SafeArrayAccessData(zArrayPr,(void** HUGEP)&zdata); for(int t=0;t<3;t++) { z0[t]=zdata[t]; } m_1=z0[0]; m_2=z0[1]; m_3=z0[2]; UpdateData(false); SafeArrayUnaccessData(zArrayPr); SafeArrayDestroy(xArrayPr); SafeArrayDestroy(yArrayPr); SafeArrayDestroy(zArrayPr); 对这个com组件的调用能够成功。 下面是对我项目中的程序进行调用,我失败了,希望有人能够帮帮我。 ‘inline code’ 考虑到大侠们的感受,我这里只贴出部分参数的设定, HRESULT hr; hr=CoCreateInstance(CLSID_test01,NULL,CLSCTX_ALL,IID_Itest01,(void **)&m_pTest); if(FAILED(hr)) { AfxMessageBox("failed"); return; } VARIANT GST,GSTm,Heat,Heatm,Up_thR,Up_thRm,Up_elec,Up_elecm,Down_elec,Down_elecm,Precision,Fmin,Write01,R; SAFEARRAYBOUND GSTBound[1],GSTmBound[1],HeatBound[1],HeatmBound[1],Up_thRBound[1],Up_thRmBound[1],Up_elecBound[1],Up_elecmBound[1];Down_elecBound[1],Down_elecmBound[1],PrecisionBound[1]; SAFEARRAY *GSTArrayPr,*GSTmArrayPr,*HeatArrayPr,*HeatmArrayPr,*Up_thRArrayPr,*Up_thRmArrayPr; SAFEARRAY *Up_elecArrayPr,*Up_elecmArrayPr,*Down_elecArrayPr,*Down_elecmArrayPr,*PrecisionArrayPr; double HUGEP *GSTdata; double gst[3]={300,300,120}; GSTBound[0].cElements=3,GSTBound[0].lLbound=0; GSTArrayPr=SafeArrayCreate(VT_R8,1,GSTBound); HRESULT hr1; hr1=SafeArrayAccessData(GSTArrayPr,(void HUGEP**)&GSTdata); for(int i0=0;i0<3;i0++) { GSTdata[i0]=gst[i0]; } SafeArrayUnaccessData(GSTArrayPr); VariantInit(&GST); GST.vt=VT_R8|VT_ARRAY; GST.parray=GSTArrayPr; VARIANT addrin,addout; addrin.vt=VT_BSTR; addrin.bstrVal=_com_util::ConvertStringToBSTR("'D:\\MATLAB6.5\\work3\\pulse_rst.txt'"); addout.vt=VT_BSTR; addout.bstrVal=_com_util::ConvertStringToBSTR("'D:\\MATLAB6.5\\work3'"); hr=m_pTest->elec_mini3(1,&R,GST,GSTm,Heat,Heatm,Up_elec,Up_elecm,Down_elec,Down_elecm,Up_thR,Up_thRm,Precision,Fmin,Write01,addrin,addout); m_R=R.dblVal; UpdateData(false); 运行结果得到的没有初始化的R.dblVal=-9.255……;调试的时候出现了User breakpoint called from code at 0X7C9120e的错误。 在下很急,希望有人看到这个后能帮帮我。

winform程序的Application.Run()抛出异常:“未将对象引用设置到对象的实例“?

##winform程序的Application.Run()抛出异常:“未将对象引用设置到对象的实例“ ![图片说明](https://img-ask.csdn.net/upload/201912/05/1575519266_161353.png) ###下面是调试时感觉出问题的地方: ``` //触发事件 private void MC_Code_SelectedIndexChanged(object sender, EventArgs e) { label8.Text = MC_Code.Text; if (MC_Code.Text == null) return; mc_code = MC_Code.Text; Dept_Code = dept_code.Text; try { Thread thr = new Thread(loadDataGridView); thr.Start(); } catch { } } string mc_code = ""; string Dept_Code = ""; ***#感觉出问题的函数#*** void loadDataGridView() { DataTable table = new DataTable(); //BindingSource bs = new BindingSource(); while (true) { table = getData(mc_code, Dept_Code, Login.Site); if (table == null) return; //BindingSource bs = new BindingSource(); //bs.DataSource = table; //bs.DataMember = "Data"; try { //第一次在下拉列表中选择一个值代码运行到此处,不会出现任何问题;但是当在下拉列表中重新选择值第二次运行到此处时,就会跳转到Application.Run()这个地方抛出异常:“未将对象引用设置到对象的实例“ #this.dataGridView1.DataSource = table;# //this.dataGridView1.DataBindings.Add("Text",bs,""); } catch { return; } Thread.Sleep(60000); } } **不知道具体是什么问题,求大神解决!** ```

调用DOMPDF库的render方法时超时

<div class="post-text" itemprop="text"> <p>PDF with few pages it works perfectly but when I try to generate a PDF file with more than 20 pages, it presents this error in the browser</p> <p><a href="https://i.stack.imgur.com/HhqE9.png" rel="nofollow noreferrer">ERR_CONECTION_RESET</a></p> <p>This is my code to generate pdf:</p> <pre><code>$html = ' &lt;style&gt; * { font-family: Tahoma, Verdana, Segoe, sans-serif; color: #333333; font-size: 9px;} &lt;/style&gt; &lt;table width="100%" border="0" cellpadding="1" cellspacing="1" bgcolor="#333333"&gt; &lt;tr&gt; &lt;td height="70" bgcolor="#ffffff" colspan="7" align="center" valign="middle"&gt;&lt;b style="font-size: 18px;"&gt;RELATÓRIO DE FECHAMENTO - Nº '.$id.'&lt;/b&gt;&lt;br&gt;&lt;b&gt;Data do pagamento: '.date('d/m/Y', strtotime($objDados[$idx]-&gt;dtpagamento)).'&lt;/b&gt;&lt;/td&gt; &lt;td bgcolor="#ffffff" align="center" width="130"&gt;&lt;img src="data:image/gif;base64,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" border="0"&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td height="30" bgcolor="#ffffff" colspan="8" align="center" valign="middle" colspan="2"&gt;&lt;b style="font-size: 16px;"&gt;DETALHADO&lt;/b&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr style="color: #ffffff !important;"&gt; &lt;td bgcolor="#1369a1" width="45" height="20"&gt;&lt;b&gt;DATA&lt;/b&gt;&lt;/td&gt; &lt;td bgcolor="#1369a1"&gt;&lt;b&gt;TIPO&lt;/b&gt;&lt;/td&gt; &lt;td bgcolor="#1369a1" width="30"&gt;&lt;b&gt;CHAPA&lt;/b&gt;&lt;/td&gt; &lt;td bgcolor="#1369a1" width="150"&gt;&lt;b&gt;NOME&lt;/b&gt;&lt;/td&gt; &lt;td bgcolor="#1369a1"&gt;&lt;b&gt;BANCO&lt;/b&gt;&lt;/td&gt; &lt;td bgcolor="#1369a1" width="45"&gt;&lt;b&gt;AGENCIA&lt;/b&gt;&lt;/td&gt; &lt;td bgcolor="#1369a1" width="45"&gt;&lt;b&gt;CONTA&lt;/b&gt;&lt;/td&gt; &lt;td bgcolor="#1369a1"&gt;&lt;b&gt;VALOR em R$&lt;/b&gt;&lt;/td&gt; &lt;/tr&gt; '.$lista_individual.' &lt;/table&gt; &lt;br&gt; &lt;br&gt; &lt;table width="100%" border="0" cellpadding="1" cellspacing="1" bgcolor="#333333"&gt; &lt;tr&gt; &lt;td bgcolor="#ffffff" height="30" colspan="3" align="center"&gt;&lt;b style="font-size: 16px;"&gt;SUBTOTAL&lt;/b&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr style="color: #ffffff !important;"&gt; &lt;td bgcolor="#1369a1" width="45" height="20"&gt;&lt;b&gt;CHAPA&lt;/b&gt;&lt;/td&gt; &lt;td bgcolor="#1369a1"&gt;&lt;b&gt;NOME&lt;/b&gt;&lt;/td&gt; &lt;td bgcolor="#1369a1" width="130"&gt;&lt;b&gt;SUBTOTAL em R$&lt;/b&gt;&lt;/td&gt; &lt;/tr&gt; '.$lista_subtotal.' &lt;tr&gt; &lt;td bgcolor="#c8e5f7" colspan="2" align="center" height="20"&gt;&lt;b style="font-size: 16px;"&gt;TOTAL&lt;/b&gt;&lt;/td&gt; &lt;td bgcolor="#c8e5f7" width="130"&gt;&lt;b&gt;'.number_format($lista_total,2,',','.').'&lt;/b&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;br&gt; &lt;br&gt; &lt;table width="100%" border="0" cellpadding="1" cellspacing="1" bgcolor="#333333"&gt; &lt;tr&gt; &lt;td bgcolor="#1369a1" width="50%" height="20" align="center" style="color: white; font-size: 12px;"&gt;TOTAL BANCO SANTANDER - 033&lt;/td&gt; &lt;td bgcolor="#1369a1" width="50%" align="center" style="color: white; font-size: 12px;"&gt;TOTAL OUTROS BANCOS&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td bgcolor="#ffffff" height="20" align="center" &gt;&lt;b&gt;'.number_format($tot_santander, 2 , ',', '.').'&lt;/b&gt;&lt;/td&gt; &lt;td bgcolor="#ffffff" align="center"&gt;&lt;b&gt;'.number_format($tot_qualquerbanco, 2 , ',', '.').'&lt;/b&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; '; $dompdf-&gt;load_html(utf8_encode($html)); $dompdf-&gt;render(); $dompdf-&gt;stream( "saida.pdf", array( "Attachment" =&gt; false ) ); </code></pre> <p>Is there a way to optimize time? PDF with few pages works normally but in PDF with many pages DOMPDF returns this error in the browser...</p> <p>I'm trying to search for a solution all over the internet, but none worked. I tried to increase <code>set_time_limit</code> but it did not work either.</p> </div>

why only catch the first Exception of f(0)

// exceptions/Ex9.java // TIJ4 Chapter Exceptions, Exercise 9, page 460 /* Create three new types of exceptions. Write a class with a method that * throws all three. In main(), call the method but only use a single catch * clause that will catch all three types of exceptions. */ //import static net.mindview.util.Print.*; class ExceptionA extends Exception { ExceptionA(String msg) { super(msg); } } class ExceptionB extends Exception { ExceptionB(String msg) { super(msg); } } class ExceptionC extends Exception { ExceptionC(String msg) { super(msg); } } public class Ex9 { public static void f(int x) throws ExceptionA, ExceptionB, ExceptionC { if(x < 0) throw new ExceptionA("x < 0"); if(x == 0) throw new ExceptionB("x == 0"); if(x > 0) throw new ExceptionC("x > 0"); } public static void main(String[] args) { try { f(0); f(1); f(-1); // will catch any Exception type: } catch(Exception e) { System.out.println("Caught Exception"); e.printStackTrace(System.out); } } }

proftpd+mysql 安装报异常求助

mysql 通过rpm安装 MySQL-client-5.5.37-1.linux2.6.x86_64.rpm MySQL-devel-5.5.46-1.linux2.6.x86_64.rpm MySQL-server-5.5.37-1.linux2.6.x86_64.rpm 安装proftpd时在make时包异常 配置为./configure --with-modules=mod_sql:mod_sql_mysql:mod_quotatab:mod_quotatab_sql --with-includes=/usr/include/mysql --with-libraries=/usr/lib64/mysql make 异常为 /usr/lib64/mysql//libmysqlclient.a(my_thr_init.c.o): In function `my_thread_init': /pb2/build/sb_0-16513225-1442594820.66/rpm/BUILD/mysql-5.5.46/mysql-5.5.46/mysys/my_thr_init.c:324: undefined reference to `pthread_getspecific' /pb2/build/sb_0-16513225-1442594820.66/rpm/BUILD/mysql-5.5.46/mysql-5.5.46/mysys/my_thr_init.c:342: undefined reference to `pthread_setspecific' /usr/lib64/mysql//libmysqlclient.a(my_thr_init.c.o): In function `my_thread_global_reinit': /pb2/build/sb_0-16513225-1442594820.66/rpm/BUILD/mysql-5.5.46/mysql-5.5.46/mysys/my_thr_init.c:115: undefined reference to `pthread_getspecific' /usr/lib64/mysql//libmysqlclient.a(my_thr_init.c.o): In function `my_thread_global_init': /pb2/build/sb_0-16513225-1442594820.66/rpm/BUILD/mysql-5.5.46/mysql-5.5.46/mysys/my_thr_init.c:154: undefined reference to `pthread_mutexattr_init' /pb2/build/sb_0-16513225-1442594820.66/rpm/BUILD/mysql-5.5.46/mysql-5.5.46/mysys/my_thr_init.c:155: undefined reference to `pthread_mutexattr_settype' /pb2/build/sb_0-16513225-1442594820.66/rpm/BUILD/mysql-5.5.46/mysql-5.5.46/mysys/my_thr_init.c:163: undefined reference to `pthread_mutexattr_init' /pb2/build/sb_0-16513225-1442594820.66/rpm/BUILD/mysql-5.5.46/mysql-5.5.46/mysys/my_thr_init.c:164: undefined reference to `pthread_mutexattr_settype' /pb2/build/sb_0-16513225-1442594820.66/rpm/BUILD/mysql-5.5.46/mysql-5.5.46/mysys/my_thr_init.c:168: undefined reference to `pthread_key_create' /pb2/build/sb_0-16513225-1442594820.66/rpm/BUILD/mysql-5.5.46/mysql-5.5.46/mysys/my_thr_init.c:205: undefined reference to `pthread_create' /pb2/build/sb_0-16513225-1442594820.66/rpm/BUILD/mysql-5.5.46/mysql-5.5.46/mysys/my_thr_init.c:207: undefined reference to `pthread_join' /usr/lib64/mysql//libmysqlclient.a(my_thr_init.c.o): In function `my_thread_global_end': /pb2/build/sb_0-16513225-1442594820.66/rpm/BUILD/mysql-5.5.46/mysql-5.5.46/mysys/my_thr_init.c:261: undefined reference to `pthread_key_delete' /pb2/build/sb_0-16513225-1442594820.66/rpm/BUILD/mysql-5.5.46/mysql-5.5.46/mysys/my_thr_init.c:263: undefined reference to `pthread_mutexattr_destroy' /pb2/build/sb_0-16513225-1442594820.66/rpm/BUILD/mysql-5.5.46/mysql-5.5.46/mysys/my_thr_init.c:266: undefined reference to `pthread_mutexattr_destroy' /usr/lib64/mysql//libmysqlclient.a(my_thr_init.c.o): In function `my_thread_end': /pb2/build/sb_0-16513225-1442594820.66/rpm/BUILD/mysql-5.5.46/mysql-5.5.46/mysys/my_thr_init.c:380: undefined reference to `pthread_getspecific' /pb2/build/sb_0-16513225-1442594820.66/rpm/BUILD/mysql-5.5.46/mysql-5.5.46/mysys/my_thr_init.c:427: undefined reference to `pthread_setspecific' /usr/lib64/mysql//libmysqlclient.a(my_thr_init.c.o): In function `_my_thread_var': /pb2/build/sb_0-16513225-1442594820.66/rpm/BUILD/mysql-5.5.46/mysql-5.5.46/mysys/my_thr_init.c:432: undefined reference to `pthread_getspecific' /usr/lib64/mysql//libmysqlclient.a(thr_mutex.c.o): In function `my_pthread_fastmutex_lock': /pb2/build/sb_0-16513225-1442594820.66/rpm/BUILD/mysql-5.5.46/mysql-5.5.46/mysys/thr_mutex.c:481: undefined reference to `pthread_mutex_trylock' /usr/lib64/mysql//libmysqlclient.a(charset.c.o): In function `get_charset_name': /pb2/build/sb_0-16513225-1442594820.66/rpm/BUILD/mysql-5.5.46/mysql-5.5.46/mysys/charset.c:533: undefined reference to `pthread_once' /usr/lib64/mysql//libmysqlclient.a(charset.c.o): In function `get_charset_number': /pb2/build/sb_0-16513225-1442594820.66/rpm/BUILD/mysql-5.5.46/mysql-5.5.46/mysys/charset.c:522: undefined reference to `pthread_once' /usr/lib64/mysql//libmysqlclient.a(charset.c.o): In function `get_charset_by_csname': /pb2/build/sb_0-16513225-1442594820.66/rpm/BUILD/mysql-5.5.46/mysql-5.5.46/mysys/charset.c:644: undefined reference to `pthread_once' /usr/lib64/mysql//libmysqlclient.a(charset.c.o): In function `get_charset': /pb2/build/sb_0-16513225-1442594820.66/rpm/BUILD/mysql-5.5.46/mysql-5.5.46/mysys/charset.c:597: undefined reference to `pthread_once' /usr/lib64/mysql//libmysqlclient.a(charset.c.o): In function `get_collation_number': /pb2/build/sb_0-16513225-1442594820.66/rpm/BUILD/mysql-5.5.46/mysql-5.5.46/mysys/charset.c:484: undefined reference to `pthread_once' /usr/lib64/mysql//libmysqlclient.a(charset.c.o):/pb2/build/sb_0-16513225-1442594820.66/rpm/BUILD/mysql-5.5.46/mysql-5.5.46/mysys/charset.c:619: more undefined references to `pthread_once' follow collect2: ld returned 1 exit status make: *** [proftpd] Error 1

致命错误:未捕获错误:在第27行的C:\ cont_search.php中调用boolean上的成员函数execute()

<div class="post-text" itemprop="text"> <p>How to search from two table and query execute and bind to form json array to pass</p> <p>cont_search.php</p> <pre><code> &lt;?php include "connection.php"; $keyword=$_GET["context"]; //Checking if any error occured while connecting if (mysqli_connect_errno()) { echo "Failed to connect to MySQL: " . mysqli_connect_error(); die(); } $query =$conn-&gt;prepare("(SELECT isbn, title, authors, accession, publisher, pubyear, pages, keywords, subheadings, booknote, rak, hr, vr, status, 'book' as type FROM books WHERE title LIKE '%".$keyword."%' OR authors LIKE '%".$keyword."%' OR publisher LIKE '%".$keyword."%' OR pubyear LIKE '%".$keyword."%' OR keywords LIKE '%".$keyword."%' OR subheadings LIKE '%".$keyword."%' OR booknote LIKE '%".$keyword."%') UNION ALL (SELECT t_acc, t_title, t_author, t_university, t_puby, t_keywords, t_rak, t_hr, t_vr, t_status, 'thesis' as type FROM thesis WHERE t_title LIKE '%".$keyword."%' OR t_author LIKE '%".$keyword."%' OR t_university LIKE '%".$keyword."%' OR t_puby LIKE '%".$keyword."%' OR t_keywords LIKE '%".$keyword."%')"); echo "Error: " . $query . "&lt;br&gt;" . $conn-&gt;error; $query-&gt;execute(); $query-&gt;bind_result($isbn, $title, $authors, $accession, $publisher, $pubyear, $pages, $key, $sub, $bkn, $rak, $hr, $vr, $status, $tacc, $ttile, $tauthor, $tuni, $tpuby, $tkey, $trak, $thr, $tvr, $tstatus); $books = array(); $data =array(); //traversing through all the result while($query-&gt;fetch()){ $temp = array(); $temp['isbn'] = $isbn; $temp['title'] = $title; $temp['authors'] = $authors; $temp['accession'] = $accession; $temp['publisher'] = $publisher; $temp['pubyear'] = $pubyear; $temp['pages'] = $pages; $temp['keywords'] = $key; $temp['subheadings'] = $sub; $temp['booknote'] = $bkn; $temp['rak'] = $rak; $temp['hr'] = $hr; $temp['vr'] = $vr; $temp['status'] = $status; $temp['t_acc'] = $tacc; $temp['t_title'] = $ttile; $temp['t_author'] = $tauthor; $temp['t_university'] = $tuni; $temp['t_puby'] = $tpuby; $temp['t_keywords'] = $tkey; $temp['t_rak'] = $trak; $temp['t_hr'] = $thr; $temp['t_vr'] = $tvr; $temp['t_status'] = $tstatus; array_push($data, $temp); } $books['ss'] = true; //ss=send status $books['search'] = $data; //displaying the result in json format header('Access-Control-Allow-Origin: *'); header('Content-type:application/json;charset=utf-8'); echo json_encode($books); ?&gt; </code></pre> <blockquote> <p><a href="http://localhost/cont_search.php?context=english" rel="nofollow noreferrer">http://localhost/cont_search.php?context=english</a></p> <p>I execute/run above query and error occur</p> <p>Error: The used SELECT statements have a different number of columns</p> <p>Fatal error: Uncaught Error: Call to a member function execute() on boolean in C:\cont_search.php</p> </blockquote> </div>

simulink 运行时报错:Assignment of complex data to noncomplex data

我用了MATLAB function 模块来实现小波降噪,下面是程序: function y = fcn(u) %#codegen coder.extrinsic('wavedec'); coder.extrinsic('wnoisest'); coder.extrinsic('ddencmp'); coder.extrinsic('wdencmp'); y=0; xiaobo=0; thr=0.0000;thrs=0; x=u; %使用db24小波,做8层分解 wname='bior2.6';lev=8; [c,l]=wavedec(x,lev,wname); sigma=wnoisest(c,l,1); alpha=2; [thr,sorh,keepapp]=ddencmp('den','wp',x); thrs=thr+1; xiaobo=wdencmp('gbl',c,l,wname,lev,thrs,'s',1); y = xiaobo; 不知道为什么就会一直在报这个错,workspace显示thr=6.5700啊 这是复杂数么? 求教各位大神!!!!! --------------------------------------------------------------------------------------------- 我试了试把小波包的‘wp’改成小波的wv就好了,但是有人知道为什么么。 还有一点,我用fromfile输入一个二维的信号,第一行是时间,第二行是幅值,输进我设计的MATLAB FUNCTION 这个方法行得通么

springboot hibernate整合问题

在一个service方法中调用sessionFactory.getCurrentSession()的时候报如下异常Could not obtain transaction-synchronized Session for current thread 网上查询报错原因是说必须加@Transactional(readOnly = true),按说明加确实是可以解决。但是这个service方法仅仅是一个查询,不想用事务方式,能否在不写@Transactional(readOnly = true)情况下正常获取session,并进行查询。不想为每个查询service都加@Transactional(readOnly = true), 也不想用openSession方式。 非常感谢,如解决追加分数

android开发,遇到了Fatal signal 11 (SIGSEGV)

具体报错是 Fatal signal 11 (SIGSEGV) at 0x000000000 (code=1), thread 5761 public class MainActivity extends Activity implements OnGestureListener { ViewFlipper flipper; GestureDetector detector; Animation[] animations=new Animation[4]; final int FLIP_DISTANCE=50; @Override public void onCreate(Bundle savedInstanceState){ super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); detector=new GestureDetector(this, this); flipper=(ViewFlipper)findViewById(R.id.flipper); flipper.addView(addImageView(R.drawable.xjf1)); flipper.addView(addImageView(R.drawable.xjf2)); flipper.addView(addImageView(R.drawable.xjf3)); flipper.addView(addImageView(R.drawable.xjf4)); flipper.addView(addImageView(R.drawable.xjf5)); animations[0]=AnimationUtils.loadAnimation(this, R.anim.left_in); animations[1]=AnimationUtils.loadAnimation(this,R.anim.left_out); animations[2]=AnimationUtils.loadAnimation(this,R.anim.right_in); animations[3]=AnimationUtils.loadAnimation(this,R.anim.right_out); } private View addImageView(int resId) { // TODO Auto-generated method stub ImageView imageView=new ImageView(this); imageView.setImageResource(resId); imageView.setScaleType(ImageView.ScaleType.CENTER); return imageView; } @Override public boolean onTouchEvent(MotionEvent event){ return detector.onTouchEvent(event); } @Override public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) { // TODO Auto-generated method stub if(e1.getX()-e2.getX()>FLIP_DISTANCE){ flipper.setInAnimation(animations[0]); flipper.setOutAnimation(animations[1]); flipper.showPrevious(); return true; }else if(e2.getX()-e1.getX()>FLIP_DISTANCE){ flipper.setInAnimation(animations[2]); flipper.setOutAnimation(animations[3]); flipper.showNext(); return true; } return false; } } 这是主要代码,实现的是用手势切换图片,在手机上就会报以上错误,但是在我的平板上可以正常运行,貌似和内存有点关系

JavaScript上的ajax中请求的资源上没有“Access-Control-Allow-Origin”标头[duplicate]

<div class="post-text" itemprop="text"> <div class="question-status question-originals-of-duplicate"> <p>This question already has an answer here:</p> <ul> <li> <a href="/questions/15005500/loading-cross-domain-endpoint-with-jquery-ajax" dir="ltr">Loading cross-domain endpoint with jQuery AJAX</a> <span class="question-originals-answer-count"> 9 answers </span> </li> <li> <a href="/questions/14681292/same-origin-policy-and-cors-cross-origin-resource-sharing" dir="ltr">Same origin Policy and CORS (Cross-origin resource sharing)</a> <span class="question-originals-answer-count"> 2 answers </span> </li> <li> <a href="/questions/20035101/why-does-my-javascript-code-get-a-no-access-control-allow-origin-header-is-pr" dir="ltr">Why does my JavaScript code get a “No 'Access-Control-Allow-Origin' header is present on the requested resource” error when Postman does not?</a> <span class="question-originals-answer-count"> 44 answers </span> </li> </ul> </div> <p>I am currently working on a <code>spring project</code>, and I am designating <code>uri</code> using a page controller. We need to use <code>uri short API</code> now. There is a problem. The way that we're doing it is <code>PHP</code>. But I have to use the code in <code>JavaScript</code>. </p> <p>I tried this code.</p> <pre class="lang-js prettyprint-override"><code> data = {}; data.key = "ehelkhej45jjb38h6f5234234hg"; data.short = "www.google.com"; data.name = "googleuri" $.ajax({ url : "https://cutt.ly/api/api.php", type : "POST", dataType : "json", beforeSend : function(xhr){ xhr.setRequestHeader("Access-Control-Allow-Origin", "*"); xhr.setRequestHeader("Content-type","application/x-www-form-urlencoded"); }, data : data, success : function(result) { console.log(result); } }); </code></pre> <p>This has caused me an error.</p> <blockquote> <p>Access to XMLHttpRequest at '<a href="https://cutt.ly/api/api.php" rel="nofollow noreferrer">https://cutt.ly/api/api.php</a>' from origin '<a href="http://localhost:11000" rel="nofollow noreferrer">http://localhost:11000</a>' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. jquery-1.9.1.js:8526 POST <a href="https://cutt.ly/api/api.php" rel="nofollow noreferrer">https://cutt.ly/api/api.php</a> net::ERR_FAILED</p> </blockquote> <p>I could tried <code>Postman</code></p> <p><a href="https://i.stack.imgur.com/98F9o.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/98F9o.png" alt="postman"></a></p> <p>When I first called this, the <code>body</code> was empty and <code>status : 500Internal Server Error</code>. But when I call again, I get a <code>response</code> like a picture.</p> <p>And I could tried <code>GET</code> and <code>jsonp</code> but it was Blocked</p> <pre class="lang-js prettyprint-override"><code> $.ajax({ url : "https://cutt.ly/api/api.php", type : "GET", dataType : "jsonp", data : data, success : function(result) { console.log(result); } }); </code></pre> <p><strong>Block ERROR</strong></p> <blockquote> <p>jquery-1.9.1.js:8336 Cross-Origin Read Blocking (CORB) blocked cross-origin response <a href="https://cutt.ly/api/api.php?callback=jQuery191049576531804679713_1565245716711&amp;key=ehelkhej45jjb38h6f5234234hg&amp;short=www.google.com&amp;name=googleuri&amp;_=1565245716712" rel="nofollow noreferrer">https://cutt.ly/api/api.php?callback=jQuery191049576531804679713_1565245716711&amp;key=ehelkhej45jjb38h6f5234234hg&amp;short=www.google.com&amp;name=googleuri&amp;_=1565245716712</a> with MIME type text/html. See <a href="https://www.chromestatus.com/feature/5629709824032768" rel="nofollow noreferrer">https://www.chromestatus.com/feature/5629709824032768</a> for more details.</p> </blockquote> <p>What I've tried. It was worked. But it is error</p> <blockquote> <p>GET <a href="http://cors-anywhere.herokuapp.com/https://cutt.ly/api/api.php?key=ehelkhej45jjb38h6f5234234hg&amp;short=redisgate.kr&amp;name=redisgate" rel="nofollow noreferrer">http://cors-anywhere.herokuapp.com/https://cutt.ly/api/api.php?key=ehelkhej45jjb38h6f5234234hg&amp;short=redisgate.kr&amp;name=redisgate</a> 500 (Internal Server Error)</p> </blockquote> <pre class="lang-js prettyprint-override"><code>var options = "https://cutt.ly/api/api.php?key=ehelkhej45jjb38h6f5234234hg&amp;short=www.google.com&amp;name=googleuri" $.ajaxPrefilter( function (options) { if (options.crossDomain &amp;&amp; jQuery.support.cors) { var http = (window.location.protocol === 'http:' ? 'http:' : 'https:'); options.url = http + '//cors-anywhere.herokuapp.com/' + options.url; } }); $.get( options, function (response) { console.log("&gt; ", response); }); </code></pre> <p><a href="https://cutt.ly/cuttly-api" rel="nofollow noreferrer">This link</a> is the link that has API usage. How can you solve this problem?</p> </div>

Eclipse中调用javax.swing的问题

import javax.swing.JOptionPane; public class Displayunicode { } 如上,javax.swing.JOptionPane;会显示红色波浪线,报错提示为 Access restriction: The type JOptionPane is not accessible due to restriction on required library E:\Program Files\Java\jre8\lib\rt.jar Displayunicode.java /practise/src/practise line 2 Java Problem 但什么环境变量都配置对了啊,IDE是Eclipse最新版本的啊,java版本也是最新的,求解这是为什么啊?

newFixedThreadPool例子无法运行求解

@Test public void test1() { ExecutorService fixedThreadPool = Executors.newFixedThreadPool(3); for (int i = 0; i < 10; i++) { final int index = i; fixedThreadPool.execute(new Runnable() { @Override public void run() { try { System.out.println(index); Thread.sleep(2000); } catch (Exception e) { e.printStackTrace(); } } }); } } 以上是我在别的博客找到的例子,但是这个例子无法实现“每2秒打印3个数字”这个效果。前三个线程被执行,但是后面加入的都不行。for并没有被阻塞。

SIFT算法如何修改阈值

SIFT的代码中如何修改阈值呢,如何调用opencv中已有的函数来修改阈值。 contr_thr和 curv_thr

jboss-EAP启动上下文的问题

16:17:55,489 ERROR [org.jboss.as.server] (management-handler-thread - 6) JBAS015 870: 部署 "itoo-basic-teacher-ear-full.ear" 的部署被回滚并带有下列错误消息: {"JBAS014671: 失败的服务" => {"jboss.web.deployment.default-host./itoo-basic-tea cher-web" => "org.jboss.msc.service.StartException in service jboss.web.deployme nt.default-host./itoo-basic-teacher-web: org.jboss.msc.service.StartException in anonymous service: JBAS018040: 启动上下文失败 Caused by: org.jboss.msc.service.StartException in anonymous service: JBAS01 8040: 启动上下文失败"}} 16:17:55,596 INFO [org.jboss.as.jpa] (ServerService Thread Pool -- 80) JBAS0114 03: 停止 Persistence Unit 服务 'itoo-basic-teacher-ear-full.ear/itoo-excelV2.0-a pi.jar#MT_HOTEL_SERVICE' 16:17:55,599 INFO [org.jboss.as.jpa] (ServerService Thread Pool -- 71) JBAS0114 03: 停止 Persistence Unit 服务 'itoo-basic-teacher-ear-full.ear/itoo-basic-teach er-web.war#MT_HOTEL_SERVICE' 16:17:55,598 INFO [org.jboss.as.jpa] (ServerService Thread Pool -- 81) JBAS0114 03: 停止 Persistence Unit 服务 'itoo-basic-teacher-ear-full.ear/itoo-basic-api.j ar#MT_HOTEL_SERVICE' 16:17:55,597 INFO [org.jboss.as.jpa] (ServerService Thread Pool -- 65) JBAS0114 03: 停止 Persistence Unit 服务 'itoo-basic-teacher-ear-full.ear/itoo-authority-a pi.jar#MT_HOTEL_SERVICE' 16:17:55,604 INFO [stdout] (ServerService Thread Pool -- 80) [EL Warning]: 2017 -03-05 16:17:55.603--Thread(Thread[ServerService Thread Pool -- 80,5,ServerServi ce ThreadGroup])--session_manager_no_partition 16:17:55,615 INFO [stdout] (ServerService Thread Pool -- 65) [EL Config]: 2017- 03-05 16:17:55.614--ServerSession(800566064)--Connection(1500604457)--Thread(Thr ead[ServerService Thread Pool -- 65,5,ServerService ThreadGroup])--disconnect 16:17:55,618 INFO [stdout] (ServerService Thread Pool -- 65) [EL Info]: 2017-03 -05 16:17:55.617--ServerSession(800566064)--Thread(Thread[ServerService Thread P ool -- 65,5,ServerService ThreadGroup])--/vfs:/D:/tools/jboss-eap-6.2-itoo4.0/bi n/content/itoo-basic-teacher-ear-full.ear/itoo-authority-api.jar/_MT_HOTEL_SERVI CE logout successful 16:17:55,622 INFO [stdout] (ServerService Thread Pool -- 65) [EL Warning]: 2017 -03-05 16:17:55.621--Thread(Thread[ServerService Thread Pool -- 65,5,ServerServi ce ThreadGroup])--session_manager_no_partition 16:17:55,625 INFO [stdout] (ServerService Thread Pool -- 81) [EL Config]: 2017- 03-05 16:17:55.624--ServerSession(171065381)--Connection(1423559114)--Thread(Thr ead[ServerService Thread Pool -- 81,5,ServerService ThreadGroup])--disconnect 16:17:55,627 INFO [stdout] (ServerService Thread Pool -- 81) [EL Info]: 2017-03 -05 16:17:55.627--ServerSession(171065381)--Thread(Thread[ServerService Thread P ool -- 81,5,ServerService ThreadGroup])--/vfs:/D:/tools/jboss-eap-6.2-itoo4.0/bi n/content/itoo-basic-teacher-ear-full.ear/itoo-basic-api.jar/_MT_HOTEL_SERVICE l ogout successful 16:17:55,630 INFO [stdout] (ServerService Thread Pool -- 81) [EL Warning]: 2017 -03-05 16:17:55.63--Thread(Thread[ServerService Thread Pool -- 81,5,ServerServic e ThreadGroup])--session_manager_no_partition 16:17:55,635 INFO [stdout] (ServerService Thread Pool -- 71) [EL Config]: 2017- 03-05 16:17:55.632--ServerSession(1481767078)--Connection(2138480062)--Thread(Th read[ServerService Thread Pool -- 71,5,ServerService ThreadGroup])--disconnect 16:17:55,637 INFO [stdout] (ServerService Thread Pool -- 71) [EL Info]: 2017-03 -05 16:17:55.637--ServerSession(1481767078)--Thread(Thread[ServerService Thread Pool -- 71,5,ServerService ThreadGroup])--/vfs:/D:/tools/jboss-eap-6.2-itoo4.0/b in/content/itoo-basic-teacher-ear-full.ear/itoo-basic-teacher-web.war/WEB-INF/li b/itoo-basic-api-0.0.2-SNAPSHOT.jar/_MT_HOTEL_SERVICE logout successful 16:17:55,640 INFO [stdout] (ServerService Thread Pool -- 71) [EL Warning]: 2017 -03-05 16:17:55.64--Thread(Thread[ServerService Thread Pool -- 71,5,ServerServic e ThreadGroup])--session_manager_no_partition 16:17:55,650 INFO [org.jboss.as.server.deployment] (MSC service thread 1-4) JBA S015877: Stopped deployment null (runtime-name: itoo-base.jar) in 159ms 16:17:55,653 INFO [org.jboss.as.server.deployment] (MSC service thread 1-4) JBA S015877: Stopped deployment null (runtime-name: itoo-excelV2.0-api.jar) in 162ms 16:17:55,653 INFO [org.jboss.as.server.deployment] (MSC service thread 1-8) JBA S015877: Stopped deployment null (runtime-name: itoo-basic-api.jar) in 162ms 16:17:55,652 INFO [org.jboss.as.server.deployment] (MSC service thread 1-6) JBA S015877: Stopped deployment null (runtime-name: itoo-basic-teacher-core.jar) in 161ms 16:17:55,651 INFO [org.jboss.as.server.deployment] (MSC service thread 1-1) JBA S015877: Stopped deployment null (runtime-name: itoo-authority-api.jar) in 160ms 16:17:55,659 INFO [org.jboss.as.server.deployment] (MSC service thread 1-2) JBA S015877: Stopped deployment null (runtime-name: itoo-tool.jar) in 168ms 16:17:55,654 INFO [org.jboss.as.server.deployment] (MSC service thread 1-3) JBA S015877: Stopped deployment null (runtime-name: itoo-cloud-api.jar) in 162ms 16:17:55,940 INFO [org.jboss.as.server.deployment] (MSC service thread 1-1) JBA S015877: Stopped deployment null (runtime-name: itoo-basic-teacher-web.war) in 4 48ms 16:17:56,046 INFO [org.jboss.as.server.deployment] (MSC service thread 1-1) JBA S015877: Stopped deployment itoo-basic-teacher-ear-full.ear (runtime-name: itoo- basic-teacher-ear-full.ear) in 557ms

下面代码有线程问题吗?

public class TestObject { private static int num = 0; public static int getNum(){ Thread th=Thread.currentThread(); try { th.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } if(num<100){ return num++; } if(num == 100){ num = 0; return 100; } return 0; } } ``` ``` public class MainObj { public static void main(String[] args) { Thread t = new Thread(new Thr()); Thread t1 = new Thread(new Thr()); t.start(); t1.start(); } } class Thr implements Runnable{ @Override public void run() { while (true) { int num = TestObject.getNum(); System.out.println(Thread.currentThread().getName()+":"+num); } } } ``` ```

Mongodb在java中,多线程update时报错,请问是哪里出现的问题?

``` public class LocationPressureTest { private Todo todo; private int number; static Mongo mg = new Mongo("localhost", 27017); static DB db = mg.getDB("location_pressure_test_db"); static DBCollection col = db.getCollection("location_pressure_test_col"); public interface Todo { public void doIt(); } public LocationPressureTest(int number, Todo todo) { this.number = number; this.todo = todo; } public void start() { for(int i = 0; i < number; i++) { new Thread(new Runnable() { @Override public void run() { while(true) { if(todo != null) { try { todo.doIt(); } catch (Throwable t) { t.printStackTrace(); break; } try { Thread.sleep(1000); } catch (InterruptedException e) { e.printStackTrace(); } } } } }).start(); } } /** * @param args */ public static void main(String[] args) { LocationPressureTest loadRunner = null; loadRunner = new LocationPressureTest(347, new Todo() { @Override public void doIt() { System.out.println(Thread.currentThread()); col.update(col.findOne(new BasicDBObject("_id", String.valueOf(Math .round(Math.random() * 5000000)))), new BasicDBObject("$set", new BasicDBObject("coordinates", new Double[] { Math.random() * 360 - 180, Math.random() * 360 - 180 }))); } }); loadRunner.start(); synchronized (loadRunner) { try { loadRunner.wait(); } catch (Exception e) { } } } } ``` **报错如下** ``` com.mongodb.MongoWaitQueueFullException: Too many threads are already waiting for a connection. Max number of threads (maxWaitQueueSize) of 50 has been exceeded. at com.mongodb.connection.DefaultConnectionPool.createWaitQueueFullException(DefaultConnectionPool.java:259) at com.mongodb.connection.DefaultConnectionPool.get(DefaultConnectionPool.java:87) at com.mongodb.connection.DefaultConnectionPool.get(DefaultConnectionPool.java:80) at com.mongodb.connection.DefaultServer.getConnection(DefaultServer.java:69) at com.mongodb.binding.ClusterBinding$ClusterBindingConnectionSource.getConnection(ClusterBinding.java:86) at com.mongodb.operation.OperationHelper.withConnectionSource(OperationHelper.java:182) at com.mongodb.operation.OperationHelper.withConnection(OperationHelper.java:175) at com.mongodb.operation.BaseWriteOperation.execute(BaseWriteOperation.java:105) at com.mongodb.operation.BaseWriteOperation.execute(BaseWriteOperation.java:57) at com.mongodb.Mongo.execute(Mongo.java:745) at com.mongodb.Mongo$2.execute(Mongo.java:728) at com.mongodb.DBCollection.executeWriteOperation(DBCollection.java:327) at com.mongodb.DBCollection.update(DBCollection.java:461) at com.mongodb.DBCollection.update(DBCollection.java:426) at com.mongodb.DBCollection.update(DBCollection.java:485) at com.mongodb.DBCollection.update(DBCollection.java:500) at load.LocationPressureTest$2.doIt(LocationPressureTest.java:68) at load.LocationPressureTest$1.run(LocationPressureTest.java:43) at java.lang.Thread.run(Unknown Source) ```

IDEA中如何把一个花括号的css格式化为一行

把这种变成下边一行的形式 ``` .hpro-thr { padding-left: 14% } .hpro-fou { padding-right: 0; padding-left: 17% } ``` ``` .hpro-thr{padding-left:14%} .hpro-fou{padding-right:0;padding-left:17%} ```

cmd中mysql的配置异常问题

我的mysql,在cmd命令中打不开,于是我用以下方法 1.找到配置文件my.ini  ,然后将其打开,可以选择用记事本打开 2.打开后,搜索mysqld关键字 找到后,在mysqld下面添加skip-grant-tables,保存退出。 3.保存后在控制面板服务里面重启mySQL 4.然后运行cmd 输入mysql -u root -p就可以不用密码登录了,出现password:的时候直接回车可以进入。 五 1.进入mysql数据库: mysql> use mysql;Database changed 2.给root用户设置新密码,蓝色部分自己输入:mysql> update user set password=password("123456") where user="root";Query OK, 1 rows affected (0.04 sec)Rows matched: 1 Changed: 1 Warnings: 0 3.刷新数据库mysql> flush privileges;Query OK, 0 rows affected (0.01 sec) 4.退出mysql:mysql> quitBye PS:123456为新密码,用户可根据自己需要修改成自己的密码; 6.改好之后,再修改一下my.ini这个文件,把我们刚才加入的"skip-grant-tables"这行删除,保存退出再重启mysql服务就可以了。 在第五大步的第2小步出现了问题 mysql> use mysql;Database changed Database changed -> mysql> update user set password=password("123456") where user="root";Query OK, 1 rows affected (0.04 sec)Rows matched: 1 Changed: 1 Warnings: 0 ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'Database changed mysql> update user set password=password("123456") where user="' at line 1 -> 这个错误不知道什么原因,求大神

hive启动问题,hiveserver2一直不启动

2015-09-22 16:50:55,690 INFO [main]: metastore.ObjectStore (ObjectStore.java:setConf(272)) - Initialized ObjectStore 2015-09-22 16:50:55,691 INFO [main]: metastore.HiveMetaStore (HiveMetaStore.java:logInfo(746)) - 0: get_databases: default 2015-09-22 16:50:55,691 INFO [main]: HiveMetaStore.audit (HiveMetaStore.java:logAuditEvent(371)) - ugi=hadoop ip=unknown-ip-addr cmd=get_databases: default 2015-09-22 16:50:55,701 INFO [main]: metastore.HiveMetaStore (HiveMetaStore.java:logInfo(746)) - 0: Shutting down the object store... 2015-09-22 16:50:55,702 INFO [main]: HiveMetaStore.audit (HiveMetaStore.java:logAuditEvent(371)) - ugi=hadoop ip=unknown-ip-addr cmd=Shutting down the object store... 2015-09-22 16:50:55,703 INFO [main]: metastore.HiveMetaStore (HiveMetaStore.java:logInfo(746)) - 0: Metastore shutdown complete. 2015-09-22 16:50:55,703 INFO [main]: HiveMetaStore.audit (HiveMetaStore.java:logAuditEvent(371)) - ugi=hadoop ip=unknown-ip-addr cmd=Metastore shutdown complete. 2015-09-22 16:50:55,703 INFO [main]: service.AbstractService (AbstractService.java:start(104)) - Service:ThriftBinaryCLIService is started. 2015-09-22 16:50:55,704 INFO [main]: service.AbstractService (AbstractService.java:start(104)) - Service:HiveServer2 is started. 2015-09-22 16:50:55,793 INFO [Thread-11]: thrift.ThriftCLIService (ThriftBinaryCLIService.java:run(98)) - Starting ThriftBinaryCLIService on port 10000 with 5...500 worker threads hiveserver2一直卡在启动ThriftBinaryCLIService是为什么?配置文件改了bind.host

关于 数据结构 线索二叉树的建立和实现

学习了严蔚敏的《数据结构》为了加深映像,把上面的代码自己敲了一遍。在VC6.0里,编译 和链接都通过了,但是没有办法运行,恳求各位高手和大师告诉我,哪里出问题了,我实在 是找不出来啊!!! #include "stdafx.h" #include <stdio.h> #include <stdlib.h> #include "math.h" typedef char TElemType; typedef enum PointerTag{Link,Thread}; typedef struct BiThrNode//建立线索二叉树的储存结构 { TElemType data; struct BiThrNode *lchild,*rchild; PointerTag LTag,RTag; }BiThrNode,*BiThrTree; BiThrTree pre;//定义的全局变量, void CreateBiTree(BiThrTree &T)//创建线索二叉树 { for(int i=1;i<7;++i) { char ch; scanf("%c",&ch); if(ch==' ') { T=NULL; } else { if(!(T=(BiThrNode*)malloc(sizeof(BiThrNode)))) { exit(OVERFLOW); } T->data=ch; CreateBiTree(T->lchild); CreateBiTree(T->rchild); } } } void InThreading(BiThrTree p)//中序遍历进行中序线索化 { if(p) { InThreading(p->lchild); if(!p->lchild) { p->LTag=Thread; p->lchild=pre; } if(!pre->rchild) { pre->RTag=Thread; pre->rchild=p; } pre=p; InThreading(p->rchild); } } void InOrderThreading(BiThrTree &Thrt,BiThrTree T)//建立头结点,中序线索化二叉树 { if(!(Thrt=(BiThrTree)malloc(sizeof(BiThrNode)))) exit(OVERFLOW); Thrt->LTag=Link; Thrt->RTag=Thread; Thrt->rchild=Thrt; if(!T) T->lchild=Thrt; else { Thrt->lchild=T; pre=Thrt; InThreading(T); pre->rchild=Thrt; pre->RTag=Thread; Thrt->rchild=pre; } } int InOrderTraverse_Thr(BiThrTree T)//中序遍历线索二叉树 { BiThrTree p; p=T->lchild; while(p!=T) { while(p) p=p->lchild; if(p->data) return 0; while(p->RTag==Thread&&p->rchild!=T) { p=p->rchild; printf("%c",p->data); } p=p->rchild; } return 1; } int main(int argc, char* argv[]) { BiThrTree T; BiThrTree Thr; printf("请输入前序二叉树的内容;\n"); CreateBiTree(T); //建立二叉树 InOrderThreading(T,T); //加入头结点,并线索化 printf("输出中序二叉树的内容:\n"); InOrderTraverse_Thr(T); printf("\n"); return 0; }

软件测试入门、SQL、性能测试、测试管理工具

软件测试2小时入门,让您快速了解软件测试基本知识,有系统的了解; SQL一小时,让您快速理解和掌握SQL基本语法 jmeter性能测试 ,让您快速了解主流来源性能测试工具jmeter 测试管理工具-禅道,让您快速学会禅道的使用,学会测试项目、用例、缺陷的管理、

计算机组成原理实验教程

西北工业大学计算机组成原理实验课唐都仪器实验帮助,同实验指导书。分为运算器,存储器,控制器,模型计算机,输入输出系统5个章节

Java 最常见的 200+ 面试题:面试必备

这份面试清单是从我 2015 年做了 TeamLeader 之后开始收集的,一方面是给公司招聘用,另一方面是想用它来挖掘在 Java 技术栈中,还有那些知识点是我不知道的,我想找到这些技术盲点,然后修复它,以此来提高自己的技术水平。虽然我是从 2009 年就开始参加编程工作了,但我依旧觉得自己现在要学的东西很多,并且学习这些知识,让我很有成就感和满足感,那所以何乐而不为呢? 说回面试的事,这份面试...

winfrom中嵌套html,跟html的交互

winfrom中嵌套html,跟html的交互,源码就在里面一看就懂,很简单

玩转Python-Python3基础入门

总课时80+,提供源码和相关资料 本课程从Python零基础到纯Python项目实战。内容详细,案例丰富,覆盖了Python知识的方方面面,学完后不仅对Python知识有个系统化的了解,让你从Python小白变编程大牛! 课程包含: 1.python安装 2.变量、数据类型和运算符 3.选择结构 4.循环结构 5.函数和模块 6.文件读写 7.了解面向对象 8.异常处理

程序员的兼职技能课

获取讲师答疑方式: 在付费视频第一节(触摸命令_ALL)片头有二维码及加群流程介绍 限时福利 原价99元,今日仅需39元!购课添加小助手(微信号:itxy41)按提示还可领取价值800元的编程大礼包! 讲师介绍: 苏奕嘉&nbsp;前阿里UC项目工程师 脚本开发平台官方认证满级(六级)开发者。 我将如何教会你通过【定制脚本】赚到你人生的第一桶金? 零基础程序定制脚本开发课程,是完全针对零脚本开发经验的小白而设计,课程内容共分为3大阶段: ①前期将带你掌握Q开发语言和界面交互开发能力; ②中期通过实战来制作有具体需求的定制脚本; ③后期将解锁脚本的更高阶玩法,打通任督二脉; ④应用定制脚本合法赚取额外收入的完整经验分享,带你通过程序定制脚本开发这项副业,赚取到你的第一桶金!

HoloLens2开发入门教程

本课程为HoloLens2开发入门教程,讲解部署开发环境,安装VS2019,Unity版本,Windows SDK,创建Unity项目,讲解如何使用MRTK,编辑器模拟手势交互,打包VS工程并编译部署应用到HoloLens上等。

基于VHDL的16位ALU简易设计

基于VHDL的16位ALU简易设计,可完成基本的加减、带进位加减、或、与等运算。

MFC一站式终极全套课程包

该套餐共包含从C小白到C++到MFC的全部课程,整套学下来绝对成为一名C++大牛!!!

利用Verilog实现数字秒表(基本逻辑设计分频器练习)

设置复位开关。当按下复位开关时,秒表清零并做好计时准备。在任何情况下只要按下复位开关,秒表都要无条件地进行复位操作,即使是在计时过程中也要无条件地进行清零操作。 设置启/停开关。当按下启/停开关后,将

董付国老师Python全栈学习优惠套餐

购买套餐的朋友可以关注微信公众号“Python小屋”,上传付款截图,然后领取董老师任意图书1本。

Python可以这样学(第一季:Python内功修炼)

董付国系列教材《Python程序设计基础》、《Python程序设计(第2版)》、《Python可以这样学》配套视频,讲解Python 3.5.x和3.6.x语法、内置对象用法、选择与循环以及函数设计与使用、lambda表达式用法、字符串与正则表达式应用、面向对象编程、文本文件与二进制文件操作、目录操作与系统运维、异常处理结构。

计算机操作系统 第三版.pdf

计算机操作系统 第三版 本书全面介绍了计算机系统中的一个重要软件——操作系统(OS),本书是第三版,对2001年出版的修订版的各章内容均作了较多的修改,基本上能反映当前操作系统发展的现状,但章节名称基

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

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

Vue.js 2.0之全家桶系列视频课程

基于新的Vue.js 2.3版本, 目前新全的Vue.js教学视频,让你少走弯路,直达技术前沿! 1. 包含Vue.js全家桶(vue.js、vue-router、axios、vuex、vue-cli、webpack、ElementUI等) 2. 采用笔记+代码案例的形式讲解,通俗易懂

微信公众平台开发入门

本套课程的设计完全是为初学者量身打造,课程内容由浅入深,课程讲解通俗易懂,代码实现简洁清晰。通过本课程的学习,学员能够入门微信公众平台开发,能够胜任企业级的订阅号、服务号、企业号的应用开发工作。 通过本课程的学习,学员能够对微信公众平台有一个清晰的、系统性的认识。例如,公众号是什么,它有什么特点,它能做什么,怎么开发公众号。 其次,通过本课程的学习,学员能够掌握微信公众平台开发的方法、技术和应用实现。例如,开发者文档怎么看,开发环境怎么搭建,基本的消息交互如何实现,常用的方法技巧有哪些,真实应用怎么开发。

150讲轻松搞定Python网络爬虫

【为什么学爬虫?】 &nbsp; &nbsp; &nbsp; &nbsp;1、爬虫入手容易,但是深入较难,如何写出高效率的爬虫,如何写出灵活性高可扩展的爬虫都是一项技术活。另外在爬虫过程中,经常容易遇到被反爬虫,比如字体反爬、IP识别、验证码等,如何层层攻克难点拿到想要的数据,这门课程,你都能学到! &nbsp; &nbsp; &nbsp; &nbsp;2、如果是作为一个其他行业的开发者,比如app开发,web开发,学习爬虫能让你加强对技术的认知,能够开发出更加安全的软件和网站 【课程设计】 一个完整的爬虫程序,无论大小,总体来说可以分成三个步骤,分别是: 网络请求:模拟浏览器的行为从网上抓取数据。 数据解析:将请求下来的数据进行过滤,提取我们想要的数据。 数据存储:将提取到的数据存储到硬盘或者内存中。比如用mysql数据库或者redis等。 那么本课程也是按照这几个步骤循序渐进的进行讲解,带领学生完整的掌握每个步骤的技术。另外,因为爬虫的多样性,在爬取的过程中可能会发生被反爬、效率低下等。因此我们又增加了两个章节用来提高爬虫程序的灵活性,分别是: 爬虫进阶:包括IP代理,多线程爬虫,图形验证码识别、JS加密解密、动态网页爬虫、字体反爬识别等。 Scrapy和分布式爬虫:Scrapy框架、Scrapy-redis组件、分布式爬虫等。 通过爬虫进阶的知识点我们能应付大量的反爬网站,而Scrapy框架作为一个专业的爬虫框架,使用他可以快速提高我们编写爬虫程序的效率和速度。另外如果一台机器不能满足你的需求,我们可以用分布式爬虫让多台机器帮助你快速爬取数据。 &nbsp; 从基础爬虫到商业化应用爬虫,本套课程满足您的所有需求! 【课程服务】 专属付费社群+每周三讨论会+1v1答疑

SEIR课程设计源码与相关城市数据.rar

SEIR结合学报与之前博客结合所做的一些改进,选择其中三个城市进行拟合仿真SEIR结合学报与之前博客结合所做的一些改进,选择其中三个城市进行拟合仿真SEIR结合学报与之前博客结合所做的一些改进,选择其

Python数据挖掘简易入门

&nbsp; &nbsp; &nbsp; &nbsp; 本课程为Python数据挖掘方向的入门课程,课程主要以真实数据为基础,详细介绍数据挖掘入门的流程和使用Python实现pandas与numpy在数据挖掘方向的运用,并深入学习如何运用scikit-learn调用常用的数据挖掘算法解决数据挖掘问题,为进一步深入学习数据挖掘打下扎实的基础。

2019 AI开发者大会

2019 AI开发者大会(AI ProCon 2019)是由中国IT社区CSDN主办的AI技术与产业年度盛会。多年经验淬炼,如今蓄势待发:2019年9月6-7日,大会将有近百位中美顶尖AI专家、知名企业代表以及千余名AI开发者齐聚北京,进行技术解读和产业论证。我们不空谈口号,只谈技术,诚挚邀请AI业内人士一起共铸人工智能新篇章!

Java面试题大全(2020版)

发现网上很多Java面试题都没有答案,所以花了很长时间搜集整理出来了这套Java面试题大全,希望对大家有帮助哈~ 本套Java面试题大全,全的不能再全,哈哈~ 一、Java 基础 1. JDK 和 JRE 有什么区别? JDK:Java Development Kit 的简称,java 开发工具包,提供了 java 的开发环境和运行环境。 JRE:Java Runtime Environ...

定量遥感中文版 梁顺林著 范闻捷译

这是梁顺林的定量遥感的中文版,由范闻捷等翻译的,是电子版PDF,解决了大家看英文费时费事的问题,希望大家下载看看,一定会有帮助的

GIS程序设计教程 基于ArcGIS Engine的C#开发实例

张丰,杜震洪,刘仁义编著.GIS程序设计教程 基于ArcGIS Engine的C#开发实例.浙江大学出版社,2012.05

人工智能-计算机视觉实战之路(必备算法+深度学习+项目实战)

系列课程主要分为3大阶段:(1)首先掌握计算机视觉必备算法原理,结合Opencv进行学习与练手,通过实际视项目进行案例应用展示。(2)进军当下最火的深度学习进行视觉任务实战,掌握深度学习中必备算法原理与网络模型架构。(3)结合经典深度学习框架与实战项目进行实战,基于真实数据集展开业务分析与建模实战。整体风格通俗易懂,项目驱动学习与就业面试。 建议同学们按照下列顺序来进行学习:1.Python入门视频课程 2.Opencv计算机视觉实战(Python版) 3.深度学习框架-PyTorch实战/人工智能框架实战精讲:Keras项目 4.Python-深度学习-物体检测实战 5.后续实战课程按照自己喜好选择就可以

三个项目玩转深度学习(附1G源码)

从事大数据与人工智能开发与实践约十年,钱老师亲自见证了大数据行业的发展与人工智能的从冷到热。事实证明,计算机技术的发展,算力突破,海量数据,机器人技术等,开启了第四次工业革命的序章。深度学习图像分类一直是人工智能的经典任务,是智慧零售、安防、无人驾驶等机器视觉应用领域的核心技术之一,掌握图像分类技术是机器视觉学习的重中之重。针对现有线上学习的特点与实际需求,我们开发了人工智能案例实战系列课程。打造:以项目案例实践为驱动的课程学习方式,覆盖了智能零售,智慧交通等常见领域,通过基础学习、项目案例实践、社群答疑,三维立体的方式,打造最好的学习效果。

微信小程序开发实战之番茄时钟开发

微信小程序番茄时钟视频教程,本课程将带着各位学员开发一个小程序初级实战类项目,针对只看过官方文档而又无从下手的开发者来说,可以作为一个较好的练手项目,对于有小程序开发经验的开发者而言,可以更好加深对小程序各类组件和API 的理解,为更深层次高难度的项目做铺垫。

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

最近面试了一个31岁8年经验的程序猿,让我有点感慨,大龄程序猿该何去何从。

去除异常值matlab程序

数据预处理中去除异常值的程序,matlab写成

用verilog HDL语言编写的秒表

在秒表设计中,分模块书写。用在七段数码管上显示。输入频率是1KHZ.可以显示百分秒,秒,分。如要显示小时,只需修改leds里的代码和主模块代码。改程序以通过硬件电路验证。完全正确。

[透视java——反编译、修补和逆向工程技术]源代码

源代码。

相关热词 c# 解析cad c#数字格式化万 c#int转byte c#格式化日期 c# wpf 表格 c# 实现ad域验证登录 c#心跳包机制 c#使用fmod.dll c#dll vb 调用 c# outlook
立即提问
相关内容推荐