基本上,如果我在:http://example.com/content/connect/152,我想知道 url 中是否存在“connect”,然后将菜单的选定值设置为特定的值.. . (该 url 也可能类似于http://example.com/content/connections,在这种情况下,它仍然应该匹配...)
这就是我一直在尝试的,这显然不起作用......
var path = window.location.pathname;
if(path).match(/^connect) {
$("#myselect").val('9');
} else {
$("#myselect").val('0');
}
Run Code Online (Sandbox Code Playgroud) 我正在尝试获取包含我的存储库的特定目录或文件的所有提交。
我尝试了以下代码:
public PlotCommitList getPlotCommits(String path){
System.out.println(path);
PlotCommitList<PlotLane> plotCommitList = new PlotCommitList<PlotLane>();
PlotWalk revWalk = new PlotWalk(repository);
try {
ObjectId rootId = repository.resolve("HEAD");
if (rootId != null) {
RevCommit root = revWalk.parseCommit(rootId);
revWalk.markStart(root);
revWalk.setTreeFilter(PathFilter.create(path));
plotCommitList.source(revWalk);
plotCommitList.fillTo(Integer.MAX_VALUE);
return plotCommitList;
}
} catch (AmbiguousObjectException ex) {
Logger.getLogger(GitRepository.class.getName()).log(Level.SEVERE, null, ex);
} catch (IOException ex) {
Logger.getLogger(GitRepository.class.getName()).log(Level.SEVERE, null, ex);
}
return plotCommitList;
}
Run Code Online (Sandbox Code Playgroud)
我不只得到影响该文件的提交。我得到了整个列表的一些“子列表”,但不仅仅是那些影响该文件的提交。
也许 TreeFilter 不起作用我怎么想?我应该使用其他方式来获得这些提交吗?我看到 log 命令有一个路径过滤器,但我还没有尝试过,因为它返回一个 RevCommit 列表,对于我的 PlotCommitList,我需要一个 revwalk 来用作源。而且我认为我不能将 RevCommit 转换为 PlotCommit。
一个人在这里遇到了同样的问题(文件A和文件B问题的第一个答案):链接 - 单击此处
我将创建一个自解压存档,但在连接默认解压路径时遇到问题。我想在与自解压存档程序相同的路径中解压我的文件。不幸的是,这些文件正在另一个路径(C:\Users\computer\AppData\Temp\IXP000.TMP)中提取。可以设置路径吗?
在过去的 64 分钟里,这个错误耗尽了我的理性思考能力,我真的不知道我该怎么办。
当我在包含的文件中使用以下 3 行时:
var_dump(file_exists('G:/xampp/htdocs/myproject/public_html/includes/htmlPurifierAndMarkdown.php')); //retuurns true
var_dump(__FILE__);
include '../htmlPurifierAndMarkdown.php'; //gives error
Run Code Online (Sandbox Code Playgroud)
我得到以下输出:
boolean true
string 'G:\xampp\htdocs\myproject\public_html\includes\classes\genral.class.php' (length=71)
( ! ) Warning: include(../htmlPurifierAndMarkdown.php) [function.include]: failed to open stream: No such file or directory in G:\xampp\htdocs\myproject\public_html\includes\classes\genral.class.php on line 4
Call Stack
# Time Memory Function Location
1 0.0005 345328 {main}( ) ..\add.php:0
2 0.0036 382408 include( 'G:\xampp\htdocs\myproject\public_html\includes\classes\events.class.php' ) ..\add.php:28
3 0.0041 398024 include( 'G:\xampp\htdocs\myproject\public_html\includes\classes\standardpost.class.php' ) ..\events.class.php:2
4 0.0047 413928 include( 'G:\xampp\htdocs\myproject\public_html\includes\classes\genral.class.php' ) ..\standardpost.class.php:2
Run Code Online (Sandbox Code Playgroud)
简而言之:
所以我只是在想象东西还是这是一些严重的 php …
// Dividend Limit check or increase the Dividend
if (dival == 10) {
writer.println("Divident has reached it Limit !");
i++;
// update the file name
String upath = "channel_" + i;
System.out.println(path);
// find channel_1 and replace with the updated path
if (path.contains("channel_1")) {
path = "D:/File Compression/Data/low_freq/low_freq/house_1/"
+ upath + ".dat";
} else {
JOptionPane.showMessageDialog(null, "Invalid File Choosen");
System.exit(0);
}
dival = 10;
} else {
dival = dival + 10;
writer.println("Dividen:" + dival);
}
Run Code Online (Sandbox Code Playgroud)
这些行采用递归方法。第一次给出正确的路径:
D:/File Compression/Data/low_freq/low_freq/house_1/channel_2.dat
Run Code Online (Sandbox Code Playgroud)
但是在第二次调用时,它将正斜杠翻转为反斜杠: …
我在本地安装了 winston,并指定了日志文件名:'./dataTest.log'。
var winston = require('winston');
winston.add(winston.transports.File, { filename: './dataTest.log' });
Run Code Online (Sandbox Code Playgroud)
但是我发现日志文件位于用户主文件夹中。(我在 Macos 上是 /Users/username)。为什么?我希望它位于 mynodeproject/public 文件夹中。
尝试将路径设置为“dataTest.log”,结果相同。
编辑:这可能与节点有关?那么如何在节点中设置相对路径呢?
我在 Windows 上有两个版本的 Python,想通过cmd. 我试图制作它们的快捷方式python.exe并将它们重命名为python26和python33(我还将它们的位置添加到PATH),但不幸的是这不起作用。中的调用python26或python26.lnk输出not recognized as an internal command。
有没有其他方法可以做到(如 Linux virtualenv),或者我错过了我的想法?
我在 .bat 文件中添加一行,如下所示:
path %~dp0;%PATH%
Run Code Online (Sandbox Code Playgroud)
但显示此消息:
\common 此时出乎意料。
让我告诉你路径。
PATH=C:\Program Files\Common Files\Microsoft Shared\Windows Live;C:\Program File
s (x86)\Common Files\Microsoft Shared\Windows Live;c:\Program Files (x86)\AMD AP
P\bin\x86_64;c:\Program Files (x86)\AMD APP\bin\x86;C:\Windows\system32;C:\Windo
ws;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;c:\Progr
am Files (x86)\ATI Technologies\ATI.ACE\Core-Static\;C:\Program Files (x86)\Sony
\VAIO Startup Setting Tool;;C:\Program Files (x86)\Windows Live\Shared;C:\Progra
m Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\P
rogram Files (x86)\Common Files\Thunder Network\KanKan\Codecs;C:\Program Files\C
alibre2\
Run Code Online (Sandbox Code Playgroud)
这就是路径。我要添加的路径(%~dp0)是:
C:\Users\Workspace\Desktop\Files\Programming\GoogleSearch\
Run Code Online (Sandbox Code Playgroud)
这对我很重要。
谢谢你。
只是一个简单的问题,很难(对我来说)找到答案:D。这是我的代码(我将尝试翻译西班牙语部分):
File carpetanueva = new File("C:"+File.separator+"sistema" + File.separator +
fechasal+File.separator+doc);
carpetanueva.mkdirs();
carpetanueva.setWritable(true);
rutadestino = ("c:"+File.separator+"sistema" +
File.separator + fechasal+File.separator +
doc+File.separator+"imagen.jpg");
//realizo la copia de la imagen desde el jfilechooser a su destino:
Path desde = Paths.get(rutaorigen);
Path hacia = Paths.get(rutadestino);
try {
Files.copy(desde, hacia);
JOptionPane.showMessageDialog(null,
"Se adjunto la planilla de ambulancia correctamente");
} catch (IOException e) {
JOptionPane.showMessageDialog(null, "error: "+e.getLocalizedMessage());
}
Run Code Online (Sandbox Code Playgroud)
我从 JFileChooser 得到“rutaorigen”(来自路径)。我通过使用一些变量来创建“rutadestino”(topath),这样我就可以发出命令。问题是..如果目录和文件“imagen.jpg”已经存在,它会给出一个错误..(例外)..我如何检查图像是否已经存在,如果存在,重命名新图像到,例如,imagen2?我无法弄清楚代码,因为我是新手,我做了一项研究,但找不到这样的东西!提前致谢 :)
我的问题有两部分 - 首先,标题到底是什么 - Path.getNameCount() 方法实际计数的是什么?在Eclipse中选择方法时,我阅读了它附带的小弹出信息,我认为这是一个合适的用法。我使用它创建的这个方法在运行时返回 5 作为 int 。其次,我想要做的是返回目标目录中有多少文件,以便我可以运行另一种方法,我必须以适当的次数检索文件名。如果 getNameCount() 方法不适合此功能,您是否有任何关于如何完成相同目的的建议?
//Global Variable for location of directory
Path dir = FileSystems.get("C:\\Users\\Heather\\Desktop\\Testing\\Testing2");
//Method for collecting the count of the files in the target directory.
public int Count()
{
int files=0;
files = dir.getNameCount();
return files;
}
}
Run Code Online (Sandbox Code Playgroud)