- c++
- c语言
- java
jsf(Primeface) 为什么直接访问xhtml不显示UI组件
http://localhost:8080/PrimeFaceCurd/index.xhtml
http://localhost:8080/PrimeFaceCurd/
这两个地址,访问的是同一个页面。
为什么第一个不显示UI组件
第二个却显示?
- python
- oracle
- python
- 问答团队
- java
- 开发语言
- eclipse
import java.util.Scanner;
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
int n,out;
int c[]=new int[7];
out=0;
char r;
r=' ';
n=in.nextInt();
String array[]=new String[n];
for(int i=0;i<n;i++)
{
array[i]=in.next().intern();
}
for (int i = 0; i < array.length; i++) {
// System.out.println(array[i]);
for(int j=0;j<7;j++)
{
if(j==0|j==2|j==4|j==6)
{
c[j]=(int)array[i].charAt(j)-48;
if(r=='*'&j>=2)
{
c[j]=c[j]*c[j-2];
c[j-2]=0;
}
if(r=='/'&j>=2)
{
c[j]=c[j-2]/c[j];
c[j-2]=0;
}
if(r=='-'&j>=2)
{
c[j]=-c[j];
}
}
if(j==1|j==3|j==5)
{
r=array[i].charAt(j);
}
}
out=c[0]+c[2]+c[4]+c[6];
// System.out.println(c[0]);
// System.out.println(c[2]);
// System.out.println(c[4]);
// System.out.println(c[6]);
// System.out.println(out);
if(out==24)
{
System.out.println("Yes");
}
else
System.out.println("No");
}
}
}
- sql
- mysql
- c语言
- unix
- linux
- centos
- ubuntu
#!/bin/bash
clear
>ip-up.txt
>ip-down.txt
read -p "please input addr" ipc
for i in {1..254}
do
ping -c 2 -W 1 $ipc.$i &>/dev/null
if [ $? -eq 0 ] ; then
echo "$ipc.$i is up" &>/dev/null >>ip-up.txt
else
echo "$ipc.$i is down" &>/dev/null >>ip-down.txt
fi
done
wait
sort -n -k 4 -t . ip-up.txt -o ip-up.txt
cat ip-up.txt
sort -n -k 4 -t . ip-down.txt -o ip-down.txt
cat ip-down.txt
echo "ping test are finished"
这个是慢的那个。。
#!/bin/bash
#V1.0 2019-09-10
#Ping test shell script by tutor
clear
>ip-up.txt
>ip-down.txt
while true;
do
read -p "Please input the ip segment for ping test(like 192.168.100) : " segment
if [ -z $segment ] ; then
segment="192.168.100"
fi
echo -n "the ip segment is ${segment} , are you sure to continue [y/n] ? "
read action
if [ -z $action ] ; then
break
fi
if [ "$action" = "y" ]; then
break
fi
done
echo "ping test is ready to run! "
for i in {1..254}
do
{
ping -c2 -W1 ${segment}.${i} &>/dev/null
if [ $? -eq 0 ]; then
echo "${segment}.$i is up" &>/dev/null >> ip-up.txt
else
echo "${segment}.$i is down" &>/dev/null >> ip-down.txt
fi
}&
done
wait
sort -n -k 4 -t . ip-up.txt -o ip-up.txt
cat ip-up.txt
sort -n -k 4 -t . ip-down.txt -o ip-down.txt
cat ip-down.txt
echo "ping test are finished!"
这个是快的那个
两个脚本速度差距特别大,求大佬解惑。。。拜托了
- javascript

