灯角

文章 0 评论 0 浏览 23

灯角 2024-11-11 15:57:51

现在是这样的:

Resque.remove_queue("...")

This is what works now:

Resque.remove_queue("...")

如何销毁由 resque 工作人员排队的工作?

灯角 2024-11-11 15:35:24

您需要的答案是 AJAX。我建议花一些时间在此处了解其工作原理。

AJAX 将允许您调用服务器上的远程页面并从中获取响应。该远程页面可以执行任何普通 php 脚本可以执行的任何操作,包括根据需要将信息保存到数据库。

The answer you need is AJAX. I recommend spending some time learning how it works here.

AJAX will allow you to call a remote page on the server and get responses from it. That remote page can do anything that any normal php script could do, including as you need, save info to the database.

javascript在后端调用php

灯角 2024-11-11 14:51:37

你当然可以 - 我用 Python 开发了这个库来完成我的网络抓取工作。

一个好的解析库是 lxml

如果您是 Python 新手,您可能需要先阅读这本电子书

You certainly can - I developed this library in Python for my web scraping work.

A good parsing library is lxml.

If you are new to Python you may want to work through this ebook first.

是否可以通过Python进行HTML抓取、数据挖掘?

灯角 2024-11-11 13:20:28

对我有用:http://jsfiddle.net/mplungjan/xBzPW/

<style>
.income_table { background-color:red }
.toggled_tr { background-color:yellow }
</style>
<script>
$(document).ready(function() {
  $(".income_table tr").click(function () {
   $(this).toggleClass("toggled_tr");
  });
});
</script>

<table class="income_table">
    <tr>
        <td>Row 1 cell 1</td>
        <td>Row 1 cell 2</td>
    </tr>
    <tr>
        <td>Row 2 cell 1</td>
        <td>Row 2 cell 2</td>
    </tr>
</table> 

Works for me : http://jsfiddle.net/mplungjan/xBzPW/

<style>
.income_table { background-color:red }
.toggled_tr { background-color:yellow }
</style>
<script>
$(document).ready(function() {
  $(".income_table tr").click(function () {
   $(this).toggleClass("toggled_tr");
  });
});
</script>

<table class="income_table">
    <tr>
        <td>Row 1 cell 1</td>
        <td>Row 1 cell 2</td>
    </tr>
    <tr>
        <td>Row 2 cell 1</td>
        <td>Row 2 cell 2</td>
    </tr>
</table> 

Javascript 定位 tr 元素

灯角 2024-11-11 10:24:40

这里是解析和解析的完整代码将 RTF 写入纯文本

    import java.io.FileInputStream;
    import java.io.FileWriter;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import javax.swing.text.BadLocationException;
    import javax.swing.text.Document;
    import javax.swing.text.rtf.RTFEditorKit;

    public class rtfToJson {
    public static void main(String[] args)throws IOException, BadLocationException {
    // TODO Auto-generated method stub
    RTFEditorKit rtf = new RTFEditorKit();
    Document doc = rtf.createDefaultDocument();

    FileInputStream fis = new FileInputStream("C:\\SampleINCData.rtf");
    InputStreamReader i =new InputStreamReader(fis,"UTF-8");
    rtf.read(i,doc,0);
   // System.out.println(doc.getText(0,doc.getLength()));
    String doc1 = doc.getText(0,doc.getLength());


    try{    
           FileWriter fw=new FileWriter("B:\\Sample INC Data.txt");    
           fw.write(doc1);    
           fw.close();    
          }catch(Exception e)
    {
              System.out.println(e);
              }    
          System.out.println("Success...");    
     }    

    }

