我正在使用grep-type工具来搜索纯文字字符串.我正在寻找一行日志文件的出现,作为单独日志文件中一行的一部分.搜索文本可以包含各种正则表达式特殊字符,例如[]().*^$-\.
有没有使用正则表达式的Unix搜索工具,只是搜索字符串的字面值?
我经常使用该net user命令查看用户的AD组:
net user /DOMAIN <username>
Run Code Online (Sandbox Code Playgroud)
这很好用,但组名被截断为大约20个字符.在我的组织中,大多数群组名称都比这长得多.
有没有人知道通过命令行获取非截断的AD组的方法?
我有一个版本号列表,比方说它们在一个文件versions.txt中
1.2.100.4
1.2.3.4
10.1.2.3
9.1.2.3
Run Code Online (Sandbox Code Playgroud)
我希望对它们进行排序,以便按版本排序.即:
1.2.3.4
1.2.100.4
9.1.2.3
10.1.2.3
Run Code Online (Sandbox Code Playgroud)
我已经尝试使用"k"参数使用各种排序命令,但是不能很好地理解它以完成它.任何帮助,将不胜感激.
我有一个项目,我正在尝试创建一个分发zip文件,其中包含(在其他文件中)一个可执行jar,其中包含我的java项目的依赖项.
所以我希望它看起来像这样:
-wiki-search-1.0.0-dist.zip
-wiki-search.bat
-wiki-search-help.html
-wiki-search-1.0.0-jar-with-dependencies.jar
-jar content...
Run Code Online (Sandbox Code Playgroud)
我正在使用程序集插件和预定义的描述符"jar-with-dependencies"来创建我的可执行jar文件.
我在我的pom中指定了一个单独的程序集插件条目,引用自定义描述符来尝试构建可分发的zip文件.
所以我的pom部分看起来像这样:
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
<archive>
<manifest>
<mainClass>quicksearch.QuickSearchApp</mainClass>
</manifest>
</archive>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>attached</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptors>
<descriptor>src/main/assembly/dist.xml</descriptor>
</descriptors>
</configuration>
<executions>
<execution>
<id>make-assembly</id>
<phase>package</phase>
<goals>
<goal>attached</goal>
</goals>
</execution>
</executions>
</plugin>
Run Code Online (Sandbox Code Playgroud)
我的自定义描述符如下所示:
<assembly>
<id>dist</id>
<formats>
<format>tar.gz</format>
<format>tar.bz2</format>
<format>zip</format>
</formats>
<fileSets>
<fileSet>
<includes>
<include>${project.basedir}/target/wiki-search-0.0.1-SNAPSHOT-jar-with-dependencies.jar</include>
</includes>
<outputDirectory>.</outputDirectory>
</fileSet>
<fileSet>
<directory>${project.basedir}/src/main/etc</directory>
<includes>
<include>*</include>
</includes>
<outputDirectory></outputDirectory>
</fileSet>
</fileSets>
</assembly>
Run Code Online (Sandbox Code Playgroud)
一切正常.正在构建jar-with-dependencies.我的dist zip文件正在构建中.但是dist zip文件不包含jar-with-dependencies文件.
在我们公司,我们有一个严格的Eclipse错误/警告设置列表,必须使用.使用此列表编译我们的更改,在签入之前不应存在错误/警告.
这些错误/警告可以在Eclipse中的Preferences - > Java - > Compiler - > Errors/Warnings下找到.(下面是一些Eclipse设置的示例,请原谅底部的剪辑.)
我是IntelliJ用户.IntelliJ有一个类似的概念叫做"Inspections".检查设置可在设置 - >编辑器 - >检查下找到.
有没有人知道在最接近的IntelliJ检查设置匹配上迁移Eclipse错误/警告的方法.我可以看到有一种方法可以导出/导入IntelliJ设置,但是在Eclipse中看不到任何这样的功能.
任何帮助,将不胜感激.
请注意:这个问题不是关于在Eclipse和IntelliJ之间迁移"代码样式"设置.
这已在StackOverflow上的许多帖子中得到解决.最推荐的解决方案是设置:
android:descendantFocusability="blocksDescendants"
Run Code Online (Sandbox Code Playgroud)
在列表项布局的根布局上.我做了以下事情.
android:descendantFocusability="blocksDescendants"在根目录的项目布局.setDescendantFocusability(BLOCK)在listView上调用,以及每个listViewItem.focus=disabled在ImageButtons上设置然而,当点击了孩子ImageButtons之一,我不能让在任何听众ListView或ListView项目射击.
下面是我用来呈现列表项的"模板".
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/reminderItem"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:descendantFocusability="blocksDescendants"
android:padding="0dp">
<RelativeLayout
android:id="@+id/topPartOfReminder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="10dp">
<LinearLayout
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:id="@+id/textLayout">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:fontFamily="sans-serif-light"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="22sp"
android:text="10:00"
android:textStyle="normal"
android:id="@+id/textTime"/>
<TextView
android:fontFamily="sans-serif-condensed"
android:textSize="9sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="AM"
android:paddingLeft="2dp"
android:textStyle="normal"
android:id="@+id/textAmPm"/>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text=" - "
android:id="@+id/textDivider"/>
<TextView
android:fontFamily="sans-serif-light"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="16sp"
android:text="March 26"
android:id="@+id/textDate"/>
</LinearLayout>
<TextView
android:fontFamily="sans-serif-light"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="12sp"
android:text="Blah …Run Code Online (Sandbox Code Playgroud) 有一个超链接.单击时,我想要在外部浏览器中打开一个链接.
网上引用的常用方法似乎是:
final Hyperlink hyperlink = new Hyperlink("http://www.google.com");
hyperlink.setOnAction(t -> {
application.getHostServices().showDocument(hyperlink.getText());
});
Run Code Online (Sandbox Code Playgroud)
但是我没有参考Application.所述链路是从对话,这是从一个控制器,其经由FXML文件打开打开打开,从而获得到应用程序对象的引用将是相当痛苦.
有谁知道这样做的简单方法?
干杯
我有一个multimap(就像Guava提供的那样):
Multimap<K, V>
Run Code Online (Sandbox Code Playgroud)
这在逻辑上可以看作:
Map<K, Set<V>>
Run Code Online (Sandbox Code Playgroud)
我的multimap中的数据具有唯一键和唯一值.即,永远不会将相同的值分配给多个键.
除了维护两个Map结构之外,是否有人知道现有的class/api可能会让我通过键或值快速查找.
例如
Collection<V> get(K)
...and...
K getKeyByValue(V)
Run Code Online (Sandbox Code Playgroud)
顺便说一句,地图必须是可变的,即我的数据一直在变化.(对于不可变映射,Guava提供了一个ImmutableMultimap.inverse(),如果我的Map可以是不可变的,它将解决这个问题.)
任何帮助都会得到赞赏.
我写了一个扩展,在Firefox中提供grep'ing功能.在我的工作场所,我们使用浏览器访问所有日志文件,grep功能非常适合过滤结果,仅查看特定的日志记录级别(INFO,WARN,ERROR)等.
设置了扩展样板.
想知道我是否可以得到一些关于所需的javascript的提示.在功能之后:
function grepPage(regex){
...
}
Run Code Online (Sandbox Code Playgroud)
这会将正则表达式应用于firefox中加载的文本文件中的每一行,并将加载的文本文件更改为仅显示匹配的行.
这是我可以花费多年时间尝试锻炼的东西,当我确信会有更简单的方法来做这件事.
任何帮助将受到高度赞赏.
干杯,本
我是一名java程序员.我经常使用bash脚本进行文本处理.
grep,sed,awk,tr,wc,find等实用程序以及命令之间的管道提供了如此强大的组合.
但是,bash编程缺乏可移植性,可测试性以及Java中存在的更优雅的编程结构.它还使得集成到我们的其他Java产品中变得更加困难.
我想知道是否有人知道任何可能提供我正在寻找的Java文本处理库.
能够写下来真是太酷了:
Text.createFromFile("blah.txt).grep("-v","ERROR.*").sed("s/ERROR/blah/g").awk("print $1").writeTo("output.txt")
Run Code Online (Sandbox Code Playgroud)
这可能是天上掉馅饼的东西.但是我想我无论如何都要提出这个问题.