call-recording 相关问题


cout << order of call to functions it prints?

以下代码: myQueue.enqueue('a'); myQueue.enqueue('b'); 计算<< myQueue.dequeue() << myQueue.dequeue(); prints "ba" to the console while: myQueue.enqueue('a'); myQueue.enque...


如何DROP开头为“`”的数据库,导致添加单反棍无法解决[重复]

如何删除带有反引号的 mysql NAMMIK(innodb_version 10.4.18)?它是由 CALL sys.create_synonym_db 无意添加的;请注意,添加单个背杆并不能解决问题,因为


如何删除以“`”开头的数据库,因为添加单个backstick无法解决[重复]

如何删除带有反引号的 mysql NAMMIK(innodb_version 10.4.18)?它是由 CALL sys.create_synonym_db 无意添加的;请注意,添加单个背杆并不能解决问题,因为


汇编和模板类

我正在开发一个小项目,并尝试将一些硬编码值用于内联汇编。为此,我使用模板。我创建了一个代码片段来显示我所看到的 #包括 我正在开发一个小项目,并尝试将一些硬编码值用于内联汇编。为此,我使用模板。我创建了一个代码片段来显示我所看到的 #include <iostream> template <size_t T> struct MyClass { size_t myValue = T; void doSomething() { size_t value = T; __asm { mov eax, [T] mov [value], eax } std::cout << value << std::endl; } }; int main() { auto o = new MyClass<999>(); o->doSomething(); return 0; } 事实证明,对于汇编代码,它试图使用数据段而不是“直接将数字粘贴到那里” ; 25 : { push ebp mov ebp, esp push ecx ; 26 : auto o = new MyClass<999>(); push 4 call ??2@YAPAXI@Z ; operator new add esp, 4 ; 14 : size_t value = T; mov DWORD PTR _value$2[ebp], 999 ; 000003e7H ; 26 : auto o = new MyClass<999>(); mov DWORD PTR [eax], 0 mov DWORD PTR [eax], 999 ; 000003e7H ; 15 : __asm ; 16 : { ; 17 : mov eax, [T] mov eax, DWORD PTR ds:0 ; 18 : mov [value], eax mov DWORD PTR _value$2[ebp], eax ; 19 : } ; 20 : std::cout << value << std::endl; 我正在使用 Visual Studio 2015。还有其他方法可以实现此目的吗? 啊,多么可爱又扭曲的问题啊! 我尝试使用 T 初始化 constexpr 变量。结果是相同的 - 从内存加载值。宏可用于将文字传递给内联汇编,但它们与模板不能很好地混合。 使用 T 在类中初始化枚举在理论上应该可行(https://msdn.microsoft.com/en-us/library/ydwz5zc6.aspx提到枚举可以在内联汇编中使用),但是在内联汇编使 Visual Studio 2015 编译器崩溃:-)。 似乎有效的是一个函数模板,它使用模板参数声明一个枚举,然后在内联程序集中使用该枚举。如果必须将其放在模板类中,则可以在类中实例化模板函数,如下所示: #include <iostream> template <size_t T> void dosomething() { enum { LOCALENUM = T }; size_t value = 0; __asm { mov eax, LOCALENUM mov[value], eax } std::cout << value << std::endl; } template <size_t T> struct MyClass { size_t myValue = T; void doSomething() { ::dosomething<T>(); } }; int main() { //dosomething<999>(); auto o = new MyClass<999>(); o->doSomething(); return 0; } 这会产生以下汇编代码: auto o = new MyClass<999>(); 001B1015 mov dword ptr [eax],0 001B101B mov dword ptr [eax],3E7h o->doSomething(); 001B1021 mov eax,3E7h <--- Victory! 001B1026 mov dword ptr [ebp-4],eax 001B1029 mov ecx,dword ptr [_imp_?cout@std@@3V?$basic_ostream@DU?$char_traits@D@std@@@1@A (01B2048h)] 001B102F push offset std::endl<char,std::char_traits<char> > (01B1050h) 001B1034 push dword ptr [ebp-4] 001B1037 call dword ptr [__imp_std::basic_ostream<char,std::char_traits<char> >::operator<< (01B2044h)]


php 使用函数更改函数外部变量的值