Here is the full code to parse & write RTF as a plain text

    import java.io.FileInputStream;
    import java.io.FileWriter;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import javax.swing.text.BadLocationException;
    import javax.swing.text.Document;
    import javax.swing.text.rtf.RTFEditorKit;

    public class rtfToJson {
    public static void main(String[] args)throws IOException, BadLocationException {
    // TODO Auto-generated method stub
    RTFEditorKit rtf = new RTFEditorKit();
    Document doc = rtf.createDefaultDocument();

    FileInputStream fis = new FileInputStream("C:\\SampleINCData.rtf");
    InputStreamReader i =new InputStreamReader(fis,"UTF-8");
    rtf.read(i,doc,0);
   // System.out.println(doc.getText(0,doc.getLength()));
    String doc1 = doc.getText(0,doc.getLength());


    try{    
           FileWriter fw=new FileWriter("B:\\Sample INC Data.txt");    
           fw.write(doc1);    
           fw.close();    
          }catch(Exception e)
    {
              System.out.println(e);
              }    
          System.out.println("Success...");    
     }    

    }

Java 中 RTF 到纯文本

灯角 2024-11-11 09:15:22

我要做的是创建一个特殊的类来处理菜单创建和事件并将所有内容委托给它。代码如下所示:

public class MenuHandler {
    private Activity activity;

    public MenuHandler(Activity activity) {
        this.activity = activity;
    }

    public boolean onCreateOptionsMenu(Menu menu) {
        MenuInflater inflater = activity.getMenuInflater();
        inflater.inflate(R.menu.menu, menu);
        return true;
    }

    public boolean onOptionsItemSelected(MenuItem item) {
        //Handle events here
    }
}

然后,当您需要在 Activity 中添加菜单时,您可以创建 MenuHandler 并将方法调用委托给它:

public MyActivity extends Activity {
    private MenuHandler menuHandler;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        menuHandler = new MenuHandler(this);
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        return menuHandler.onCreateOprionsMenu(menu);
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        return menuHandler.onOptionsItemSelected(item);
    }
}

What I would do is create a special class to handle menu creation and events and delegate everythng to it. The code will look like this:

public class MenuHandler {
    private Activity activity;

    public MenuHandler(Activity activity) {
        this.activity = activity;
    }

    public boolean onCreateOptionsMenu(Menu menu) {
        MenuInflater inflater = activity.getMenuInflater();
        inflater.inflate(R.menu.menu, menu);
        return true;
    }

    public boolean onOptionsItemSelected(MenuItem item) {
        //Handle events here
    }
}

Then when you need to have a menu in your Activity, you create MenuHandler and delegate method calls to it:

public MyActivity extends Activity {
    private MenuHandler menuHandler;

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        menuHandler = new MenuHandler(this);
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        return menuHandler.onCreateOprionsMenu(menu);
    }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        return menuHandler.onOptionsItemSelected(item);
    }
}

将类转换为接口

灯角 2024-11-11 04:10:10

如果您可以将其导出为 CSV 或 TSV 文件,则可以使用我的 CHCSVParser 来完成所有解析为你工作。

If you can export it as a CSV or TSV file, you can use my CHCSVParser to do all of the parsing work for you.

Excel 文件导入 NSArray

灯角 2024-11-10 17:18:00

这段代码会对你有所帮助。

wbb = (WebView) findViewById(R.id.webView_tobe_loaded);

    WebSettings wbset=wbb.getSettings();
    wbset.setJavaScriptEnabled(true);
    wbb.setWebViewClient(new MyWebViewClient());
    String url="http://www.google.com";

    System.out.println(getdeviceid());
    wbb.getSettings().setJavaScriptEnabled(true);
    wbb.loadUrl(url);

This piece of code will help you.

wbb = (WebView) findViewById(R.id.webView_tobe_loaded);

    WebSettings wbset=wbb.getSettings();
    wbset.setJavaScriptEnabled(true);
    wbb.setWebViewClient(new MyWebViewClient());
    String url="http://www.google.com";

    System.out.println(getdeviceid());
    wbb.getSettings().setJavaScriptEnabled(true);
    wbb.loadUrl(url);

如何在Android WebView中显示网站

灯角 2024-11-10 12:16:32

您可以将“单词”数组设置为正则表达式数组,和 \b 字边界标记。例如:

var spam_words_arr=new Array(
    /\bloan\b/i,
    ...
);

...然后使用 exec< /a> 或 test 函数在正则表达式上做测试。

事实上,你的数组可能会成为一个巨大的交替,两端都有 \b:(

var regex = /\b(?:loan|winning|bulk email|mortgage|free)\b/i;

我显然已经将数组的大部分内容排除在外。)在 JavaScript 正则表达式中,像 a|b 这样的交替表示“匹配 ab

