小编mic*_*ael的帖子

在脚本完成之前执行Ruby系统调用

我有一个Ruby脚本,使用erb模板生成Latex文档.生成.tex文件后,我想进行系统调用以编译文档pdflatex.以下是脚本的骨骼:

class Book
  # initialize the class, query a database to get attributes, create the book, etc.
end

my_book = Book.new
tex_file = File.open("/path/to/raw/tex/template")
template = ERB.new(tex_file.read)
f = File.new("/path/to/tex/output.tex")
f.puts template.result
system "pdflatex /path/to/tex/output.tex"
Run Code Online (Sandbox Code Playgroud)

system行使我进入交互式tex输入模式,就像文档是空的一样.如果我删除了呼叫,则正常生成文档.如何确保在生成文档之后才进行系统调用?与此同时,我只是使用一个调用ruby脚本的bash脚本,然后pdflatex解决问题.

ruby erb pdflatex

0
推荐指数
1
解决办法
338
查看次数

ASP.NET上的radiobuttons出错

为什么以下代码显示错误?请更正一下:

    protected void Button1_Click(object sender, EventArgs e)
{
    if (RadioButtonList1.SelectedIndex='0') 
    {
        Response.Redirect("page1.aspx");
    }
    else if (RadioButtonList1.SelectedIndex='1') 
    {
        Response.Redirect("page2.aspx");
    }
    else if (RadioButtonList1.SelectedIndex='2') 
    {
        Response.Redirect("page3.aspx");
    }
}
Run Code Online (Sandbox Code Playgroud)

我的设计代码是:

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:RadioButtonList ID="RadioButtonList1" runat="server">
            <asp:ListItem>item1</asp:ListItem>
            <asp:ListItem>item2</asp:ListItem>
            <asp:ListItem>item3</asp:ListItem>
        </asp:RadioButtonList></div>
        <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" />
    </form>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

c# asp.net

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

Js - 如果var未定

为什么以下代码中没有显示警报?

var a = Array();
a[1] = "asd";
a[100] = "asdd";
alert(typeof a[50]);
if(typeof a[50] === 'undefinied') alert('und');
Run Code Online (Sandbox Code Playgroud)

javascript

-1
推荐指数
1
解决办法
92
查看次数

哪种计算:'+',' - ','*','/'在intel X86 cpu上最快?

哪一种计算:+,-,*,/是发展最快的Intel X86 CPU?有人告诉我/是最快的,但他没有告诉我为什么.我不知道.可以证明吗?

x86

-1
推荐指数
1
解决办法
343
查看次数

标签 统计

asp.net ×1

c# ×1

erb ×1

javascript ×1

pdflatex ×1

ruby ×1

x86 ×1