是否有一种将Integer数组转换为int数组的奇特方法?(我不想迭代每个元素;我正在寻找一种优雅而快速的方法来编写它)
我正在使用另一种方式
scaleTests.add(Arrays.stream(data).boxed().toArray(Double[]::new));
我正在寻找单线但无法找到的东西.
目标是:
int[] valuesPrimitives = <somehow cast> Integer[] valuesWrapper
Run Code Online (Sandbox Code Playgroud) 我正在 Github 上运行google-github-actions/deploy-cloudrun操作,在尝试将 docker 映像推送到 Artifact Registry 时失败。
Google Artifact Registry
失败name invalid: Missing image name. Pushes should be of the form docker push HOST-NAME/PROJECT-ID/REPOSITORY/IMAGE
Github 操作 YML
# Authenticate Docker to Google Cloud Artifact Registry
- name: Docker Auth
id: docker-auth
uses: 'docker/login-action@v1'
with:
username: 'oauth2accesstoken'
password: '${{ steps.auth.outputs.access_token }}'
registry: '${{ env.GAR_LOCATION }}-docker.pkg.dev'
- name: Build and Push Container
run: |-
docker build -t "${{ env.GAR_LOCATION }}-docker.pkg.dev/${{ env.PROJECT_ID }}/${{ env.SERVICE …
Run Code Online (Sandbox Code Playgroud) docker google-cloud-platform github-actions google-artifact-registry
我有一点理解问题.
在Qt Wiki中写道,我必须:
提示:确保将Perl添加到git前面的路径,因为它发布了一个过时的版本(Perl 5.8),这将导致脚本失败.
但这究竟意味着什么呢?这是指PATH变量吗?它包含以下项目:
C:\Python33\
C:\Perl64\site\bin
C:\Perl64\bin
C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common
C:\Program Files (x86)\AMD APP\bin\x86_64
C:\Program Files (x86)\AMD APP\bin\x86
%SystemRoot%\system32
%SystemRoot%
%SystemRoot%\System32\Wbem
%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\
C:\Program Files (x86)\ATI Technologies\ATI.ACE\Core-Static
C:\Program Files\Microsoft SQL Server\110\Tools\Binn\
C:\Program Files\Common Files\Autodesk Shared\
C:\Program Files\Microsoft\Web Platform Installer\
C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages\v1.0\
C:\Program Files (x86)\Windows Kits\8.0\Windows Performance Toolkit\
C:\Program Files (x86)\Autodesk\Backburner\
C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\
C:\Program Files\Microsoft SQL Server\100\Tools\Binn\
C:\Program Files\Microsoft SQL Server\100\DTS\Binn\
C:\Python33\Lib\site-packages\PyQt4
Run Code Online (Sandbox Code Playgroud)
有人能告诉我如何在git前面设置路径吗?我不知道这意味着什么
问候
我正在使用Redux Toolkit (RTK) 和 Redux Toolkit Query (RTK-Query)。
在任何情况下仍然使用 是最佳实践、必要还是建议thunks
,或者我应该将所有逻辑移至组件中?(handleLogin()
如下所示)
const Login = () => {
const dispatch = useDispatch()
const [formState, setFormState] = useState({ name: '', password: '' })
const [login, { isLoading }] = useLoginMutation()
const { push } = useHistory()
const handleLogin = async () => {
try {
const user = await login(formState).unwrap()
dispatch(setCredentials(user));
} catch (e) {
console.error(e)
}
}
return (
<div>
<input type="text" name="name" placeholder="name" />
<input type="password" …
Run Code Online (Sandbox Code Playgroud) 我正在尝试让react-native-permissions
我的 Expo 开发客户端版本运行。构建成功,但是当我启动应用程序时,我得到一个相对通用的“未检测到权限处理程序”。错误。
研究建议添加权限ios/Podfile
并确保ios/<appname>/Info.plist
条目需要存在。
该应用程序无需react-native-permissions即可运行,但我想使用该包来检查是否设置了权限并引导用户进行设置(如果没有)。
pod 'Permission-Microphone', :path => "#{permissions_path}/Microphone"
pod 'Permission-SpeechRecognition', :path => "#{permissions_path}/SpeechRecognition"
Run Code Online (Sandbox Code Playgroud)
<key>NSMicrophoneUsageDescription</key>
<string>CUSTOM: Allow to access the microphone</string>
<key>NSSpeechRecognitionUsageDescription</key>
<string>CUSTOM: Allow to securely recognize user speech</string>
Run Code Online (Sandbox Code Playgroud)
...
"plugins": [
"@react-native-firebase/app",
"@react-native-firebase/perf",
"@react-native-firebase/crashlytics",
"@react-native-google-signin/google-signin",
["react-native-fbsdk-next",
{
"appID": "xxx",
"clientToken": "xxx",
"displayName": "xxx",
"advertiserIDCollectionEnabled": false,
"autoLogAppEventsEnabled": false,
"isAutoInitEnabled": true
}
],
[
"@react-native-voice/voice",
{
"microphonePermission": "CUSTOM: Allow access the microphone",
"speechRecognitionPermission": "CUSTOM: to securely recognize user speech"
}
] …
Run Code Online (Sandbox Code Playgroud) javascript react-native expo react-native-permissions expo-eas
关注*ngFor
<ul>
<li *ngFor="#todo of todoService.todos">
{{todo}}
<li>
</ul>
Run Code Online (Sandbox Code Playgroud)
其中todoService是注入接口
import {Injectable} from 'angular2/core';
@Injectable()
export class TodoService {
todos = []
}
Run Code Online (Sandbox Code Playgroud)
当我加载页面时,输出<li></li>
而不是什么.
知道为什么吗?由于数组是空的,因此不应该有<li>
-tag
编辑 当我用值初始化数组时也会发生这种情况.无缘无故总是有一个尾随的空元素.
EDIT2 问题示例 https://plnkr.co/edit/MRYC4MHtlDLfBMUPsL6o?p=preview
根据tRPC
文档,查询参数必须遵循此格式
myQuery?input=${encodeURIComponent(JSON.stringify(input))}
Run Code Online (Sandbox Code Playgroud)
我有这个程序:
hello: publicProcedure
.input(z.object({ text: z.string() }))
.output(z.object({ greeting: z.string() }))
.query(({ input }) => {
return {
greeting: `Hello ${input.text}`,
};
}),
Run Code Online (Sandbox Code Playgroud)
手动构造的 URL 返回错误:
const data = {text: "my message"}
const res = await fetch('http://localhost:3000/api/trpc/example.hello?batch=1&input='+encodeURIComponent(JSON.stringify(data)), { method: 'GET' });
const body = await res.json();
console.log(body);
Run Code Online (Sandbox Code Playgroud)
该错误表明查询参数编码不正确?知道出了什么问题吗?使用客户端,它的工作原理:const test = api.example.hello.useQuery({ text: "my message" });
{
"error": {
"json": {
"message": "[\n {\n \"code\": \"invalid_type\",\n \"expected\": \"object\",\n \"received\": \"undefined\",\n \"path\": [],\n \"message\": \"Required\"\n }\n]", …
Run Code Online (Sandbox Code Playgroud) 我使用的基本代码是http://www.glfw.org/documentation.html中的示例
我得到这个输出:
1>------ Build started: Project: ConsoleApplication1, Configuration: Debug Win32 ------
1> Quelle.cpp
1>Quelle.obj : error LNK2019: unresolved external symbol _glfwInit referenced in function _main
1>Quelle.obj : error LNK2019: unresolved external symbol _glfwTerminate referenced in function _main
1>Quelle.obj : error LNK2019: unresolved external symbol _glfwCreateWindow referenced in function _main
1>Quelle.obj : error LNK2019: unresolved external symbol _glfwWindowShouldClose referenced in function _main
1>Quelle.obj : error LNK2019: unresolved external symbol _glfwPollEvents referenced in function _main
1>Quelle.obj : error LNK2019: unresolved …
Run Code Online (Sandbox Code Playgroud) 我有一个编码问题.
该表使用utf8_general_ci
了php标头,header("Content-Type: text/html; charset=utf-8");
并在html <meta charset="utf-8">
中设置了元标记.BOM设置正确.德语字符显示在phpmyadmin中.
但是当我输出编码结果时:Sask
还有什么想法我能做什么?
我想知道如何将角度ui路由与护照结合起来.我找到的所有示例都使用node.js路由.
var routerApp = angular.module('routerApp', ['ui.router']);
routerApp.config(function($stateProvider, $urlRouterProvider) {
$urlRouterProvider.otherwise('/home');
$stateProvider
.state('home', {
url: '/home',
templateUrl: 'partial-home.html'
})
.state('about', {
// for example just show if is loggedIn
});
Run Code Online (Sandbox Code Playgroud)
我将如何在上面的代码段中实现此功能?
function isLoggedIn(req, res, next) {
// if user is authenticated in the session, carry on
if (req.isAuthenticated())
return next();
// if they aren't redirect them to the home page
res.redirect('/');
}
Run Code Online (Sandbox Code Playgroud)
谢谢你的每一个提示
javascript ×3
angularjs ×2
angular ×1
arrays ×1
c++ ×1
docker ×1
encoding ×1
expo ×1
expo-eas ×1
git ×1
glfw ×1
html ×1
java ×1
java-8 ×1
linker ×1
next.js ×1
node.js ×1
opengl ×1
passport.js ×1
perl ×1
php ×1
qt ×1
react-native ×1
react-redux ×1
redux ×1
redux-thunk ×1
rpc ×1
rtk-query ×1
sql ×1
trpc.io ×1
typescript ×1
utf-8 ×1
wrapper ×1