为此使用正则表达式的另一个优点是您可以更加灵活而不是所有可疑单词的暴力列表。


离题

  1. 为了初始化数组,我建议使用数组文字表示法,而不是您使用的构造函数调用,例如:

    var spam_words_array = [
        入口,
        入口,
        入口,
        // ...
    ];
    

    它更短,它不会与重新定义Array的人发生冲突,并且您不会对var x = new Array(5);有什么歧义应该意味着(创建一个包含五个空白点的数组,而不是一个包含 5 个条目的数组)。

  2. eval 的这些用法……很奇怪,因为它们看起来完全没有必要。很少有需要使用 eval 的用例(我已经成功地进行了几年的 JavaScript 编码,但从未在生产代码中使用过它)。如果您发现自己正在编写 eval,建议您在 StackOverflow 上发布一个问题,其中只包含您认为需要它的代码以及原因,这里的人员将为您提供更好的选择。

You could make your array of "words" an array of regular expressions, and the the \b word boundary marker. E.g.:

var spam_words_arr=new Array(
    /\bloan\b/i,
    ...
);

...then use the exec or test functions on the regular expression to do the test.

In fact, your array could become one massive alternation with \b on either end:

var regex = /\b(?:loan|winning|bulk email|mortgage|free)\b/i;

(I've obviously left most of the array out.) In a JavaScript regular expression, an alternation like a|b means "match a or b.

Another advantage to using a regular expression for this is that you can be more flexible than a brute-force list of all suspect words.


Off-topic:

  1. For initializing an array, I'd recommend array literal notation rather than the constructor call you've used, e.g.:

    var spam_words_array = [
        entry,
        entry,
        entry,
        // ...
    ];
    

    It's shorter, it can't run afoul of someone redefining Array, and you don't have the ambiguity of what var x = new Array(5); should mean (that creates an array with five blank spots, rather than an array with one entry containing 5).

  2. Those uses of eval are...odd as they seem completely unnecessary. There are very, very few use-cases where eval is necessary (I've managed to do several years of JavaScript coding without ever using it in production code). If you find yourself writing eval, recommend posting a question here on StackOverflow with just the bit of code you think you need it for, and why, and the folks here will give you a better alternative.

JavaScript 垃圾邮件词过滤器

灯角 2024-11-10 08:04:52

在 Dynamics CRM 中,有一个快速查看表单的概念。我们可以将查找控制实体的信息显示到这个快速查看表单中。我们可以在添加表单的自定义部分添加快速查看表单。

In Dynamics CRM, there is a concept of a Quick view form. We can show the information of lookup control entity into this Quick view form. We can add the quick view form in a customization section where we are adding the forms.

如何在 Microsoft Dynamic CRM 的帐户表单中显示主要联系信息?

灯角 2024-11-10 06:13:35

您开始播放电影,但没有将 [thePlayer view] 添加到视图层次结构中,这就是您看不到任何内容的原因。看一下苹果文档中对此操作的描述:

当您将电影播放器​​的视图添加到应用程序的视图层次结构时,请确保正确调整框架的大小,如下所示:

MPMoviePlayerController *player =
        [[MPMoviePlayerController alloc] initWithContentURL: myURL];
[player.view setFrame: myView.bounds];  // player's frame must match parent's
[myView addSubview: player.view];
// ...
[player play];

MPMoviePlayerController 类参考

You initiated playing of a movie but didn't add [thePlayer view] into views hierarchy that is why you do not see anything. Take a look at description of this operation in apple docs:

When you add a movie player’s view to your app’s view hierarchy, be sure to size the frame correctly, as shown here:

MPMoviePlayerController *player =
        [[MPMoviePlayerController alloc] initWithContentURL: myURL];
[player.view setFrame: myView.bounds];  // player's frame must match parent's
[myView addSubview: player.view];
// ...
[player play];

MPMoviePlayerController Class Reference

如何在 iPhone 应用程序中播放电影?

灯角 2024-11-10 04:20:38

首先,有一个 List.nth 函数可以替换您的辅助函数。

let n = Random.int (List.length lst) in
    List.nth n lst ;;

(尽管这不会更快,因为我很确定它的作用与您的辅助函数几乎相同)

就加快速度而言:如果您拥有的字符串数量是固定的,您可以使用数组由于数组的访问时间是恒定的,这会大大加快速度。

First off, there's a List.nth function which could replace your helper function.

let n = Random.int (List.length lst) in
    List.nth n lst ;;

(though this would not be any faster since I'm pretty sure it does just about the same thing as your helper function does)

As far as speeding this up goes: if the number of strings you have is fixed, you could use an Array which would speed things up quite a lot as the access time for an Array is constant.

如何在 Ocaml 中随机选择一个元素?

灯角 2024-11-10 02:15:46

Java 不支持静态重命名。一种想法是使用新的类名对有问题的对象进行子类化(但由于某些副作用/限制,这可能不是一个好主意,例如您的目标类可能具有最终修饰符。在允许的情况下,如果显式类型检查,代码可能会表现不同使用 getClass()instanceof ClassToRename 等(下面的示例改编自不同的答案)

class MyApp {

  public static void main(String[] args) {
    ClassToRename parent_obj = new ClassToRename("Original class");
    MyRenamedClass extended_obj_class_renamed = new MyRenamedClass("lol, the class was renamed");
    // these two calls may be treated as the same
    // * under certain conditions only *
    parent_obj.originalFoo();
    extended_obj_class_renamed.originalFoo();
  }  

  private static class ClassToRename {
    public ClassToRename(String strvar) {/*...*/}
    public void originalFoo() {/*...*/}
  }

  private static class MyRenamedClass extends ClassToRename {
    public MyRenamedClass(String strvar) {super(strvar);}
  }

}

Java doesn't support static renaming. One idea is to subclass object in question with a new classname (but may not be a good idea because of certain side-effects / limitations, e.g. your target class may have the final modifier. Where permitted the code may behave differently if explicit type checking is used getClass() or instanceof ClassToRename, etc. (example below adapted from a different answer)

class MyApp {

  public static void main(String[] args) {
    ClassToRename parent_obj = new ClassToRename("Original class");
    MyRenamedClass extended_obj_class_renamed = new MyRenamedClass("lol, the class was renamed");
    // these two calls may be treated as the same
    // * under certain conditions only *
    parent_obj.originalFoo();
    extended_obj_class_renamed.originalFoo();
  }  

  private static class ClassToRename {
    public ClassToRename(String strvar) {/*...*/}
    public void originalFoo() {/*...*/}
  }

  private static class MyRenamedClass extends ClassToRename {
    public MyRenamedClass(String strvar) {super(strvar);}
  }

}

java,有没有一种方法可以用另一个名称导入一个类

灯角 2024-11-10 01:53:07

我认为你正在谈论 MySQL 并且你想做一个数据透视表。访问 ArtfulSoftware 的 MySQL 站点并查看数据透视表教程:
http://www.artfulsoftware.com/infotree/queries.php

I'm thinking you are talking MySQL and you want to do a pivot table. Go to ArtfulSoftware's MySQL site and review the pivot table tutorials:
http://www.artfulsoftware.com/infotree/queries.php

选择每天员工缺勤的计数

灯角 2024-11-10 01:32:02

GMFBridge 可用于此目的。 AFAIK 有 .NET 端口。查看 http://directshownet.sourceforge.net/about.html

使用智能连接可能会减慢速度图形构建过程。使用直接连接也可以加快该过程。

The GMFBridge can be used for this. There are ports to .NET AFAIK. Have a look at the GMFPlay application mentioned at http://directshownet.sourceforge.net/about.html.

Using intelligent connect can slow down the graph building process. Using direct connections should speed up the process as well.

如何在不同的文件中重用 DirectShow 过滤图

更多

推荐作者

娇女薄笑

文章 0 评论 0

biaggi

文章 0 评论 0

xiaolangfanhua

文章 0 评论 0

rivulet

文章 0 评论 0

我三岁

文章 0 评论 0

薆情海

文章 0 评论 0

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文