我有一个Azure工作者角色(WR),应该使用以下命令从.cscfg文件中获取它的配置:
var setting = CloudConfigurationManager.GetSetting("My.Setting.Name");
Run Code Online (Sandbox Code Playgroud)
在模拟器中运行这很好,我得到:
Getting "My.Setting.Name" from ServiceRuntime: PASS.
Run Code Online (Sandbox Code Playgroud)
信息.但是,当我发布到我的远程环境时,我得到:
Getting "My.Setting.Name" from ServiceRuntime: FAIL.
Getting "My.Setting.Name" from ConfigurationManager: FAIL.
Run Code Online (Sandbox Code Playgroud)
消息.在Azure管理门户的"CloudServices/Configure"部分中,我可以看到配置中列出的设置,并且设置正确.
我正在使用Azure SDK 2.0
azure azure-worker-roles azure-web-roles azure-configuration
也许你已经听过了.它可能是在一个月前在Google IO上宣布的.Google Cloud Messaging只是下游(服务器 - >手机),但现在通过增强型CCS(云连接服务器),您可以通过XMPP协议通过持久TCP连接向上游发送消息.我已经设计了一个适用于GCM和HTTP的应用程序.它使用gcm库和那里打包的类(如GCMRegistrar).现在不推荐使用此类,Google建议使用GoogleCloudMessaging API.
现在一切都有点不同了.您有Google文档,他们会解释非常好,您可以如何设计Android应用程序.但是我的服务器有问题,因为我之前从未使用过XMPP.他们在这里给出了一个Python代码:http: //developer.android.com/google/gcm/gs.html 但我不知道Python.所以我调查了然后我找到了XMPPHP库.然后,您可以使用PHP并使用该库连接XMPP并发送/接收消息.
我没有使用它的经验,它对我不起作用.如何打开与Google XMPP服务器的XMPP连接?
我发现这种方式打开一个连接(这里你使用库):
$conn = new XMPPHP_XMPP($host, $port, $user, $password, $resource, $server, $printlog, $loglevel);
Run Code Online (Sandbox Code Playgroud)
有谁知道我必须通过哪些参数才能与谷歌CCS连接?
我也想知道:
我如何通过XMPP向设备发送消息?如何从设备接收消息?
我想使用javascript从给定的字符串中删除html标签.我研究了当前的方法,但是它们出现了一些未解决的问题.
现有解决方案
(1)使用javascript,创建虚拟div标签并获取文本
function remove_tags(html)
{
var tmp = document.createElement("DIV");
tmp.innerHTML = html;
return tmp.textContent||tmp.innerText;
}
Run Code Online (Sandbox Code Playgroud)
(2)使用正则表达式
function remove_tags(html)
{
return html.replace(/<(?:.|\n)*?>/gm, '');
}
Run Code Online (Sandbox Code Playgroud)
(3)使用JQuery
function remove_tags(html)
{
return jQuery(html).text();
}
Run Code Online (Sandbox Code Playgroud)
这三个解决方案正常工作,但如果字符串是这样的
<div> hello <hi all !> </div>
Run Code Online (Sandbox Code Playgroud)
剥离的字符串就像
hello
.但我只需要删除html标签.喜欢hello <hi all !>
编辑:背景是,我想删除特定文本区域的所有用户输入html标记.但我想让用户输入<hi all>
一些文字.在当前的方法中,它删除包含在<>内的任何内容.
我想得到url-param id,但它不起作用.大家能帮助我吗?以下代码不起作用.
网址:
http://localhost:9000/rest/alerts?ids[]=123?ids[]=456
Run Code Online (Sandbox Code Playgroud)
Routes.conf
GET /restws/alerts{ids} controllers.AlertService.findAlertsForIds(ids: List[String])
Run Code Online (Sandbox Code Playgroud)
AlertService.java
public static Result findAlertsForIds(List<String> ids){
return ok("Coole Sache");
}
Run Code Online (Sandbox Code Playgroud) 如何设置我的自定义下载器?我看不到一个Builder方法来更改下载器类.
我想使用Google HTTP Client库,我准备好了一个子类,如下所示:
import com.nostra13.universalimageloader.core.download.BaseImageDownloader;
public class GoogleHttpDownloader extends BaseImageDownloader {
//constructors, etc...
@Override
protected InputStream getStreamFromNetwork(String imageUri, Object extra)
throws IOException {
//new instancce of client, connect, return stream
}
}
Run Code Online (Sandbox Code Playgroud)
但是,如何使用UIL?
谢谢.
在我的WPF窗口应用程序中,当我将鼠标移到按钮上时,按钮上的背景图像消失,按钮显示为好像没有任何图像.我想要的是,当鼠标在按钮上时,或者单击按钮时,图像仍然应该显示在按钮上,它不应该消失.
这是我的代码:
<Button Margin="465, 3, 0, 0" Width="25" Height="20" IsEnabled="True" IsDefault="False" IsCancel="False" BorderBrush="{x:Null}" ToolTip="Reload pads list"> <Button.Background> <ImageBrush ImageSource="/FieldPlanner;component/Images/reload.gif" /> </Button.Background> </Button>
Run Code Online (Sandbox Code Playgroud) 最近我的GCM推送消息通知不再起作用.我没有更改任何内容,在我的Google API控制台中,如果是白名单IP地址,我已经注册了我的专用服务器的IPV6.
但是当我尝试访问GCM服务时,我总是收到错误:
擅自
错误401
也试过IPV4但没有成功......
我在自己的电脑上尝试过相同的脚本,一切顺利......
任何想法都会非常感激:)
谢谢你的帮助
给这篇Dr Dobbs文章,特别是Builder Pattern,我们如何处理子类化Builder的情况?以我们想要子类化添加GMO标签的示例的简化版本为例,一个简单的实现将是:
public class NutritionFacts {
private final int calories;
public static class Builder {
private int calories = 0;
public Builder() {}
public Builder calories(int val) { calories = val; return this; }
public NutritionFacts build() { return new NutritionFacts(this); }
}
protected NutritionFacts(Builder builder) {
calories = builder.calories;
}
}
Run Code Online (Sandbox Code Playgroud)
子类:
public class GMOFacts extends NutritionFacts {
private final boolean hasGMO;
public static class Builder extends NutritionFacts.Builder {
private boolean hasGMO = false;
public Builder() …
Run Code Online (Sandbox Code Playgroud) 在寻找旋转矩阵的pythonic方法时,我遇到了这个答案.但是没有附加说明.我在这里复制了片段:
rotated = zip(*original[::-1])
Run Code Online (Sandbox Code Playgroud)
它是如何工作的?