极限编程冒险在C#勘误?(Errata in Extreme Programming Adventures in C#?)
我试图通过Ron Jeffries在C#中的极限编程冒险工作。 然而,我在第3章中被卡住了,因为代码没有, 也不能做作者说的那样。
基本上,文字说我应该能够在启用文字包装的文本框中编写一些文本。 如果我然后将光标移动到中间行并按回车键,则代码应该重新显示光标前面的行,添加几行和一组HTML段落标记,然后附加其余行。 代码与文本不匹配,因为它使用了textbox.lines属性。 那么,无论文本框中有多少个文字包装线,在Lines属性中只有一行,直到您按回车。 因此,代码应该“将其余行复制到缓冲区中”的说法对我来说似乎是错误的。
我会很感激任何有这本书经验的人告诉我我在读什么,或者在做什么,错的!
谢谢。
始盗龙
I'm trying to work my way through Ron Jeffries's Extreme Programming Adventures in C#. I am stuck, however, in Chapter 3 because the code does not, and cannot, do what the author says it does.
Basically, the text says that I should be able to write some text in a word-wrap enabled text box. If I then move the cursor to an intermediate line and hit enter, the code should re-display the lines before the cursor, add a couple of lines and a set of HTML paragraph tags, then append the rest of the lines. The code doesn't match the text because it uses the textbox.lines property. Well, no matter how many word-wrapped lines there are in a text box, there's only ONE line in the Lines property until you hit a carriage return. So, the statement that the code should, "Copy the rest of the lines into the buffer" appears wrong to me.
I'd appreciate anybody having experience with the book telling me what I'm reading, or doing, wrong!
Thanks.
EoRaptor
原文:https://stackoverflow.com/questions/310164
最满意答案
按照上面cricket_007的建议,我开始挖掘Android Studio,看它是否会报告安装命令。 我找到了命令,将它们放在一个shell脚本文件中,现在我可以将apk安装到四个磨损设备上。 首先,在Android Studio中,我转到:Build | 建立APK。 生成穿戴apk文件。 然后我使用以下命令执行shell脚本:
echo "Installing 422E..." adb -s G6NZCJ00401422E push /Users/fred/abcdec/apps/myWearApp/wear/build/outputs/apk/wear-debug.apk /data/local/tmp/com.xyz.myWearApp adb -s G6NZCJ00401422E shell pm install -r "/data/local/tmp/com.xyz.myWearApp" echo "Starting 422E..." adb -s G6NZCJ00401422E shell am start -n "com.xyz.myWearApp/com.xyz.myWearApp.MainWearActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER echo "Installing 6227..." adb -s G6NZCJ004076227 push /Users/fred/abcdec/apps/myWearApp/wear/build/outputs/apk/wear-debug.apk /data/local/tmp/com.xyz.myWearApp adb -s G6NZCJ004076227 shell pm install -r "/data/local/tmp/com.xyz.myWearApp" echo "Starting 6227..." adb -s G6NZCJ004076227 shell am start -n "com.xyz.myWearApp/com.xyz.myWearApp.MainWearActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER echo "Installing 922a..." adb -s G5NZCJ02746922A push /Users/fred/abcdec/apps/myWearApp/wear/build/outputs/apk/wear-debug.apk /data/local/tmp/com.xyz.myWearApp adb -s G5NZCJ02746922A shell pm install -r "/data/local/tmp/com.xyz.myWearApp" echo "Starting 922A..." adb -s G5NZCJ02746922A shell am start -n "com.xyz.myWearApp/com.xyz.myWearApp.MainWearActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER echo "Done." echo "Installing Moto…” adb -s localhost:4444 push /Users/fred/abcdec/apps/myWearApp/wear/build/outputs/apk/wear-debug.apk /data/local/tmp/com.xyz.myWearApp adb -s localhost:4444 shell pm install -r "/data/local/tmp/com.xyz.myWearApp" echo "Starting Moto…” adb -s localhost:4444 shell am start -n "com.xyz.myWearApp/com.xyz.myWearApp.MainWearActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER echo "Done."
当然,这也可以扩展到安装移动应用程序。 我确信我可以找到gradle命令来实际编译.apk文件作为脚本的一部分。 如果我发现了,我也会发布它。
Following the recommendations above from cricket_007, I started digging around Android Studio to see if it would report the commands for installation. I found the commands, put them in a shell script file and am now able to install the apk to four wear devices at once. So first, in Android Studio, I go to: Build | Build APK. The generates the wear apk file. Then I execute a shell script with the following commands:
echo "Installing 422E..." adb -s G6NZCJ00401422E push /Users/fred/abcdec/apps/myWearApp/wear/build/outputs/apk/wear-debug.apk /data/local/tmp/com.xyz.myWearApp adb -s G6NZCJ00401422E shell pm install -r "/data/local/tmp/com.xyz.myWearApp" echo "Starting 422E..." adb -s G6NZCJ00401422E shell am start -n "com.xyz.myWearApp/com.xyz.myWearApp.MainWearActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER echo "Installing 6227..." adb -s G6NZCJ004076227 push /Users/fred/abcdec/apps/myWearApp/wear/build/outputs/apk/wear-debug.apk /data/local/tmp/com.xyz.myWearApp adb -s G6NZCJ004076227 shell pm install -r "/data/local/tmp/com.xyz.myWearApp" echo "Starting 6227..." adb -s G6NZCJ004076227 shell am start -n "com.xyz.myWearApp/com.xyz.myWearApp.MainWearActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER echo "Installing 922a..." adb -s G5NZCJ02746922A push /Users/fred/abcdec/apps/myWearApp/wear/build/outputs/apk/wear-debug.apk /data/local/tmp/com.xyz.myWearApp adb -s G5NZCJ02746922A shell pm install -r "/data/local/tmp/com.xyz.myWearApp" echo "Starting 922A..." adb -s G5NZCJ02746922A shell am start -n "com.xyz.myWearApp/com.xyz.myWearApp.MainWearActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER echo "Done." echo "Installing Moto…” adb -s localhost:4444 push /Users/fred/abcdec/apps/myWearApp/wear/build/outputs/apk/wear-debug.apk /data/local/tmp/com.xyz.myWearApp adb -s localhost:4444 shell pm install -r "/data/local/tmp/com.xyz.myWearApp" echo "Starting Moto…” adb -s localhost:4444 shell am start -n "com.xyz.myWearApp/com.xyz.myWearApp.MainWearActivity" -a android.intent.action.MAIN -c android.intent.category.LAUNCHER echo "Done."
Of course, this could be extended to install the mobile app as well. I'm sure that I can find the gradle command to actually compile the .apk file as part of the script. If I find that, I will also post it.
相关问答
更多-
Android Studio是否有用于设置.gradle文件内容的GUI或是否必须通过手动编辑完成所有操作? 可以通过Android Studio主菜单中的文件>项目结构配置一些内容。 但是,Gradle基于Groovy脚本语言,因此在“项目结构”对话框中有很多事情是您无法做到的。 如果是后者,Android Studio是否有一个可以标记语法错误的gradle-aware源编辑器等? 是。 Does Android Studio have a GUI for setting the things that ...
-
如何使用Android Studio和毕业生构建Android库?(How to build an android library with Android Studio and gradle?)[2022-02-08]
注意 :这个答案是一个纯粹的Gradle答案,我在IntelliJ中定期使用这个答案,但是我不知道Android Studio是如何集成的。 我相信知道我正在发生什么,所以这是我如何使用Gradle和Android。 TL; DR完整示例 - https://github.com/ethankhall/driving-time-tracker/ 免责声明 :这是我正在/正在开展的项目。 Gradle有一个定义的结构(你可以改变,底部的链接告诉你怎么样),如果你曾经使用过,这与Maven非常相似。 Proje ... -
您未明确包含的库有时可以传递到您的构建中 - 例如,您添加的库依赖于另一个库。 您可以运行gradle dependencies来显示gradle dependencies树,以分析哪些依赖关系拉入哪些传递依赖关系。 I figured out the issue it was the stax-api-1.0.jar this included the javax.xml.stream.events.* classes after removing the jar i was able to build ...
-
看起来解决方法是将SDK工具降级到版本25.2.5。 可以从这里下载。 对于我的环境,我保留了两个版本的SDK工具,使用符号链接在它们之间切换: tools -> /c/devtools/Android/SDK/tools.25.2.5 tools.25.2.5 tools.26.0.2 Looks like workaround is to downgrage SDK tools to the version 25.2.5. Can be downloaded from h ...
-
使用Android Studio构建时签署我的Android应用程序(Sign my android app when building with Android Studio)[2022-12-16]
菜单位于“文件”>“项目结构”下。 然后从左侧列表中选择您的模块,切换到签名选项卡,然后添加您的签名信息。 这将对build.gradle进行两处更改: 首先,它会添加一个看起来像这样的signingConfigs {}部分 - signingConfigs { release { storeFile file("your.keystore") storePassword 'mySecreKystorePassword' keyAlias 'myKey ... -
在xcode项目中自动构建和安装多个目标(Automate building and installing of multiple targets in xcode project)[2024-04-08]
您需要为每个不同的目标创建一个运行xcodebuild的脚本,其中包含不同的参数。 还有Application Loader的命令行工具,它允许您扩展此脚本以自动将二进制文件上载到应用商店。 You need to create a script which runs xcodebuild with different arguments for each of the different targets. There is also Application Loader’s command-line to ... -
按照上面cricket_007的建议,我开始挖掘Android Studio,看它是否会报告安装命令。 我找到了命令,将它们放在一个shell脚本文件中,现在我可以将apk安装到四个磨损设备上。 首先,在Android Studio中,我转到:Build | 建立APK。 生成穿戴apk文件。 然后我使用以下命令执行shell脚本: echo "Installing 422E..." adb -s G6NZCJ00401422E push /Users/fred/abcdec/apps/myWearApp/ ...
-
错误:(14,25)找不到与给定名称匹配的资源(在'label'处,值为'@ string / Midgar-Flower-Girl')。 这意味着Android Studio在res/values/strings.xml文件夹中找不到@string/Midgar-Flower-Girl 。 我该如何纠正这个问题? 确保你的res/values/strings.xml有一个名为Midgar-Flower-Girl的string ,如果你这样做,也许最好的解决办法是清理代码 Error:(14, 25) No ...
-
在teamcity构建步骤中试试这个。 在两个构建步骤中使用相同的解决方案。 这是一个垃圾,但没有更好的。 buildstep0 runner类型:msbuild 命令行参数:/ p:Configuration = Debug buildstep1 runner类型:msbuild 命令行参数:/ p:Configuration = Release In teamcity build steps try this. In both build steps use the same solution. It' ...
-
android studio 3.0卡在“构建gradle项目信息”(android studio 3.0 stuck at “building gradle project info”)[2024-02-25]
由于下载Gradle需要很长时间,当您的网络状况不佳时,您必须自行下载。 我的解决方案是: 1. 下载新版本的gradle ,例如gradle-4.3-all.zip等,并将文件放入AS Gradle位置( Mac :转到Application文件夹并打开AS的包,然后放入新的Gradle文件夹中的Gradle PS:如果你没有找到新的gradle版本文件夹,那么你可以自己创建。Windows :就像前面的两个答案一样); 2. 断开您的Wifi或LAN; 3.像往常一样打开Android Studio 3 ...