小编Ste*_*and的帖子

Parsec:"try"和"lookAhead"之间的区别?

parsec中"try"和"lookAhead"函数有什么区别?

haskell parsec

21
推荐指数
1
解决办法
2684
查看次数

Haskell的树木

还在学习haskell,我真的看不出它们之间的区别

data Tree a = Leaf a | Branch [Tree a]
Run Code Online (Sandbox Code Playgroud)

data Tree a = Leaf a | Branch (Tree a) (Tree a)
Run Code Online (Sandbox Code Playgroud)

什么是最好的根据你?这两种写作方式的含义是什么?

haskell

20
推荐指数
3
解决办法
1万
查看次数

实时货币webservice

任何人都知道具有频繁更新的实时货币汇率Web服务(多个分钟.).需要一个我正在构建的小型Android应用程序,因此需要是免费的.

web-services currency rate

20
推荐指数
3
解决办法
5万
查看次数

AngularJS服务在控制器之间传递数据

当使用AngularJS服务尝试在两个控制器之间传递数据时,我的第二个控制器在尝试从服务访问数据时总是收到未定义的.我猜这是因为第一个服务执行$ window.location.href并且我认为这是清除服务中的数据?有没有办法让我将URL更改为新位置,并将数据保留在第二个控制器的服务中?当我运行下面的代码时,第二个控制器中的警报始终是未定义的.

app.js(定义服务的地方)

var app = angular.module('SetTrackerApp', ['$strap.directives', 'ngCookies']);

app.config(function ($routeProvider) 
{
$routeProvider
  .when('/app', {templateUrl: 'partials/addset.html', controller:'SetController'})
  .when('/profile', {templateUrl: 'partials/profile.html', controller:'ProfileController'})
  .otherwise({templateUrl: '/partials/addset.html', controller:'SetController'});
});

app.factory('userService', function() {
var userData = [
    {yearSetCount: 0}
];

return {
    user:function() {
        return userData;
    },
    setEmail: function(email) {
        userData.email = email;
    },
    getEmail: function() {
        return userData.email;
    },
    setSetCount: function(setCount) {
        userData.yearSetCount = setCount;
    },
    getSetCount: function() {
        return userData.yearSetCount;
    }
};
});
Run Code Online (Sandbox Code Playgroud)

