小编ska*_*dal的帖子

Meteor的反应性如何在幕后工作?

我已阅读文档并查看了反应性背后来源,但我不明白.

有人可以解释这是如何在幕后工作,因为它看起来像魔术:).

meteor

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

strcmp会在代码点顺序中比较utf-8字符串吗?

在C程序中,我想按Unicode代码点顺序对有效的UTF-8编码字符串列表进行排序.没有整理,没有区域设置意识.

所以我需要一个比较功能.编写这样一个迭代unicode字符的函数很容易.(我碰巧使用了GLib,所以我会迭代g_utf8_next_char并比较返回值g_utf8_next_char.)

但是,出于好奇和可能的简单性和效率,我想知道的是:一个简单的逐字节strcmp(或g_strcmp)实际上会做同样的工作吗?我想,它应,由于UTF-8 编码的最显著位第一和需要编码在N + 1个字节将具有比需要在N个字节将被编码的码点的较大初始字节的码点.

但也许我错过了什么?提前致谢.

c unicode glib utf-8

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

如何在 Java 中以语言环境正确的顺序格式化日和月?

有没有办法在 Java/Kotlin 中以正确的语言环境顺序格式化日期和月份(以紧凑形式)而不是年份?所以对于英语应该是“Sep 20”,但对于瑞典语应该是“20 sep.”。

为了比较,在 Cocoa 平台上,我可以执行以下操作(在 Swift 中):

let formatter = DateFormatter()
formatter.locale = Locale(identifier: "sv_SE")
formatter.setLocalizedDateFormatFromTemplate("MMM d")
print(formatter.string(from: Date()))
Run Code Online (Sandbox Code Playgroud)

这将正确地扭转局面。Java SDK 是否有相同的功能?我一直在尝试各种形式DateTimeFormatterSimpleTimeFormatAPI和旧API,但没有成功。

注意:此问题不同,我不想要包含年份的完整媒体格式。我也不想要DateTimeFormatter.ofPattern("MMM d"),因为这在瑞典语中给出了不正确的结果,或者DateTimeFormatter.ofPattern("d MMM"),因为在英语中给出了不正确的结果。

java localization date-formatting

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

Google登录无效

我尝试在我的网站上使用Google登录,但是,它一直给我400错误.

我引用了这篇文章:https://developers.google.com/identity/sign-in/web/sign-in,我的代码非常简单:

<html>
<head>
  <title>Test Google Login</title>
  <script src="https://apis.google.com/js/platform.js" async defer></script>
  <meta name="google-signin-client_id" content="<CHANGE IT>">
  <script>
  function onSignIn(googleUser) {
    var profile = googleUser.getBasicProfile();
    console.log('ID: ' + profile.getId());
    console.log('Name: ' + profile.getName());
    console.log('Image URL: ' + profile.getImageUrl());
    console.log('Email: ' + profile.getEmail());
  }
  </script>
</head>
<body>
  <div class="g-signin2" data-onsuccess="onSignIn"></div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

当我点击登录按钮时,它弹出一个窗口,登录后,它给了我400错误,如下所示:

400. That’s an error.

The requested URL was not found on this server. That’s all we know.
Run Code Online (Sandbox Code Playgroud)

我想这是重定向问题,但我不知道如何配置它.所以我查了url它还给了我:

https://accounts.google.com/o/oauth2/auth?fetch_basic_profile=true&scope=email+profile+openid&response_type=permission&e=3100087&redirect_uri=storagerelay://http/127.0.0.1:8000?id%3Dauth867179&ss_domain=http://127.0.0.1:8000&client_id=378468243311-9dt7m9ufa9mee305j1b12815put5betb.apps.googleusercontent.com&openid.realm&hl=en&from_login=1&as=1b5f0a407ea58e11&pli=1&authuser=0
Run Code Online (Sandbox Code Playgroud)

为什么redirect_uri"storagerelay://http/127.0.0.1:8000?id%3Dauth867179"?

google-api google-oauth

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

为什么 gettext Automake 宏包含已弃用的 AM_PROG_MKDIR_P 宏?

我正在尝试构建一个我有一段时间没有重新访问过的项目。我以 GNOME 应用程序的典型方式使用 GNU 自动工具。现在,当运行autogen.sh(反过来使用gnome-autogen.sh)时,我收到以下错误:

automake: warnings are treated as errors
configure.ac:47: warning: The 'AM_PROG_MKDIR_P' macro is deprecated, and its use is discouraged.
configure.ac:47: You should use the Autoconf-provided 'AC_PROG_MKDIR_P' macro instead,
configure.ac:47: and use '$(MKDIR_P)' instead of '$(mkdir_p)'in your Makefile.am files.
autoreconf: automake failed with exit status: 1
[simon:~/git/toddlerfun] master(+2/-2) 1 ± 
Run Code Online (Sandbox Code Playgroud)

问题似乎源于 gettext,运行此错误报告中的命令给出了相同的结果:

$ grep -ri AM_PROG_MKDIR_P m4
m4/intl.m4:  AC_REQUIRE([AM_PROG_MKDIR_P])dnl defined by automake
m4/po.m4:  AC_REQUIRE([AM_PROG_MKDIR_P])dnl defined by automake
$ head -n1 m4/po.m4 …
Run Code Online (Sandbox Code Playgroud)

automake gnome

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