昨天甲骨文决定取消java.sun.com一段时间.这对我来说很麻烦,因为xalan试图验证一些XML但无法检索properties.dtd.
我正在使用xalan 2.7.1来运行一些XSL转换,我不希望它验证任何东西.所以尝试像这样加载XSL:
SAXParserFactory spf = SAXParserFactory.newInstance();
spf.setNamespaceAware(true);
spf.setValidating(false);
XMLReader rdr = spf.newSAXParser().getXMLReader();
Source xsl = new SAXSource(rdr, new InputSource(xslFilePath));
Templates cachedXSLT = factory.newTemplates(xsl);
Transformer transformer = cachedXSLT.newTransformer();
transformer.transform(xmlSource, result);
Run Code Online (Sandbox Code Playgroud)
在XSL本身,我做这样的事情:
<xsl:variable name="entry" select="document(concat($prefix, $locale_part, $suffix))/properties/entry[@key=$key]"/>
Run Code Online (Sandbox Code Playgroud)
此代码检索的XML在顶部具有以下定义:
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
<properties>
<entry key="...
Run Code Online (Sandbox Code Playgroud)
尽管上面的java代码指示解析器不是VALIDATE,但它仍然向java.sun.com发送请求.虽然java.sun.com不可用,但这会使转换失败并显示以下消息:
Can not load requested doc: http://java.sun.com/dtd/properties.dtd
Run Code Online (Sandbox Code Playgroud)
如何让xalan停止尝试验证从"document"函数加载的XML?
我看到有一个名为Cabal的很好的包系统可以处理依赖项解析.所以我正在尝试安装它,所以我可以让它为我安装Haskell OpenGL模块.但是,Cabal本身有很多依赖.有没有办法在不手动解析所有依赖项的情况下安装Cabal?我尝试运行引导程序,但似乎没有这样做,因为它报告缺少模块parsec和网络(反过来又有自己的依赖项).
在mtl模块安装到我之前,手动构建dep让我大约3个深度:
user@machine:~/haskell/mtl-1.1.0.2$ runghc Setup build
Preprocessing library mtl-1.1.0.2...
Building mtl-1.1.0.2...
Control/Monad/Cont.hs:74:7:
Could not find module `Control.Monad':
Perhaps you haven't installed the profiling libraries for package base?
Use -v to see a list of the files searched for.
Run Code Online (Sandbox Code Playgroud) 我已经定义了一个转换器:
import org.springframework.binding.convert.converters.StringToObject;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.text.ParseException;
import java.util.Date;
public class StringToDateTwoWayConverter extends StringToObject {
private DateFormat format = null;
public StringToDateTwoWayConverter () {
super(StringToDateTwoWayConverter.class);
format = new SimpleDateFormat("MM/dd/yyyy");
}
@Override
protected Object toObject(String string, Class targetClass) throws Exception {
Date date = null;
try {
date = format.parse(string);
} catch (ParseException e) {
e.printStackTrace();
return null;
}
return date;
}
@Override
protected String toString(Object object) throws Exception {
Date date = (Date) …Run Code Online (Sandbox Code Playgroud) 我正在尝试学习Android开发,我想知道如何从麦克风中捕获音频,然后更改音频中的声音,使其听起来更浓或更清晰等等.简而言之:如何录制和更改声音的参数?(在java中,当然)
我正在尝试安装Manuel Chakravarty的加速模块,但是在使用cuda依赖项时遇到了一些麻烦。
我已经安装了NVIDIA的CUDA开发人员驱动程序和CUDA工具包。以机智:
ludflu@beefy ~/Downloads $ nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2011 NVIDIA Corporation
Built on Thu_Jan_12_14:41:45_PST_2012
Cuda compilation tools, release 4.1, V0.2.1221
Run Code Online (Sandbox Code Playgroud)
这样安装cuda cabal模块失败:
cabal install cuda
Resolving dependencies...
[1 of 1] Compiling Main ( /tmp/cuda-0.4.1.07892/cuda-0.4.1.0/Setup.hs, /tmp/cuda-0.4.1.07892/cuda-0.4.1.0/dist/setup/Main.o )
Linking /tmp/cuda-0.4.1.07892/cuda-0.4.1.0/dist/setup/setup ...
Configuring cuda-0.4.1.0...
...
checking for library containing cuDriverGetVersion... no
configure: error: could not find CUDA driver library
********************************************************************************
The configuration process failed to locate your CUDA installation. Ensure that
you have installed the …Run Code Online (Sandbox Code Playgroud) 我正在使用D3.js渲染包含光栅图像的节点的图形.
var mainscreenURL = s3_base_url + viewController + "/screenshot.jpeg";
svg.select(".mainScreen").transition().attr("height",0).remove();
svg.append("image").attr("xlink:href", mainscreenURL)
.attr("width", mainScreenW)
.attr("height", mainScreenH)
.attr("x", (w / 2) - (mainScreenW / 2))
.attr("y", (h / 2) - (mainScreenH / 2))
.attr("class", "mainScreen")
.attr("id", viewController)
});
Run Code Online (Sandbox Code Playgroud)
其中一些图像非常大,因此HTTP请求(由浏览器隐式发出)可能需要相当长的时间.我无法缓存图像,因为它们是动态生成的.
如果这是常规HTML,我会显示一个占位符图像,然后在成功完成HTTP get请求后将其换成真实的东西.但由于这是SVG,没有明确的请求,我最终得到了一个令人讨厌的破碎图像,然后被真实的东西取代.
在图像满载时,是否有任何可以挂钩的事件?
我想使用haste-compiler包来执行haskell-to-javascript的事情:
jsnavely@beefy:~/project$ cabal install haste-compiler
Resolving dependencies...
...
Configuring zip-archive-0.2.3...
Building zip-archive-0.2.3...
Preprocessing library zip-archive-0.2.3...
[1 of 1] Compiling Codec.Archive.Zip ( src/Codec/Archive/Zip.hs, dist/build/Codec/Archive/Zip.o )
src/Codec/Archive/Zip.hs:163:27: Not in scope: `decodeOrFail'
Failed to install zip-archive-0.2.3
cabal: Error: some packages failed to install:
haste-compiler-0.3 depends on zip-archive-0.2.3 which failed to install.
zip-archive-0.2.3 failed during the building phase. The exception was:
ExitFailure 1
Run Code Online (Sandbox Code Playgroud)
我注意到有一个更新版本的zip-archive将二进制版本提升到> = 0.7,它提供了这个decodeOrFail功能.因此,我尝试检查haste-compiler repo并将zip-archive版本提交到新的zip-archive 0.2.3.2.但这没有帮助:
jsnavely@beefy:~/project/haste-compiler$ cabal install
Resolving dependencies...
cabal: Could not resolve dependencies:
trying: haste-compiler-0.3 …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用XRPC连接到汤森路透研究员ID服务.
我的问题如下:
1)什么是XRPC?
2)发送适当的数据需要做什么
我正在做基于Spring 3注释的控制器.问题是,当验证失败时,参考数据会丢失,即countryDivisions的东西.我没有把它放在表单中,因为它不是用户可编辑的数据,这里的正统观点是只有用户可编辑的数据才会出现在表单中.我还有其他选择吗?
@Controller
public class MyInfoController {
@Autowired
private MyInfoFormValidator validator;
private void loadReferenceData(ModelMap model) {
model.put("countryDivisions",countryDivisionService.getCountryDivisionOrderedByCode());
}
@ModelAttribute
private MyInfoForm loadMyInfo() {
MyInfoForm form = new MyInfoForm();
//load it up
return form;
}
@RequestMapping(value="/editMyInfo", method = RequestMethod.GET)
public String editMyInfo(ModelMap model ) {
loadReferenceData(model);
return "contactEdit";
}
@RequestMapping(value="/editMyInfo", method = RequestMethod.POST)
public String saveMyInfo(ModelMap model, MyInfoForm form,BindingResult result ) {
validator.validate (form,result);
if (result.hasErrors()) {
model.put("commandName", "myInfoForm");
return "contactEdit";
}
//save some stuff
return "redirect:viewMyInfo";
}
}
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用Haskell解析二进制格式(PES):
import qualified Data.ByteString.Lazy as BL
import Data.Word
import Data.Word.Word24
import qualified Data.ByteString.Lazy.Char8 as L8
data Stitch = MyCoord Int Int deriving (Eq, Show)
data PESFile = PESFile {
pecstart :: Word24
, width :: Int
, height :: Int
, numColors :: Int
, header :: String
, stitches :: [Stitch]
} deriving (Eq, Show)
readPES :: BL.ByteString -> Maybe PESFile
readPES bs =
let s = L8.drop 7 bs
pecstart = L8.readInt s in
case pecstart of
Nothing …Run Code Online (Sandbox Code Playgroud) haskell ×4
java ×4
cabal ×2
spring ×2
android ×1
annotations ×1
attributes ×1
audio ×1
binary ×1
bytestring ×1
controller ×1
cuda ×1
d3.js ×1
gpu ×1
hackage ×1
javascript ×1
nvidia ×1
svg ×1
validation ×1
web-services ×1
xalan ×1
xml ×1