小编sha*_*osh的帖子

Python curses不支持重定向

我试图在Win7中的Eclipse中使用Pyrses中的Curses.

我安装了Python 3.2(64位)和curses-2.2.win-amd64-py3.2.当我将以下测试代码输入PyDev时:

import curses  

myscreen = curses.initscr()
myscreen.border(0)
myscreen.addstr(12, 25, "Python curses in action!")    
myscreen.refresh()
myscreen.getch()     
curses.endwin()
Run Code Online (Sandbox Code Playgroud)

它没有显示任何语法错误,所以我认为curses已正确安装.

但是,当我将其作为Python Run运行时,输出显示:不支持重定向.我不知道这个问题来自哪里.我google了很多但找不到相关信息.

python curses pydev

10
推荐指数
2
解决办法
8252
查看次数

如何更新AngularJS中的json文件中的数据?

我正在使用$ resource.query()从JSON文件中获取JSON数组.我可以使用$ save更改数据,但JSON文件实际上并未更新.谷歌搜索整个上午后无法找到解决方案.不确定是否可以使用AngularJS更新本地json文件.任何帮助,将不胜感激.

这是我的代码.

getData: function(datatype){
    var url = "data/" + datatype + ".json";
    return $resource(url, {}, {
        query: {
            method: "GET",
            isArray: true
        }
    });
},
Run Code Online (Sandbox Code Playgroud)

在另一个服务函数中调用getData()函数:

var post = this.getData("jobs").query(function(){               
    angular.forEach(staffs, function(staff){
        for(var i = 0; i < post.length; i++){
            if(post[i].id == jobId){
                alert(post[i].name); //Here it shows the original name "names and numbers"
                post[i].name = "changed";
                post[i].$save();    
                alert(post[i].name); //Here it shows the new name "changed"
                                     //but the data json file is not changed
                continue;
            }
        }
    });
}); …
Run Code Online (Sandbox Code Playgroud)

javascript json angularjs

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

ng-include在PhoneGap中不起作用

我正在尝试使用PhoneGap Build将我的angularjs应用程序构建到一个Android应用程序中,但是却遇到了ng-include的src问题.

下面的代码尝试将subheader的html呈现到视图中.它在chrome浏览器中完美运行,但是在我用phonegap转换代码后,它无法正常工作.我还尝试了其他路径,如'../templates/subheader.html'和'/templates/subheader.html',它们都不起作用.

<div class="bar bar-subheader bar-stable" ng-include="'templates/subheader.html'">
</div>
Run Code Online (Sandbox Code Playgroud)

有什么建议?

android angularjs cordova

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

SVG精灵在Safari中不起作用

对于Web开发人员而言,Safari并不比IE更好.这是我在Safari中看到的问题.

我正在尝试使用SVG精灵在我的网页中加载产品图标.

HTML代码:

<img src="https://www.abc123.com/icon_sprite.svg#amex">
Run Code Online (Sandbox Code Playgroud)

SVG Sprite代码:

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="276" height="224" viewBox="0 0 276 224" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
    <view id="affiliate-programs" viewBox="148 0 32 32"/>
    <svg width="32" height="32" viewBox="0 0 32 32" x="148"><path .../></svg>
    <view id="alipay" viewBox="0 64 49 32"/>
    <svg width="49" height="32" viewBox="0 0 49 32" y="64"><path .../></svg>
    <view id="amex" viewBox="50 0 49 32"/>
    <svg width="49" height="32" viewBox="0 0 49 32" x="50"><path .../></svg>
    <view id="auction" viewBox="148 64 32 32"/>
    <svg width="32" height="32" …
Run Code Online (Sandbox Code Playgroud)

html safari svg sprite

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

在javascript中使用网络天气服务

我想用javascript来消费cdyne提供的网络气象服务.这是我的代码:

<html>  
<head>  
    <title>weather app</title>  
</head>  
<body>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
    <script language="JavaScript">
    function CallService() {
        var DTO = "{ 'ZIP': '85281' }";

        $.ajax({

            type: "POST",
            url: "wsf.cdyne.com/WeatherWS/Weather.asmx/GetCityWeatherByZIP",
            data: JSON.stringify(DTO),
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            processData: true,
            success: function (msg) {       
                alert(msg);
            },
            error: function (req, status, error) {
                alert(req + "# " + status + "@ " + error);
            },
            complete: function (req, status) {
                alert(req + "% " + status);
            }
        });
    }
    CallService();
    </script>
</body>  
</html> 
Run Code Online (Sandbox Code Playgroud)

当我运行代码时,它在警报中显示[object Object] …

javascript service weather

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

标签 统计

angularjs ×2

javascript ×2

android ×1

cordova ×1

curses ×1

html ×1

json ×1

pydev ×1

python ×1

safari ×1

service ×1

sprite ×1

svg ×1

weather ×1