我需要从给定的文本中提取所有英语动词,我想知道我是如何做到的......乍一看,我的想法是使用正则表达式,因为所有英语动词时态都遵循模式,但也许有另一种方法可以做到这一点.我的想法很简单:
你怎么看?我想这不是一种有效的方法,但我无法想象另一种方法.
先感谢您!
PS:
似乎每次我启动Xcode项目或"清理所有目标"时,Active Executable都会重置为iPad模拟器.
在Xcode 3.2.6发布之前,Xcode默认为iPhone模拟器或记得我以前的Active Executable ......我从来没有注意到这种行为,因为我一般都在做iPhone工作.这一直困扰着我最新的Xcode更新(iOS 4.3版本)并且真的很烦人.
类似的问题/答案建议将我的Target的"目标设备系列"设置为"iPhone" - 这已经完成.
这是新的行为吗?
有没有改变默认的'Active Executable'?
你可以使用streamreader来读取普通文本文件,然后在保存当前位置后再读取流读取器,然后再次打开streamreader并开始读取该poision吗?
如果不是我可以使用什么来完成相同的情况而不锁定文件?
这样的事情:
var fs = File.Open(@"C:\testfile.txt", FileMode.Open, FileAccess.Read);
var sr = new StreamReader(fs);
Debug.WriteLine(sr.ReadLine());//Prints:firstline
var pos = fs.Position;
while (!sr.EndOfStream)
{
Debug.WriteLine(sr.ReadLine());
}
fs.Seek(pos, SeekOrigin.Begin);
Debug.WriteLine(sr.ReadLine());//Prints Nothing, i expect it to print SecondLine.
Run Code Online (Sandbox Code Playgroud)
@lasseespeholt
这是我试过的代码
var position = -1;
StreamReaderSE sr = new StreamReaderSE(@"c:\testfile.txt");
Debug.WriteLine(sr.ReadLine());
position = sr.BytesRead;
Debug.WriteLine(sr.ReadLine());
Debug.WriteLine(sr.ReadLine());
Debug.WriteLine(sr.ReadLine());
Debug.WriteLine(sr.ReadLine());
Debug.WriteLine("Wait");
sr.BaseStream.Seek(position, SeekOrigin.Begin);
Debug.WriteLine(sr.ReadLine());
Run Code Online (Sandbox Code Playgroud) 我有以下模型Activity与语言依赖属性Title.语言依赖性由两个附加实体Translation(标题是这种类型,多对一)和TranslationValue(一对多)定义.
如果我写下面的hql:
from Activity act join fetch act.Title join fetch act.Title.TranslationValuesSet
Run Code Online (Sandbox Code Playgroud)
这到目前为止工作正常.但是一旦我将act添加到select语句中,我就遇到了TranslationValuesSet的连接问题:
select act from Activity act join fetch act.Title join fetch act.Title.TranslationValuesSet
Run Code Online (Sandbox Code Playgroud)
NHibernate.QueryException: Query specified join fetching, but the owner of the fetched association was not present in the select list [FromElement{explicit,not a collection join,fetch join,fetch non-lazy properties,classAlias=,role=Translation.TranslationValuesSet,tableName=TranslationValue,tableAlias=translatio3_,origin=Translation translatio2_,colums={translatio2_.TranslationId ,className=TranslationValue}}] [select act from Activity act join fetch act.Title join fetch act.Title.TranslationValuesSet
我无法弄清楚为什么Hibernate不喜欢它!?
任何tipps的Thx!
我使用Android WebView for Twitter OAuth:Twitter要求用户登录并授权应用程序,我检索访问令牌并将其保留在我的应用程序中.
我不需要(也不要)存储用户密码,但WebView会保留Twitter的cookie,并且还会询问用户是否要记住密码.因此,即使在通过他的Twitter帐户页面取消授权应用程序并且我的应用程序销毁访问令牌之后,下次打开WebView时,它可能仍然登录,即使没有,它也有密码框已经填写.
如何强制WebView不要求记住密码,以及不保留会话cookie?如果那是不可能的,我可以删除它存储的所有状态(图像缓存除外)吗?
我在qnx momemntics上运行以下代码.
#define BILLION 1000000000L;
struct timespec start_time;
struct timespec stop_time;
void start MyTestFunc() {
//Initialize the Test Start time
clock_gettime(CLOCK_REALTIME,&start_time)
// ... additonal code.
cout << "The exectuion time of func "<< calculateExecutionTime();
}
double calculateExecutionTime ()
{
clock_gettime(CLOCK_REALTIME,&stop_time);
double dSeconds = (stop_time.tv_sec - start_time.tv_sec);
double dNanoSeconds = (double)( stop_time.tv_nsec - start_time.tv_nsec ) / BILLION;
return dSeconds + dNanoSeconds;
}
Run Code Online (Sandbox Code Playgroud)
现在我想将代码移植到Windows上.任何人都可以提供示例代码.
谢谢!
我使用Newtonsofts的Json.Net将一些对象数组序列化为json.对象具有一组共同的属性,但也具有Meta属性,这是一个字典
在序列化期间,我希望将键值对添加到我的json对象,就像它们在根级别属性中一样,就像这样......
{
id: 1,
name:'jeff',
food:'spinch',
spoon: 'ýes'
}
Run Code Online (Sandbox Code Playgroud)
不是这样的:
{
id: 1,
name:'jeff',
meta:{
food:'spinch',
spoon: 'ýes'
}
}
Run Code Online (Sandbox Code Playgroud)
我已经挖了JsonSerializerSettings,但似乎无法发现我可以跳进去并覆盖???
我需要帮助以下代码不起作用:
var timeoutID=0;
var currentImage=0;//first image is position 0 in arrImages array
var arrImages=[bla bla bla array of image URLs];
function slideShow()
{
if($('#myImg').complete)// <------- Here is where it fails as that's UNDEFINED.
{
//curentImage is a global var that remebembers the on-screen image array key
var nextImage=currentImage+1;
//arrImages is the array of image URLs
if(nextImage>=arrImages.length){nextImage=0;}
$('#myImg').attr('src',nextImage);
clearTimeout(timeoutID);
//Change image each second after previous image was loaded
timeoutID=setTimeout("slideShow()",1000);
}
else
{
$('#myImg').load(slideShow);
}
}
基本上我想每秒更改#myImg的src,前提是计数器在加载图像后启动.
*我讨厌Stack Overflow文本编辑器中的代码按钮!
我想要做的是拆分sharepoint 2010上的globalnavigation栏,这样我就可以控制哪些菜单项应该浮动到栏的左侧或右侧.
如果没有完整的自定义版本,有没有办法做到这一点,所以我只需要编辑当前版本.或者我真的要做一个全新的?
我到目前为止所尝试的只是复制所有的UL> LI,用于显示如下的菜单项:
<div class="s4-tn">
<div class="menu horizontal menu-horizontal">
<ul class="static">
<li class="static dynamic-children">
<a href="#" CssClass="static dynamic-children menu-item">
<span class="additional-background">
<span class="menu-item-text">Custom Dropdown</span>
</span>
</a>
<ul class="dynamic">
<li class="dynamic">
<a href="#" class="dynamic menu-item">
<span class="additional-background">
<span class="menu-item-text">Test subsite</span>
</span>
</a>
</li>
</ul>
</li>
</ul>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
但它似乎没有触发下拉功能.可能只是一个天真的尝试.
任何有关此主题的指南或教程的链接都将是一个很大的帮助.
嘿,我发现了一个奇怪的气质页面随机给我以下错误
XML Parsing Error: no element found Location: http://kj2011/site_2011/nonprofit-database/overview.aspx Line Number 1, Column 1:
这个页面好像2周,但截至昨天我随机得到上述错误.我要删除页面并重新创建错误消失但几小时后会再次出现.我有一些其他模板
即 http://kj2011/site_2011/nonprofit-database/financial.aspx
它具有相同的主文件和用户控件,但从未得到错误只是overview.aspx页面.
有任何想法吗 ?