程序设计

专业和发烧友程序员的问答


4
Maven的pom.xml中的pluginManagement是什么?
这是我的pom文件的一个片段。 .... <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-dependency-plugin</artifactId> <version>2.4</version> <executions> <execution> <phase>install</phase> <goals> <goal>copy-dependencies</goal> </goals> <configuration> ...... </configuration> </execution> </executions> </plugin> </plugins> ... 我在命令中成功使用了它 mvn install 但是,当我尝试将其包含在“ pluginManagement”标记中时,maven-dependency-plugin启动install目标时,这些标记将停止工作。为什么“ pluginManagement”标签会更改构建行为?还是应该使用其他目标或选择?

10
使用命令行在Linux中将xlsx转换为csv
我正在寻找一种在Linux上将xlsx文件转换为csv文件的方法。 我不想使用PHP / Perl或类似的东西,因为我正在考虑处理几百万行,所以我需要快速的东西。我在Ubuntu仓库上找到了一个名为xls2csv的程序,但它只能转换xls(Office 2003)文件(我当前正在使用),但是我需要支持较新的Excel文件。 有任何想法吗?
266 linux  excel  csv  converter  xlsx 



10
以编程方式在LinearLayout中设置边距
我正在尝试使用Java(而不是XML)来创建一个LinearLayout,并带有一个充满屏幕且具有边距的按钮。这是不带边距的代码: LinearLayout buttonsView = new LinearLayout(this); buttonsView.setOrientation(LinearLayout.VERTICAL); for (int r = 0; r < 6; ++r) { Button btn = new Button(this); btn.setText("A"); LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT, LinearLayout.LayoutParams.FILL_PARENT); // Verbose! lp.weight = 1.0f; // This is critical. Doesn't work without it. buttonsView.addView(btn, lp); } ViewGroup.LayoutParams lp = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, …
266 java  android  layout  view  margin 

5
Python,Matplotlib,子图:如何设置轴范围?
如何将第二个子图的y轴范围设置为[0,1000]?我的数据(文本文件中的一列)的FFT图导致一个(inf。?)尖峰,因此实际数据不可见。 pylab.ylim([0,1000]) 不幸的是,它没有任何作用。这是整个脚本: # based on http://www.swharden.com/blog/2009-01-21-signal-filtering-with-python/ import numpy, scipy, pylab, random xs = [] rawsignal = [] with open("test.dat", 'r') as f: for line in f: if line[0] != '#' and len(line) > 0: xs.append( int( line.split()[0] ) ) rawsignal.append( int( line.split()[1] ) ) h, w = 3, 1 …
266 python  range  axis  matplotlib 


6
解码Python字符串中的HTML实体?
我正在使用Beautiful Soup 3解析一些HTML,但是它包含HTML实体,Beautiful Soup 3不会自动为我解码: >>> from BeautifulSoup import BeautifulSoup >>> soup = BeautifulSoup("<p>£682m</p>") >>> text = soup.find("p").string >>> print text £682m 如何解码HTML实体text以获得"£682m"而不是"£682m"。

8
在if语句中初始化的变量的作用域是什么?
我是Python的新手,所以这可能是一个简单的范围界定问题。Python文件(模块)中的以下代码使我有些困惑: if __name__ == '__main__': x = 1 print x 在我使用过的其他语言中,此代码将引发异常,因为该x变量是if语句的局部变量,不应在其外部存在。但是此代码将执行并打印1。任何人都可以解释此行为吗?是否在模块中创建的所有变量都是全局的/可用于整个模块?

3
android:fontFamily的有效值及其对应的值是什么?
在此问题的答案中,用户列出了android:fontFamily和的12个变量的值(请参见下文)。这些价值从何而来?的文档android:fontFamily未在任何地方列出此信息(我在此处和此处进行了检查)。字符串在Android styles.xml文件的不同位置列出,但是这些字符串如何映射回Roboto字体? 从android 4.1 / 4.2开始,可以使用以下Roboto字体系列: android:fontFamily="sans-serif" // roboto regular android:fontFamily="sans-serif-light" // roboto light android:fontFamily="sans-serif-condensed" // roboto condensed android:fontFamily="sans-serif-thin" // roboto thin (android 4.2) android:fontFamily="sans-serif-medium" // roboto medium (android 5.0) 与此结合 android:textStyle="normal|bold|italic" 12种变体是可能的: 定期 斜体 胆大 加粗斜体 光 斜体 瘦 细斜体 浓缩常规 斜体字 浓缩粗体 粗体斜体 在styles.xml应用程序的文件中,我正在与某人合作,将其列为字体系列,我很确定这是错误的: <item name="android:fontFamily">Roboto-Regular.ttf</item> 我想正确设置我们应用程序的主题(包括正确使用fontFamily),并删除在查看文件之前创建的某些样式中的所有冗余。
266 android  fonts  styles 

15
手机上Google Play商店应用中的“为此应用评分”链接
我想在Android应用程序中添加“为此应用程序评分”链接,以在用户手机上的Google Play商店应用程序中打开该应用程序列表。 要在手机上的Google Play商店应用中打开打开market://或http://-link,我需要编写什么代码? 您将代码放在哪里? 有人对此有示例实现吗? 您是否必须指定将放置market://或http://链接的屏幕,并且最好使用- market://或http://?

4
为什么Javascript`atob()`和`btoa()`这样命名?
在Javascript中,window.atob()method解码base64字符串,然后window.btoa()将a编码string为base64。 那么,为什么没有他们命名为喜欢的base64Decode()和base64Encode()? atob()并且btoa()没有任何意义,因为它们根本不是语义的。 我想知道原因。
266 javascript 

6
连接两个一维NumPy数组
我在NumPy中有两个简单的一维数组。我应该能够使用numpy.concatenate将它们连接起来。但是我收到以下代码的错误: TypeError:只有length-1数组可以转换为Python标量 码 import numpy a = numpy.array([1, 2, 3]) b = numpy.array([5, 6]) numpy.concatenate(a, b) 为什么?

10
Java 8:两个LocalDateTime之间以多个单位表示的差异
我正在尝试计算两者之间的差异LocalDateTime。 输出必须为格式y years m months d days h hours m minutes s seconds。这是我写的: import java.time.Duration; import java.time.Instant; import java.time.LocalDateTime; import java.time.Period; import java.time.ZoneId; public class Main { static final int MINUTES_PER_HOUR = 60; static final int SECONDS_PER_MINUTE = 60; static final int SECONDS_PER_HOUR = SECONDS_PER_MINUTE * MINUTES_PER_HOUR; public static void …

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.