我的Unix机器上有一些文件开头
--
Run Code Online (Sandbox Code Playgroud)
例如 --testings.html
如果我尝试删除它,我会收到以下错误:
cb0$ rm --testings.html
rm: illegal option -- -
usage: rm [-f | -i] [-dPRrvW] file ...
unlink file
Run Code Online (Sandbox Code Playgroud)
我试过了
rm "--testings.html" || rm '--testings.html'
Run Code Online (Sandbox Code Playgroud)
但没有任何作用.
如何在终端上删除这些文件?
是否可以从Java创建MySQL数据库?
我只看到了这样的连接URL示例,其中在URL中指定了数据库名称:
String url="jdbc:mysql://localhost:3306/test";
Connection con = DriverManager.getConnection( url, "cb0", "xxx" );
Run Code Online (Sandbox Code Playgroud)
当我只有登录名和密码时,如何创建MySQL数据库?
首先,我对mongodb很新.这是我的问题,我无法找到解决方案.
假设我有3个不同的收藏品.
mongos> show collections
collectionA
collectionB
collectionC
Run Code Online (Sandbox Code Playgroud)
我想创建一个脚本,遍历此数据库中的所有集合,并在每个集合中查找最后插入的时间戳.这是在mongos里面有效的方法.
var last_element = db.collectionA.find().sort({_id:-1}).limit(1);
printjson(last_element.next()._id.getTimestamp());
ISODate("2014-08-28T06:45:47Z")
Run Code Online (Sandbox Code Playgroud)
1.问题(迭代所有集合)
是否有任何可能性...... 喜欢.
var my_collections = show collections;
my_collections.forEach(function(current_collection){
print(current_collection);
});
Run Code Online (Sandbox Code Playgroud)
问题在这里,分配my_collections不起作用.我得到SyntaxError: Unexpected identifier.我需要引用'show'声明吗?它甚至可能吗?
2.问题(在js var中存储集合)
我可以通过这样做来解决问题1:
var my_collections = ["collectionA", "collectionB", "collectionC"];
my_collections.forEach(function(current_collection){
var last_element = db.current_collection.find().sort({_id:-1}).limit(1);
print(current_collection);
printjson(last_element.next()._id.getTimestamp());
});
Run Code Online (Sandbox Code Playgroud)
将last_element.next()产生以下错误:
错误hasNext:在src/mongo/shell/query.js中为false:124
似乎last_element未正确保存.
关于我做错什么的任何建议?
UPDATE
尼尔斯回答了我的解决方案.除了他的代码,我还要检查函数是否getTimestamp真的存在.对于某些"虚拟"集合,似乎没有_id属性.
db.getCollectionNames().forEach(function(collname) {
var last_element = db[collname].find().sort({_id:-1}).limit(1);
if(last_element.hasNext()){
var next = last_element.next();
if(next._id !== undefined && typeof next._id.getTimestamp == 'function'){
printjson(collname …Run Code Online (Sandbox Code Playgroud) 我有一些.tex文件,我希望从中接收纯文本而没有任何乳胶标签,例如\ section {...}或\newpage.
有没有人知道如何实现这一目标?我也有.pdf文件,但是当我从那里复制代码时,有些单词会被连接起来,这真的很糟糕.
你知道有什么工具吗?
是否可以登录远程mysql机器并使用远程机器上的"system"执行命令.我可以登录到远程计算机,但使用:'system'的命令在我的本地计算机上执行.谢谢!
我使用mysql使用命令从'Host1'连接到'Host2'
mysql -uUsername -p data_base_name -h Host2
Run Code Online (Sandbox Code Playgroud)
当我执行
'system hostname'
Run Code Online (Sandbox Code Playgroud)
在我联系之后我得到了.
'Host1'
Run Code Online (Sandbox Code Playgroud) 我已经运行了无法杀死的进程.这是我的EyeTV应用程序,这里是'ps aux'所说的:
cb0 87583 1,0 3,4 812796 144236 ?? UE 21Nov09 2638:11.45 [.....]/EyeTV
Run Code Online (Sandbox Code Playgroud)
过程状态真的很奇怪,因为我以前从未见过UE.该联机帮助表告诉我
U表示在不间断等待中标记进程
E表示该过程正试图退出
但我无法杀死这个过程.任何想法我怎么能强迫它退出?
附加信息:以下任何一项法规均无效:
我有一个PHP的Web服务构建,它使用UsernameToken作为身份验证机制.我有PHP客户端代码可以访问此Web服务.现在我需要用Java做到这一点.也许你可以帮助我!
可以使用以下php代码访问此服务:
$password="super_secure_pass";
$timestamp=gmdate('Y-m-d\TH:i:s\Z');
$nonce=mt_rand();
$passdigest=base64_encode(pack('H*',sha1(pack('H*',$nonce).pack('a*',$timestamp).pack('a*',$password))));
$nonce=base64_encode(pack('H*',$nonce))
Run Code Online (Sandbox Code Playgroud)
这些值被解析为此Soap头.
<wsse:Security SOAP-ENV:mustUnderstand="0" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
<wsse:UsernameToken>
<wsse:Username>'.$username.'</wsse:Username>
<wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordDigest">'.$passdigest.'</wsse:Password>
<wsse:Nonce>'.$nonce.'</wsse:Nonce>
<wsu:Created xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">'.$timestamp.'</wsu:Created>
</wsse:UsernameToken>
</wsse:Security>
Run Code Online (Sandbox Code Playgroud)
使用此代码,我可以毫无问题地访问Web服务.现在我需要用Java做到这一点.
我创建了必要的文件,实现了一个处理程序来添加一个带有UsernameToken的soap标头.但是当我尝试访问WS时,我总是收到"Not Authorized"错误.我认为在创建passdigest或nonce条目时我遗漏了一些东西.
以下是我如何计算它们:
Random generator = new Random();
String nonceString = String.valueOf(generator.nextInt(999999999));
String createTime=localToGmtTimestamp();//Returns a date with format (SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'"))
String pass="super_secure_pass";
String tmp = AeSimpleSHA1.SHA1(nonce + createTime + pass);
encodedPass = Base64.encodeBytes(tmp.getBytes());
Run Code Online (Sandbox Code Playgroud)
创建soap标头时将使用这些值:
SOAPEnvelope envelope = smc.getMessage().getSOAPPart().getEnvelope();
SOAPHeader header = envelope.addHeader();
SOAPElement security = header.addChildElement("Security", "wsse", "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd");
SOAPElement usernameToken = security.addChildElement("UsernameToken", "wsse");
SOAPElement username = usernameToken.addChildElement("Username", "wsse");
username.addTextNode(user);
SOAPElement …Run Code Online (Sandbox Code Playgroud) 尝试使用CentOS 7设置banana-pi来使用NAS,我遇到了许多我自己编译的软件包.
我想知道armv7架构是否有特别的回购?
%uname -a
Linux bananapi 4.2.3-200.el7.armv7hl #1 SMP Wed Nov 25 18:01:51 EST 2015 armv7l armv7l armv7l GNU/Linux
Run Code Online (Sandbox Code Playgroud) 我已经成功安装了blackfire代理、cli工具和探针,并且工作正常。我在使用 bf 进行分析时禁用了 xdebug 模块。
现在我想像以前一样使用xdebug,但是xdebug不起作用,它只是不会进入调试会话。没有断点甚至无法xdebug_break工作。生产者网站上的一句话说:
已知的不兼容性
请注意,不支持使用 debug 编译的 PHP,并且 Probe 可能与 XDebug 或 XHProf 发生冲突;启用探测器时禁用这些扩展。
有没有办法在不卸载整个 blackfire 工具链的情况下禁用 blackfire 代理?将文件移动/etc/php5/conf.d/90-blackfire.ini到备份位置不起作用。
更新
有效的方法是卸载 php 代理sudo apt-get remove blackfire-php。但我很确定一定有更好的解决方案。
我正在学习Common Lisp,想要玩lisp和web开发.我目前的问题来自一个简单的想法,迭代我想要包括的所有JavaScript文件.我使用SBCL和Quicklisp进行快速启动.问题可能与cl-who我正在使用的包有关.
所以我宣布了我的包,并开始这样:
(defpackage :0xcb0
(:use :cl :cl-who :hunchentoot :parenscript))
(in-package :0xcb0)
Run Code Online (Sandbox Code Playgroud)
为了简单起见,我减少了我的问题功能.所以我有这个page功能:
(defun page (test)
(with-html-output-to-string
(*standard-output* nil :prologue nil :indent t)
(:script
(:script :type "text/javascript" :href test))))
Run Code Online (Sandbox Code Playgroud)
这将产生所需的输出
*(0xcb0::page "foo")
<script>
<script type='text/javascript' href='foo'></script>
</script>
Run Code Online (Sandbox Code Playgroud)
现在我已经创建了一个生成:script标签的宏.
(defmacro js-source-file (filename)
`(:script :type "text/javascript" :href ,filename)))
Run Code Online (Sandbox Code Playgroud)
这按预期工作:
*(macroexpand-1 '(0XCB0::js-source-file "foo"))
(:SCRIPT :TYPE "text/javascript" :HREF "foo")
Run Code Online (Sandbox Code Playgroud)
但是,如果我将此包含在我的page函数中:
(defun page (test)
(with-html-output-to-string
(*standard-output* nil :prologue nil :indent t)
(:script
(js-source-file "foo"))))
Run Code Online (Sandbox Code Playgroud)
... undefined function: …
背景
我正在使用这些硬盘分区的mysql服务器上工作:
...
/dev/vdd 99G 58G 39G 61% /var/lib/mysql
tmpfs 2,4G 0 2,4G 0% /tmp
...
Run Code Online (Sandbox Code Playgroud)
我需要将mysql dump导入我的数据库。因此,我使用以下语法:
gunzip -c sql_dump.sql.gz | mysql -uDB_USER -p DB_NAME
Run Code Online (Sandbox Code Playgroud)
总的来说,这sql_dump.sql.gz是可行的,但是提取后我的文件将超过5GB。
上面的命令将失败gzip: /home/.../sql_dump.sql.gz: No space left on device。我认为这与mysql具有足够空间的分区无关,但是与/tmp只有2.4GB可用空间的分区无关。
现在,我确实将文件移动到了/var/lib/mysql具有足够可用空间的分区中。在此处将我的文件解压缩,开始mysql导入,然后删除压缩和未压缩的文件。
题
我在问自己,是否有任何方法可以强制gunzip暂时更改默认的临时目标位置,即/tmp/默认位置。这样gunzip -c sql_dump.sql.gz | ...不提取的文件存储在/tmp/无奈之下/var/lib/mysql,同时提取文件。像这样:
export "GZIP_TMP_DIR=/var/lib/mysql/"
gunzip -c sql_dump.sql.gz | mysql -uDB_USER -p DB_NAME
Run Code Online (Sandbox Code Playgroud)
这甚至可能吗?我进行了很多搜索,但找不到能解决此特定需求的任何东西。
我.html在Bash中解析一些文件.我读了输入:
while read line
do
echo $line
...do something...
done < $file
Run Code Online (Sandbox Code Playgroud)
现在我已经看到了一些非常奇怪的东西.文件中的某些行包含类似的内容
Resolution…: 720 * 576
Run Code Online (Sandbox Code Playgroud)
但是bash给了我这个:
Resolution…: 720 mysript.sh another_script.pl 576
Run Code Online (Sandbox Code Playgroud)
Bash将扩展* char到实际目录的内容.如何在不扩展的情况下逐行阅读文本.
bash ×2
mysql ×2
php ×2
armv7 ×1
banana-pi ×1
blackfire ×1
centos7 ×1
cl-who ×1
common-lisp ×1
database ×1
epel ×1
filenames ×1
gunzip ×1
java ×1
java-ws ×1
javascript ×1
latex ×1
linux ×1
macos ×1
macros ×1
mongo-shell ×1
mongodb ×1
nonce ×1
process ×1
readline ×1
state ×1
unix ×1
web-services ×1
xdebug ×1