我试图在使用函数时更改函数外部声明的变量的值 我试图更改在使用函数时声明的变量的值 <?php $test = 1; function addtest() { $test = $test + 1; } addtest(); echo $test; ?> 但似乎不能。只有在函数中声明为参数的变量才有效。有这方面的技术吗?预先感谢 将函数内部的变量更改为全局变量 - function addtest() { global $test; $test = $test + 1; } 使用全局变量有很多注意事项 - 从长远来看,您的代码将更难维护,因为全局变量可能会对未来的计算产生不良影响,您可能不知道如何操纵变量。 如果重构代码并且函数消失,这将是有害的,因为 $test 的每个实例都与代码紧密耦合。 这里有一个轻微的改进,不需要 global - $test = 1; function addtest($variable) { $newValue = $variable + 1; return $newValue; } echo $test; // 1 $foo = addtest($test); echo $foo; // 2 现在您不必使用全局变量,并且可以根据自己的喜好操作 $test,同时将新值分配给另一个变量。 不确定这是否是一个人为的示例,但在这种情况下(与大多数情况一样),使用global将是极其糟糕的形式。为什么不直接返回结果并分配返回值呢? $test = 1; function increment($val) { return $val + 1; } $test = increment($test); echo $test; 这样,如果您需要增加除 $test 之外的 任何其他 变量,您就已经完成了。 如果您需要更改多个值并返回它们,您可以返回一个数组并使用 PHP 的 list 轻松提取内容: function incrementMany($val1, $val2) { return array( $val1 + 1, $val2 + 1); } $test1 = 1; $test2 = 2; list($test1, $test2) = incrementMany($test1, $test2); echo $test1 . ', ' . $test2; 您还可以使用 func_get_args 接受动态数量的参数并返回动态数量的结果。 使用 global 关键字。 <?php $test = 1; function addtest() { global $test; $test = $test + 1; } addtest(); echo $test; // 2 ?> 也许你可以试试这个。 <?php function addTest(&$val){ # Add this & and val will update var who call in from outside $val += 1 ; } $test = 1; addTest($test); echo $test; // 2 $anyVar = 5; addTest($anyVar); echo $anyVar; // 6


如何在本机反应中强制 TextInput 增长而 multiline={false} ?

