今天我遇到了一个非常奇怪的问题.在我的游戏中,我创建了AlertDialog,以便在一个成功时向用户显示下一级别的挑战.所以,相应的代码是这样的.当游戏成功时,调用showDialog(R.id.display_success)并执行以下代码.
所以,我希望在每个调用中执行此代码.然而; 游戏只执行一次,并在每个其他执行中显示相同的AlertDialog.我的意思是,就像在创建第一个实例并且始终使用第一个实例之后不创建实例一样.我希望我能够描述我的问题.
case R.id.display_success:
updateGameSettings();
message = formatLevel()
+ formatMission();
return new AlertDialog.Builder(this)
.setIcon(R.drawable.smiley_happy)
.setTitle(R.string.dialog_success)
.setMessage(message)
.setPositiveButton(R.string.alert_dialog_newgame, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
startANewGame();
}
})
.setNegativeButton(R.string.exit, new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int whichButton) {
finish();
}
})
.create();
Run Code Online (Sandbox Code Playgroud) 我有这个代码.它来自Zend Reading Mail示例.
$message = $mail->getMessage(1);
// output first text/plain part
$foundPart = null;
foreach (new RecursiveIteratorIterator($mail->getMessage(1)) as $part) {
try {
if (strtok($part->contentType, ';') == 'text/plain') {
$foundPart = $part;
break;
}
} catch (Zend_Mail_Exception $e) {
// ignore
}
}
if (!$foundPart) {
echo 'no plain text part found';
} else {
echo $foundPart->getContent();
}
Run Code Online (Sandbox Code Playgroud)
我能得到的是消息,它运作正常.但是尝试将消息解码为可读的东西是行不通的.我已经尝试过Zend_Mime,imap_mime和iconv而没有运气.
这是我得到的一个例子 $foundPart->getContent();
Hall = F3 heim = FAr
它应该说"Hallóheimúr"
我想要的只是一些图书馆,我可以在实践中"按下按钮,接收培根".我的意思是,我只想将库指向POP3电子邮箱,并以可读的形式(没有任何编码问题)和附件获取电子邮件.
imap_mime_header_decode()给我一个包含相同数据的数组.
iconv_ mime_ decode()是一样的
有没有人知道为什么会发生这种情况或某些我可以抽象出来的库(PHP/Python或Perl)
我尝试了很多在ASP.NET MVC中实现自定义配置文件提供程序.我已经阅读了很多很多教程,但我无法找到问题所在.它与ASP.NET MVC中的实现配置文件提供程序非常相似.
但是我想创建自己的Profile Provider,所以我编写了以下继承自的类ProfileProvider:
public class UserProfileProvider : ProfileProvider
{
#region Variables
public override string ApplicationName { get; set; }
public string ConnectionString { get; set; }
public string UpdateProcedure { get; set; }
public string GetProcedure { get; set; }
#endregion
#region Methods
public UserProfileProvider()
{ }
internal static string GetConnectionString(string specifiedConnectionString)
{
if (String.IsNullOrEmpty(specifiedConnectionString))
return null;
// Check <connectionStrings> config section for this connection string
ConnectionStringSettings connObj = ConfigurationManager.ConnectionStrings[specifiedConnectionString];
if (connObj != null) …Run Code Online (Sandbox Code Playgroud) namespace WTF {
/*
* C++'s idea of a reinterpret_cast lacks sufficient cojones.
*/
template<typename TO, typename FROM>
TO bitwise_cast(FROM in)
{
COMPILE_ASSERT(sizeof(TO) == sizeof(FROM), WTF_wtf_reinterpret_cast_sizeof_types_is_equal);
union {
FROM from;
TO to;
} u;
u.from = in;
return u.to;
}
} // namespace WTF
Run Code Online (Sandbox Code Playgroud)
这是否意味着我的意思?可能是这样,bitwise_cast如果POD中的任何一个TO或FROM不是POD并且不是(AFAIK)比内置的C++更强大,那么这里指定的实现将不会编译reinterpret_cast.
我在这里看到的唯一亮点就是没有人似乎bitwise_cast在Chromium项目中使用.
我正在尝试构建一个IVR并将其连接到我的网站,我能做到的不同(廉价)方式是什么.
这是示例测试文件:
Barcode:*99899801000689811*
JSC4000I accountNumber:10006898Sequence Number:998 Envelopes: 1
LCD5010V Using jsl 'CUSOFF' for output page '6'
Barcode:*99999901000673703*
LCD5010V Using jsl 'CUSOFF' for output page '4'
LCD5005V Using job 'A' for current page '4'
Run Code Online (Sandbox Code Playgroud)
因此,在此文件中,如何搜索单词条形码并提取它的前五位数,同时将其传递到数组中.
提前致谢.
什么是使用java String.replaceAll方法剥离MY-CORP \na的输入字符串如MY-CORP\My.Name的部分的正则表达式,所以我只能得到My.Name部分?
我试过了
public static String stripDomain(String userWithDomain) {
return userWithDomain.replaceAll("^.*\\", "");
}
Run Code Online (Sandbox Code Playgroud)
但我在索引4 ^附近遇到了意外的内部错误.*
我需要显示带有字体大小滑块和搜索按钮的FlowDocument.Scroll查看模式下的FlowDocumentReader正是我想要的,除了它总是显示垂直滚动条,而我只需要在它启用时显示它(内部ReaderScrollViewer的VerticalScrollBarVisibility是可见的,但我需要自动).我怎样才能实现这样的观点?
谢谢.
我在表格中有以下数据.
Name LeftId RightId
------------------------------------------
Cat 1
Cat 2
Dog 4
Dog 5
Dog 7
Dog 69
Gerbil 12 13
Run Code Online (Sandbox Code Playgroud)
我需要将它们插入到新表中...
Id Name
-------------------------------
1 Cat
2 Cat
4 Dog
5 Dog
7 Dog
69 Dog
12 Gerbil (or 13. don't care which number out of the two)
Run Code Online (Sandbox Code Playgroud)
所以字段LeftId和RightId可以包含NULLS或NVARHCAR值(即使它们被列为数字,上面......它们将始终是数字..只是导入创建字段为nvarchar(255).
如果需要,我可以修改源表字段.
有人可以帮忙吗?
我猜测insert语句中会有一个select查询并使用CASE语句.不过,我只是不确定如何做到最好.
干杯:)
我正在寻找RegEx来返回段落中的第一个[n]单词,或者如果段落包含少于[n]个单词,则返回完整的段落.
例如,假设我最多需要前7个单词:
<p>one two <tag>three</tag> four five, six seven eight nine ten.</p><p>ignore</p>
Run Code Online (Sandbox Code Playgroud)
我得到:
one two <tag>three</tag> four five, six seven
Run Code Online (Sandbox Code Playgroud)
对包含少于请求的字数的段落使用相同的RegEx:
<p>one two <tag>three</tag> four five.</p><p>ignore</p>
Run Code Online (Sandbox Code Playgroud)
简单地回复:
one two <tag>three</tag> four five.
Run Code Online (Sandbox Code Playgroud)
我对此问题的尝试产生了以下RegEx:
^(?:\<p.*?\>)((?:\w+\b.*?){1,7}).*(?:\</p\>)
Run Code Online (Sandbox Code Playgroud)
但是,这只返回第一个单词 - "one".它不起作用.我觉得 .*?(在\ w +\b之后)导致问题.
我哪里错了?任何人都可以提出一个有效的RegEx吗?
仅供参考,我正在使用.Net 3.5的RegEX引擎(通过C#)
非常感谢