为什么我应该使用关键字声明类属性(变量)或方法(函数)public,如果它们在默认情况下是公开的?或者,是吗?
用不同的方式来表达我的问题是public多余的?我的理解private和protected,但为什么声明public,如果类成员是公共的呢?
我是初学者,在尝试进入计算机科学大学之前,我正在尝试在Haskell上做一些教程.
我被困在这个程序中.它需要三个数字并按升序排列.任何人都可以帮助我并告诉我什么是错的,因为它让我发疯了?谢谢你的时间.
import Prelude hiding (min,max)
orderTriple :: (Int -> Int -> Int) -> (Int -> Int -> Int)
max :: Int -> Int -> Int -> Int
min :: Int -> Int -> Int -> Int
middle :: Int -> Int -> Int -> Int
max x y z
|(x>=y) && (x>=z) = x
|(y>=x) && (y>=z) = y
|otherwise = z
min d e f
|(d<=e) && (d<=f) = d
|(e<=d) && (e<=f) = e
|otherwise = f …Run Code Online (Sandbox Code Playgroud) 我目前正在使用Apache Tomcat 5.5.16来提供基于Lucene的搜索API.
最近我在servlet类中有一些NullPointerExceptions.这个班叫com.my_company.search.servlet.SearchServlet.
对于某些类型的输入,我可以例行地创建NullPointerException,但是我无法确定它到底在哪里.
StackTrace表示此处发生了错误:
com.my_company.search.servlet.SearchServlet.doGet(Unknown Source)
此类的源和.class文件全部包含在:
$TOMCAT_HOME/webapps/my_servlet/WEB-INF/classes/com/my_company/search/servlet/
我的问题是,如何让Tomcat为我提供更具描述性的错误位置?
我正在尝试做以下事情......
这就是我现在所拥有的......但它没有正确渲染.有没有人知道我如何解决这个问题?
CSS
/* Curved Corners */
.bl {
background: url(bl.gif) 0 100% no-repeat;
/*background-color:#EFFBEF;*/
width: 700px;
margin-left: auto ;
margin-right: auto ;}
.br {
background: url(br.gif) 100% 100% no-repeat;
}
.tl {
background: url(tl.gif) 0 0 no-repeat;
}
.tr {
background: url(tr.gif) 100% 0 no-repeat;
}
.clear {font-size: 1px; height: 1px}
Run Code Online (Sandbox Code Playgroud)
HTML
<div class="bl"><div class="br"><div class="tl"><div class="tr">
<div id="header">
</div>
<div id="footer">
</div>
</div></div></div></div>
Run Code Online (Sandbox Code Playgroud) 说你或我编写了一个HTML元素......
<a id='hydrogen' href='#'>H</a>
Run Code Online (Sandbox Code Playgroud)
......还有一些:hoverCSS ......
#hydrogen:hover {
background:red;
}
Run Code Online (Sandbox Code Playgroud)
...现在我们想在悬停时放一个花哨的手形光标.这有两种选择:
适用于无状态元素:
#hydrogen {
cursor:pointer;
}
Run Code Online (Sandbox Code Playgroud)
或者,适用于:悬停状态.
#hydrogen:hover {
color:red;
cursor:pointer;
}
Run Code Online (Sandbox Code Playgroud)
我的问题:有什么理由说明为什么一种方式比其他方式更具决定性?
......还是番茄,西红柿?
我正在寻找一些可赎回的方式来获取有关名人和名人的信息.给定一个字符串,我想,以确定它是否是一个有名的人的名字,如果是这样,如果他们还活着,也许他们落入(如演员,音乐家,运动员)哪个类别.
有没有人知道任何公开的API来做这样的事情?我能想到的最好的是维基百科,但它很有问题,因为大部分信息必须被解析,并且不是可靠且可预测的格式.
我还希望能够在初始搜索没有任何内容时为可能的名称提供建议(因为字符串将来自人并且可能包含拼写错误).
我有一个使用的拖放脚本readAsArrayBuffer().缓冲区的长度是完美的,但我似乎无法弄清楚如何从缓冲区中提取数据.
显然我必须制作一个DataView或Uint8Array或其他东西,然后迭代它的byteLength...帮助!
编辑 相关代码(不是很多):
var reader = new FileReader();
reader.onload = function(e) {
// do something with e.target.result, which is an ArrayBuffer
}
reader.readAsArrayBuffer(someFileHandle);
Run Code Online (Sandbox Code Playgroud) 我使用linq连接多个表并编写复杂的查询.这里,当我将有"0"的任何参数即CategoryId,GameId,LimitVariantId,这意味着用户已选择了"所有",从接口.
我的Sql查询,当我将参数值传递给大于'0'时:
select * from dbo.GameCombinations gc
inner join dbo.StakeBuyInByStakeCategories sbsc
on sbsc.StakeBuyInByStakeCategoryId = gc.StakeBuyInByStakeCategoryId
inner join dbo.GameTables gt
on gc.GameCombinationId = gt.GameCombinationId
where gc.CurrencyId=1 and gc.GameTypeId=2
and sbsc.StakeBuyInId=gt.BuyIn
and gc.CategoryId=4
and gc.GameId=7
and gc.LimitVariantId=23
and gc.StakeCategoryId in (3,5,6)
Run Code Online (Sandbox Code Playgroud)
当我将传递CategoryId 0然后我的Sql查询将是:
select * from dbo.GameCombinations gc
inner join dbo.StakeBuyInByStakeCategories sbsc
on sbsc.StakeBuyInByStakeCategoryId = gc.StakeBuyInByStakeCategoryId
inner join dbo.GameTables gt
on gc.GameCombinationId = gt.GameCombinationId
where gc.CurrencyId=1 and gc.GameTypeId=2
and sbsc.StakeBuyInId=gt.BuyIn
--and gc.CategoryId=4
and gc.GameId=7
and …Run Code Online (Sandbox Code Playgroud) 我在 React 项目上使用 Webpack,它似乎以一种我不理解的奇怪方式HtmlWebpackPlugin影响了webpack 开发服务器。
它似乎允许我浏览到index.html该文件在代码库中的任何位置,这是单独使用开发服务器无法实现的。
假设我有以下目录结构:
myproj/
|- package.json
|- webpack.config.js
|- src/
|- index.html
|- index.jsx
Run Code Online (Sandbox Code Playgroud)
和一个webpack.config.js看起来像这样的文件:
const path = require('path');
module.exports = {
entry: './src/index.jsx',
devServer: {
contentBase: __dirname
}
};
Run Code Online (Sandbox Code Playgroud)
然后我跑webpack-dev-server --mode=development。由于我已devServer.contentBase设置为当前目录 ( myproj) 并且index.html文件在里面myproj/src,因此我必须浏览http://localhost:8080/src/index.html以查看我的 Web 应用程序。如果我尝试浏览,http://localhost:8080/index.html则会得到 404。这对我来说很有意义。
然后我添加了HtmlWebpackPlugin,里面没有改变任何东西webpack.config.js:
const HtmlWebpackPlugin = require('html-webpack-plugin');
....
plugins: [
new HtmlWebpackPlugin({
template: './src/index.html'
}) …Run Code Online (Sandbox Code Playgroud) css ×2
javascript ×2
api ×1
arraybuffer ×1
c# ×1
class ×1
closures ×1
definition ×1
exception ×1
haskell ×1
html ×1
java ×1
linq ×1
namespaces ×1
php ×1
public ×1
semantics ×1
servlets ×1
stack-trace ×1
terminology ×1
tuples ×1
types ×1
webpack ×1
wikipedia ×1