logincontroller.js :(控制器1在服务中设置值)

    app.controller('LoginController', function ($scope, $http, $window, userService) {

$scope.login …
Run Code Online (Sandbox Code Playgroud)

angularjs angularjs-service

20
推荐指数
1
解决办法
7万
查看次数

在C#中定义不同类型的数字

您可以在C#中以各种方式定义一个数字,

1F // a float with the value 1
1L // a long with the value 1
1D // a double with the value 1
Run Code Online (Sandbox Code Playgroud)

我个人正在寻找哪种方式short,但是为了让问题更好地为人们提供参考,你可以应用的数字文字的所有其他后期修复是什么?

c# numbers

18
推荐指数
2
解决办法
2万
查看次数

Configuration Manager仅显示Debug

我在ASP.NET应用程序上的Visual Studio 2008中工作,该应用程序已部署到测试服务器.我想在没有调试信息的情况下进行生成,但配置管理器仅在我的项目的配置下拉列表中显示"Debug".

我的其他Visual Studio项目显示"Debug","Release","New ..."和"Edit ...".

为什么我看不到发布选项,或新的和编辑命令?

configuration build-environment visual-studio-2008 visual-studio

17
推荐指数
1
解决办法
2万
查看次数

decodeAudioData返回null错误

我来到这里希望你们这里可爱的人们可以帮我解决一些我遇到的问题.

具体来说,每次我尝试使用webkitAudioContext的decodeAudioData方法时,它总是以空错误触发错误处理程序.这是我目前使用的代码:

var soundArray;
var context = new webkitAudioContext();
function loadSound(soundName) {
    var request = new XMLHttpRequest();
    request.open('GET',soundName);
    request.responseType = 'arraybuffer';
    request.onload = function() {
            context.decodeAudioData(this.response, function(buf) {
                sounds[soundName] = buf;
            },function(err) { console.log("err(decodeAudioData): "+err); });
    }
    request.send();
}
Run Code Online (Sandbox Code Playgroud)

此时,它不断地将错误消息记录到控制台说err(decodeAudioData) = null,主要是因为这就是我决定记录它的方式.在任何情况下,任何想法为什么会这样?

我正在使用Chrome Canary,v20.0.1121.0来尝试获得一些有用的功能.但是,显然,它不起作用!那么,任何想法我可以做什么?如果需要任何新信息,请告诉我,我会根据需要进行更新.

javascript html5 webkit google-chrome web-audio-api

17
推荐指数
2
解决办法
9513
查看次数

为什么"未定义引用`boost :: system :: generic_category"即使我链接到boost_system

如果我没有放置-lboost_system标志,我会理解这个错误信息,但它确实在这里:

g++ -o build/myproject build/main/main.o -L/usr/local/boost/boost_1_52_0/boost/libs -L/usr/lib -Lbuild -L. -lboost_system -lboost_thread -lpthread -lboost_regex -lpq -lmylibrary
build/libmylibrary.a(library.o): In function `__static_initialization_and_destruction_0(int, int)':
library.cpp:(.text+0x25f): undefined reference to `boost::system::generic_category()'
library.cpp:(.text+0x269): undefined reference to `boost::system::generic_category()'
library.cpp:(.text+0x273): undefined reference to `boost::system::system_category()'

你知道我应该调查什么来解决这个问题吗?(我使用gcc 4.6.3)

linker gcc boost

17
推荐指数
1
解决办法
2万
查看次数

numpy.apply_along_axis的表现究竟如何?

我在某些代码中遇到过numpy.apply_along_axis函数.我不明白有关它的文档.

这是文档的一个示例:

>>> def new_func(a):
...     """Divide elements of a by 2."""
...     return a * 0.5
>>> b = np.array([[1,2,3], [4,5,6], [7,8,9]])
>>> np.apply_along_axis(new_func, 0, b)
array([[ 0.5,  1. ,  1.5],
       [ 2. ,  2.5,  3. ],
       [ 3.5,  4. ,  4.5]])
Run Code Online (Sandbox Code Playgroud)

至于我认为我理解文档,我原以为:

array([[ 0.5,  1. ,  1.5],
       [ 4  ,  5  ,  6  ],
       [ 7  ,  8  ,  9  ]])
Run Code Online (Sandbox Code Playgroud)

即在[[1,2,3],[4,5,6],[7,8,9]中沿轴[1,2,3]应用函数,即轴0

显然我错了.你能纠正我吗?

python numpy scipy

16
推荐指数
2
解决办法
1万
查看次数

Haskell中的Catamorphism和树遍历

我很不耐烦,期待理解与这个SO问题有关的 catamorphism :)

我只练习了Real World Haskell教程的开头.所以,也许我现在要问的方式太多了,如果是这样的话,那就告诉我应该学习的概念.

下面,我引用了维基百科代码样本的catamorphism.

我想知道你对下面的foldTree的看法,这是一种遍历树的方法,与其他SO问题和答案相比,还涉及遍历Tree n-ary树遍历.(独立于二进制或不二进制,我认为下面的catamorphism可以编写,以便管理n-ary树)

我评论了我的理解,如果你能纠正我,并且澄清一些事情,我会很高兴.

{-this is a binary tree definition-}
data Tree a = Leaf a
            | Branch (Tree a) (Tree a)

{-I dont understand the structure between{} 
however it defines two morphisms, leaf and branch 
leaf take an a and returns an r, branch takes two r and returns an r-} 
data TreeAlgebra a r = TreeAlgebra { leaf   :: a      -> r
                                   , branch :: r -> r …
Run Code Online (Sandbox Code Playgroud)

haskell tree-traversal catamorphism

15
推荐指数
1
解决办法
2976
查看次数