我想在打字稿中创建一个类型,它可以将字符串转换为大写:
type _Upper<T> = ...
_Upper<'abc'> // 'ABC'
Run Code Online (Sandbox Code Playgroud)
谁能告诉我这个吗?

我是图像处理新手。我想检测该图像中的一条特定线,即图像中间的水平线。我想知道如何处理它。这是地图,它已经被简化为边缘地图。
我使用 vaadin 和 flow 开发 web 应用程序已经有一段时间了(与 Spring Boot 一起),并且偶然发现了 hilla,一个新的 vaadin“插件”或项目...(www.hilla.dev)。
我知道 flow 和 vaadin 使用 typescript 来做一些事情,但我从来不需要深入研究我的 java 后端和生成的 html/js/css 之间的这个元层......
所以我问自己,hilla 有什么用处让我的生活变得更轻松?或者,hilla 是否更适合从 javascript 和 typescript 转向 vaadin 的人,而不是相反?
我有一个像这样的获取刷新令牌网址client.com/api//auth/refresh-token。但我很难使用这个。我认为登录后应该在本地存储中保存刷新令牌。但我该如何使用它呢?
登录.tsx
export const useLogin = () => {
const LoginAuth = async (data: AuthenticationProps) => {
await axios.post(baseURL + `client/auth/login`,
{
email: data.email,
password: data.password,
},
{
headers: {
"Content-Type": "application/json",
Accept: "application/json",
}
}
)
.then((res) => {
if(res.status === 200) {
console.log("success")
}
}, (err) => {
console.log(err);
})
}
return {
LoginAuth,
}
}
Run Code Online (Sandbox Code Playgroud) 我有一个简单的应用程序,显示当地酒店的列表。每个列表项都有一个<Link/>重定向到另一个组件的组件,该组件在地图上显示该特定酒店的位置。当切换路由时,组件似乎<ProductList/>被破坏了,其中的所有状态也被破坏了。所以每次当它进行新的 API 调用并重新渲染时。我尝试将其保存在本地存储中componentWillUnmount并检索它,useEffect()以便我可以有条件地进行 API 调用,它可以工作,但有时不起作用。
import React, { useState, useEffect} from "react";
import ProductItem from "../Components/ProductItem";
import axios from "axios";
const ProductList = () => {
const [hotelList, setHotelList] = useState([]);
// Get user location by IP
const getCurrentLocation = () => {
return fetch("https://ipinfo.io/json?token=MyToken").then(
(response) => response.json()
);
};
// Get list of hotels in specific location
const getHotelsInLocation = (destInfo) => {
console.log('destInfo is: ', destInfo)
const options = { …Run Code Online (Sandbox Code Playgroud) 我正在尝试签署 AWS API 请求,然后使用 cURL。
目的是将跟踪号码提交给服务提供商的 API,并使用响应。
我对 AWS API 完全是个菜鸟,经过多次测试后找不到我的错误。
我尝试了很多方法,但都导致了{"message":"Forbidden"}。
这是我当前的脚本:
<?php
$accessKeyId = "AKIA55D**********";
$secretAccessKey = "NQ0xcl**********";
$method ='GET';
$uri = '/tracking/shipments';
$secretKey = $secretAccessKey;
$access_key = $accessKeyId;
$region = 'af-south-1';
$service = 'execute-api';
$host = "https://api.shiplogic.com";
$alg = 'sha256';
$date = new DateTime('Africa/Johannesburg');
$dd = $date->format( 'Ymd\THis\Z' );
$amzdate2 = new DateTime( 'Africa/Johannesburg' );
$amzdate2 = $amzdate2->format( 'Ymd' );
$amzdate = $dd;
$algorithm = 'AWS4-HMAC-SHA256';
$canonical_uri = $uri;
$canonical_querystring = '';
$canonical_headers = "host:".$host."\n"."x-amz-date:".$amzdate."\n"; …Run Code Online (Sandbox Code Playgroud) 这SoundViewModel是一个ViewModel类,val listSoundRecordState可能被应用程序中的某些模块使用。
在代码 A 中,我fun collectListSoundRecord()在需要使用数据时调用listSoundRecordState。但fun collectListSoundRecord()可能会因为Jetpack Compose重新组合而反复启动,不知道会不会耗费很多系统资源?
在代码B中,我 private fun collectListSoundRecord()在 中启动init { },collectListSoundRecord()只会启动一次,但即使我不需要使用数据listSoundRecordState,它也会保留在内存中直到App代码关闭,这种方式会消耗很多系统资源吗?
代码A
@HiltViewModel
class SoundViewModel @Inject constructor(
...
): ViewModel() {
private val _listSoundRecordState = MutableStateFlow<Result<List<MRecord>>>(Result.Loading)
val listSoundRecordState = _listSoundRecordState.asStateFlow()
init { }
//It may be launched again and again
fun collectListSoundRecord(){
viewModelScope.launch {
listRecord().collect {
result -> _listSoundRecordState.value =result
}
}
}
private fun listRecord(): Flow<Result<List<MRecord>>> …Run Code Online (Sandbox Code Playgroud) kotlin kotlin-coroutines android-jetpack-compose kotlin-flow
好吧,我一直在仔细搜索,并且在实现 BaseAdapter 时遇到了一些问题。
我已经能够 按照上面的示例实现一个简单的光标适配器http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/view/List7.html 。
这里有一个非常好的 BaseAdapter 示例:List14 google example
我想使用 BaseAdapter 创建自己的列表适配器来显示列表视图,其中包含数据库中的多个项目。我知道这可以使用简单游标适配器来完成,但我希望以不同的方式处理行,因此我希望能够通过重写 getView 来绘制每一行。数据将从游标中提取。
我知道这段代码对于获取光标数据来说很难看,但假设我已经填充了光标。如果第 8 列包含图像资源 id,您对此有何建议。:
@Override
public View getView(int position, View convertView, ViewGroup parent) {
// TODO Auto-generated method stub
cursor.moveToPosition(position);
ImageView i = new ImageView(mContext);
i.setImageResource(cursor.getShort(8));
i.setAdjustViewBounds(true);
i.setLayoutParams(new AbsListView.LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT));
return i;
}
Run Code Online (Sandbox Code Playgroud)
您有任何使用光标绘制 BaseAdapter 的好示例吗?
我需要更新一个旧的经典 asp,并且必须调用一个通常返回数组的函数,但在某些情况下可能返回一个Nothing或一个未定义的值。
如何检查结果是否确实返回一个数组?
我正在使用 JOGL2 和 NativeWindow API 用 Java 编写应用程序。如何隐藏鼠标光标?
[编辑]
我没有使用 JFrame 来创建窗口,而是使用 JOGL 中的 GLWindow 来创建窗口。GLWindow 没有 setCursor 方法。这还有可能吗?
reactjs ×2
typescript ×2
adapter ×1
android ×1
arrays ×1
asp-classic ×1
caching ×1
curl ×1
hilla ×1
java ×1
javascript ×1
jogl ×1
kotlin ×1
kotlin-flow ×1
listview ×1
mouse-cursor ×1
php ×1
r ×1
signing ×1
spring-boot ×1
vaadin ×1
vaadin-flow ×1