我想在php 5.5中使用php gettext扩展(在win2008服务器上,使用IIS7).我这样做:
<?php
$locale = "es";
if (isSet($_GET["locale"])) $locale = $_GET["locale"];
putenv("LC_ALL=$locale");
setlocale(LC_ALL, $locale);
bindtextdomain("messages", "./locale");
textdomain("messages");
echo gettext("Hello world");
?>
Run Code Online (Sandbox Code Playgroud)
使用此文件夹结构:
locale/es/LC_MESSAGES/messages.mo
Run Code Online (Sandbox Code Playgroud)
但它总是只返回Hello世界而不是正确的翻译现在(基于我缺乏西班牙语技能)是在messages.po文件中:
msgid ""
msgstr ""
"Project-Id-Version: TestXlations\n"
"POT-Creation-Date: 2014-04-19 08:15-0500\n"
"PO-Revision-Date: 2014-04-19 09:18-0500\n"
"Language-Team: \n"
"Language: es\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
"X-Generator: Poedit 1.6.3\n"
"X-Poedit-Basepath: .\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Poedit-SearchPath-0: c:/dev\n"
msgid "Hello world"
msgstr "Hola World"
Run Code Online (Sandbox Code Playgroud)
这从cmd行和IIS失败.所以我看到gettext调用等并执行它但它没有读取翻译文件.我该如何进一步调试?即使删除翻译文件,我也会得到相同的行为.
可以通过属性文件设置Ant属性,从属性文件中解析其他属性吗?
例如,我可以这样做:
<property name="prop1" value="in_test_xml1" />
<property name="prop2" value="${prop1}" />
Run Code Online (Sandbox Code Playgroud)
并且prop2变为"in_test_xml1".非常好.
但在这种情况下,使用输入属性文件时:
prop1=sample_prop
prop2=${prop1}
Run Code Online (Sandbox Code Playgroud)
prop2未设置为"sample_prop"
因此,当执行解析的属性位于ant文件本身时,解析其他属性的属性似乎才有效.
这是预期还是我错过了什么?
这是来自"man select"的代码示例加上几行来读取正在写入的实际文件.我怀疑当./myfile.txt
写入时,select
会返回它现在可以从该fd读取.但是,只要txt文件存在,select就会在while循环中不断返回.我希望它只在新数据写入文件末尾时返回.我认为这应该是如何运作的.
#include <stdio.h>
#include <fcntl.h>
#include <stdlib.h>
#include <sys/time.h>
#include <sys/types.h>
#include <unistd.h>
int
main(void)
{
fd_set rfds;
struct timeval tv;
int retval;
int fd_file = open("/home/myfile.txt", O_RDONLY);
/* Watch stdin (fd 0) to see when it has input. */
FD_ZERO(&rfds);
FD_SET(0, &rfds);
FD_SET(fd_file, &rfds);
/* Wait up to five seconds. */
tv.tv_sec = 5;
tv.tv_usec = 0;
while (1)
{
retval = select(fd_file+1, &rfds, NULL, NULL, &tv);
/* Don't rely on the value of …
Run Code Online (Sandbox Code Playgroud) 我正在寻找解释为什么在这些网站上讨论了2种不同的mercator公式.
我理解这是正确的墨卡托投影算法:
http://en.wikipedia.org/wiki/Mercator_projection
y = ln|sec(lat) + tan(lat)|
Run Code Online (Sandbox Code Playgroud)
但是,这个网站指的是完全不同的东西:http: //wiki.openstreetmap.org/wiki/Mercator
#include <math.h>
double lat2y(double a) { return 180/M_PI * log(tan(M_PI/4+a*(M_PI/180)/2)); }
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?
我正在关注微软关于此主题的教程,但它不起作用,我不清楚几个项目. http://msdn.microsoft.com/en-us/library/ms733766.aspx
这是我的错误:
HTTP Error 404.17 - Not Found
The requested content appears to be script and will not be served by the static file handler.
Run Code Online (Sandbox Code Playgroud)
谢谢.
以下链接器命令导致以下错误.这是为XCode for iOS中的模拟器目标构建的.目前还不清楚甚至通过XCode提供Xlinker参数.关于我如何在这里寻求解决方案的任何想法?
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -static -arch_only i386 -syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/ iPhoneSimulator7.1.sdk -Xlinker -sectcreate -Xlinker __TEXT -Xlinker __entitlements -o libxxx.a
错误:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool:未知选项字符`X': - Xlinker
(注意:这个错误似乎无处不在.几天前相同的项目文件正在构建).
我有一个依赖于多个静态库的 exe,在 Visual Studio 中,它们都作为 1 个 sln 文件的一部分进行管理,并且该 exe 依赖于静态库。
如何在 Qt Creator 中进行设置?似乎有 2 个选项:1. 在 Qt Creator“会话”中创建多个项目。但是会话不会在用户之间共享,对吗?所以我不确定这会如何工作?例如,是否有创建的会话文件?2.使用子项目。并制作exe的静态lib sub projs?
有什么建议吗?我对 Qt Creator 完全陌生,需要将它用于 linux 端口。
谢谢!
我需要有条件地更新一列,在某些情况下根本不更新它。这是我能想到的最好方法,但它似乎在 ELSE 中效率低下,因为它仍在使用列的当前值更新列。有没有更好的方法让 ELSE 可以“什么都不做”。
UPDATE mytable
SET col1 = CASE WHEN (col1 = 20) THEN 10 ELSE col1 END
Run Code Online (Sandbox Code Playgroud) 这是 lambda 代码。我不确定为什么bucket.objects.all()无法访问s3。
导入 json 导入 boto3 s3 = boto3.resource('s3')
def lambda_handler(事件, 上下文): 打印(事件)
message = 'Hello {}!'.format(event['Records'][0]['s3']['bucket']['name'])
print(message)
bucket = s3.Bucket('my-bucketname-demo')
# this works
print(bucket.creation_date)
# this fails on access denied
# Iterates through all the objects, doing the pagination for you. Each obj
# is an ObjectSummary, so it doesn't contain the body. You'll need to call
# get to get the whole body. …
Run Code Online (Sandbox Code Playgroud) 我正在使用一个开源库,它构建为像libshared.la这样的文件.我可以使用普通的gcc命令静态链接到这个文件吗?我更熟悉.so文件的动态链接和.a文件的静态链接.虽然不确定.la.谢谢!