<TextInput ref={inputRef} value={text} style={styles.textInput} returnKeyType="next" placeholder={"placeholder"} scrollEnabled={false} blurOnSubmit={false} onFocus={onFocusInput} textAlignVertical="center" onContentSizeChange={onChangeContentSizeChange} onChangeText={onInputChangeValue} onBlur={onInputBlur} onKeyPress={onInputKeyPress} onSubmitEditing={() => NextScript(id)} multiline={false} numberOfLines={5} /> 逻辑是我想要 onSubmitEditing 带我到下一个 TextInput 字段,并且我需要文本来包装输入的多个文本。如果我启用 multiline,一旦按下回车键,它会在进入下一个输入之前进入下一行,这就是我试图避免的。 是否可以用onSubmitEditing完全取代回车键?每当我按下回车键时,它都会尝试在移动到下一个TextInput之前输入换行符,因此它会创建一个糟糕的用户界面,其中文本在重新定位然后进入下一行之前会稍微向上移动。 如果我将 blurOnSubmit 设置为 true,它会停止,但键盘会在提交时关闭。 如果我将 multiline 设置为 false,它会停止但不会换行。 我创建了一个示例,onKeyPress将允许您在按下回车键时聚焦下一个文本字段。 import { Text, SafeAreaView, StyleSheet, TextInput } from 'react-native'; export default function App() { return ( <SafeAreaView style={styles.container}> <TextInput multiline={true} placeholder={'PLACEHOLDER'} onKeyPress={(e) => { if (e.nativeEvent.key == 'Enter') { console.log('ENTER'); //focusNextTextField(); } }} style={{ borderColor: '#000000', borderWidth: 1 }} /> </SafeAreaView> ); } const styles = StyleSheet.create({ container: { flex: 1, justifyContent: 'center', alignContent: 'center', padding: 8, }, }); 我也面临同样的问题。后来我找到了解决办法。 自定义文本输入处理:您需要一个自定义逻辑来处理文本输入及其在按“Enter”键时的行为。您将以编程方式控制文本换行和导航到下一个输入字段,而不是依赖多行的默认行为。 用 onSubmitEditing 替换 Enter 键:要覆盖“Enter”键的默认行为,您可以使用 onKeyPress 事件。检测何时按下“Enter”键并以编程方式触发 onSubmitEditing 函数。 维护文本换行:由于 multiline={false} 禁用自动文本换行,因此您需要实现一种方法来根据输入的内容大小或字符数手动处理文本换行。 以下是如何实现这一点的概念示例: import React, { useState, useRef } from 'react'; import { TextInput, StyleSheet } from 'react-native'; const CustomTextInput = () => { const [text, setText] = useState(''); const nextInputRef = useRef(null); const onInputKeyPress = (e) => { if (e.nativeEvent.key === 'Enter') { // Replace the Enter key functionality // Call the function you would have in onSubmitEditing handleEnterKeyPress(); } }; const handleEnterKeyPress = () => { // Logic to navigate to next TextInput // Focus the next input field if (nextInputRef.current) { nextInputRef.current.focus(); } // Additional logic if needed to handle text wrapping }; return ( <TextInput value={text} style={styles.textInput} onChangeText={setText} onKeyPress={onInputKeyPress} blurOnSubmit={false} // prevent keyboard from closing // other props /> ); }; const styles = StyleSheet.create({ textInput: { // styling for your text input }, }); export default CustomTextInput;


有什么问题吗?文本区域什么也没显示,但值是

我正在编写代码以在 中以灰色向用户显示提示; 接下来的想法是: 最初以灰色显示“请在此处输入您的询问”; 如果用户点击它,颜色会变为...</desc> <question vote="3"> <p>我正在编写代码以在 <pre><code><textarea/></code></pre> 中以灰色向用户显示提示;</p> <p>下一个想法是:</p> <ol> <li>最初将<pre><code>'Please, type your inquiry there'</code></pre>置于灰色;</li> <li>如果用户单击它,颜色将变为黑色,文本将变为 <pre><code>''</code></pre>。这部分工作正常;</li> <li>如果用户输入然后删除(即将字段留空),那么我们需要将 <pre><code>'Please, type your inquiry there'</code></pre> 放回灰色。</li> </ol> <p>步骤 (3) 在 Chrome 和 Firefox 中均不起作用。它什么也没显示。当我使用 Chrome 检查器时,它显示:</p> <blockquote> <p>element.style { 颜色: rgb(141, 141, 141); }</p> </blockquote> <p>这是正确的,而 HTML 中的 <pre><code>"Please, type your inquiry there"</code></pre> 也是正确的。但场地是空的。可能是什么问题??? 我特别使用了 <pre><code>console.log()</code></pre>,它们还显示应该是......的输出 </p>这是 HTML 和 JS 代码:<p> </p><code><textarea name='contact_text' id='contact_text' onclick='text_area_text_cl();' onBlur='text_area_text_fill();'> </textarea> <script> var contact_text_changed = false; var contact_contacts_changed = false; function text_area_text() { if (contact_text_changed == false) { $("#contact_text").css("color","#8d8d8d"); $("#contact_text").html('Please, type your inquiry there'); } else { $("#contact_text").css("color","#000000"); } // Write your code here }; function text_area_text_cl() { if (contact_text_changed == false) { $("#contact_text").text(''); $("#contact_text").css("color","#000000"); console.log('sdfdfs111'); contact_text_changed = true; } }; function text_area_text_fill() { if ($("#contact_text").val() == '') { contact_text_changed = false; $("#contact_text").css("color","#8d8d8d"); $("#contact_text").html('Please, type your inquiry there'); //document.getElementById('contact_text').innerHTML = 'Please, type your inquiry there' console.log('sdfdfs'); } else { console.log('__'); } }; // call functions to fill text_area_text(); </script> </code><pre> </pre> </question> <answer tick="true" vote="3">要设置 <p><code><textarea></code><pre> 的值,您需要使用 </pre><code>.val()</code><pre>:</pre> </p><code>$("#contact_text").val(''); </code><pre> </pre>或<p> </p><code>$("#contact_text").val('Please, type your enquiry there'); </code><pre> </pre>等等。让“占位符”代码正常工作是很棘手的。 <p>较新的浏览器允许<a href="http://caniuse.com/#search=placeholder" rel="nofollow">:</a> </p><code><textarea placeholder='Please, type your enquiry there' id='whatever'></textarea> </code><pre> </pre>他们会为您管理这一切。<p> </p><p>编辑<em> - 从评论中,这里解释了为什么 </em><code>.html()</code><pre> 最初有效(嗯,它</pre>确实<em>有效,但请继续阅读)。 </em><code><textarea></code><pre> 元素的标记内容(即元素中包含的 DOM 结构)表示 </pre><code><textarea></code><em> 的 </em>initial<pre> 值。在任何用户交互之前(和/或在 JavaScript 触及 DOM 的“value”属性之前),这就是显示为字段值的内容。然后,更改 DOM 的该部分就会更改该初始值。然而,一旦进行了一些用户交互,初始值就不再与页面视图相关,因此不会显示。仅显示更新后的值。</pre> </p> </answer></body>


SecurityException:不允许启动服务Intent { act=com.google.android.c2dm.intent.REGISTER pkg=com.google.android.gms (有额外功能)}

我尝试从 Google 获取我的 GCM 注册 ID。 我的代码: 字符串SENDER_ID =“722*****53”; /** * 向 GCM 服务器异步注册应用程序。 * * 存储注册信息... 我尝试从 Google 获取我的 GCM 注册 ID。 我的代码: String SENDER_ID = "722******53"; /** * Registers the application with GCM servers asynchronously. * <p> * Stores the registration ID and the app versionCode in the application's * shared preferences. */ private void registerInBackground() { new AsyncTask<Void, Void, String>() { @Override protected String doInBackground(Void... params) { String msg = ""; try { if (gcm == null) { gcm = GoogleCloudMessaging.getInstance(context); } regid = gcm.register(SENDER_ID); msg = "Device registered, registration ID=" + regid; // You should send the registration ID to your server over // HTTP, so it // can use GCM/HTTP or CCS to send messages to your app. sendRegistrationIdToBackend(); // For this demo: we don't need to send it because the // device will send // upstream messages to a server that echo back the message // using the // 'from' address in the message. // Persist the regID - no need to register again. storeRegistrationId(context, regid); } catch (IOException ex) { msg = "Error :" + ex.getMessage(); // If there is an error, don't just keep trying to register. // Require the user to click a button again, or perform // exponential back-off. } return msg; } @Override protected void onPostExecute(String msg) { mDisplay.append(msg + "\n"); } }.execute(null, null, null); } 我收到错误: 03-01 19:15:36.261: E/AndroidRuntime(3467): FATAL EXCEPTION: AsyncTask #1 03-01 19:15:36.261: E/AndroidRuntime(3467): java.lang.RuntimeException: An error occured while executing doInBackground() 03-01 19:15:36.261: E/AndroidRuntime(3467): at android.os.AsyncTask$3.done(AsyncTask.java:299) 03-01 19:15:36.261: E/AndroidRuntime(3467): at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:352) 03-01 19:15:36.261: E/AndroidRuntime(3467): at java.util.concurrent.FutureTask.setException(FutureTask.java:219) 03-01 19:15:36.261: E/AndroidRuntime(3467): at java.util.concurrent.FutureTask.run(FutureTask.java:239) 03-01 19:15:36.261: E/AndroidRuntime(3467): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230) 03-01 19:15:36.261: E/AndroidRuntime(3467): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080) 03-01 19:15:36.261: E/AndroidRuntime(3467): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573) 03-01 19:15:36.261: E/AndroidRuntime(3467): at java.lang.Thread.run(Thread.java:841) 03-01 19:15:36.261: E/AndroidRuntime(3467): Caused by: java.lang.SecurityException: Not allowed to start service Intent { act=com.google.android.c2dm.intent.REGISTER pkg=com.google.android.gms (has extras) } without permission com.google.android.c2dm.permission.RECEIVE 03-01 19:15:36.261: E/AndroidRuntime(3467): at android.app.ContextImpl.startServiceAsUser(ContextImpl.java:1800) 03-01 19:15:36.261: E/AndroidRuntime(3467): at android.app.ContextImpl.startService(ContextImpl.java:1772) 03-01 19:15:36.261: E/AndroidRuntime(3467): at android.content.ContextWrapper.startService(ContextWrapper.java:480) 03-01 19:15:36.261: E/AndroidRuntime(3467): at com.google.android.gms.gcm.GoogleCloudMessaging.b(Unknown Source) 03-01 19:15:36.261: E/AndroidRuntime(3467): at com.google.android.gms.gcm.GoogleCloudMessaging.register(Unknown Source) 03-01 19:15:36.261: E/AndroidRuntime(3467): at com.example.gcm.DemoActivity$1.doInBackground(DemoActivity.java:177) 03-01 19:15:36.261: E/AndroidRuntime(3467): at com.example.gcm.DemoActivity$1.doInBackground(DemoActivity.java:1) 03-01 19:15:36.261: E/AndroidRuntime(3467): at android.os.AsyncTask$2.call(AsyncTask.java:287) 03-01 19:15:36.261: E/AndroidRuntime(3467): at java.util.concurrent.FutureTask.run(FutureTask.java:234) 03-01 19:15:36.261: E/AndroidRuntime(3467): ... 4 more 这是我的清单: <?xml version="1.0" encoding="utf-8"?> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.example.manyexampleapp" android:installLocation="preferExternal" android:versionCode="1" android:versionName="1.0" > <uses-sdk android:minSdkVersion="11" android:targetSdkVersion="18" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" /> <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission.GET_ACCOUNTS" /> <uses-permission android:name="android.permission.WAKE_LOCK" /> <uses-permission android:name="com.example.manyexampleapp.c2dm.permission.RECEIVE" /> <uses-permission android:name="com.example.manyexampleapp.gcm.permission.C2D_MESSAGE" /> <permission android:name="com.example.manyexampleapp.gcm.permission.C2D_MESSAGE" android:protectionLevel="signature" /> <application android:name="com.zoomer.ifs.BaseApplication" android:allowBackup="true" android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/AppTheme" > <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" /> <activity android:name="com.zoomer.ifs.MainActivity" android:label="@string/app_name" android:configChanges="orientation|keyboardHidden|screenSize" android:launchMode="singleTop"> <!-- <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> --> </activity> <!-- PUSH --> <!-- WakefulBroadcastReceiver that will receive intents from GCM services and hand them to the custom IntentService. The com.google.android.c2dm.permission.SEND permission is necessary so only GCM services can send data messages for the app. --> <receiver android:name="com.example.gcm.GcmBroadcastReceiver" android:permission="com.google.android.c2dm.permission.SEND" > <intent-filter> <!-- Receives the actual messages. --> <action android:name="com.google.android.c2dm.intent.RECEIVE" /> <category android:name="com.example.manyexampleapp" /> </intent-filter> </receiver> <service android:name="com.example.gcm.GcmIntentService" /> <activity android:name="com.example.gcm.DemoActivity"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <!-- DB --> <activity android:name="com.example.db.DbActivity" android:label="@string/app_name" > <intent-filter> </intent-filter> </activity> <activity android:name="com.example.http.RestGetActivity" android:label="@string/app_name" android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen" > </activity> <activity android:name="com.example.fb.FacebookLoginActivity" android:label="@string/app_name" > <!-- <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> --> </activity> <activity android:name="com.example.http.SendFeedbackActivity" android:label="@string/app_name" > <!-- <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> --> </activity> <activity android:name="com.zoomer.general.SearchNearbyOffersActivity" android:label="@string/app_name" > <intent-filter> </intent-filter> </activity> <activity android:name="com.facebook.LoginActivity" android:label="@string/app_name" > <intent-filter> </intent-filter> </activity> <activity android:name="com.example.manyexampleapp.StoresListActivity" > <intent-filter> </intent-filter> </activity> <activity android:name="com.example.fb.ShareActivity" > <intent-filter> </intent-filter> </activity> <activity android:name="com.example.notifications.NotificationsActivity" > <intent-filter> </intent-filter> </activity> <activity android:name="com.example.fb2.no_use.MainActivity" > <intent-filter> </intent-filter> </activity> <activity android:name="com.zoomer.offers.OffersListActivity" > <!-- <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> --> </activity> <activity android:name="com.example.http.SearchNearbyOffersActivity" > <!-- <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> --> </activity> <service android:name="com.example.geo.LocationService" android:enabled="true" /> <receiver android:name="com.example.manyexampleapp.BootReceiver" > <intent-filter> <action android:name="android.intent.action.BOOT_COMPLETED" /> <action android:name="com.example.manyexampleapp.LocationService.LOCATION_BROAD_MSG" /> </intent-filter> </receiver> <meta-data android:name="com.facebook.sdk.ApplicationId" android:value="@string/app_id" /> </application> </manifest> 改变 <uses-permission android:name="com.example.manyexampleapp.c2dm.permission.RECEIVE" /> 到 <!-- This app has permission to register and receive data message. --> <uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" /> 您收到异常是因为您尚未定义所需的权限 如果应用程序开发后安装了播放服务, 可能会发生 com.google.android.c2dm.permission.RECEIVE 权限已被授予但 android 仍在抱怨同样的错误。 在这种情况下,您必须完全重新安装开发的应用程序才能使此权限发挥作用。 我认为你必须检查 Kotlin 版本兼容性。


© www.soinside.com 2019 - 2024. All rights reserved.