使用eshell或ansi-term和bash emacs时,会根据您所在的目录更改default-directory变量.
因此,如果我移动到/home/user/code/project然后使用ido-find-file打开文件,它将使用CWD启动ido.如果我使用ksh(我的普通shell)或zsh(尝试测试)它不起作用.有没有设置或者这只是在bash下支持?
谢谢
我在下面的HTML中遇到问题:
<html>
<body>
<p style="font-size: large">
Some paragraph text
<span><pre style="display:inline">some span text</pre></span>
additional paragraph text that continues ...
</p>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
所以这只是一个段落,其中包含一些预先格式化的文本.我遇到的问题是Opera和Chrome都没有像我期望的那样显示.具体来说,他们在跨度之前关闭段落标记并强制换行.WTH?
使用chromes HTML检查选项,它显示<p>标签正在关闭,空<span></span>插入而不是封闭<pre>.如果删除范围,Chrome仍然会关闭<p>标记,强制换行.
我需要显示以下标记结构,而不强制使用任何换行符<p><span><pre><code></code></pre></span></p>.这是完全可能还是有其他选择或解决方法?
编辑:我已经锁定了<pre>标签,因为它是wordpress语法高亮插件的一部分.
注意:我认为这里最好的建议是验证您的HTML.我遇到的很多问题是因为某些浏览器正在优雅地处理无效的HTML而其他浏览器并不优雅.验证意味着您可以使用干净的平板.
我知道我可以在node.js中创建一个类似tcp的服务器
var dataServer = net.createServer(function (stream) {
});
dataServer.on("listening", function() {
// this data server listen to a random port
// but how can I get the number of port
console.log(dataServer.localPort)
}
dataServer.listen(0, '0.0.0.0');
Run Code Online (Sandbox Code Playgroud)
但我不知道如何获取端口号并发送到另一个服务.
或者我应该找到一个随机可用端口并传递给dataServer.listen?
我正在尝试抓取每个URL参数并从头到尾显示它们,但我希望能够在页面的任何位置显示任何参数.我怎样才能做到这一点?我需要在脚本上添加或修改什么内容?
以下是URL值的示例.
http://www.localhost.com/topics/index.php?cat=3&sub1=sub-1&sub2=sub-2&sub3=sub-3&sub4=sub-4
Run Code Online (Sandbox Code Playgroud)
这是我的PHP脚本.
$url = $_SERVER['QUERY_STRING'];
$query = array();
if(!empty($url)){
foreach(explode('&', $url) as $part){
list($key, $value) = explode('=', $part, 2);
$query[$key] = $value;
}
}
Run Code Online (Sandbox Code Playgroud) 我有这样的功能:
def print(name:String, surname:String) { println(name + " " + surname) }
Run Code Online (Sandbox Code Playgroud)
我也有一个Tuple2:
val johnsmith = ("John", "Smith")
Run Code Online (Sandbox Code Playgroud)
当我用johnsmith调用print时,我收到以下错误:
scala> print(johnsmith)
error: not enough arguments for method print: (name: String,surname: String)Unit.
Unspecified value parameter surname.
print(johnsmith)
^
Run Code Online (Sandbox Code Playgroud)
这有什么办法吗?我可以通过让print接受Tuple2来实现这一点:
def print2(t:Tuple2[String,String]) { println(t._1 + " " + t._2) }
Run Code Online (Sandbox Code Playgroud)
现在我可以用任何一种方式调用它:
scala> print2(johnsmith)
John Smith
scala> print2("john", "smith")
john smith
Run Code Online (Sandbox Code Playgroud)
有什么我想念的吗?
我有两个文件,一个EXE和一个DLL
exe是一个vb.net应用程序的构建,我也需要DLL
我想要的是一个自我提取器,将这些文件放在一起,然后运行时它将提取它们并立即运行EXE
是否有一个非常简单,易于使用的BOX软件将执行此操作?商业与否,无所谓
在eclipse中(使用emacs键)我点击ctrl-x-ctrl-f并搜索包含单词I type的文件名.什么是相同的emacs功能emacs功能?
我应该如何使用RSpec测试这个助手?
module ApplicationHelper
def build_rpx_url(provider)
signin_url(provider) << "?token_url=" << token_url << provider_params(provider)
end
private
def signin_url(provider)
case provider.downcase
when 'facebook'; 'https://login.xyz.net/facebook/connect_start'
when 'google'; 'https://login.xyz.net/openid/start'
when 'twitter'; 'https://login.xyz.net/twitter/start'
when 'linkedin'; 'https://login.xyz.net/linkedin/start'
when 'yahoo'; 'https://login.xyz.net/openid/start'
end
end
def provider_params(provider)
params = case provider.downcase
when 'facebook'; ["ext_perm=publish_stream,email,offline_access"]
when 'google'; ["openid_identifier=https://www.google.com/accounts/o8/id"]
when 'twitter'; []
when 'linkedin'; []
when 'yahoo'; ["openid_identifier=http://me.yahoo.com/"]
end
params.empty? ? '' : "&" << params.join('&')
end
def token_url
"#{new_user_session_url}?authenticity_token=#{Rack::Utils.escape(form_authenticity_token)}"
end
end
Run Code Online (Sandbox Code Playgroud) 我在http://wiki.fluentnhibernate.org/Getting_started上完成了Fluent NHibernate教程,项目编译得很好.
但是,我收到运行时错误,我似乎无法解决它.您可以在教程中看到的CreateSessionFactory方法中发生错误.这里是:
private static ISessionFactory CreateSessionFactory()
{
return Fluently.Configure()
.Database
(
SQLiteConfiguration.Standard
.UsingFile(DbFile)
)
.Mappings(m => m.FluentMappings.AddFromAssemblyOf<FluentNHibernateSample.Program>())
.ExposeConfiguration(BuildSchema)
.BuildSessionFactory();
}
Run Code Online (Sandbox Code Playgroud)
我认为最有帮助的事情是给你从最外层异常到最内层异常的异常链(这是一个真正的单词):
An invalid or incomplete configuration was used while creating a SessionFactory. Check PotentialReasons collection, and InnerException for more detail.
An invalid or incomplete configuration was used while creating a SessionFactory. Check PotentialReasons collection, and InnerException for more detail.
Could not compile the mapping document: (XmlDocument)
persistent class FluentNHibernateSample.Entities.Employee, FluentNHibernate, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null not found
Could not …Run Code Online (Sandbox Code Playgroud) c# nhibernate visual-studio-2010 fluent-nhibernate assembly-resolution
我正在做一个过滤器,其中我检查unicode(utf-8编码)字符串是否不包含大写字符(在所有语言中).如果字符串根本不包含任何套接字符,那对我来说没问题.
例如:'你好!' 不会通过过滤器,但"!" 应该通过过滤器,因为"!" 不是一个套装的角色.
我打算使用islower()方法,但在上面的例子中,"!".islower()将返回False.
根据Python Docs,"如果unicode字符串的套接字符全部为小写且字符串包含至少一个套接字符,则python unicode方法islower()返回True,否则返回False."
由于当字符串不包含任何套接字符时,该方法也返回False,即."!",我想检查字符串是否包含任何套接字符.
像这样......
string = unicode("!@#$%^", 'utf-8')
#check first if it contains cased characters
if not contains_cased(string):
return True
return string.islower():
Run Code Online (Sandbox Code Playgroud)
有关contains_cased()函数的任何建议吗?
或者可能采用不同的实施方法?
谢谢!