Emacs版本 25.1.1
所有emacs源文件都位于文件夹中:... \ emacs \ share \ emacs \ 25.1 \ lisp \
假设我在Emacs文件打开url.el。在此文件中具有url-retrieve函数。我如何找到(使用emacs)还有另一个* .el文件使用此功能?
谢谢。
我想测试http请求/响应。所以我使用WireMock。
我想存根特定请求的响应:这里代码:
public class WireMockPersons {
@Rule
public WireMockRule wireMockRule = new WireMockRule(8089);
@Test
public void exactUrlOnly() {
stubFor(get(urlEqualTo("/some/thing"))
.willReturn(aResponse()
.withHeader("Content-Type", "text/plain")
.withBody("Hello world!")));
assertThat(testClient.get("/some/thing").statusCode(), is(200));
assertThat(testClient.get("/some/thing/else").statusCode(), is(404));
}
Run Code Online (Sandbox Code Playgroud)
代码未编译,因为没有对象testClient。如何获取testClient对象?
这里是 XML:
<TextView
android:id="@+id/toolbaTitleTextView"
style="@style/textViewOneLine"
android:layout_width="0dp"
android:layout_height="0dp"
android:textAllCaps="true"
android:textColor="@android:color/black"
android:textSize="13sp"
/>
Run Code Online (Sandbox Code Playgroud)
我需要编写 Espresso 测试检查TextView 的字体大小(以SP为单位)= 13。
所以这里测试一下:
@Test
public void toolBarTextSize() {
onView(withId(R.id.toolbaTitleTextView)).check(matches(withFontSize(13)));
}
Run Code Online (Sandbox Code Playgroud)
这里匹配器:
public static Matcher<View> withFontSize(final float expectedSize) {
return new BoundedMatcher<View, View>(View.class) {
@Override
public boolean matchesSafely(View target) {
if (!(target instanceof TextView)) {
return false;
}
TextView targetEditText = (TextView) target;
return targetEditText.getTextSize() == expectedSize;
}
@Override
public void describeTo(Description description) {
description.appendText("with fontSize: ");
description.appendValue(expectedSize);
}
};
}
Run Code Online (Sandbox Code Playgroud)
但我收到错误,因为大小以像素 …
安卓工作室 3.5
classpath 'com.android.tools.build:gradle:3.6.0-beta01'
Run Code Online (Sandbox Code Playgroud)
在 app/build.gradle 中:
def releaseOutputFileName = "${rootProject.name}_${defaultConfig.versionName}.apk"
def packageAppOutputDirPath = output.packageApplication.outputDirectory.toPath()
Run Code Online (Sandbox Code Playgroud)
但我得到错误:
com.android.build.gradle.internal.crash.ExternalApiUsageException: groovy.lang.MissingMethodException: No signature of method: org.gradle.api.internal.file.DefaultFilePropertyFactory$DefaultDirectoryVar.toPath() is applicable for argument types: () values: []
Run Code Online (Sandbox Code Playgroud) 安卓工作室 3.6
构建.gradle:
buildscript {
ext.kotlin_version = '1.3.50'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.6.0-beta01'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
Run Code Online (Sandbox Code Playgroud)
在 app/build.gradle 中:
android {
viewBinding.enabled = true
dataBinding {
enabled = true
}
Run Code Online (Sandbox Code Playgroud)
在我的活动中:
import android.os.Bundle
import android.util.Log
import androidx.appcompat.app.AppCompatActivity
import androidx.viewpager2.widget.ViewPager2
import com.myproject.BuildConfig
import com.myproject.R
import com.myproject.adapter.CustomFragmentStateAdapter
import com.myproject.databinding.QrBluetoothSwipeActivityBinding
import com.myproject.ui.fragment.BluetoothPageFragment
import com.myproject.ui.fragment.QrPageFragment
import androidx.databinding.DataBindingUtil
import androidx.databinding.ObservableInt
class QRBluetoothSwipeActivity : AppCompatActivity() {
private lateinit var viewBinding: QrBluetoothSwipeActivityBinding
var positionObservable = ObservableInt()
companion object {
private val TAG = QRBluetoothSwipeActivity::class.java.name …Run Code Online (Sandbox Code Playgroud) 安卓工作室3.6
build.gradle:
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.AA_VERSION = '4.4.0'
ext.kotlin_version = '1.2.21'
ext.BUTTER_KNIFE_VERSION = '8.8.1'
ext.GLIDE_VERSION = '4.2.0'
repositories {
google()
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.6.0-beta05'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
Run Code Online (Sandbox Code Playgroud)
在应用程序/build.gradle中
buildscript {
repositories {
maven { url 'https://maven.fabric.io/public' }
}
}
apply plugin: 'com.android.application'
apply plugin: 'kotlin-android-extensions'
apply …Run Code Online (Sandbox Code Playgroud) 安卓工作室3.6
在 build.gradle 中:
compileOptions {
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_1_8
}
api 'org.apache.commons:commons-io:1.3.2'
Run Code Online (Sandbox Code Playgroud)
在我的代码中
import org.apache.commons.io.FileUtils
import java.io.*
import java.nio.charset.StandardCharsets
val file = File(folderPath + File.separator + resultFileName)
FileUtils.writeStringToFile(
file,
fileContents,
StandardCharsets.UTF_8.toString()
)
Run Code Online (Sandbox Code Playgroud)
但我收到错误:
java.nio.charset.CharsetICU[UTF-8]
java.io.UnsupportedEncodingException: java.nio.charset.CharsetICU[UTF-8]
at java.nio.charset.Charset.forNameUEE(Charset.java:322)
at java.lang.String.getBytes(String.java:534)
at org.apache.commons.io.IOUtils.write(IOUtils.java:810)
at org.apache.commons.io.FileUtils.writeStringToFile(FileUtils.java:1110)
at com.myproject.client.common.util.AndroidFileUtil.saveTextToFile(AndroidFileUtil.kt:106)
at com.myproject.client.service.RecognizedCheckDataService$Companion.saveRecognizedText(RecognizedCheckDataService.kt:117)
at com.myproject.client.viewmodel.ScanCheckRompetrolViewModel.finishProcessRecognizedCheck(ScanCheckRompetrolViewModel.kt:1059)
at com.myproject.client.viewmodel.ScanCheckRompetrolViewModel.access$finishProcessRecognizedCheck(ScanCheckRompetrolViewModel.kt:28)
at com.myproject.client.viewmodel.ScanCheckRompetrolViewModel$runDetector$1.onSuccess(ScanCheckRompetrolViewModel.kt:193)
at com.myproject.client.viewmodel.ScanCheckRompetrolViewModel$runDetector$1.onSuccess(ScanCheckRompetrolViewModel.kt:28)
at com.google.android.gms.tasks.zzn.run(Unknown Source)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by: java.nio.charset.IllegalCharsetNameException: java.nio.charset.CharsetICU[UTF-8]
Run Code Online (Sandbox Code Playgroud) 安卓工作室 3.6
在一个屏幕上,我通过这样的协程轮询:
fun initPoll() =
viewModelScope.launch(Dispatchers.Main) {
var errorMessage = ""
try {
while (true) {
val balanceValue: BigDecimal = TransportService.getBonuse()
delay(1000)
}
} catch (e: CancellationException) {
Debug.e(
TAG,
"initPoll: error_message = ${e.message}, ex = $e"
)
} catch (e: Throwable) {
Debug.e(
TAG,
"initPoll: error_message = ${e.message}, ex = $e"
)
}
}
Run Code Online (Sandbox Code Playgroud)
在运输服务中:
suspend fun getBonuse() =
withContext(Dispatchers.IO) {
// some code here
} // Dispatchers.Main
Run Code Online (Sandbox Code Playgroud)
在活动中:
import kotlinx.coroutines.*
private lateinit var poll: Job
override fun …Run Code Online (Sandbox Code Playgroud) Linux 薄荷 20.1
在 IntelIJ 2020 中,我导入 SpringBoot gradle 项目。
这是我的 build.gradle
plugins {
id 'org.springframework.boot' version '2.4.2'
id 'io.spring.dependency-management' version '1.0.11.RELEASE'
id 'java'
}
group = 'com.gmail.myproject
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '1.8'
repositories {
mavenCentral()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
}
test {
useJUnitPlatform()
}
Run Code Online (Sandbox Code Playgroud)
从终端我成功运行 spring boot 项目:
./gradlew bootrun
Run Code Online (Sandbox Code Playgroud)
好的。
现在我想从 IntelIJ 运行项目。但我收到错误:
11:23:24 AM: Executing task...
FAILURE: Build failed with an exception.
* What went wrong:
The specified initialization script '/tmp/ijresolvers.gradle' does not …Run Code Online (Sandbox Code Playgroud) Linux 薄荷 20.2
我想安装 PgAdmin4。
这里是官方教程
https://www.pgadmin.org/download/pgadmin-4-apt/
步骤: sudo curl https://www.pgadmin.org/static/packages_pgadmin_org.pub | sudo apt-key add % 接收百分比 % Xferd 平均速度 时间 时间 当前 Dload 上传总花费左速度 100 3935 100 3935 0 0 4517 0 --:--:-- --:--:-- --: --:-- 4512
sudo sh -c 'echo "deb https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/$(lsb_release -cs) pgadmin4 main" > /etc/apt/sources.list.d/pgadmin4.list && apt update'
Run Code Online (Sandbox Code Playgroud)
结果:
Hit:1 http://dl.google.com/linux/chrome/deb stable InRelease
Hit:2 http://apt.postgresql.org/pub/repos/apt focal-pgdg InRelease
Hit:3 http://archive.ubuntu.com/ubuntu focal InRelease
Hit:4 http://archive.canonical.com/ubuntu focal InRelease
Hit:5 http://ppa.launchpad.net/kelleyk/emacs/ubuntu focal InRelease
Hit:6 http://apt.postgresql.org/pub/repos/apt bionic-pgdg InRelease
Hit:7 https://repo.skype.com/deb stable …Run Code Online (Sandbox Code Playgroud)