小编sap*_*Pro的帖子

错误C2248:'std :: basic_ios <_Elem,_Traits> :: basic_ios':无法访问类'std :: basic_ios <_Elem,_Traits>'中声明的私有成员

我无法理解这个错误.这个错误不在我正在调试的类中.(是吗?) 错误是:

c:\program files\microsoft visual studio 10.0\vc\include\fstream(890): error    C2248: 'std::basic_ios<_Elem,_Traits>::basic_ios' : cannot access private member declared in class 'std::basic_ios<_Elem,_Traits>'
1>          with
1>          [
1>              _Elem=char,
1>              _Traits=std::char_traits<char>
1>          ]
1>          c:\program files\microsoft visual studio 10.0\vc\include\ios(176) : see     declaration of 'std::basic_ios<_Elem,_Traits>::basic_ios'
1>          with
1>          [
1>              _Elem=char,
1>              _Traits=std::char_traits<char>
1>          ]
1>          This diagnostic occurred in the compiler generated   function 'std::basic_ifstream<_Elem,_Traits>::basic_ifstream(const std::basic_ifstream<_Elem,_Traits> &)'
1>          with
1>          [
1>              _Elem=char,
1>              _Traits=std::char_traits<char>
1>          ]
 ========== Build: 0 succeeded, 1 failed, 0 …
Run Code Online (Sandbox Code Playgroud)

c++ visual-studio-2010 visual-studio-express visual-c++

5
推荐指数
1
解决办法
1万
查看次数

在servlet中启动一个新线程

当请求到达处理文件上传的servlet时,最好在该servlet中启动一个新线程,该线程new Thread(r).start()将处理上传文件附带的另一个数据.我希望这能同时处理这两个工作.

java multithreading servlets web

5
推荐指数
1
解决办法
1万
查看次数

对于具有大量参数的函数,是否有任何解决方法?

我每天都会调用一次函数:

new SubmitLogs().mail(IP, date_time_UTC, date_time_IST , pageVisited , userCountry , userRegion , city , userAgent);
Run Code Online (Sandbox Code Playgroud)

函数参数不断增长.最初它就像:

new SubmitLogs().mail(IP, date_time_UTC, userAgent);
Run Code Online (Sandbox Code Playgroud)

现在还有5个参数.它预计会在一周内包含更多的参数.现在我不喜欢这样.保留具有如此多参数的函数对我来说似乎不是一件好事.这有什么工作吗?如果函数不断增长,我将永远不想向函数发送50个参数.该电话的作用是通过短信和短主题通过电子邮件发送参数中的详细信息.

java arguments function

5
推荐指数
1
解决办法
263
查看次数

System.in.read实际返回了什么?

什么:

System.in.read()
Run Code Online (Sandbox Code Playgroud)

回来?该文件 说:

返回:数据的下一个字节,如果到达流的末尾,则返回-1.

但是,例如,如果我进入:10我回来了49.这是为什么 ?

java java-io

5
推荐指数
2
解决办法
1万
查看次数

椭圆形的小径

我正在尝试制作一个简单的球动画,从1角开始,然后转到面板的另一个角落.我为此编写了一个程序.

当我运行程序时,oval离开了轨迹.我的意思是说它在程序运行时会留下"颜色痕迹".在我的程序中timer,每100毫秒触发一次事件.

以下是负责运行代码的逻辑:

void function() {
  // in this there is a action listener timed accordingly to fire event of 
  // doing x++ every 100th miliseconds
}

public void paintComponent(final Graphics g) {
 g.setColor(Color.black);
 g.drawOval(x,y,width,height);
 g.fillOval(x,y,width,height);
}
Run Code Online (Sandbox Code Playgroud)

输出屏幕截图:

java graphics user-interface swing 2d

4
推荐指数
1
解决办法
1163
查看次数

使用BufferedReader有什么效率影响?

用于从文件中读取字符的这两种方法有什么区别.

第一

FileReader fr = new FileReader( new File( "file.txt") );
int x = 0;
while( ( x = fr.read() ) != -1 ) {
    System.out.println( (char) x );
}
Run Code Online (Sandbox Code Playgroud)

第二

BufferedReader bfr = new BufferedReader( new FileReader( new File( "file.txt") ) );
int x = 0;
while( ( x = bfr.read() ) != -1 ) {
    System.out.println( (char) x );
}
Run Code Online (Sandbox Code Playgroud)

这两个代码都从文件中读取字符并将其写在控制台上.

哪种方法更有效,为什么? 或者它是一回事?

java file bufferedreader

4
推荐指数
2
解决办法
1130
查看次数

是Java Bootstrapped的编译器吗?

是Java Bootstrapped的编译器吗?

如果它是自引导的,那么第一个java编译器是如何编写的?

java compiler-construction bootstrapping javac

4
推荐指数
1
解决办法
1434
查看次数

Windows 键盘按键的 ascii 代码以及功能键 (F1 - F12) 和其他键(如 shift、capslock、backspace、ctrl 等)的代码

为了编写与键盘相关的应用程序,我需要键盘上按键的 ASCII 代码列表。

这是一个 Windows 键盘:

在此输入图像描述

从哪里可以获得代码?如果我能得到十六进制的代码那就太好了。

windows keyboard hex ascii

4
推荐指数
1
解决办法
5万
查看次数

会话默认持续多长时间?

会话持续多长时间:

HttpSession session = request.getSession();
Run Code Online (Sandbox Code Playgroud)

最后我没有明确申报session.setMaxInactiveInterval(int i)?我们假设,用户不会从浏览器中删除cookie.

java session java-ee

4
推荐指数
1
解决办法
5127
查看次数

为什么我得到部署错误?

当我尝试从netbeans部署我的Web应用程序时,出现以下错误:

Starting Tomcat process...
Waiting for Tomcat...
Tomcat server started.
W:\UnderTest\NetbeansCurrent\WebApplication1\nbproject\build-impl.xml:1033: 
Deployment error: Access to Tomcat server has not been authorized.
Set the correct username and password with the "manager-script" role in the 
Tomcat customizer in the Server Manager.
See the server log for details.
BUILD FAILED (total time: 14 seconds)
Run Code Online (Sandbox Code Playgroud)

那是什么 ?为什么我收到此错误?

以下是来自以下内容的片段 tomcat-users.xml:

    <tomcat-users>
<!--
  NOTE:  By default, no user is included in the "manager-gui" role required
  to operate the "/manager/html" web application.  If you wish to …
Run Code Online (Sandbox Code Playgroud)

java tomcat netbeans web-applications java-ee

4
推荐指数
1
解决办法
8337
查看次数