我有两个问题:
JSONResult和ActionResult有什么区别?
何时在MVC中使用JSONResult?
asp.net-mvc jsonresult asp.net-mvc-3 asp.net-mvc-4 asp.net-mvc-5
我正试图从浏览器捕获用户的音频输入.我用WAV完成了它,但文件非常大.我的一个朋友告诉我,OGG文件要小得多.有谁知道如何将WAV转换为OGG?我也有原始数据缓冲区,我真的不需要转换.但我只需要OGG编码器.
这是Matt Diamond的RecorderJS的WAV编码器:
function encodeWAV(samples){
var buffer = new ArrayBuffer(44 + samples.length * 2);
var view = new DataView(buffer);
/* RIFF identifier */
writeString(view, 0, 'RIFF');
/* file length */
view.setUint32(4, 32 + samples.length * 2, true);
/* RIFF type */
writeString(view, 8, 'WAVE');
/* format chunk identifier */
writeString(view, 12, 'fmt ');
/* format chunk length */
view.setUint32(16, 16, true);
/* sample format (raw) */
view.setUint16(20, 1, true);
/* channel count */
view.setUint16(22, 2, true); …Run Code Online (Sandbox Code Playgroud) 在静态编译的链接阶段在Windows上构建时,可能会发生LNK4099警告.
例如,当使用nmake和VC10构建时,我得到一个LNK4099警告流,如:
libcurl_a_debug.lib(rc2_cbc.obj) : warning LNK4099: PDB 'lib.pdb' was not found with 'libcurl_a_debug.lib(rc2_cbc.obj)' or at 'C:\dev\scaler\center\dlux\lib.pdb'; linking object as if no debug info
Run Code Online (Sandbox Code Playgroud)
StackOverflow可以很好地概述问题,但不是理解它所需的详细信息.
而不是忽略警告或禁用警告,我想修复我的构建中的makefile以解决问题.
问题是怎么出现的?如何删除警告的原因?
我需要uuidgenLinux shell 脚本,但它不在我的 Debian 7.1 网络安装中。
apt-get install uuidgen失败,不清楚我应该使用什么包,现有的问题似乎要求替代方案而不是真正的 uuidgen.
有经验的人可以uuidgen评论从哪里得到它,为什么它不在自己的包中?
附注。如果这是在错误的 StackExchange 站点上,请指出正确的方向。
我目前正在使用以下命令:
git diff --no-prefix -w trunk > my_beautiful_code.patch
Run Code Online (Sandbox Code Playgroud)
但是当我在评论板中上传差异时收到以下错误:
No valid separator after the filename was found in the diff header
Run Code Online (Sandbox Code Playgroud)
有没有办法让git做正确的事情?我相信审查板正在寻找确切的svn格式.我可以克隆svn repo,应用补丁,然后用svn制作补丁,但这很乏味,我想要一个更清洁的工作流程......
谢谢!
我想从一次提交创建审核委员会审核.
当我使用时post-review,它会提交我的repo和master之间的所有差异.
如何将此限制为特定提交?或者特定提交中的文件?
我有一个存根JSON OBJECT但需要使用Mockito模拟以下内容:
HttpResponse response = defaultHttpClient.execute(postRequest);
BufferedReader rd = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
StringBuilder result = new StringBuilder();
while ((line = rd.readLine()) != null) {
result.append(line);
}
JSONObject jsonResponseObject = new JSONObject(result.toString());
Run Code Online (Sandbox Code Playgroud)
我创建了以下Mocks:
@Mock
private HttpClient mockHttpClient;
private HttpPost mockHttpPost;
private HttpResponse mockHttpResponse;
private HttpEntity mockHttpEntity;
private InputStream mockInputStream;
private InputStreamReader mockInputStreamReader;
private BufferedReader mockBufferedReader;
Run Code Online (Sandbox Code Playgroud)
并有以下when声明:
Mockito.when(mockHttpClient.execute(mockHttpPost)).thenReturn(mockHttpResponse);
Mockito.when(mockHttpResponse.getEntity()).thenReturn(mockHttpEntity);
Mockito.when(mockHttpEntity.getContent()).thenReturn(mockInputStream);
Run Code Online (Sandbox Code Playgroud)
问题:我是否需要创建所有这些'when'语句,如果是,那么我需要创建哪些其他语句才能获得存根JSON?
有什么建议吗?
谢谢
我正在启动一个OpenGL引擎,使用SFML作为上下文和输入管理器,使用GLSDK加载OpenGL(以及现在不重要的图像和事物)和Boost用于其他一些事情.
我一直想知道"日志记录"的想法,并尝试了Boost.Log(未能编译示例,并且唯一的问题参考未解决),Log4CPP(在启动时出错)最后一切似乎都是使用easylogging ++很好,是一个只有标题的库(horray!),它有一些巧妙的语法IMO.
但是在编译时会出现一堆错误:
C2664:'el :: base :: utils :: DateTime :: gettimeofday':无法将参数1从'int*'转换为'el :: base :: utils :: timeval*'
C2228:'.tv_usec'的左边必须有class/struct/union
我用这种方式实现了它:
'helpers.Log.cpp':'_ INITIALIZE_EASYLOGGINGPP'并实现init(),如下所示:
el::Configurations conf("../log_config.cfg");
el::Loggers::reconfigureLogger("default", conf);
el::Loggers::reconfigureAllLoggers(conf);
Run Code Online (Sandbox Code Playgroud)现在,只有这两个文件处理日志记录.'engine.Core.hpp'包括'helpers.Log.hpp','engine.Boot.hpp'(现在空白),'glload/gl_load.hpp','glload/gl_3_3.hpp'以及在'的构造函数中核心类,在引擎名称空间内,调用init()函数.
整个应用程序中没有其他任何操作.就是这样,日志系统的初始化,但它完全失败了.
系统信息
操作系统:Windows 7 x64
IDE:Visual Studio 2012
编译器: VS2012(v110)
COMPILE COMMAND:cl/c/IF:/ BTSync/prog_projs/KINGDOMS/trunk/inc/IF:/ dev/SFML/21/include/IF:/ dev/GLSDK/052/glload/include/IF:/ dev/GLSDK/052/glutil/include/IF:/ dev/GLSDK/052/glm/IF:/ dev/GLSDK/052/glmesh/include/IF:/ dev/GLSDK/052/glimage/include/IF:/ dev/BOOST/154/IF:/ DEV/LIBROCKET/121_3/include/Zi/nologo-/W3/WX-/Od/Ob0/Oy-/D WIN32/D …
我最近在我的C++应用程序中采用了Easylogging ++,并且遇到了我希望只是文档遗漏的东西.
我希望每次启动应用程序时都清除我的日志文件,而不是从以前的应用程序实例添加日志事件.我意识到我可以在任何日志记录事件之前在启动时删除日志文件,但这看起来像是一个黑客.
任何帮助,将不胜感激.谢谢.
我想用Mono构建我的VisualStudio 2012解决方案(.sln),但它无法编译依赖于VisualStudio特定程序集的项目.例如
xbuild ServerResource.sln
...
HypervResourceControllerTest.cs(18,17): error CS0234: The type or namespace name `VisualStudio' does not exist in the namespace `Microsoft'. Are you missing an assembly reference?
Run Code Online (Sandbox Code Playgroud)
在这种情况下,HypervResourceControllerTest.cs(18,17)是对Visual Studio测试工具的引用:
using Microsoft.VisualStudio.TestTools.UnitTesting;
Run Code Online (Sandbox Code Playgroud)
由于我不需要编译测试环境,我可以告诉Mono编译器绕过.sln中的特定项目吗?
我HttpsURLConnection根据StackExchange答案创建了一个模拟:
import java.net.URL;
import javax.net.ssl.HttpsURLConnection;
...
@RunWith(PowerMockRunner.class)
public class DialogTest {
public void mockHttpsUrlConnectionExample() throws Exception
{
URL mockUrl = PowerMockito.mock(URL.class);
PowerMockito.whenNew(URL.class).withAnyArguments().thenReturn(mockUrl);
HttpsURLConnection mockUrlConnection = PowerMockito.mock(HttpsURLConnection.class);
PowerMockito.when(mockUrl.openConnection()).thenReturn(mockUrlConnection);
PowerMockito.when(mockUrlConnection.getResponseCode()).thenReturn(200);
// Create and call my objects ...
}
}
Run Code Online (Sandbox Code Playgroud)
但是,当我使用它时,我看到一个强制转换异常:
java.lang.ClassCastException: sun.net.www.protocol.https.HttpsURLConnectionImpl cannot be cast to javax.net.ssl.HttpsURLConnection
Run Code Online (Sandbox Code Playgroud)
问题出在这个代码中:
import java.net.URL;
import javax.net.ssl.HttpsURLConnection;
...
private Boolean sendRequest(String endpoint, JSONObject requestData, Boolean throwOnAuthException) throws JSONException, IOException {
this.responseData = null;
try {
String serviceURI = getServiceURI();
String dialogUri = String.format("%s%s", …Run Code Online (Sandbox Code Playgroud) git ×2
java ×2
logging ×2
review-board ×2
app-startup ×1
asp.net-mvc ×1
audio ×1
debian ×1
glload ×1
json ×1
jsonresult ×1
mocking ×1
mockito ×1
mono ×1
ogg ×1
opengl ×1
pdb-files ×1
powermock ×1
powermockito ×1
reset ×1
web ×1
windows ×1
xbuild ×1