首先,我知道' Groovy String to int '的问题及其响应.我是Groovy语言的新手,现在正在玩一些基础知识.将String转换为int的最简单方法似乎是:
int value = "99".toInteger()
Run Code Online (Sandbox Code Playgroud)
要么:
int value = Integer.parseInt("99")
Run Code Online (Sandbox Code Playgroud)
这些都有效,但对这些答案的评论让我感到困惑.第一种方法
String.toInteger()已弃用,如groovy文档中所述.我也认为
Integer.parseInt()利用核心Java功能.
所以我的问题是:是否有任何合法的,纯粹的groovy方式来执行将String转换为int这样一个简单的任务?
我一直在使用WCF
(.svc)服务一段时间,请求格式是,JSON
并且响应格式XML
在Android应用程序中正常工作.几天前,我为DigiCert SSL
的WCF
服务实现了一个证书(使用我的通配符功能).该服务可从浏览器访问,并且不会显示错误.下面是WebConfig
<?xml version="1.0"?>
<configuration>
<configSections>
<sectionGroup name="applicationSettings" type="System.Configuration.ApplicationSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<section name="IntermediateWebService.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" requirePermission="false" />
</sectionGroup>
</configSections>
<system.web>
<compilation debug="true" targetFramework="4.0" />
<customErrors mode="Off"/>
</system.web>
<system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="IntermediateWebService.WebBehavior">
<serviceMetadata httpsGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="true"/>
</behavior>
<behavior>
<!-- To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment -->
<serviceMetadata httpsGetEnabled="true"/>
<!-- To …
Run Code Online (Sandbox Code Playgroud) 有没有办法禁用 Kotlin 元数据或只是混淆它们?它是在编译期间添加的。\n整个代码都经过了很好的混淆,但名为“kotlin-reflect.jar”的 Kotlin 库留下了方法详细信息,例如类名、方法和带有类型的参数。
\n\n\n\n@Metadata(mv = {1, 1, 13}, bv = {1, 0, 3}, k = 1, d1 = \n {"\\000\\022\\n\\002\\030\\ 002\n\002\030\002\n\000\n\002\020\016\n\002\b\002\030\0002\ \0020\\001B\\r\\022\\006\\020\\002\\032\\0020\\003?\\006\\002\\020\\004R\\016\\020\\ 002\\032\\0020\\003X?\\004?\\006\\002\\n\\000\xef\xbf\xbd\\006\\005"}, \n d2 = {"Lcom/ test/SomeException;", "Lcom/test/SomeException;", "errorMessage", "", "(Ljava/lang/String;)V", "build"})\n 公共最终类 SomeException 扩展了 Exception {\n公共 SomeException(@NotNull String paramString) { super(paramString); this.errorMessage = paramString; }\n 私有最终字符串 errorMessage;\n }
\n
我想在Android Studio编辑器中添加更改的“ loge”模板以删除最后一个必需的参数-Exception对象。现在,“ loge”模板结果如何:
在dafualt模板之前插入:
public void doSmth() {
//start write "loge" word here
}
Run Code Online (Sandbox Code Playgroud)
在dafualt模板之后插入:
public void doSmth() {
Log.e(TAG, "doSmth: ", );
}
Run Code Online (Sandbox Code Playgroud) android intellij-idea live-templates android-studio android-log
我正在通过使用Kotlin Koans int IntelliJ EduKotlin插件(https://plugins.jetbrains.com/plugin/8186)学习Kotlin .在执行任务并运行它们时,这个插件正在运行,我无法创建新的Kotlin脚本并在没有此插件的情况下运行它.
名为Hello.kt的文件中的示例代码:
fun hello() : String {
return "ok"
}
Run Code Online (Sandbox Code Playgroud)
然后我创建从'Kotlin脚本'派生的新运行配置,将'Working directory'设置为ProjectName/src文件夹(或ProjectName文件夹,相同结果),IDE向我显示'找不到脚本文件:Hello.kt'警告,如屏幕如下:
事实上,在尝试运行脚本时,我得到了以下堆栈跟踪:
"C:\Program Files\Java\jdk1.8.0_74\bin\java" -Dfile.encoding=windows-1250 -classpath C:\Users\myUser\.IdeaIC2016\config\plugins\Kotlin\kotlinc\lib\kotlin-compiler.jar;C:\Users\myUser\.IdeaIC2016\config\plugins\Kotlin\kotlinc\lib\kotlin-reflect.jar;C:\Users\myUser\.IdeaIC2016\config\plugins\Kotlin\kotlinc\lib\kotlin-runtime.jar org.jetbrains.kotlin.cli.jvm.K2JVMCompiler -script Hello.kt
exception: java.lang.RuntimeException: Failed to evaluate script: kotlin.KotlinNullPointerException
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileScript(KotlinToJVMBytecodeCompiler.kt:263)
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileAndExecuteScript(KotlinToJVMBytecodeCompiler.kt:212)
at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:181)
at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.doExecute(K2JVMCompiler.kt:49)
at org.jetbrains.kotlin.cli.common.CLICompiler.exec(CLICompiler.java:181)
at org.jetbrains.kotlin.cli.common.CLICompiler.exec(CLICompiler.java:138)
at org.jetbrains.kotlin.cli.common.CLICompiler.exec(CLICompiler.java:57)
at org.jetbrains.kotlin.cli.common.CLICompiler.doMainNoExit(CLICompiler.java:248)
at org.jetbrains.kotlin.cli.common.CLICompiler.doMain(CLICompiler.java:238)
at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler$Companion.main(K2JVMCompiler.kt:248)
at org.jetbrains.kotlin.cli.jvm.K2JVMCompiler.main(K2JVMCompiler.kt)
Caused by: kotlin.KotlinNullPointerException
at org.jetbrains.kotlin.cli.jvm.compiler.KotlinToJVMBytecodeCompiler.compileScript(KotlinToJVMBytecodeCompiler.kt:475)
... 10 more
Process finished with exit code 2
Run Code Online (Sandbox Code Playgroud)
此外,hello方法被标记为从未使用过.但是,当我将文件扩展名从.kt更改为.ktscript时,此方法被标记为已使用,运行代码的输出如下:
"C:\Program Files\Java\jdk1.8.0_74\bin\java" …
Run Code Online (Sandbox Code Playgroud) 我正在构建一个小应用程序,昨天工作得很好,但今天添加按钮后没有.我恢复了所有的更改,但我仍然得到相同的错误,即应用程序内存不足.这是代码和堆栈跟踪:
public class MainActivity extends AppCompatActivity {
private MainActivity mainActivity = new MainActivity();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
}
public boolean onCreateOptionsMenu(Menu menu) {
// Inflate the menu; this adds items to the action bar if it is present.
getMenuInflater().inflate(R.menu.menu_main, menu);
return true;
}
@Override
public boolean onOptionsItemSelected(MenuItem item) {
// Handle action bar item clicks here. The action bar will
// automatically handle clicks on the Home/Up button, so long
// as you specify a parent …
Run Code Online (Sandbox Code Playgroud) android ×3
java ×2
kotlin ×2
android-log ×1
c# ×1
decompiling ×1
groovy ×1
obfuscation ×1
proguard ×1
ssl ×1
wcf ×1