<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title>test</title>
</head>
<body>
<button>1111</button>
<button>2222</button>
<button>3333</button>
</body>
<script>
for(var i=0;i<3;i++){
document.getElementsByTagName("button")[i].onclick=function(){
alert(i);
}
}
</script>
</html>
为什么点击每个按钮都会弹出3??
- c++
- 问答团队
- java
今天在使用ssm中分页插件pagehelper时发生一个奇怪的事情
```java
<!--pagehelper-->
<pagehelper.version>5.1.2</pagehelper.version>
<!--pagehelper-->
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper</artifactId>
<version>${pagehelper.version}</version>
</dependency>
```
同样的代码,都是用aop实现的
```java
public Object invoke(ProceedingJoinPoint args) throws Throwable{
Object[] params = args.getArgs();
//分页对象
PageBean pageBean=null;
for (Object param : params) {
if(param instanceof PageBean){
pageBean= (PageBean) param;
break;
}
}
//设置分页参数
if(null!=pageBean&&pageBean.isPagination()){
PageHelper.startPage(pageBean.getPage(),pageBean.getRows());
}
//执行方法,得到返回结果
Object result = args.proceed(params);
System.out.println(result);
JsonResponseBody data= (JsonResponseBody) result;
if(null!=pageBean&&pageBean.isPagination()){
if(null==data.getData())
return new JsonResponseBody<>(ResponseStatus.STATUS_602);
List lst= (List) data.getData();
PageInfo pi=new PageInfo(lst);
pageBean.setTotal(pi.getTotal()+"");
return new JsonResponseBody<>(lst,pageBean.getTotal());
}
return new JsonResponseBody<>(data.getData());
}
```
但是有一个方法在切入AOP之后总是报错,如下:
```java
org.springframework.web.util.NestedServletException
```
百度了一下,说是jar包冲突,于是把jar包改成 5.1.0,果然问题解决了,
但是之后我改回5.1.2,结果也不报错了,
原因不明
- python
用的是Jupyter,求大神解答!急! 代码如下: import numpy as np t=np.arange(1,10,1) print(t) y=0.9*t+np.sin(t) y import matplotlib.pyplot as plt %matplotlib inline plt.plot(t,y,'db') model=np.polyfit(t,y,deg=1) model t2=np.arange=(-2,12,1) t2 y2predict=np.polyval(model,t2) y2predict plt.plot(t,y,'o',t2,y2predict,'x') plt.show() 在这里出问题了 报错代码如下 TypeError Traceback (most recent call last) <ipython-input-8-d0e83e3a8d52> in <module> 1 plt.plot(t,y,'o',t2,y2predict,'x') ----> 2 plt.show() D:\anaconda\lib\site-packages\matplotlib\pyplot.py in show(*args, **kwargs) 351 """ 352 _warn_if_gui_out_of_main_thread() --> 353 return _backend_mod.show(*args, **kwargs) 354 355 D:\anaconda\lib\site-packages\ipykernel\pylab\backend_inline.py in show(close, block) 41 display( 42 figure_manager.canvas.figure, ---> 43 metadata=_fetch_figure_metadata(figure_manager.canvas.figure) 44 ) 45 finally: D:\anaconda\lib\site-packages\ipykernel\pylab\backend_inline.py in _fetch_figure_metadata(fig) 178 if _is_transparent(fig.get_facecolor()): 179 # the background is transparent --> 180 ticksLight = _is_light([label.get_color() 181 for axes in fig.axes 182 for axis in (axes.xaxis, axes.yaxis) D:\anaconda\lib\site-packages\ipykernel\pylab\backend_inline.py in <listcomp>(.0) 181 for axes in fig.axes 182 for axis in (axes.xaxis, axes.yaxis) --> 183 for label in axis.get_ticklabels()]) 184 if ticksLight.size and (ticksLight == ticksLight[0]).all(): 185 # there are one or more tick labels, all with the same lightness D:\anaconda\lib\site-packages\matplotlib\axis.py in get_ticklabels(self, minor, which) 1253 if minor: 1254 return self.get_minorticklabels() -> 1255 return self.get_majorticklabels() 1256 1257 def get_majorticklines(self): D:\anaconda\lib\site-packages\matplotlib\axis.py in get_majorticklabels(self) 1205 def get_majorticklabels(self): 1206 """Return this Axis' major tick labels, as a list of `~.text.Text`.""" -> 1207 ticks = self.get_major_ticks() 1208 labels1 = [tick.label1 for tick in ticks if tick.label1.get_visible()] 1209 labels2 = [tick.label2 for tick in ticks if tick.label2.get_visible()] D:\anaconda\lib\site-packages\matplotlib\axis.py in get_major_ticks(self, numticks) 1376 r"""Return the list of major `.Tick`\s.""" 1377 if numticks is None: -> 1378 numticks = len(self.get_majorticklocs()) 1379 1380 while len(self.majorTicks) < numticks: D:\anaconda\lib\site-packages\matplotlib\axis.py in get_majorticklocs(self) 1281 def get_majorticklocs(self): 1282 """Return this Axis' major tick locations in data coordinates.""" -> 1283 return self.major.locator() 1284 1285 def get_minorticklocs(self): D:\anaconda\lib\site-packages\matplotlib\ticker.py in __call__(self) 2274 def __call__(self): 2275 vmin, vmax = self.axis.get_view_interval() -> 2276 return self.tick_values(vmin, vmax) 2277 2278 def tick_values(self, vmin, vmax): D:\anaconda\lib\site-packages\matplotlib\ticker.py in tick_values(self, vmin, vmax) 2282 vmin, vmax = mtransforms.nonsingular( 2283 vmin, vmax, expander=1e-13, tiny=1e-14) -> 2284 locs = self._raw_ticks(vmin, vmax) 2285 2286 prune = self._prune D:\anaconda\lib\site-packages\matplotlib\ticker.py in _raw_ticks(self, vmin, vmax) 2265 low = edge.le(_vmin - best_vmin) 2266 high = edge.ge(_vmax - best_vmin) -> 2267 ticks = np.arange(low, high + 1) * step + best_vmin 2268 # Count only the ticks that will be displayed. 2269 nticks = ((ticks <= _vmax) & (ticks >= _vmin)).sum() TypeError: 'tuple' object is not callable
- python
这段代码会出现TypeError: There are no type variables left in dict[{'id': '1001', 'name': '张三', 'english': 100, 'python': 100, 'java': 100}]这个问题,是为什么呢?
```
mode=input('请选择排序方式(1.按英语成绩排序 2.按python成绩排序 3.按java成绩排序 0.按总成绩排序)')
if mode=='1':
student_new.sort(key=lambda a:int(a['english']),reverse=asc_or_desc_bool)
elif mode=='2':
student_new.sort(key=lambda x:int(x['python']),reverse=asc_or_desc_bool)
elif mode=='3':
student_new.sort(key=lambda x:int(x['java']),reverse=asc_or_desc_bool)
elif mode=='0':
student_new.sort(key=lambda x:int(x['english'])+int(x['python'])+int(x['java']),reverse=asc_or_desc_bool)
else:
```
- 小程序
- android
- 人工智能
- 测试用例
- 多彩生活