尝试在OS X上构建一个基本的PhoneGap应用程序时,我遇到了一个奇怪的问题.该应用程序仅使用Android平台进行设置.当我输入"PhoneGap build"时,我收到以下错误.
:processDebugManifest
/Volumes/Data/Tests/my-app/platforms/android/AndroidManifest.xml:15:5 Error:
uses-sdk:minSdkVersion 7 cannot be smaller than version 10 declared in library /Volumes/Data/Tests/my-app/platforms/android/build/intermediates/exploded-aar/android/CordovaLib/unspecified/debug/AndroidManifest.xml
Suggestion: use tools:overrideLibrary="org.apache.cordova" to force usage
Run Code Online (Sandbox Code Playgroud)
当我然后编辑指定的文件并将行设置为
<uses-sdk android:minSdkVersion=“10” android:targetSdkVersion="22" />
Run Code Online (Sandbox Code Playgroud)
并再次构建,错误不会改变.此设置是否存在于其他位置?或者还有其他事情发生在这里?
我试图让一个超级简单的集线器连接跨域工作,但没有运气.我已经阅读了几十篇文章并完成了所有提到但仍然没有成功的帖子.
我的服务器中心在这里
public class ChatHub : Hub
{
public void Send(string name, string message)
{
Clients.All.broadcastMessage(name, message);
}
}
Run Code Online (Sandbox Code Playgroud)
我的服务器MapHubs调用在这里
RouteTable.Routes.MapHubs(new HubConfiguration { EnableCrossDomain = true });
Run Code Online (Sandbox Code Playgroud)
我的任何javascript客户端都在这里
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width" />
<title>Index</title>
<script src="~/Scripts/jquery-2.0.1.min.js"></script>
<script src="~/Scripts/jquery.signalR-1.1.2.min.js"></script>
<script src="/signalr/hubs"></script>
</head>
<body>
<div class="container">
<input type="text" id="displayname" value="Test" />
<input type="text" id="message" value="I'm here" />
<input type="button" id="sendmessage" value="Send" />
</div>
<script type="text/javascript">
$(function ()
{
$.connection.hub.url = 'http://<my url>/';
var chat = $.connection.chatHub;
alert(chat);
$.connection.hub.start().done(function () …Run Code Online (Sandbox Code Playgroud) 我正在使用ng2-translate在我正在创建的Angular 2 RC5应用程序中进行语言处理.该应用程序有两个功能模块,一个是延迟加载的,另一个是预先加载的.TranslateModule通过共享模块提供.问题是转换管道在急切加载的模块中工作正常但不是懒惰加载的模块.为了验证它与加载方法有关,我将两者都转换为eager-loading,一切正常.
可以在此处找到演示此问题的插件:Plunker重要代码也在下面.
初始页面是急切加载的页面,因此字符串看起来很好.单击Login,它将转到延迟加载的所有字符串都是大写的,即未翻译.
任何帮助,将不胜感激.
app.module:
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { TranslateModule } from 'ng2-translate/ng2-translate';
import { AppComponent } from './app.component';
import { WelcomeModule } from './welcome/welcome.module';
import { routing } from './app.routing';
@NgModule({
imports: [ BrowserModule, WelcomeModule, TranslateModule.forRoot(), routing ],
declarations: [ AppComponent ],
bootstrap: [ AppComponent ]
})
export class AppModule { }
Run Code Online (Sandbox Code Playgroud)
app.routing:
import { Routes, RouterModule } from '@angular/router';
export const routes: …Run Code Online (Sandbox Code Playgroud) 我正在尝试为我运行的基本SignalR聊天服务器构建PhoneGap iOS客户端(ASP.NET MVC 4).从浏览器中的页面访问它时,一切都很好,但我似乎无法通过PhoneGap应用程序连接它.这是我的代码的相关部分:
服务器global.asax
protected void Application_Start()
{
// Register the default hubs route: ~/signalr * This must be registered before any other routes
RouteTable.Routes.MapHubs(new HubConfiguration { EnableCrossDomain = true });
AreaRegistration.RegisterAllAreas();
WebApiConfig.Register(GlobalConfiguration.Configuration);
FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters);
RouteConfig.RegisterRoutes(RouteTable.Routes);
}
Run Code Online (Sandbox Code Playgroud)
服务器web.config
<configuration>
<system.webServer>
<modules runAllManagedModulesForAllRequests="true"></modules>
</system.webServer>
</configuration>
Run Code Online (Sandbox Code Playgroud)
服务器中心
public class ChatHub : Hub
{
public void Send(string name, string message)
{
Clients.All.broadcastMessage(name, message);
}
}
Run Code Online (Sandbox Code Playgroud)
PhoneGap客户端
<body>
<div data-role="page">
<div data-role="header">
<h1>Life As A Pixel</h1>
</div><!-- /header -->
<div data-role="content">
<label for="username">Name:</label>
<input …Run Code Online (Sandbox Code Playgroud) 我已经创建了一个Web API自定义操作过滤器来记录传入的调用.我正在尝试获取呼叫者的IP地址以及我发现的所有内容Request.UserHostAddress.问题在于,无论呼叫来自何处,IP都是相同的.
这是我的动作过滤器的代码:
public class LogActionFilter : ActionFilterAttribute
{
public override void OnActionExecuting(HttpActionContext actionContext)
{
var name = actionContext.ActionDescriptor.ActionName;
// Get the sender address
var caller = ((HttpContextWrapper)actionContext.Request.Properties["MS_HttpContext"]).Request.UserHostAddress;
// Log the call
SystemBL.InsertSiteLog("WebAPI:" + name, "From:" + caller);
}
}
Run Code Online (Sandbox Code Playgroud)
我也尝试过:
var caller = ((HttpContextWrapper)actionContext.Request.Properties["MS_HttpContext"]).Request.ServerVariables["REMOTE_ADDR"].ToString();
Run Code Online (Sandbox Code Playgroud)
但结果是一样的.有任何想法吗?
我正在使用angular-chart(基于chart.js)创建一些条形图,但在获取所需的条形样式时遇到了麻烦。我希望条形像这样是纯色:
但我不知道如何摆脱chart.js默认添加的alpha:
我的html看起来像这样:
<body ng-app="myApp" ng-controller="myController as ctrl">
<canvas id="outreach" class="chart chart-bar"
chart-labels="ctrl.socialChart.labels"
chart-data="ctrl.socialChart.data"
chart-series="ctrl.socialChart.series"
chart-colors="ctrl.socialChart.colors"
chart-options="ctrl.socialChart.options"></canvas>
</body>
Run Code Online (Sandbox Code Playgroud)
和javascript:
angular.module('myApp', ['chart.js'])
.controller('myController', [function() {
var ctrl = this;
ctrl.socialChart = {
options: {
legend: {
display: true
}
},
labels: ['2012'],
series: ['FACEBOOK', 'GOOGLE', 'TWITTER', 'INSTAGRAM'],
// colors: ['rgba(237, 64, 42, 1)', 'rgba(240, 171, 5, 1)', 'rgba(160, 180, 33, 1)', 'rgba(0, 163, 159, 1)'],
colors: ['#ED402A', '#F0AB05', '#A0B421', '#00A39F'],
data: [[1178], [652], [1004], [838]]
}
}]);
Run Code Online (Sandbox Code Playgroud)
这是一个演示的Plunker:Plunker
我已经找到了许多有关使用rgba表示法(由于某种原因使我完全错误的颜色)和fillColor(我根本无法使用)的信息。很难说出chart.js版本1或2的信息是什么。
任何帮助,将不胜感激。
当我输入属性的值并且我点击空格时,它会自动跳转到下一个属性.我想在键入id或者其他东西时这是有意义的,但是当用多个类输入class属性时它真的很烦人.有谁知道改变这种行为的方法?
我有一个使用Controller作为语法的Angular控制器设置,我需要从一个方法创建一个带有绑定数据字段的Ionic Popup.我无法弄清楚的是如何为数据绑定设置弹出窗口的范围.我找到了这个例子但是使用this和$ scope对我来说似乎很麻烦.有没有更好的方法来做到这一点,还是我应该回到$ scope方法?
我的控制器看起来像这样(标有问题):
.controller('AccountCtrl', function ($ionicPopup) {
// Properties ===========
this.resetData = {};
// Methods ==============
this.forgotPassword = function () {
var myPopup = $ionicPopup.show({
template: '<input type="text" ng-model="<What goes here?>.resetData.resetEmail">',
title: 'Please enter your e-mail address',
scope: <What goes here?>
buttons: [
{
text: 'Submit',
onTap: function (e) {
console.log("Password reset:" + <What goes here?>.resetData);
}
},
{ text: 'Cancel' }
]
});
}
})
Run Code Online (Sandbox Code Playgroud)
我的模板看起来像:
<ion-view view-title="Sign In">
<ion-content has-bouncing="false" ng-controller="AccountCtrl as account">
<a …Run Code Online (Sandbox Code Playgroud) 我将我的API连接到Azure的API Management服务.当我尝试调用我的一个端点时,出现以下错误:
{
"statusCode": 500,
"message": "Internal server error",
"activityId": "79c1bef9-a05d-4734-b729-0657c1749e40"
}
Run Code Online (Sandbox Code Playgroud)
我启用了跟踪,这是跟踪json
{
"traceId": "79c1bef9a05d4734b7290657c1749e40",
"traceEntries": {
"inbound": [
{
"source": "api-inspector",
"timestamp": "2017-10-24T21:50:09.6322945Z",
"elapsed": "00:00:00.0002259",
"data": {
"request": {
"method": "GET",
"url": "https://mysite.azure-api.net/partner/api/partner/ClientsActions",
"headers": [
{
"name": "Ocp-Apim-Subscription-Key",
"value": "..."
},
{
"name": "Connection",
"value": "Keep-Alive"
},
{
"name": "Host",
"value": "mysite.azure-api.net"
}
]
}
}
},
{
"source": "api-inspector",
"timestamp": "2017-10-24T21:50:09.6322945Z",
"elapsed": "00:00:00.0002352",
"data": {
"configuration": {
"api": {
"from": "/partner",
"to": null,
"version": null,
"revision": "1" …Run Code Online (Sandbox Code Playgroud) 我有一个 ASP.NET Core 项目 (netcoreapp2.0),它引用类库项目 (netstandard2.0) 中的模型。我正在尝试使用 Mapster 来映射存储在类库中的对象。Mapster 的文档说使用以下代码从 Startup.cs 调用 Scan 方法:
TypeAdapterConfig.GlobalSettings.Scan(assembly1, assembly2, assemblyN)
Run Code Online (Sandbox Code Playgroud)
我遇到的问题是如何最好地获取类库的程序集引用以传递给 Scan 方法。我认为这更像是一个一般的 .NET 问题,而不是特定于 Mapster 的问题。我能想到的最好的是以下内容,但感觉很尴尬。
private Assembly GetAssemblyByName(string name)
{
var assemblies = Assembly.GetEntryAssembly().GetReferencedAssemblies();
var assemblyName = assemblies.FirstOrDefault(i => i.Name == name);
var assembly = Assembly.Load(assemblyName);
return assembly;
}
Run Code Online (Sandbox Code Playgroud)
有没有更好的方法来处理这个问题?
更新:显然我上面的解决方案破坏了代码优先迁移。任何人都可以建议一种方法来实现这一目标吗?