Scala + Play + Intellij IDEA问题(Scala + Play + Intellij IDEA Issue)
当我使用激活器创建新的Scala + Play项目时,我得到了以下错误。 我正在使用标准激活方法为项目生成Intellij Idea支持,但每次我遇到下面的问题。
我不知道如何解决以下问题。 请帮忙,
#
项目'play-scala-intro'具有较旧的格式并将被转换。 您可能无法使用早期版本的IntelliJ IDEA打开项目。 细节...
旧版本的项目文件将保存到:'E:\ Personal \ Scala Workspace \ play-scala-intro \ projectFilesBackup'
#
I was getting below error when I was making new Scala + Play project using activator. I am using standard activator method to generate Intellij Idea support for project but every time I was facing below issue.
I dont know how to resolve below issue. Please help,
#
The project 'play-scala-intro' has an older format and will be converted. You may not be able to open the project with earlier versions of IntelliJ IDEA. Details...
Old versions of project files will be saved to: 'E:\Personal\Scala Workspace\play-scala-intro\projectFilesBackup'
#
原文:https://stackoverflow.com/questions/28773709
最满意答案
这通常被称为自然排序 。 有实现它的模块: Sort :: Naturally
要获得最高价值 - 您可以排序并获取最后一个元素:
use strict; use warnings; use Sort::Naturally; my @names = (...); my $name_with_biggest_number = (nsort(@names))[-1];
更新 - 手动排序
使用地图/排序/地图成语 。 但是,只有在文件名中有单个数字时才能工作:
use strict; use warnings; my @names = (...); my @sorted_names = map { $_->[0] } sort { $b->[1] <=> $a->[1] } ## descending order map { [ $_, m/(\d+)/ ] } ## extracting first number @names; my $name_with_biggest_number = $sorted_names[0];
更新 - 无需排序
根据输入数据,避免使用
sort
可能更有效。 所以你可以明确的代码搜索最大数量:sub name_with_largest_number { my (@names) = @_; my $max_number = undef; my $name_with_max_number = undef; for my $name (@names) { my ($number) = ($name =~ m/(\d+)/); if (defined $number) { if (! defined $max_number || $number > $max_number) { $max_number = $number; $name_with_max_number = $name; } } } return $name_with_max_number; } print name_with_largest_number(...);
This is usually called natural sort. There is module implementing it: Sort::Naturally
To get highest value - you can sort and get last element:
use strict; use warnings; use Sort::Naturally; my @names = (...); my $name_with_biggest_number = (nsort(@names))[-1];
Update - sort manually
Using map/sort/map idiom. But will work only if there is single number in file name:
use strict; use warnings; my @names = (...); my @sorted_names = map { $_->[0] } sort { $b->[1] <=> $a->[1] } ## descending order map { [ $_, m/(\d+)/ ] } ## extracting first number @names; my $name_with_biggest_number = $sorted_names[0];
Update - without sort
Depending on input data it can be more efficient to avoid using
sort
. So you can explicitly code search of max number:sub name_with_largest_number { my (@names) = @_; my $max_number = undef; my $name_with_max_number = undef; for my $name (@names) { my ($number) = ($name =~ m/(\d+)/); if (defined $number) { if (! defined $max_number || $number > $max_number) { $max_number = $number; $name_with_max_number = $name; } } } return $name_with_max_number; } print name_with_largest_number(...);
相关问答
更多-
您可以使用File::Basename : use File::Basename; my @files = glob('/Perl/Assignment/*'); foreach my $file (@files){ print basename($file), "\n"; } 它长期以来一直是核心Perl的一部分。 (在这种情况下必须使用parens,否则它会认为"\n"是basename的参数而不是print 。) You could use File::Basename: use File: ...
-
你不得不说: use utf8; 在你的Perl源代码中,如果你期望这些字符串被解释为字符而不是二进制。 % uname -a Darwin arwen 10.4.0 Darwin Kernel Version 10.4.0: Fri Apr 23 18:28:53 PDT 2010; root:xnu-1504.7.4~1/RELEASE_I386 i386 % cat /tmp/makeit use utf8; $name = "abcüabc"; $path = "/tmp/$name"; ...
-
为什么使用join而不是循环会更短或更干净? 我会说它让它变得更复杂。 你似乎在做什么只是根据条件松散地匹配 名称包含offers或已cleared name包含regup或regdn 名称以.csv结尾。 那么为什么不这样做呢: if ( $file =~ /offers|cleared/i and $file =~ /regup|regdn/i and $file =~ /csv$/i) 您可能对以下内容感兴趣: use strict; use warnings; use ...
-
Perl 6在内部使用Unicode字符串(在基于字形的表示中),并且编码发生在IO边界。 对于控制台输出,您可以通过$*OUT.encoding("...")手动设置编码。 对于目录列表,它取决于后端:使用JVM,它应该做正确的事情(或者以与Java相同的方式失败)。 使用MoarVM,它将取决于平台:在Win32上,使用Unicode API(这也应该做正确的事情),而在其他平台上, 假设使用UTF-8 。 从该片段可以看出,原则上使用不同编码的能力存在于最低级别,但它似乎没有以任何方式暴露给用户... ...
-
#!/bin/bash dir="$1" print_if_greater="45" for fname in "$dir"/[0-9]*; do num="${fname##*/}" # isolate filename from path num="${num%%[^0-9]*}" # extract leading digits from filename if (( num > print_if_greater )); then prin ...
-
File :: Temp文件名保证在整个流程中是唯一的吗?(Are File::Temp filenames guaranteed to be unique across processes?)[2021-04-14]
File :: Temp会尝试通过将O_EXCL标志设置为sysopen来确保它不打开现有文件,这会导致sysopen在文件已存在时失败。 然而: O_EXCL可能无法在网络文件系统上工作... 所以在某些网络文件系统中,一个进程可能会打开另一个进程创建的现有临时文件。 NFS上的File :: Temp还有其他问题 ,所以你应该只在本地文件系统上使用它。 File::Temp tries to ensure that it doesn't open an existing file by setting ... -
如何比较perl中的文件名(How to compare filenames in perl)[2023-05-24]
这通常被称为自然排序 。 有实现它的模块: Sort :: Naturally 要获得最高价值 - 您可以排序并获取最后一个元素: use strict; use warnings; use Sort::Naturally; my @names = (...); my $name_with_biggest_number = (nsort(@names))[-1]; 更新 - 手动排序 使用地图/排序/地图成语 。 但是,只有在文件名中有单个数字时才能工作: use strict; use warning ... -
为每个文件追加一个时间戳,最长为毫秒: #!/usr/local/bin/perl use Time::HiRes qw(gettimeofday); my $timestamp = int (gettimeofday * 1000); print STDOUT "timestamp = $timestamp\n"; exit; 输出: timestamp = 1227593060768 Append a timestamp to each file, up to the millisecond: # ...
-
UTF-16文本由:编码层处理。 当它进入$_ ,就没有办法告诉它它曾经是UTF-16。 我不认为这是你的问题。 我的猜测是你的文件名中有一些空格(当你试图打印时你没有注意到),或者你不在你认为的目录中。 尝试 if (-e $filename) { print "File exists!" } else { print "File <$filename> not found" } 并仔细检查文件名。 你也可以use Cwd; 并打印出当前目录。 The UTF-16 text is processed ...
-
glob运算符的工作方式与命令行处理器类似。 如果您编写
,它将查找与rawdata/*Epley或maneuver*.csv匹配的文件 您必须将glob表达式放在双引号中: my @files = <"rawdata/*$term*.csv"> The glob operator works like the command-line processor. If you write ...