我有一个主要用F#编写的项目,它使用用C#编写的组件.它在Windows上使用Visual Studio构建,在Linux和OS X上使用Makefiles构建.
我正在尝试将其移植到.NET Core,后者拥有自己的构建系统dotnet build.我很难复制我现有构建系统的嵌套项目处理.也就是说,我希望它构建C#DLL,然后构建F#可执行项目并将其链接到它.
我试图没有DLL,但每个project.json文件显然只能用一种语言引用文件.如果你尝试将C#文件添加到compileFiles一个F#项目文件的列表中,dotnet build抱怨说,它不能编译Foo.cs使用fsc.
我的C#项目位于F#项目的子目录中,以它实现的命名空间命名,因此我在该目录中创建了一个新的.NET Core C#DLL项目,但现在我没有看到如何将这两个项目绑定在一起.
在dependencies该特征的项目文件格式似乎并没有解决这种问题.如果DLL项目在Foo/Bar并且它实现了Foo.Bar命名空间,则dotnet restore无法使用此依赖项引用找到它:
"dependencies": {
...other stuff...
"Foo.Bar": "*"
},
Run Code Online (Sandbox Code Playgroud)
显然它只能搜索NuGet的依赖项.我不想纯粹将组件运送到NuGet,以便dotnet restore能够找到它.
我不想使用bin语法来引用构建的DLL,因为这需要2遍构建和第三个project.json文件.(一个用于F#项目,一个用于C#项目,一个用于引用构建的DLL.)即便如此,我仍然没有看到如何将第一个项目与第三个项目联系起来.
当然有一种简单的方法来使用嵌套的构建树dotnet build吗?
我特别习惯了Firebug和YSlow.我正在研究的一件事是gzip压缩.YSlow仍然为我的网站提供了一个"F",表示我的CSS和JavaScript文件没有被压缩.
但是,如果我对我的网站运行外部gzip测试(例如http://www.gidnetwork.com/tools/gzip-test.php),它告诉我gzip正在工作并给我节省,尽管我认为这可能只是HTML.
这是我.htaccess文件的相关部分:
<IfModule mod_gzip.c>
mod_gzip_on Yes
mod_gzip_dechunk Yes
mod_gzip_item_include file \.css$
mod_gzip_item_include file \.(html?|txt|js|php|pl|jpg|png|gif)$
mod_gzip_item_include handler ^cgi-script$
mod_gzip_item_include mime ^text/.*
mod_gzip_item_include mime ^application/x-javascript.*
mod_gzip_item_exclude mime ^image/.*
mod_gzip_item_exclude rspheader ^Content-Encoding:.*gzip.*
</IfModule>
Run Code Online (Sandbox Code Playgroud)
为什么YSlow不同意外部gzip测试?
我无法解决这个循环依赖问题; 总是得到这个错误:"无效使用不完整类型结构GemsGame"我不知道为什么编译器不知道GemsGame的声明,即使我包含gemsgame.h两个类都相互依赖(GemsGame存储GemElements的向量) ,和GemElements需要访问这个相同的向量)
这是GEMELEMENT.H的部分代码:
#ifndef GEMELEMENT_H_INCLUDED
#define GEMELEMENT_H_INCLUDED
#include "GemsGame.h"
class GemsGame;
class GemElement {
private:
GemsGame* _gemsGame;
public:
GemElement{
_gemsGame = application.getCurrentGame();
_gemsGame->getGemsVector();
}
};
#endif // GEMELEMENT_H_INCLUDED
Run Code Online (Sandbox Code Playgroud)
......和GEMSGAME.H:
#ifndef GEMSGAME_H_INCLUDED
#define GEMSGAME_H_INCLUDED
#include "GemElement.h"
class GemsGame {
private:
vector< vector<GemElement*> > _gemsVector;
public:
GemsGame() {
...
}
vector< vector<GemElement*> > getGemsVector() {
return _gemsVector;
}
}
#endif // GEMSGAME_H_INCLUDED
Run Code Online (Sandbox Code Playgroud) 我正在尝试编译一个使用Java的JNI头的C程序jni.h,但是我收到以下错误:
sorry, unimplemented: 64-bit mode not compiled in #include <jni.h>
Run Code Online (Sandbox Code Playgroud)
我使用64位JDK,所以我不明白为什么会这样.
是否有任何编译器用于*nix之类的系统或适当的工具包以与Flash一起使用的ActionScript 3?
如何使Winsock程序仅接受来自特定地址的连接请求?我希望被拒绝的连接完全被忽略而不是获得TCP拒绝.
我正在设置一个UDP套接字,并试图绑定应该是一个有效的网络广播地址(192.168.202.255:23456),但bind失败,错误10049 ,WSAEADDRNOTAVAIL . 如果我使用localhost广播地址127.0.0.255,它会成功.
WSAEADDRNOTAVAIL该文档说"请求的地址在其上下文中无效.这通常是由于尝试绑定到对本地计算机无效的地址.这也可能是由connect,sendto,WSAConnect,WSAJoinLeaf或者WSASendTo远程地址或端口对远程计算机无效(例如,地址或端口0)." 但我认为这个地址192.168.202.255应该是一个有效的广播地址,因为运行时有以下条目ipconfig:

可能是什么问题?
我是Winsock编程的新手,我可能犯了一个基本错误,但我找不到它.我到目前为止的代码是:
m_ulAddress = ParseIPAddress(strAddress);
// Winsock 2.2 is supported in XP
const WORD wVersionRequested = MAKEWORD(2, 2);
WSADATA oWSAData;
const int iError = WSAStartup(wVersionRequested, &oWSAData);
if (iError != 0) {
PrintLine(L"Error starting the network connection: WSAStartup error " + IntToStr(iError));
} else if (LOBYTE(oWSAData.wVersion) != 2 || HIBYTE(oWSAData.wVersion) != 2) {
PrintLine(L"Error finding version 2.2 of Winsock; got version " + …Run Code Online (Sandbox Code Playgroud) 如果我声明这个F#函数:
let extractColumn col (grid : List<Map<string, string>>) =
List.map (fun row -> row.[col]) grid
Run Code Online (Sandbox Code Playgroud)
编译器抱怨:
错误FS0752:运算符'expr.[idx]'已根据此程序点之前的信息用于不确定类型的对象.考虑添加其他类型约束
为lambda row参数添加类型注释会修复它:
let extractColumn col (grid : List<Map<string, string>>) =
List.map (fun (row : Map<string, string>) -> row.[col]) grid
Run Code Online (Sandbox Code Playgroud)
为什么不能row从extractColumn函数的grid参数中获取类型?
我正在尝试使用CMake检查系统是否已xsltproc安装,以及它是否来自libxslt版本 1.1.27 或更高版本。(早期版本中有一个我不想解决的错误。)
当您运行时xsltproc --version,您会得到如下输出:
Using libxml 20900, libxslt 10128 and libexslt 817
xsltproc was compiled against libxml 20900, libxslt 10128 and libexslt 817
libxslt 10128 was compiled against libxml 20900
libexslt 817 was compiled against livxml 20900
Run Code Online (Sandbox Code Playgroud)
我编写了这个 CMake 代码来解析第一行中的第二个整数,并尝试将其与 10127 进行比较,这应该告诉我是否有足够新的版本xsltproc:
execute_process(COMMAND xsltproc --version
OUTPUT_VARIABLE XSLTPROC_VERSION ERROR_QUIET)
if(XSLTPROC_VERSION)
string(REGEX MATCH "libxslt [0-9]+" LIBXSLT_VERSION
${XSLTPROC_VERSION})
if(LIBXSLT_VERSION LESS 10127) # Always succeeds! Why?
message(STATUS "xsltproc found, but it's …Run Code Online (Sandbox Code Playgroud) 我有一个用简单模板构建的网站; header.tpl,navigation.tpl,body_home.tpl,body_about.tpl,body_anotherpage.tpl等.navigation.tpl包含jQuery,用于动态构建下拉导航菜单.在第一个下拉菜单中单击元素时,将根据单击的元素构建下一个元素.在某些时候,没有更多的下降并且设置了变量,例如:var action ="dropdowncomplete".现在,在body _*.tpl模板文件中,当动作==="dropdowncomplete"的计算结果为true时,会运行更多的jQuery.但是,我不知道如何使用jQuery(也不是JS)进行此检查.这是一段简化的代码来说明它是如何工作的:
/* header.tpl (<head>) - setting this global variable */
var action = null;
/* navigation.tpl - for simplicity's sake, when link is clicked, the var is set */
$(document).ready(function() {
$('a').live('click', function() {
action = "dropdowncomplete";
}); });
/* body_*.tpl - this should be executed when the var is set, in this case when a link is clicked */
if(action === "dropdowncomplete") {
// do something
}
Run Code Online (Sandbox Code Playgroud)
请注意,以上3个JS/jQuery代码都在不同的脚本块中!
谢谢.