我正在寻找一个很好的JS片段来将时间戳(例如从Twitter API)转换为友好的用户友好相对时间(例如2秒前,一周前等).
有人愿意分享一些他们喜欢的方法(最好不要使用插件)吗?
我想知道之间是否存在差异(除了引擎兼容性和可选发生之外)
CHARINDEX (expressionToFind ,expressionToSearch [, start_location])
Run Code Online (Sandbox Code Playgroud)
和
INSTR (string , substring [, position [, occurrence]])
Run Code Online (Sandbox Code Playgroud)
谢谢。
在尝试在 Visual Studio for Mac Community (7.0.1 [build 24]) 上编译 Xamarin Forms (2.3.4.247) 项目时,我在编码一段时间后不断收到以下两个错误,任何有关导致该错误的原因以及如何修复的线索它?
/Users/PathToProjectRoot/packages/Xamarin.Forms.2.3.4.247/build/portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20/Xamarin.Forms.targets(3,3): Error MSB4061: The "XamlCTask" task could not be instantiated from "/Users/PathToProjectRoot/packages/Xamarin.Forms.2.3.4.247/build/portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20/Xamarin.Forms.Build.Tasks.dll". Could not load file or assembly 'Xamarin.Forms.Build.Tasks' or one of its dependencies (MSB4061) (ProjectName)
/Users/PathToProjectRoot/packages/Xamarin.Forms.2.3.4.247/build/portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20/Xamarin.Forms.targets(3,3): Error MSB4060: The "XamlCTask" task has been declared or used incorrectly, or failed during construction. Check the spelling of the task name and the assembly name. (MSB4060) (ProjectName)
Run Code Online (Sandbox Code Playgroud)
bin和obj文件夹以尝试重建。 …如果我尝试更换或取消订单,我会收到一条消息
58=Conditionally Required Field Missing
,下一条消息包含
58=Invalid MsgType
以下日志:
换单(tgFZctx200U61是我这边的,FG是换的。):
20170203-15:44:04.225 : 8=FIX.4.49=15135=G34=349=tgFZctx200U6152=20170203-15:44:04.22556=FG1=U6111=270071221=138=240=241=2700744=11640054=155=RTS-3.1760=20170203-18:44:04.20510=028
20170203-15:44:04.225 : 8=FIX.4.49=23235=849=FG56=tgFZctx200U6134=352=20170203-15:43:56.98137=572984433198=F:572984433526=$01$11=270071241=2700717=exec-201702031001027616150=E39=E55=RTS-3.17461=FXXXXX54=138=140=2151=114=06=060=19700101-00:00:00.00010=213
20170203-15:44:04.275 : 8=FIX.4.49=11535=j34=449=tgFZctx200U6152=20170203-15:44:04.27556=FG45=358=Conditionally Required Field Missing372=8380=510=065
20170203-15:44:04.275 : 8=FIX.4.49=33335=849=FG56=tgFZctx200U6134=452=20170203-15:43:56.98237=572984753198=F:572984753526=$01$11=270071241=27007453=1448=tgFZctx200U61447=C452=317=3355471052150=539=01=FZ00U6155=RTS-3.1754=138=240=244=116400.00000336=9291151=214=06=060=20170203-15:43:56.98920008=-922337203685372211120018=[51000-3355471052-0]10=100
20170203-15:44:04.285 : 8=FIX.4.49=10335=349=FG56=tgFZctx200U6134=552=20170203-15:43:57.03345=4371=372373=1158=Invalid MsgType372=810=164
Run Code Online (Sandbox Code Playgroud)
取消订单:
20170203-15:26:19.178 : 8=FIX.4.49=15435=F34=349=tgFZctx200U6152=20170203-15:26:19.17856=FG11=270061237=57286383038=141=2700644=116470.0000054=155=RTS-3.1760=20170203-18:26:19.17810=013
20170203-15:26:19.188 : 8=FIX.4.49=20735=849=FG56=tgFZctx200U6134=352=20170203-15:26:11.92437=572863830198=F:572863830526=$01$11=270061241=2700617=exec-201702031001027615150=639=655=RTS-3.17461=FXXXXX54=138=140=2151=114=06=010=239
20170203-15:26:19.418 : 8=FIX.4.49=11535=j34=449=tgFZctx200U6152=20170203-15:26:19.41856=FG45=358=Conditionally Required Field Missing372=8380=510=070
20170203-15:26:19.418 : 8=FIX.4.49=33335=849=FG56=tgFZctx200U6134=452=20170203-15:26:11.92437=572863830198=F:572863830526=$01$11=270061241=27006453=1448=tgFZctx200U61447=C452=317=3354681208150=439=41=FZ00U6155=RTS-3.1754=138=140=244=116470.00000336=9291151=014=06=060=20170203-15:26:11.93120008=-922337203685267353520018=[51000-3354681208-0]10=080
20170203-15:26:19.418 : 8=FIX.4.49=10335=349=FG56=tgFZctx200U6134=552=20170203-15:26:12.16445=4371=372373=1158=Invalid MsgType372=810=161
Run Code Online (Sandbox Code Playgroud)
最好的问候,米哈伊尔
我有以下(匿名)systemd 脚本,名为 tomcat-autostart.service,存储在“/usr/lib/systemd/system/tomcat-autostart.service”中
[Unit]
Description=Tomcat Autostart Script
Requires=var-www-projects.mount
After=var-www-projects.mount
[Service]
Type=forking
ExecStart=/usr/bin/tomcat-autostart start
ExecStop=/usr/bin/tomcat-autostart stop
[Install]
WantedBy=multi-user.target
Run Code Online (Sandbox Code Playgroud)
运行后
sudo systemctl daemon-reload
sudo systemctl enable tomcat-autostart.service
Run Code Online (Sandbox Code Playgroud)
我收到错误消息:
Failed to execute operation: Bad message
Run Code Online (Sandbox Code Playgroud)
我还在 /var/log/messages 中得到以下输出
Feb 17 11:29:53 cheese systemd: [/usr/lib/systemd/system/tomcat-autostart.service:1] Assignment outside of section. Ignoring.
Feb 17 11:29:53 cheese systemd: tomcat-autostart.service lacks both ExecStart= and ExecStop= setting. Refusing.
Feb 17 11:29:53 cheese systemd: [/usr/lib/systemd/system/tomcat-autostart.service:1] Missing '='.
Feb 17 11:29:53 cheese systemd: [/usr/lib/systemd/system/tomcat-autostart.service:1] Missing '='.
Run Code Online (Sandbox Code Playgroud)
我让它工作了一段时间,然后我在“[Unit]”行上方添加了一些注释,然后它停止工作了。然后我删除了注释,并且可能无意中修改了脚本中的其他内容,此后我无法让它再次运行。
它似乎以自己的矛盾为乐。第一条错误消息表明第一行有一个赋值(“[Unit]”),第三条错误消息表明该赋值缺少“=”符号。所以基本上,“[Unit]”是一个赋值,只不过它不是因为它缺少“=”符号。
搜索该问题已确定第二条错误消息是其他错误消息的直接原因。因为它忽略节标题,所以它永远不会读取 ExecStart 和 …
作为angular的初学者,我在尝试通过angular-cli构建我的应用程序时遇到了一个问题。
在遵循了本教程之后:
我的appModule看起来像:
...
providers: [
{ provide: HttpService, useFactory: (backend: XHRBackend, options: RequestOptions) => {
return new HttpService(backend, options); },
deps: [XHRBackend, RequestOptions]}
]
...
Run Code Online (Sandbox Code Playgroud)
构建它时,我得到:
Error: Error encountered resolving symbol values statically. Function calls are
not supported. Consider replacing the function or lambda with a reference to an
exported function (position 63:39 in the original .ts file), resolving symbol Ap
pModule in ../angular/app/src/app/app.module.ts
at positionalError (..\angular\app\node_modules\@angular\compiler-c
li\src\static_reflector.js:595:18)
Run Code Online (Sandbox Code Playgroud)
当我使用ng serve该应用程序时,没有任何问题。
我试图了解如何在另一个Promise中解决Promise.
我想要实现的步骤如下:
User通过UserManager(功能)获取其idfirstNameUser通过UserManager(功能)保存到数据库我正在寻找测试成功UserManager.saveUser(user);回报的回应true.但是我收到了一个错误.
UserManagerTest.js
//[...]
it("Should save a user to the database", function () {
var response = UserManager.getUserByLogin("Foo.Bar@provider.com", "Test")
.then(function (user) {
user.firstName = "Macarena";
return UserManager.saveUser(user);
})
.catch((error) => {
console.log("This error occured: "+error);
return false;
})
return Promise.all([
expect(response).to.eventually.be.true
]);
});
//[...]
Run Code Online (Sandbox Code Playgroud)
控制台输出
1) UserManager Save Should save a user to the database:
AssertionError: expected undefined to be true
at node_modules/chai-as-promised/lib/chai-as-promised.js:305:22
at process._tickCallback …Run Code Online (Sandbox Code Playgroud) 我在firebase例程中有以下代码.收到通知时,如何将通知消息或数据显示为警报?我的服务器上的PHP代码成功地通过id将消息推送到Android设备,并且在收到消息时听到声音,但我想显示警报或转移到片段(我更喜欢警报).
public class MyFirebaseMessagingService extends FirebaseMessagingService
{
private static final String TAG = "MyFirebaseMessService";
@Override
public void onMessageReceived(RemoteMessage remoteMessage)
{
commonfunc.myprint("#####_____MyFirebaseMessService_from 1 : " + remoteMessage.getFrom());
if(remoteMessage.getData().size() > 0)
{
commonfunc.myprint("MyFirebaseMessService_getdata 2 : " + remoteMessage.getData());
Map<String, String> data = remoteMessage.getData();
String value1 = data.get("dtitle");
String value2 = data.get("dbody");
commonfunc.myprint("MyFirebaseMessService_getdata 2 : " + value1 + " " + value2);
sendNotification(remoteMessage.getData().toString());
}
if (remoteMessage.getNotification() != null)
{
commonfunc.myprint("MyFirebaseMessService_getNot 3 body: " + remoteMessage.getNotification().getBody());
commonfunc.myprint("MyFirebaseMessService_getNot 3 title: " + remoteMessage.getNotification().getTitle());
sendNotification(remoteMessage.getNotification().getBody()); …Run Code Online (Sandbox Code Playgroud)