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

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

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

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的错误。 在下很急,希望有人看到这个后能帮帮我。

调用 Ant api 出现Compile failed; see the compiler error output for details异常

[b][color=red][color=red][color=red]该方法是把d:/generator-output/hibernate/code/这个文件夹下的多个.java编译为.class文件[/color][/color][/color][/b] 但是出现Compile failed; see the compiler error output for details异常,希望大家帮忙解决,谢了 public boolean sourceConvertClass() { boolean flag = false; File f = new File("d:/generator-output/hibernate/code/"); // 找到所有的文件 File[] files = f.listFiles(); Javac compiler = new Javac(); File destFile = null; for (File file : files) { // 找出不含.java文件 if (file.getName().contains(".java")) { compiler.setProject(new Project()); // 编译后的.class文件存放的路径 destFile = new File("d:/generator-output/hibernate/code/"); destFile.mkdirs(); // 要编译的源文件目录 Path srcPath = new Path(compiler.getProject(), "d:/generator-output/hibernate/code/"); compiler.setFork(true); compiler.setSrcdir(srcPath); compiler.setDestdir(destFile); try { compiler.execute(); flag = true; } catch (BuildException e) { //System.out.println("编译.class文件出现错误"); } } } return flag; }

调用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>

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 这个方法行得通么

有大神知道这个job的异常吗

![图片说明](https://img-ask.csdn.net/upload/201907/10/1562752753_837230.jpg) 已知为类转换异常,但是具体的异常未知,发现强转的类是在一个jar包下

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方式。 非常感谢,如解决追加分数

Could not obtain transaction-synchronized Session

excel数据导入数据库的小逻辑,断点调试发现走了dao层的save方法,但是并没有sql语句输出,而且数据库也没有数据。用spring-test测试dao层的save方法报错org.hibernate.HibernateException: Could not obtain transaction-synchronized Session for current thread at org.springframework.orm.hibernate5.SpringSessionContext.currentSession(SpringSessionContext.java:132) at org.hibernate.internal.SessionFactoryImpl.getCurrentSession(SessionFactoryImpl.java:692) at com.balaiduo.tcm.dao.impl.HibernateDao.getCurrentSession(HibernateDao.java:13) at com.balaiduo.tcm.test.DaoTest.addEmploy(DaoTest.java:19) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47) at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12) at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44) at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17) at org.springframework.test.context.junit4.statements.RunBeforeTestMethodCallbacks.evaluate(RunBeforeTestMethodCallbacks.java:75) at org.springframework.test.context.junit4.statements.RunAfterTestMethodCallbacks.evaluate(RunAfterTestMethodCallbacks.java:86) at org.springframework.test.context.junit4.statements.SpringRepeat.evaluate(SpringRepeat.java:84) at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:254) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:89) at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238) at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63) at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236) at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53) at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229) at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61) at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:70) at org.junit.runners.ParentRunner.run(ParentRunner.java:309) at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:193) at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50) at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

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%} ```

java 里面,我使用了math下面sin方法,但是为什么以下两种参数出来的结果大大不同?下有代码

public class ClockTest { public ClockTest () { System.out.println(Math.round(500*Math.sin(30*Math.PI/180))) ; System.out.println(Math.round(500*Math.sin((1/6)*Math.PI))) ; } public static void main(String[] args) { // TODO Auto-generated method stub new ClockTest () ; } } 就是中间那两行println,按道理来说,两个出来的结果都是250,但是下面那个出来是0,真是奇怪

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

SIFT算法如何修改阈值

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

下面代码有线程问题吗?

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); } } } ``` ```

Servlet Request 如何通过mybatis进行搜索

各位大佬,本人自学小白求教 现在已得到 ``` String[] interest = req.getParameterValues("interest"); for (int i = 0; i < interest.length; i++) { System.out.println(interest[i]); } String date1 = req.getParameter("date1"); String date2 = req.getParameter("date2"); ``` 两个请求,然后怎么通过得到的请求传送给mapper.xml 进行sql搜索 sql语句是 ``` SELECT ch.pin, ch.checktime, us.badgenumber, us.name, us.defaultdeptid FROM checkinout ch LEFT JOIN userinfo us on ch.pin=us.badgenumber WHERE ch.checktime between '2019/04/01' AND '2019/04/30' AND us.defaultdeptid IN (3,4); ```

ubuntu 16.04 重启主机后,无线网卡需插拔后才可以使用,求老鸟们协查

最近在台式机上安装了ubuntu 16.04,搭配了 USB插口的TP LINK TL-WN823N 无线网卡。 幸运的是可以正常上网了 不幸的是,只要reboot重启主机,无线网卡就需要重新插拔才可以用。 但是冷启动的话,无线网卡就可以正常使用,就是有的时候会掉线。 以下是一些命令,应该是看内核和驱动的吧 root@work-PC:~# uname -r 4.10.0-33-generic root@work-PC:~# lsusb: root@work-PC:~# lsusb Bus 002 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 008 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 001 Device 002: ID 0bda:818b Realtek Semiconductor Corp. Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 004 Device 003: ID 03f0:0324 Hewlett-Packard SK-2885 keyboard Bus 004 Device 002: ID 046d:c014 Logitech, Inc. Corded Workstation Mouse Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub root@work-PC:~# root@work-PC:~# lsusb -t: root@work-PC:~# lsusb -t /: Bus 08.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M /: Bus 07.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M /: Bus 06.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M /: Bus 05.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M /: Bus 04.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M |__ Port 1: Dev 2, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M |__ Port 2: Dev 3, If 0, Class=Human Interface Device, Driver=usbhid, 1.5M /: Bus 03.Port 1: Dev 1, Class=root_hub, Driver=uhci_hcd/2p, 12M /: Bus 02.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/6p, 480M /: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=ehci-pci/6p, 480M |__ Port 2: Dev 2, If 0, Class=Vendor Specific Class, Driver=rtl8xxxu, 480M root@work-PC:~# root@work-PC:~# lsmod | grep 8192: root@work-PC:~# lsmod | grep 8192 snd_hda_core 81920 4 snd_hda_intel,snd_hda_codec,snd_hda_codec_generic,snd_hda_codec_realtek sudo dmesg | grep 8192: root@work-PC:~# sudo dmesg | grep 8192 [ 0.000000] setup_percpu: NR_CPUS:8192 nr_cpumask_bits:4 nr_cpu_ids:4 nr_node_ids:1 [ 0.000000] percpu: Embedded 36 pages/cpu @ffffa0f0bb600000 s107992 r8192 d31272 u524288 [ 0.000000] pcpu-alloc: s107992 r8192 d31272 u524288 alloc=1*2097152 [ 0.000000] RCU restricting CPUs from NR_CPUS=8192 to nr_cpu_ids=4. [ 12.031268] usb 1-2: rtl8192eu_parse_efuse: dumping efuse (0x200 bytes): [ 12.031371] usb 1-2: RTL8192EU rev B (SMIC) 2T2R, TX queues 3, WiFi=1, BT=0, GPS=0, HI PA=0 [ 12.031373] usb 1-2: RTL8192EU MAC: 30:b4:9e:84:1f:28 [ 12.031375] usb 1-2: rtl8xxxu: Loading firmware rtlwifi/rtl8192eu_nic.bin root@work-PC:~# root@work-PC:~# sudo iwconfig: root@work-PC:~# sudo iwconfig enp0s25 no wireless extensions. lo no wireless extensions. wlx30b49e841f28 IEEE 802.11 ESSID:off/any Mode:Managed Access Point: Not-Associated Tx-Power=20 dBm Retry short limit:7 RTS thr=2347 B Fragment thr:off Encryption key:off Power Management:off root@work-PC:~# root@work-PC:~#

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 -> 这个错误不知道什么原因,求大神

flutter Android配置时出现下面问题,死活解决不了,请大佬帮忙。。。。。

* Error running Gradle: ProcessException: Process "C:\Users\Downloads\fluttermusic\android\gradlew.bat" exited abnormally: > Configure project :app IOException: https://dl.google.com/android/repository/addons_list-3.xml java.io.IOException: Unable to tunnel through proxy. Proxy returns "HTTP/1.1 407 Proxy Authentication Required" IOException: https://dl.google.com/android/repository/addons_list-2.xml java.io.IOException: Unable to tunnel through proxy. Proxy returns "HTTP/1.1 407 Proxy Authentication Required" IOException: https://dl.google.com/android/repository/addons_list-1.xml java.io.IOException: Unable to tunnel through proxy. Proxy returns "HTTP/1.1 407 Proxy Authentication Required" Failed to download any source lists! java.io.IOException: Unable to tunnel through proxy. Proxy returns "HTTP/1.1 407 Proxy Authentication Required" FAILURE: Build failed with an exception. * Where: Build file 'C:\Users\F2846804\Downloads\fluttermusic\android\build.gradle' line: 32 * What went wrong: A problem occurred evaluating root project 'android'. > A problem occurred configuring project ':app'. > Failed to find Build Tools revision 28.0.3 * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. * Get more help at https://help.gradle.org BUILD FAILED in 1s Command: C:\Users\Downloads\fluttermusic\android\gradlew.bat app:properties Finished with error: Please review your Gradle project setup in the android/ folder.

使用ACE互斥锁进行线程同步,编译都没有问题,不加锁跑起来线程不同步很正常,加了锁,运行时崩溃

参数类: class Args { public: Args(int iterations):mutex_(), iterations_(iterations){} //初始化列表 ACE_Thread_Mutex mutex_; //锁对象 int iterations_; }; worker函数 void* worker (void * arguments) { //这里我没有用 iterations_,用全局变量number做了一个简单循环 Args *arg= (Args*) arguments; while (::number>0) { LOG_INFO("yes i can" << number); arg->mutex_.acquire(); //不加这个锁,number会错乱,加了锁,运行时崩溃 number -= 10; arg->mutex_.release(); } return NULL; } 主程序 int n_threads = 3; //定义即将新建的线程的线程ID和句柄 ACE_thread_t *threadID = new ACE_thread_t[n_threads+1]; ACE_hthread_t *threadHandles = new ACE_hthread_t[n_threads+1]; //启动线程组 if(ACE_Thread::spawn_n( threadID, //线程ID n_threads, //线程数 (ACE_THR_FUNC)worker, //线程执行的函数worker 0, //worker函数参数 THR_JOINABLE | THR_NEW_LWP, //flags ACE_DEFAULT_THREAD_PRIORITY, 0, 0, threadHandles)==-1) ACE_DEBUG((LM_DEBUG,"Error in spawning thread/n")); //等待所有线程运行结束 for(int i=0; i < n_threads; i++) { ACE_Thread::join(threadHandles[i]); }

在中国程序员是青春饭吗?

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

程序员请照顾好自己,周末病魔差点一套带走我。

程序员在一个周末的时间,得了重病,差点当场去世,还好及时挽救回来了。

和黑客斗争的 6 天!

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

搜狗输入法也在挑战国人的智商!

故事总是一个接着一个到来...上周写完《鲁大师已经彻底沦为一款垃圾流氓软件!》这篇文章之后,鲁大师的市场工作人员就找到了我,希望把这篇文章删除掉。经过一番沟通我先把这篇文章从公号中删除了...

总结了 150 余个神奇网站,你不来瞅瞅吗?

原博客再更新,可能就没了,之后将持续更新本篇博客。

副业收入是我做程序媛的3倍,工作外的B面人生是怎样的?

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

MySQL数据库面试题(2020最新版)

文章目录数据库基础知识为什么要使用数据库什么是SQL?什么是MySQL?数据库三大范式是什么mysql有关权限的表都有哪几个MySQL的binlog有有几种录入格式?分别有什么区别?数据类型mysql有哪些数据类型引擎MySQL存储引擎MyISAM与InnoDB区别MyISAM索引与InnoDB索引的区别?InnoDB引擎的4大特性存储引擎选择索引什么是索引?索引有哪些优缺点?索引使用场景(重点)...

如果你是老板,你会不会踢了这样的员工?

有个好朋友ZS,是技术总监,昨天问我:“有一个老下属,跟了我很多年,做事勤勤恳恳,主动性也很好。但随着公司的发展,他的进步速度,跟不上团队的步伐了,有点...

我入职阿里后,才知道原来简历这么写

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

优雅的替换if-else语句

场景 日常开发,if-else语句写的不少吧??当逻辑分支非常多的时候,if-else套了一层又一层,虽然业务功能倒是实现了,但是看起来是真的很不优雅,尤其是对于我这种有强迫症的程序"猿",看到这么多if-else,脑袋瓜子就嗡嗡的,总想着解锁新姿势:干掉过多的if-else!!!本文将介绍三板斧手段: 优先判断条件,条件不满足的,逻辑及时中断返回; 采用策略模式+工厂模式; 结合注解,锦...

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

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

2020阿里全球数学大赛:3万名高手、4道题、2天2夜未交卷

阿里巴巴全球数学竞赛( Alibaba Global Mathematics Competition)由马云发起,由中国科学技术协会、阿里巴巴基金会、阿里巴巴达摩院共同举办。大赛不设报名门槛,全世界爱好数学的人都可参与,不论是否出身数学专业、是否投身数学研究。 2020年阿里巴巴达摩院邀请北京大学、剑桥大学、浙江大学等高校的顶尖数学教师组建了出题组。中科院院士、美国艺术与科学院院士、北京国际数学...

男生更看重女生的身材脸蛋,还是思想?

往往,我们看不进去大段大段的逻辑。深刻的哲理,往往短而精悍,一阵见血。问:产品经理挺漂亮的,有点心动,但不知道合不合得来。男生更看重女生的身材脸蛋,还是...

程序员为什么千万不要瞎努力?

本文作者用对比非常鲜明的两个开发团队的故事,讲解了敏捷开发之道 —— 如果你的团队缺乏统一标准的环境,那么即使勤劳努力,不仅会极其耗时而且成果甚微,使用...

为什么程序员做外包会被瞧不起?

二哥,有个事想询问下您的意见,您觉得应届生值得去外包吗?公司虽然挺大的,中xx,但待遇感觉挺低,马上要报到,挺纠结的。

当HR压你价,说你只值7K,你该怎么回答?

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

面试:第十六章:Java中级开发(16k)

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

面试阿里p7,被按在地上摩擦,鬼知道我经历了什么?

面试阿里p7被问到的问题(当时我只知道第一个):@Conditional是做什么的?@Conditional多个条件是什么逻辑关系?条件判断在什么时候执...

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

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

大三实习生,字节跳动面经分享,已拿Offer

说实话,自己的算法,我一个不会,太难了吧

程序员垃圾简历长什么样?

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

《Oracle Java SE编程自学与面试指南》最佳学习路线图2020年最新版(进大厂必备)

正确选择比瞎努力更重要!

《Oracle Java SE编程自学与面试指南》最佳学习路线图(2020最新版)

正确选择比瞎努力更重要!

都前后端分离了,咱就别做页面跳转了!统统 JSON 交互

文章目录1. 无状态登录1.1 什么是有状态1.2 什么是无状态1.3 如何实现无状态1.4 各自优缺点2. 登录交互2.1 前后端分离的数据交互2.2 登录成功2.3 登录失败3. 未认证处理方案4. 注销登录 这是本系列的第四篇,有小伙伴找不到之前文章,松哥给大家列一个索引出来: 挖一个大坑,Spring Security 开搞! 松哥手把手带你入门 Spring Security,别再问密...

字节跳动面试官竟然问了我JDBC?

轻松等回家通知

面试官:你连SSO都不懂,就别来面试了

大厂竟然要考我SSO,卧槽。

阿里面试官让我用Zk(Zookeeper)实现分布式锁

他可能没想到,我当场手写出来了

终于,月薪过5万了!

来看几个问题想不想月薪超过5万?想不想进入公司架构组?想不想成为项目组的负责人?想不想成为spring的高手,超越99%的对手?那么本文内容是你必须要掌握的。本文主要详解bean的生命...

自从喜欢上了B站这12个UP主,我越来越觉得自己是个废柴了!

不怕告诉你,我自从喜欢上了这12个UP主,哔哩哔哩成为了我手机上最耗电的软件,几乎每天都会看,可是吧,看的越多,我就越觉得自己是个废柴,唉,老天不公啊,不信你看看…… 间接性踌躇满志,持续性混吃等死,都是因为你们……但是,自己的学习力在慢慢变强,这是不容忽视的,推荐给你们! 都说B站是个宝,可是有人不会挖啊,没事,今天咱挖好的送你一箩筐,首先啊,我在B站上最喜欢看这个家伙的视频了,为啥 ,咱撇...

代码注释如此沙雕,会玩还是你们程序员!

某站后端代码被“开源”,同时刷遍全网的,还有代码里的那些神注释。 我们这才知道,原来程序员个个都是段子手;这么多年来,我们也走过了他们的无数套路… 首先,产品经理,是永远永远吐槽不完的!网友的评论也非常扎心,说看这些代码就像在阅读程序员的日记,每一页都写满了对产品经理的恨。 然后,也要发出直击灵魂的质问:你是尊贵的付费大会员吗? 这不禁让人想起之前某音乐app的穷逼Vip,果然,穷逼在哪里都是...

立即提问
相关内容推荐