嗨我有一个文本有多个链接包裹在文本中...
我想要一个正则表达式(即时通讯使用javascript),它可以解析文本并返回一个链接数组...
例如对于文本......
http://www.youtube.com/watch?v=-LiPMxFBLZY
testing
http://www.youtube.com/watch?v=Q3-l22b_Qg8&feature=related
Run Code Online (Sandbox Code Playgroud)
正则表达式将解析文本并返回一系列链接
arr[0] = "http://www.youtube.com/watch?v=-LiPMxFBLZY"
arr[1] = "http://www.youtube.com/watch?v=Q3-l22b_Qg8&feature=related"
Run Code Online (Sandbox Code Playgroud)
即时尝试使用代码...
var ytre =/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig ;
var matches = new Array();
matches = ytre.exec(text);
var jm;
if (matches !=null )
{
for (jm=0; jm<matches.length; jm++)
{
console.log(matches[jm]);
}
}
Run Code Online (Sandbox Code Playgroud)
但它没有返回适当的结果......
请帮忙
谢谢
class CHaraICICCC
{
int i;
char c1;
int j;
char c2;
char c3;
char c4;
};
class CHaraIICCCC
{
int i;
int j;
char c1;
char c2;
char c3;
char c4;
};
void fun()
{
CHaraICICCC eici;
CHaraIICCCC eiicc;
int icic = sizeof(eici); // -> output of icic is 16.
int iicc = sizeof(eiicc); // -> output of icic is 12.
}
Run Code Online (Sandbox Code Playgroud)
如果有人知道,请让我知道为什么这样.谢谢哈拉
我最近开始使用clojure,我正在使用leiningen创建一个小项目.我在让leiningen用命令行参数表现时遇到了麻烦.以下是我的src/project/core.clj
(ns project.core
(:gen-class))
(defn -main [& args]
(println (apply str args)))
Run Code Online (Sandbox Code Playgroud)
和我的 project.clj
(defproject project "1.0.0-SNAPSHOT"
:description "FIXME: write"
:main project.core
:dependencies [[org.clojure/clojure "1.2.0"]
[org.clojure/clojure-contrib "1.2.0"]])
Run Code Online (Sandbox Code Playgroud)
现在当我跑步时lein run arg1 arg2,它给了我这个错误:
Exception in thread "main" java.lang.Exception: Unable to resolve symbol: arg1 in this context (NO_SOURCE_FILE:1)
at clojure.lang.Compiler.analyze(Compiler.java:5205)
at clojure.lang.Compiler.analyze(Compiler.java:5151)
at clojure.lang.Compiler$InvokeExpr.parse(Compiler.java:3057)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:5371)
at clojure.lang.Compiler.analyze(Compiler.java:5190)
at clojure.lang.Compiler.analyze(Compiler.java:5151)
at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:4670)
at clojure.lang.Compiler$FnMethod.parse(Compiler.java:4328)
at clojure.lang.Compiler$FnExpr.parse(Compiler.java:3173)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:5367)
at clojure.lang.Compiler.analyze(Compiler.java:5190)
at clojure.lang.Compiler.eval(Compiler.java:5421)
at clojure.lang.Compiler.eval(Compiler.java:5415)
at clojure.lang.Compiler.eval(Compiler.java:5391)
at clojure.core$eval.invoke(core.clj:2382)
at clojure.main$eval_opt.invoke(main.clj:235) …Run Code Online (Sandbox Code Playgroud) 要获得3.0打印功能,我们在Python 2.6中执行以下操作:
from __future__ import print_function
Run Code Online (Sandbox Code Playgroud)
但要使用函数我们调用print()而不是print_function().这只是一个不一致还是有充分的理由呢?
为什么不是以下内容:
from __future__ import print
Run Code Online (Sandbox Code Playgroud) 有没有办法为Hibernate中的每个表指定不同的序列,如果ID是在映射的超类上定义的?
我们的应用程序中的所有实体都扩展了一个名为的超类DataObject:
@MappedSuperclass
public abstract class DataObject implements Serializable {
@Id
@GeneratedValue(strategy = GenerationType.SEQUENCE)
@Column(name = "id")
private int id;
}
@Entity
@Table(name = "entity_a")
public class EntityA extends DataObject { ... }
@Entity
@Table(name = "entity_b")
public class EntityB extends DataObject { ... }
Run Code Online (Sandbox Code Playgroud)
这会导致所有实体使用默认的共享序列hibernate_sequence.
我希望做的是使用一个单独的序列为每个实体,例如entity_a_sequence与entity_b_sequence上面的例子.如果在子类上指定了ID,那么我可以使用@SequenceGenerator注释为每个实体指定序列,但在这种情况下,ID在超类上.鉴于ID在超类中,是否有一种方法可以为每个实体使用单独的序列 - 如果是,那么如何?
(我们正在使用PostgreSQL 8.3,如果相关的话)
有没有人有任何使用PyCharm中的Django测试运行器的不同设置文件的经验?
我的项目组成如下:
+penguinproject
+apps
+settings
--__init__.py
--common.py # this one is imported by the others below
--development.py
--production.py
--staging.py
+static
...
Run Code Online (Sandbox Code Playgroud)
使用manage.py命令运行测试(并添加--settings = settings.development)工作正常,但我想使用内置的测试运行器(因为它更好地与IDE集成).
我认为问题是我的设置没有正确加载,因为我收到此错误:
E:\Development\django_projects\penguinproject\Scripts\python.exe "C:\Program Files (x86)\JetBrains\PyCharm 1.1\helpers\pydev\pydevd.py" --client 127.0.0.1 --port 49898 --file "C:\Program Files (x86)\JetBrains\PyCharm 1.1\helpers\pycharm\django_manage.py" test items
Testing started at 20:36 ...
pydev debugger: warning: psyco not available for speedups (the debugger will still work correctly, but a bit slower)
pydev debugger: starting
E:\Development\django_projects\penguinproject\lib\site-packages\path.py:32: DeprecationWarning: the md5 module is deprecated; use hashlib instead
import …Run Code Online (Sandbox Code Playgroud) 我在arm上构建了一个根文件系统.它应该运行dbus-daemon和avahi-daemon,但是当我尝试运行时avahi-daemon
$ dbus-daemon --system
$ avahi-daemon
Run Code Online (Sandbox Code Playgroud)
我收到这条消息:
Found user 'avahi' (UID 4) and group 'avahi' (GID 4).
Successfully dropped root privileges.
avahi-daemon 0.6.28 starting up.
WARNING: No NSS support for mDNS detected, consider installing nss-mdns!
dbus_bus_request_name(): Connection ":1.0" is not allowed to own the service "org.freedesktop.Avahi" due to security policies in the configuration file
WARNING: Failed to contact D-Bus daemon.
avahi-daemon 0.6.28 exiting.
Run Code Online (Sandbox Code Playgroud)
怎么了?是关于dbus配置吗?
我正在rails应用程序上编写一个ruby,并且我收到了以下代码的编译错误
<%= form_tag(search_path, :method => "get") do %>
<%= label_tag(:q, "Search for:") %>
<%= text_field_tag(:q) %>
<%= submit_tag("Search") %>
<% end %>
Run Code Online (Sandbox Code Playgroud)
这是来自ruby on rails表单指南的示例代码:http: //guides.rubyonrails.org/form_helpers.html
产生的错误是,
编译错误/Users/kmb89144/Desktop/Stoastic/app/views/application/index.html.erb:3:语法错误,意外')'... h_path,:method =>"get")do).to_s) ; @ output_buffer.concat ... ^ /Users/kmb89144/Desktop/Stoastic/app/views/application/index.html.erb:13:语法错误,意外的kENSURE,期待')'/ Users/kmb89144/Desktop/Stoastic/app/views/application/index.html.erb:15:语法错误,意外的kEND,期待')'
提取的来源(第3行):
1:
Run Code Online (Sandbox Code Playgroud)
2:
3:<%= form_tag(search_path,:method =>"get")do%>
4:<%= label_tag(:q,"搜索:")%>
5:<%= text_field_tag(:q)%>
6:<%= submit_tag("搜索")%>
有什么建议?
谢谢