我在vim中编辑一个大文本数组,我想在它的一个子列上进行计算.
编辑文件的简化示例:
name value name saturation
red 5 green 2
blue 7 yellow 7
other text
Run Code Online (Sandbox Code Playgroud)
我想通过外部程序calc.pl来管道第4列,calc.pl用输入中的新数字替换数字,例如:
name value name saturation
red 5 green 2.4
blue 7 yellow 7.14
other text
Run Code Online (Sandbox Code Playgroud)
当我在第4列中选择矩形时,使用v.motion和!perl calc.pl,整条线将通过管道输送到calc.pl,而不仅仅是矩形.
解决方法是:将矩形切割为临时文件,在临时文件上运行calc.pl,然后将输出作为矩形读取.
在vim中是否有直接的解决方案,无需切割/外壳/粘贴?
例如,而不是做
ArrayList<ClassName> variableName;
Run Code Online (Sandbox Code Playgroud)
你做
ArrayList variableName;
Run Code Online (Sandbox Code Playgroud)
然后你添加一个"ClassName"类型的对象
variableName.add(objectName);
Run Code Online (Sandbox Code Playgroud)
会自动将数组的类型设置为
ArrayList<ClassName>
Run Code Online (Sandbox Code Playgroud)
?
public class SomeClass {
private HashSet<SomeObject> contents = new HashSet<SomeObject>();
private Set<SomeObject> contents2 = new HashSet<SomeObject>();
}
Run Code Online (Sandbox Code Playgroud)
有什么不同?最后他们都是HashSet不是吗?第二个看起来对我来说是错的,但我已经看到它经常使用,接受和工作.
我使用了一些不属于texlive的.sty文件,并希望将它们放在我的main.tex文件夹的子目录中.我使用以下行加载包:
\usepackage{sty/prettythesis}
Run Code Online (Sandbox Code Playgroud)
这有效,但使用xelatex和使用橡胶编译main.tex 会给我一个警告:
sty/prettythesis.sty: You have requested package `sty/prettythesis',
but the package provides `prettythesis'. (page 1)
Run Code Online (Sandbox Code Playgroud)
有没有办法防止这种警告或处理这种情况,而不必在所有.sty-files'\ ProvidePackage命令中包含"sty \"或设置TEXINPUTS环境变量(这似乎不能从main.tex本身) ?
我正在从两个不同的来源中删除一些文本.他们每个人都可以在不同的地方犯错,他们不会识别一封信/一组信件.如果他们不认识某事,那就换成了?例如,如果单词是Roflcopter,则一个源可能返回Ro?copter,而另一个源,Roflcop?er.我想要一个函数来返回两个匹配是否相同,允许多个?s.例:
match("Ro?copter", "Roflcop?er") --> True
match("Ro?copter", "Roflcopter") --> True
match("Roflcopter", "Roflcop?er") --> True
match("Ro?co?er", "Roflcop?er") --> True
Run Code Online (Sandbox Code Playgroud)
到目前为止,我可以使用正则表达式将一个OCR与一个完美的OCR匹配:
>>> def match(tn1, tn2):
tn1re = tn1.replace("?", ".{0,4}")
tn2re = tn2.replace("?", ".{0,4}")
return bool(re.match(tn1re, tn2) or re.match(tn2re, tn1))
>>> match("Roflcopter", "Roflcop?er")
True
>>> match("R??lcopter", "Roflcopter")
True
Run Code Online (Sandbox Code Playgroud)
但是当它们都在不同的地方时,这不起作用:
>>> match("R??lcopter", "Roflcop?er")
False
Run Code Online (Sandbox Code Playgroud) 是否可以写一个更快的等效函数?
prepend(X, Tuple) ->
list_to_tuple([X | tuple_to_list(Tuple)]).
Run Code Online (Sandbox Code Playgroud) 我不得不用gcroot做一些奇怪的事情,但我在动态转换线上得到以下错误:"不能使用'dynamic_cast'从'gcroot'转换为'IMyInterface ^'.在C#中,你可以很容易地投出一个任何接口的泛型对象.如果对象没有实现接口但是它会编译,你可能会遇到运行时错误.
gcroot<Object^> m_pDataObject;
IMyInterface obj = dynamic_cast<IMyInterface^>(m_pDataObject);
Run Code Online (Sandbox Code Playgroud) 我正在关注rails教程@ http://railstutorial.org
在第11章,我遇到了显示用户微博的问题.
根据本教程,RSPEC测试应该通过.但是,它失败了
1) UsersController GET 'show' should show the user's microposts
Failure/Error: get :show, :id => @user
undefined method `model_name' for NilClass:Class
# ./app/views/users/show.html.erb:10:in `_app_views_users_show_html_erb__49
# ./spec/controllers/users_controller_spec.rb:71
Run Code Online (Sandbox Code Playgroud)
当我尝试访问与其关联的微博的用户页面时,我得到一个例外:
NoMethodError in Users#show
Showing C:/Documents and Settings/XXXXX/workspace/sample_app/app/views/users/show.html.erb where line #10 raised:
undefined method `model_name' for NilClass:Class
Extracted source (around line #10):
7: </h1>
8: <% unless @user.microposts.empty? %>
9: <table class="microposts" summary="User microposts">
10: <%= render @microposts %>
11: </table>
12: <%= will_paginate @microposts %>
13: <% end %>
Rails.root: …Run Code Online (Sandbox Code Playgroud) 我在控制器中有以下内容
def update
@permission = Permission.find_by_user_id(params[:user_id])
Run Code Online (Sandbox Code Playgroud)
但我希望它也可以通过另一个参数找到, project_id
我如何在Rails中做这样的事情?
@permission = Permission.find_by_user_id_and_project_id(params[:user_id],params[:user_id])
Run Code Online (Sandbox Code Playgroud) Fahrzeug班
{
[Entry ("Typ")]
public string typ;
[Entry ("Name")]
public string name;
[RadioSelection("ListOfString")]
public int selected=0;
public IList<string> ListOfString;
}
public override void ViewWillAppear (bool animated)
{
base.ViewWillAppear (animated);
Fahrzeug x = new Fahrzeug();
x.typ="Neuwagen";
x.name="BMW X3";
x.ListOfString=new List<string>();
x.ListOfString.Add("asdf");
x.ListOfString.Add("bsdf");
var bc= new BindingContext(null,x,"asdf");
var dv = new MonoTouch.Dialog.DialogViewController(bc.Root,true);
dv.WantsFullScreenLayout=false;
dv.View.BackgroundColor=UIColor.DarkGray;
this.startview.AddSubview(dv.View);
Run Code Online (Sandbox Code Playgroud)
您好,我有上面的代码.startview不是全屏,上面有一个导航栏,正常的dv也超出了导航栏,但是当我点击ILISt改变值时,ILIST是全屏的,所以我无法回来,...重要的是,实际是一个UIView,我想在uiview中,...我想使用反射,因为那样我可以直接序列化数据的任何想法?