instruction
stringlengths
0
30k
I'm totally new to kotlin so I just installed IntelliJ on my pc for a course I'm taking. Since I'm not new to programming using the autocomplete is merely to save a little time. I assumed it'd be enabled by default but it isn't the case. After a little research I couldn't find any major answers whether the option was even there. Based on [this answer](https://stackoverflow.com/a/61070133/6057960) about the topic I figured the feature does exists. My question is, how do you enable the repl autocompletion feature? Am I missing something? Thanks in advance.
How to enable Kotlin REPL autocomplete
|kotlin|intellij-idea|autocomplete|read-eval-print-loop|
null
{"OriginalQuestionIds":[6219454],"Voters":[{"Id":14868997,"DisplayName":"Charlieface","BindingReason":{"GoldTagBadge":"c#"}}]}
|python|opencv|machine-learning|keras|
Rust has problems with generic reverse operator implementations (i.e. `impl<A, B> Op<A> for MyStruct<B>` is fine, `impl<A, B> Op<MyStruct<B>> for A` will not compile). Even if you manage to circumvent the overflow error (which is not possible in current Rust), you will still have problems with coherence, shown if you remove the first impl which causes the overflow: ```none error[E0210]: type parameter `A` must be covered by another type when it appears before the first local type (`Field<B>`) --> src/lib.rs:56:6 | 56 | impl<A, B, C> Mul<&Field<B>> for A | ^ type parameter `A` must be covered by another type when it appears before the first local type (`Field<B>`) | = note: implementing a foreign trait is only possible if at least one of the types for which it is implemented is local, and no uncovered type parameters appear before that first local type = note: in this case, 'before' refers to the following order: `impl<..> ForeignTrait<T1, ..., Tn> for T0`, where `T0` is the first and `Tn` is the last ``` What you want cannot be achieved in Rust. On the other hand, you can make the non-reverse impls more general, by accepting both references and owned values: ```rust impl<A, B> Mul<B> for Field<A> where A: Mul<B>, { type Output = <A as Mul<B>>::Output; fn mul(self, other: B) -> Self::Output { self.val * other } } impl<'a, A, B> Mul<B> for &'a Field<A> where &'a A: Mul<B>, { type Output = <&'a A as Mul<B>>::Output; fn mul(self, other: B) -> Self::Output { &self.val * other } } ```
I facing the above error where I testing the model of traffic sign detection. I am just Beginner to learning the model train. I watch the test in YouTube you are going well but the video was 4 year old may be that why I facing this error I have not idea what to do if any one can please answer me. thank you # PROCESS IMAGE img = np.asarray(imgOrignal) img = cv2.resize(img, (32, 32)) img = preprocessing(img) cv2.imshow("Processed Image", img) img = img.reshape(1, 32, 32, 1) cv2.putText(imgOrignal, "CLASS: " , (20, 35), font, 0.75, (0, 0, 255), 2, cv2.LINE_AA) cv2.putText(imgOrignal, "PROBABILITY: ", (20, 75), font, 0.75, (0, 0, 255), 2, cv2.LINE_AA) # PREDICT IMAGE predictions = model.predict(img) classIndex = model.predict_classes(img) probabilityValue =np.amax(predictions) cv2.putText(imgOrignal,str(classIndex)+" "+str(getCalssName(classIndex)), (120, 35), font, 0.75, (0, 0, 255), 2, cv2.LINE_AA) cv2.putText(imgOrignal, str(round(probabilityValue*100,2) )+"%", (180, 75), font, 0.75, (0, 0, 255), 2, cv2.LINE_AA) cv2.imshow("Result", imgOrignal) k=cv2.waitKey(1) if k== ord('q'): break cv2.destroyAllWindows() cap.release()
In rke kube-proxy pod is not present
|kubernetes|load-balancing|bare-metal|kube-proxy|rke|
null
I have some very simple benchmark that is run via Catch2, and compiled with -O3 using `emscripten 3.1.37`: ```cpp BENCHMARK("cpp sin only") { double sum = 1.0; for (int t = 0; t < 2000000; ++t) { sum += sin(double(t)); } return sum; }; #ifdef __EMSCRIPTEN__ BENCHMARK("js sin only") { EM_ASM_DOUBLE({ let sum = 1; for (let i = 0; i < 2000000; i++) { sum = sum + Math.sin(i); } return sum; }); }; #endif ``` I would expect, that there wouldn't be a large difference between JavaScript and WebAssembly, but there is: ``` chrome: benchmark name samples iterations est run time mean low mean high mean std dev low std dev high std dev ------------------------------------------------------------------------------- cpp sin only 100 1 7.93775 s 79.3856 ms 79.147 ms 79.7195 ms 1.43061 ms 1.10437 ms 1.97222 ms js sin only 100 1 2.21506 s 22.1354 ms 22.0064 ms 22.3 ms 742.138 us 614.746 us 901.128 us ``` Native, compiled with `GCC 12.3.0`, i get 24.2ms. * To my understanding, JavaScript uses double precision floats for all numbers. So the comparison should be fair. When using float in the C++ version, it gets to 12ms in chrome, but that is still slower (and less precise). FF sits at around 30ms. * <del>Maybe JavaScript uses a less precise, but faster implementation of sin and sqrt? Adding `-fast-math` doesn't increase performance for double. Float with fast-math in chrome becomes as fast as JavaScript, in FF it's still at around 30ms. </del> * Is it, that WebAssembly isn't given as much time in the optimiser? That could explain, why it's so much slower in FF. But shouldn't emscripten take care of most of the optimisation? * Could it be some sort of protection against meltdown/spectre? **Update** (I ran several additional benchmarks on a request in the comments): * g++12 is a bit faster than clang15, but that's within 10% * performance of sqrt is almost equal between the versions (before there was a sqrt and a sin in the example) * most of the time is spent in sin. * **increasing the iteration count to 2 millions makes JS about 4x faster. increasing it to 5 millions increases the lead to 10x. JS is still about the same speed as C++ native.** * note that the benchmark is execute 100 times by Catch2. The runtime of above code is around 1s. * I verified that it's not as simple as JS using float. The webassembly c++ computation matches the JS result exactly. * using 123456789042+1000000 increased the runtime by about 3-4x on gcc, clang native, webassembly c++ and js (the relative performance webassembly vs js stayed about the same). * reference, this is the code i used: https://pastebin.com/Mu2barB6 and here are the results for chrome: https://pastebin.com/Hbte7yRj **update 2:** After [a comment](https://stackoverflow.com/questions/77989813/why-is-sin-slower-in-webassembly-than-in-java-script/78128153?noredirect=1#comment137937888_78128153) by user21489919, I [reported the issue to emscripten](https://github.com/emscripten-core/emscripten/issues/21660).
You can achieve the desire animation using zoom in effect, we can learn it through the flutter doc, or refer below code. [https://api.flutter.dev/flutter/widgets/ScaleTransition-class.html][1] `class _ManageScale extends State<YourClass> with TickerProviderStateMixin{ late final AnimationController controller = AnimationController( duration: const Duration(seconds:2), vsync: this, )..repeat(reverse:true) ; late final Animation<double> _animation = CurvedAnimation( parent: _controller, curve:Curve.fastOutSlowIn, ); Widget build(BuildContext context) { return Scaffold( body: Center( child: ScaleTransition( scale: _animation, child: const Padding( padding: EdgeInsets.all(8.0), child: <Place_Your_Heart_Shape>(size: 150.0), ), ), ), ); } ` class _ManageScale extends State<YourClass> with TickerProviderStateMixin{ late final AnimationController controller = AnimationController( duration: const Duration(seconds:2), vsync: this, )..repeat(reverse:true) ;//putting repeat reverse true is make your container big and small in same order late final Animation<double> _animation = CurvedAnimation( parent: _controller, curve:Curve.fastOutSlowIn, ); //for proper implementation of above stateful widget see doc now use above animation as a property in your widget which is _animation Widget build(BuildContext context) { return Scaffold( body: Center( child: ScaleTransition( scale: _animation, child: const Padding( padding: EdgeInsets.all(8.0), child: <Place_Your_Heart_Shape>(size: 150.0), ), ), ), ); } `
but if my users are trusted and my session tokens are complex, they won't be able to do anything, right? like no one would be able to steal my users tokens?
null
Most commonly, you use `CStrBuf` when you have to pass a string buffer to a C API that is filled by the called function. Here is an example that calls `GetModuleFileName()` from C++ (off the top of my head). ``` // assume we got a valid HMODULE somewhere HMODULE module = ...; // somehow decide on a buffer size; for simplicity, use a constant here DWORD size = MAX_PATH; CString filename; GetModuleFileName(module, CStrBuf(filename, size), size); // the result is now in filename // (note: error checks omitted for brevity) ``` `CStrBuf` has an `operator LPTSTR`, i.e., it can be converted to a writable string implicitly. For this reason, it can be written as a temporary object in place of an `LPTSTR` argument (the second argument in this example). Note that `CStrBufT` is a class template just like `CStringT` is. Stick with the specialization `CStrBuf` that is akin to `CString`.
I had a requirement to blur an image The 'Modifier.blur' is supported on Android 12 and above. I encountered problems (crashes) with some of the libraries mentioned earlier. After searching for various solutions, I ended up using this one, which works. if you are looking to blur an image use this implementation("com.github.skydoves:landscapist-transformation:2.1.6") implementation("com.github.skydoves:landscapist-glide:2.3.2") add these dependecies use it like this GlideImage( modifier= Modifier .padding(2.dp) .width(64.dp) .height(64.dp) .clip(RoundedCornerShape(8.dp)), imageModel = { imageUrl }, component = rememberImageComponent { +BlurTransformationPlugin(radius = 10) // between 0 to Int.MAX_VALUE. } ) This configuration applies a blur transformation with a radius of 10 to your image. Adjust the radius as needed within the valid range from 0 to Int.MAX_VALUE
|webassembly|emscripten|
Your code have multiple issues, most of them syntactic ones. Let me try to rewrite it in a more _syntactically correct_ way. Then, you'll need to fix whatever semantics you want to give to it on your own: ```erlang -module(divide). -export([divide_the_cache/4]). divide_the_cache(Cache, Divided, ThreadIndex, Acc) when length(Cache) =< Acc -> L = lists:merge( [lists:nth(ThreadIndex, dict:to_list(Divided))], [lists:nth(Acc, Cache)] ), Conquered = dict:append(ThreadIndex, L, Divided), NewThreadIndex = case length(L) of 24 -> ThreadIndex + 1; _ -> ThreadIndex end, divide_the_cache(Cache, Conquered, NewThreadIndex, Acc+1). ``` What I changed: 1. `-define` in Erlang is for macros and you were not using the `?divided` macro anywhere. 1. Variables in Erlang start in uppercase. 1. `case length(Cache) =< Acc of ThreadIndex ->` made no sense to me, so I replaced it with a guard (`when length(Cache) =< Acc`). 1. `Divided` should be either a dict or a list but it's treated as a list first and a dict later… so I decided that it's always a dict and thus, for `lists:nth/2`, I used `dict:to_list/1`. 1. In Erlang, expressions end in `,` (not `;`) and functions end in `.`. 1. You shouldn't write else-less if's in Erlang, so I turned your `if` into a `case` statement. 1. Variables in Erlang can't be re-bound, that's why I introduced `NewThreadIndex`.
I’m making an in app purchase for my game on Steam. On my server I use python 3. I’m trying to make an https request as follows: conn = http.client.HTTPSConnection("partner.steam-api.com") orderid = uuid.uuid4().int & (1<<64)-1 print("orderid = ", orderid) key = "xxxxxxxxxxxxxxxxxxx" # omitted for security reason steamid = "xxxxxxxxxxxxxxxxxxx" # omitted for security reason pid = "testItem1" appid = "480" itemcount = 1 currency = 'CNY' amount = 350 description = 'testing_description' urlSandbox = "/ISteamMicroTxnSandbox/" s = f'{urlSandbox}InitTxn/v3/?key={key}&orderid={orderid}&appid={appid}&steamid={steamid}&itemcount={itemcount}&currency={currency}&itemid[0]={pid}&qty[0]={1}&amount[0]={amount}&description[0]={description}' print("s = ", s) conn.request('POST', s) r = conn.getresponse() print("InitTxn result = ", r.read()) I checked the s in console, which is: `s = /ISteamMicroTxnSandbox/InitTxn/v3/?key=xxxxxxx&orderid=11506775749761176415&appid=480&steamid=xxxxxxxxxxxx&itemcount=1&currency=CNY&itemid[0]=cgdiamond5&qty[0]=1&amount[0]=350&description[0]=testing_description` However I got a bad request response: `InitTxn result = b"<html><head><title>Bad Request</title></head><body><h1>Bad Request</h1>Required parameter 'orderid' is missing</body></html>"` How to solve this? Thank you! BTW I use almost the same way to call GetUserInfo, except changing parameters and replace POST with GET request, and it works well.
How to call Steam InitTxn properly using python?
|python|steam|steamworks-api|
I'm trying to learn to use gui in java using eclipse ide. When I run this code ``` import javax.swing.JOptionPane; public class GUI { public static void main(String[] args) { String name = JOptionPane.showInputDialog("Enter your name"); JOptionPane.showMessageDialog(null, "Hello "+name); } } ``` all it shows is terminated GUI [Java Application] How can I fix this issue? [enter image description here][1] [1]: https://i.stack.imgur.com/Jbe54.png
nginx set up reverse proxy from subfolder to a port
{"Voters":[{"Id":1145388,"DisplayName":"Stephen Ostermiller"}],"SiteSpecificCloseReasonIds":[18]}
{"OriginalQuestionIds":[56778186],"Voters":[{"Id":2370483,"DisplayName":"Machavity"}]}
I have an application permission like `TeamsAppInstallation.ReadWriteSelfForUser.All`. I also have some delegated permissions. <br> <br> I want an admin to allow a small set of permissions including the `TeamsAppInstallation.ReadWriteSelfForUser.All` and few delegated permissions during the initial installation phase of an app. <br> Later on, the admin can increment and allow all the permissions.<br><br> Using the `/common/oauth2/v2.0/authorize?` endpoint by adding a `scope` param isn't supported for application permissions. Using the `/common/adminconsent?` is not incremental, as it asks the admin to authorise all application and all delegated permissions. How can incremental consent be achieved for the admin by allowing app permissions + some delegated permissions? Is there a different/better approach for this? Referance: https://stackoverflow.com/questions/65908864/why-does-my-request-to-consent-admin-permissions-ask-all-permissions
Implementing Incremental consent when using both application and delegated permissions
|azure|oauth-2.0|microsoft-graph-teams|azure-app-registration|microsoft-oauth|
MOST SIMPLE WAY OF GETTING EMPLOYEES WORKING IN AN ORGANISATION BEFORE 1 YEAR, WE CAN ASSUME TO GIVE THEM APPRAISAL & SLECTING ONLY THOSE WHO HAVE FINISHED 1 YEAR IN AN ORGANISATION. BASICALLY FROM TODAY'S DATE I AM SUBSTRACTING 1 YEAR. ``` SELECT * FROM employees WHERE date_of_joining < (SELECT DATE_SUB(CURDATE(),INTERVAL 1 YEAR)) ; ```
{"Voters":[{"Id":-1,"DisplayName":"Community"}]}
I'm trying to make an increment counter application in Jetpack Compose. I've divided each widget across separate files. I have the text widget that displays the number on one file, the button that increases the number on another file. and I'm putting them both together on the main file. There is a problem when importing the widgets over to the main file. The function to increase the number is located in the file that the number text widget is located in, not the main file, so the function is not recognized. Here is the file containing the number text widget and the function to increase the number. @Composable fun Number(){ var number by remember { mutableIntStateOf(0) } fun increaseNumber(){ number++ } Text( text = number.toString(), style = TextStyle( color = Color.DarkGray, fontSize = 30.sp, ) ) } Here is the file containing the button to increase the number. @Composable fun AddButton(onClick: () -> Unit) { IconButton(onClick = onClick) { Icon( imageVector = Icons.Filled.Add, contentDescription = "Add Button", modifier = Modifier.size(width = 30.dp, height = 30.dp) ) } } Here is the main file class MainActivity : ComponentActivity() { override fun onCreate(savedInstanceState: Bundle?) { super.onCreate(savedInstanceState) setContent { MyApp() } } } @Composable fun MyApp() { MaterialTheme { Surface(color = Color.White, modifier = Modifier.fillMaxSize()) { MainPage() } } } @Composable fun MainPage() { Row ( horizontalArrangement = Arrangement.Center, verticalAlignment = Alignment.CenterVertically ) { AddButton(onClick = {increaseNumber()}) Number() } } I have the increaseNumber() function in the onClicked parameter for the AddButton Composable but it won't recognize it because it's in a different file. How do I import the increaseNumber() function from the number file on to the main file. Thanks for any help.
I am creating a memoization example with a function that adds up / averages the elements of an array and compares it with the cached ones to retrieve them in case they are already stored. In addition, I want to store only if the result of the function differs considerably (passes a threshold e.g. 5000 below). I created an example using a decorator to do so, the results using the decorator is slightly slower than without the memoization which is not OK, also is the logic of the decorator correct ? My code is attached below: import time import random from collections import OrderedDict def memoize(f): cache = {} def g(*args): if args[1] == 'avg': sum_key_arr = sum(args[0])/ len(list(args[0])) elif args[1] == 'sum': sum_key_arr = sum(args[0]) print(sum_key_arr) if sum_key_arr not in cache: for key, value in OrderedDict(sorted(cache.items())).items():# key in dict cannot be an array so I use the sum of the array as the key if abs(sum_key_arr - key) <= 5000:#threshold is great here so that all values are approximated! #print('approximated') return cache[key] else: #print('not approximated') cache[sum_key_arr] = f(args[0],args[1]) return cache[sum_key_arr] return g @memoize def aggregate(dict_list_arr,operation): if operation == 'avg': return sum(dict_list_arr) / len(list(dict_list_arr)) if operation == 'sum': return sum(dict_list_arr) return None t = time.time() for i in range(200,150000): res = aggregate(list(range(i)),'avg') elapsed = time.time() - t print(res) print(elapsed) UPDATE: in this update I change the input to become a dict while I search for keys of them in the caching strategy : import time import random from collections import OrderedDict def memoize(f): cache = {} def g(*args): key_arr = list(args[0].keys())[0] arr_val = list(args[0].values())[0] if key_arr not in cache: for key, value in OrderedDict(sorted(cache.items())).items():# key in dict cannot be an array so I use the sum of the array as the key if abs(value - arr_val) <= 5000:#threshold is great here so that all values are approximated! return cache[key] cache[key_arr] = f(args[0],args[1]) return cache[key_arr] return g #@memoize def aggregate(dict_list_arr,operation): if operation == 'avg': return sum(list(dict_list_arr.values())[0]) / len(list(dict_list_arr.values())[0]) if operation == 'sum': return sum(list(dict_list_arr.values())[0]) return None t = time.time() for i in range(200,5500): res = aggregate({'1':list(range(10000))},'avg') elapsed = time.time() - t print(res) print(elapsed) The time elapsed is lower in decorated call which makes sense, now does this solve my question?
{"Voters":[{"Id":12002570,"DisplayName":"user12002570"},{"Id":7582247,"DisplayName":"Ted Lyngmo"},{"Id":11082165,"DisplayName":"Brian61354270"}]}
```lang-x86asm INCLUDE Irvine32.inc INCLUDELIB Irvine32.lib INCLUDELIB kernel32.lib INCLUDELIB user32.lib .data A SBYTE 10d ; A is an 8-bit signed integer B SBYTE 2d ; B is an 8-bit signed integer cc SBYTE 20d ; C is an 8-bit signed integer D SBYTE 5d ; D is an 8-bit signed integer .code main PROC mov EAX, 0 mov EDX, 0 mov al, A ; Load A into AL register imul B movsx bx, cc imul bx movsx bx, D imul bx call DumpRegs ; exit main ENDP END main ``` I have this code and I want to modify it to print output for this (A % B) % (C % D) but when i use idiv the code doesn't give any outputs Can someone please help me out solve this
nginx redirect from subfolder to a port
|http|nginx|webserver|nginx-reverse-proxy|proxypass|
{"Voters":[{"Id":10952503,"DisplayName":"Elikill58"},{"Id":16217248,"DisplayName":"CPlus"},{"Id":1974224,"DisplayName":"Cristik"}]}
{"Voters":[{"Id":476,"DisplayName":"deceze"}],"SiteSpecificCloseReasonIds":[13]}
{"OriginalQuestionIds":[12050590],"Voters":[{"Id":285587,"DisplayName":"Your Common Sense","BindingReason":{"GoldTagBadge":"php"}}]}
{"Voters":[{"Id":238704,"DisplayName":"President James K. Polk"},{"Id":16217248,"DisplayName":"CPlus"},{"Id":1974224,"DisplayName":"Cristik"}],"SiteSpecificCloseReasonIds":[16]}
I know how to get elements with a particular *attribute*: $("#para [attr_all]") But how can I get the elements WITHOUT a particular attribute? I tried: $("#para :not([attr_all])") but it didn't work. What is the correct way to do this? --- Let me give an example: HTML: <!-- language: lang-html --> <div id="para"> <input name="fname" optional="1"> <input name="lname"> <input name="email"> </div> jQuery: <!-- language: lang-js --> $("#para [optional]") // give me the fname element $("#para :not([optional])") // give me the fname, lname, email (fname should not appear here)
How can I get the elements without a particular attribute using jQuery?
Full source code: https://github.com/remoteworkerid/backendgolang/blob/feature/RWIDPF-13/server.go You can see that the HomeHandler is working just fine for DEV_MODE, but not if its' for production I precompile template using this code: ``` func precompileTemplate() { // Menggunakan template.ParseGlob untuk memuat semua file template templates = template.Must(template.ParseGlob("static/*.html")) } ``` In my base.html: ``` <div id="content" class="p-5"> {{template "content" .}} </div> ``` And in my signup.html ``` {{ define "content" }} <h1>Signtup to RWID</h1> {{ end }} ``` In my go route: ``` err = templates.ExecuteTemplate(w, "signup.html", data) if err != nil { http.Error(w, err.Error(), http.StatusInternalServerError) } ``` But opening /signup gives me a blank page. What's wrong?
Please consider the following case that would result in memory getting written after being deallocated. The reason being that in `class PoorlyOrderedMembers` the member `m_pData` is declared after the member `m_nc` which means that the `std::unique_ptr` d'tor will be called and the instance of `ClassWithData` will be deleted just before the d'tor of `class NaughtyClass` will write to it. While _writing_ it, you could probably get hints for a problem if you try to put both member initializations in the initializer list and get an error or a warning. Alternatively, you could change `NaughtyClass` and `PoorlyOrderedMembers` to use `std::shared_ptr` but, these are only obvious after you know that there's a problem here. What would be the tell that something is wrong here when reviewing the code after the mistake was already made? ```c++ #include <cstring> #include <memory> class ClassWithData { char m_carray[32]{}; public: char* data() { return m_carray; } static constexpr size_t capacity() { return sizeof(m_carray); } }; class NaughtyClass { ClassWithData* m_p = nullptr; public: ~NaughtyClass() { char const m[] = "d'tor called"; memcpy(m_p->data(), m, sizeof m); static_assert(sizeof(m) <= ClassWithData::capacity(), "the string doesn't fit in the capacity"); } void set(ClassWithData* p) { m_p = p; } }; class PoorlyOrderedMembers { NaughtyClass m_nc; std::unique_ptr<ClassWithData> m_pData; public: PoorlyOrderedMembers() : m_pData(std::make_unique<ClassWithData>()) { m_nc.set(m_pData.get()); } }; int main() { PoorlyOrderedMembers poom; return 0; } ``` ### PS ### is anyone else mildly annoyed that `char const m[] = "literal";` can't be written as `auto m = "literal";`
I think its problem is your post add to the firebase Quary. Cheak your Quary again provides its your question.
$ npm install npm ERR! code 1 npm ERR! path /home/deeps/Documents/code/train/NODE-api/node_modules/puppeteer npm ERR! command failed npm ERR! command sh -c node install.mjs npm ERR! A complete log of this run can be found in: /home/deeps/.npm/_logs/2024-03-30T06_48_33_241Z-debug-0.log I cleared all caches and even forcefully reinstalled npm, but I am still experiencing the same issue with npm install.
Having a problem to install npm in project which i cloned from git. Even I having package.json file in my folder. Having same issue again and again
|node.js|git|npm|
null
I'm currently experimenting with the OpenCV library in C++. I've set up MinGW, CMake, and I'm coding in VSCode. However, I'm facing an inconvenience where I need to manually copy all the necessary DLL files into the project directory every time I want to run the executable program (.exe). Is there a configuration or setup that can help me avoid this constant copy-pasting of DLLs? In CMakeLists.txt, I've already set: set(OpenCV_DIR Path_to_opencv_lib) find_package( OpenCV REQUIRED ) I'm unclear about why we need to copy DLLs into the current project directory in the first place. Any assistance with these issues would be greatly appreciated.
Configure CmakeLists.txt to avoid copying dlls
|c++|opencv|visual-studio-code|cmake|
In C #12 in a nutshell, there was this claim. "Parallel.Invoke still works efficiently if you pass in an array of a million delegates. This is because it partitions large numbers of elements into batches that it assigns to a handful of underlying Tasks rather than creating a separate Task for each delegate." Is there any evidence from Microsoft learn documentation or is it a claim from author after verifying it?
Does Parallel.Invoke in .NET work efficiently for millions of delegates?
I've just installed Wordpress 6.4.3 & MAMP and managed to edit functions.php and saved my changes. When I tried to make more changes to the file, Wordpress started displaying the following error message: > Something went wrong. Your change may not have been saved. Please try again. There is also a chance that you may need to manually fix and upload the file over FTP. This is what I've added to functions.php if ($_SERVER["REQUEST_METHOD"] === "POST") { $name = sanitize_text_field($_POST["name"]); $email = sanitize_email($_POST["email"]); $message = sanitize_textarea_field($_POST["description"]); // Add code to save the form data to the database global $wpdb; $table_name = $wpdb->prefix . 'request_form'; $data = array( 'name' => $name, 'email' => $email, 'description' => $message, 'submission_time' => current_time('mysql') ); $insert_result = $wpdb->insert($table_name, $data); if ($insert_result === false) { $response = array( 'success' => false, 'message' => 'Error saving the form data.', ); } else { $response = array( 'success' => true, 'message' => 'Form data saved successfully.' ); } // Return the JSON response header('Content-Type: application/json'); echo json_encode($response); exit; } What I have done: - I've checked permissions of the file and gave read and write access to everyone on my localhost. - Restarted the server
I'm trying to learn to use gui in java using eclipse ide. When I run this code ``` import javax.swing.JOptionPane; public class GUI { public static void main(String[] args) { String name = JOptionPane.showInputDialog("Enter your name"); JOptionPane.showMessageDialog(null, "Hello "+name); } } ``` all it shows is terminated GUI [Java Application] How can I fix this issue? [screenshot][1] [1]: https://i.stack.imgur.com/Jbe54.png
You can use firebase storage to store the pdf file and retrieve it store : fun uploadPdf() { val storageReference = FirebaseStorage.getInstance().getReference("pdfs/myfile.pdf") val file = Uri.fromFile(File("path/to/your/file.pdf")) storageReference.putFile(file) .addOnSuccessListener { } .addOnFailureListener { } } retrieve: fun getPdfUrl(onResult: (String) -> Unit) { val storageReference = FirebaseStorage.getInstance().getReference("pdfs/myfile.pdf") storageReference.downloadUrl .addOnSuccessListener { uri -> onResult(uri.toString()) } .addOnFailureListener { } }
Why is getValue preferred over !! when retrieving from a Map (NoSuchElementException vs NullPointerException)?
{"Voters":[{"Id":2530121,"DisplayName":"L Tyrone"},{"Id":17303805,"DisplayName":"zephryl"},{"Id":13434871,"DisplayName":"Limey"}],"SiteSpecificCloseReasonIds":[11]}
You can make static method in that static class to get setting like below private static ApplicationSettings GetSiteSettings(IServiceCollection services) { var provider = services.BuildServiceProvider(); var siteSettingsOptions = provider.GetRequiredService<IOptionsSnapshot<ApplicationSettings>>(); var siteSettings = siteSettingsOptions.Value; if (siteSettings == null) throw new ArgumentNullException(nameof(siteSettings)); return siteSettings; } then call this method in that static class
{"OriginalQuestionIds":[192249],"Voters":[{"Id":1765658,"DisplayName":"F. Hauri - Give Up GitHub","BindingReason":{"GoldTagBadge":"bash"}}]}
I’ve created a image from my partition with the e2image tool like this: e2image -rap /dev/sdb2 /backup/sdb2.e2image The Partitions size is around 870GB, but it used only around 25GB. When I do a `ls -laht` to check it size, I get this: -rw------- 1 root root 868G 31. Mär 10:36 sdb2.e2image Then I check the size with `du` 25G /backup/sdb2.e2image now I created a lvm: LV VG Attr LSize Pool Origin Data% Meta% Move Log Cpy%Sync Convert arch_root vg_arch -wi-a----- 30.00g Now i want to restore my old partition backup, to this lv, so I do: e2image -rap /backup/sdb2.e2image /dev/mapper/vg_arch_root But i always get an error during the restoring process: e2image no space left What i'm doing wrong?
|android|gradle|dependency-management|android-media3|
I wait until the page is loaded and use the "DOMContentLoaded" method to add eventhandlers on some p tags. This works until I open and close the modal, then the page/js freezes. Why does it freeze? ``` <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Document</title> </head> <body> <div id="div_1"> <p>One</p> <p>Two</p> <p>Three</p> </div> <p id="open_modal">open the modal</p> <script> document.addEventListener("DOMContentLoaded", () => { let test = document.querySelector("#div_1") for (let i = 0; i < test.children.length; i++) { test.children[i].addEventListener("click", () => { console.log(test.children[i].innerHTML) }); }; }); document.querySelector("#open_modal").addEventListener("click", () => { if (!document.querySelector("#modal")) { document.body.innerHTML += ` <div id="modal" style="display: block; position: fixed; z-index: 1; padding-top: 100px; left: 0; top: 0; width: 100%; height: 100%; overflow: auto; background-color: rgb(0,0,0); background-color: rgba(0,0,0,0.4)"> <div id="modal_content"> <span id="modal_close">&times;</span> <p style="color: green;">Some text in the Modal..</p> </div> </div> `; document.querySelector("#modal_close").addEventListener("click", () => { document.querySelector("#modal").style.display = "none"; }); } else { document.querySelector("#modal").style.display = "block"; }; }); </script> </body> </html> ```
It was solved having page.ts with the following const userQuery = gql` query { hello } `;
I'm hacking the Linux kernel v5.15 and try to debug it with `gdb` line by line. However, it seems that some line will be skipped. I find that the default compile optimization is -O2. So I changed the Makefile like: ```lang-make ifdef CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE KBUILD_CFLAGS += -O2 # here change to -O0 else ifdef CONFIG_CC_OPTIMIZE_FOR_PERFORMANCE_O3 KBUILD_CFLAGS += -O3 else ifdef CONFIG_CC_OPTIMIZE_FOR_SIZE KBUILD_CFLAGS += -Os endif ``` Then I compile again: ```lang-sh make ARCH=riscv CROSS_COMPILE=riscv64-linux-gnu- -j$(nproc) ``` But it gives: ```lang-sh CALL scripts/checksyscalls.sh CALL scripts/atomic/check-atomics.sh CC init/main.o In file included from ././include/linux/compiler_types.h:85, from <command-line>: ./arch/riscv/include/asm/jump_label.h: In function ‘want_init_on_alloc’: ./include/linux/compiler-gcc.h:88:38: warning: ‘asm’ operand 0 probably does not match constraints 88 | #define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0) | ^~~ ./arch/riscv/include/asm/jump_label.h:20:9: note: in expansion of macro ‘asm_volatile_goto’ 20 | asm_volatile_goto( | ^~~~~~~~~~~~~~~~~ ./include/linux/compiler-gcc.h:88:38: error: impossible constraint in ‘asm’ 88 | #define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0) | ^~~ ./arch/riscv/include/asm/jump_label.h:20:9: note: in expansion of macro ‘asm_volatile_goto’ 20 | asm_volatile_goto( | ^~~~~~~~~~~~~~~~~ ./arch/riscv/include/asm/jump_label.h: In function ‘want_init_on_free’: ./include/linux/compiler-gcc.h:88:38: warning: ‘asm’ operand 0 probably does not match constraints 88 | #define asm_volatile_goto(x...) do { asm goto(x); asm (""); } while (0) | ^~~ ./arch/riscv/include/asm/jump_label.h:20:9: note: in expansion of macro ‘asm_volatile_goto’ 20 | asm_volatile_goto( | ^~~~~~~~~~~~~~~~~ make[1]: *** [scripts/Makefile.build:277: init/main.o] Error 1 make: *** [Makefile:1868: init] Error 2 ``` If the optimization parameters really cannot be changed, is there a way to debug the kernel with finer granularity?
How do you import functions from one page to another in Jetpack Compose?
|function|kotlin|import|android-jetpack-compose|
Given a <!-- begin snippet: js hide: false console: false babel: false --> <!-- language: lang-html --> <div lang="en" style=" overflow-wrap: word-break; hyphens: auto; width: 86px; background-color: highlight; color: highlightText; font-size: 10px; "> This is a text that is long enough to cause a line break if set so. By using words like "incomprehensibilities", we can demonstrate word breaks. </div> <!-- end snippet --> I would like to access the formatted text with hyphenations with JavaScript to get a string similar to: `"This is a text that is long enough to cause a line break if set so. By using words like "incomprehensibilit-ies", we can demon-strate word breaks."`. N.B. hyphens in `incomprehensibilit-ies" and `demon-strate`. Is this possible? The use case is that I need a way to break and hyphenate text in a `<text>` element of an SVG by only using SVG elements.
To resolve issues related to Python environments being externally managed, because of homebrew installed python version, execute below commmand. rm /opt/homebrew/Cellar/python\@3*/**/EXTERNALLY-MANAGED
|database|entity-relationship|database-normalization|3nf|first-normal-form|
Since you're initializing the state using `useState` with the prop `CurrentSelectedItem`, any changes to `CurrentSelectedItem` won't be reflected in the state of the component. You can use the `useEffect` hook to update the state of `SelectedItem` whenever `CurrentSelectedItem` changes: ```javascript function SelectedItem({ CurrentSelectedItem }) { const [item, setItem] = useState(CurrentSelectedItem); useEffect(() => { setItem(CurrentSelectedItem); }, [CurrentSelectedItem]); ... } ``` Or if `SelectedItem` is solely dependent on `CurrentSelectedItem`, you can remove the local state in `SelectedItem` and directly use `CurrentSelectedItem` as a prop, like ```javascript function SelectedItem({ CurrentSelectedItem }) { return ( <div className="selected-item"> {/* <img src={CurrentSelectedItem.image} className="selected-image" /> */} {CurrentSelectedItem.name} {/* <QuantityBar itemCount={0} /> */} </div> ); } ```
I am new to sendmail, installed the s-nail package on RHEL 8 VM hosted on AWS. I configured the sendmail.mc file but still unable to get mail. Command used, echo "First mail" | mail -v -s "Important mail" jadeallice302@gmail.com It shows an error like below, it looks like mail is accepted for delivery but connection got timed out. Has anyone faced same issue before ? It would be helpful for me to fix. Mar 31 10:35:47 ip-172-31-8-189 sendmail[15076]: 42VAZlCI015076: to=jadeallice302@gmail.com, ctladdr=ec2-user (1000/1000), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=30130, relay=[127.0.0.1] [127.0.0.1], dsn=2.0.0, stat=Sent (42VAZlxs015077 Message accepted for delivery) Mar 31 10:36:47 ip-172-31-8-189 sendmail[15079]: 42VAZlxs015077: to=<jadeallice302@gmail.com>, ctladdr=<ec2-user@ip-172-31-8-189.ap-south-1.compute.internal> (1000/1000), delay=00:01:00, xdelay=00:01:00, mailer=relay, pri=120469, relay=smtp.gmail.com. [142.250.4.108], dsn=4.0.0, stat=Deferred: Connection timed out with smtp.gmail.com. Thanks, Piyush
Binary Bomb Phase 2 - Decoding Assembly
|assembly|
null
If you have access to the users google drive account you can do an [about.get][1] It returns an about object which contains a user object which ... { "displayName": string, "kind": string, "me": boolean, "permissionId": string, "emailAddress": string, "photoLink": string } Gives you the users email address. [1]: https://developers.google.com/drive/api/reference/rest/v3/about/get
|go|orm|go-gorm|go-fiber|
|google-api|google-drive-api|
In all four cases you presented, Oracle would do a normal index seek (binary tree search) on the leading column `eid` because an equality predicate was provided for this column in each of your cases. But what else it does with the index depends on what other columns you're filtering on: 1. **First column** (`eid`) only: after finding the first `eid=10` entry in the leaf blocks using a binary search/seek, Oracle will scan that and any subsequent leaf blocks it needs to, moving through each block (single block reads) using a linked list, until it finds the first `eid` value that is not 10. As it does so it gathers `ROWID`s containing the table segment physical row address which it issues single block reads by `ROWID` to obtain the rest of the row. 2. **First two columns** (`eid` and `ename`): because `ename` is the second column in the index, Oracle will use both `eid` and `ename` together at the same time as it performs the binary search (seek) to find the first leaf block entry where `eid=10` and `ename='raj'`. It will then procede as above scanning leaf blocks until it finds the first row for which either of these columns have different values. 3. **First and third column** (`eid` and `esal`): because `esal` is the *third* column and you're skipping the second column, Oracle cannot use a single binary search/seek operation on `esal`. It has two choices: 3a. It does a binary search/seek only on the leading column, `eid`, but once it finds the first `eid=10` value in the leaf blocks it will do a normal scan of leaf blocks following that linked list - looking through *all* `eid=10` rows, but grabbing `ROWID`s only for those with `esal=1000`. 3b. Or, it does a skip scan: for every distinct value of the *missing intermediate column(s)* (`ename`), it will do a separate binary search/seek on the combined `eid=10 / esal=1000` value. This is a seek not a scan, but it is potentially many seeks. If there are many `ename` values this results in a lot of unnecessary single block I/O and can perform poorly. But if there are only a few values, it works pretty well. 4. **All columns**: Your last example would do a single binary search/seek on all three columns. Nothing special here. You didn't offer this as an example, but to complete the study: 5. **Third column only**: If you queried on `esal=1000` only, Oracle could do one of the following: 5a. Forget the index and scan the table itself (most likely) 5b. Do a full scan (scattered read) of 100% of the leaf blocks of the index 5c. Do a skip-scan, which means a binary search/seek for `esal=1000` for every single distinct combination of the preceding,unfiltered columns (`eid` and `ename`). That would be a lot of seeks, so is rather unlikely the optimizer would choose it. Whenever Oracle has a choice, it all depends on statistics and expected cardinalities from each operation which is largely driven by the min/max and # distinct values known for each column combined with overall table row counts. Of course you can force it with hints to if you think you know better than the statistics, but it is recommended to hold off on hinting until one has a solid grasp of how Oracle queries work internally, as you can easily tell it to do the wrong thing.
How can i add a theme toggle function to my html/css website so it changes the theme to dark and light/white in a button? I understand there's a bit of .js involved... I got a code from [CSS-Tricks](https://css-tricks.com/a-complete-guide-to-dark-mode-on-the-web/#toggling-themes) and just coppied it, of course. But, I fail to make some of the text font colors change along with the rest of the fonts in the html. Can anyone assist because I even tried calling out the text classes themselves in the css query but it doesn't work.
Toggling dark/light theme in html
|javascript|html|css|themes|
null
SO first and foremost, im a beggineer and new to stackOverflow, so im sorry if there are any inconsistency in the question this is my source code, idk why im getting the error i tried doing the code from the first, still it didnt work ```import pickle def writeFile(): with open('main.dat', mode='rb+') as fh: stu = {} n = int(input('How many records you wanna enter(press 0 if no records to be added):')) for i in range(n): name = input('Enter the name of the student:') roll = int(input('Enter the roll no of the student:')) age = int(input('Enter the age of the student:')) marks = int(input('Enter the marks of the student:')) # updating record stu['name'] = name stu['age'] = age stu['roll'] = roll stu['marks'] = marks # dumping in the file updateRec = pickle.dump(stu, fh) try: view = True while view: data = pickle.load(fh) print(data) except Exception as err: print(err) writeFile() ```
What is 'Invalid Load Key, '\x00'
|python|dictionary|file|pickle|binaryfiles|
null
It clearly says on the doc. If you need to use latest generators then you must update the project to `ionic-angular >= 3.0.0`. Latest generators have tight coupling with the `ionic-angular` `module`. **Note:** If you don't like to update latest then just create your components manually. No restrictions for that :) > Generate pipes, components, pages, directives, providers, and tabs > (ionic-angular >= 3.0.0) You can read more about [it on the doc][1]. Update --- If you need to update then you have to [do this changes][2] on your `package.json` file. See also [this video upgrade guide][3]. This is for Ionic 3, but the concept is the same. [Release notes][4] are here. [1]: http://ionicframework.com/docs/cli/generate/ [2]: https://github.com/ionic-team/ionic-conference-app/blob/master/package.json [3]: https://www.youtube.com/watch?v=oQJMUOznMrA [4]: https://github.com/ionic-team/ionic/releases
For me I solved it by reinstall ORDS using the command c:\apex\ords\bin> ORDS install and select choice 2 create or update database pool then choice 1 basic host name and continue the defaults choices after that ORDS started with no errors
{"Voters":[{"Id":20287183,"DisplayName":"HangarRash"},{"Id":3418066,"DisplayName":"Paulw11"},{"Id":1974224,"DisplayName":"Cristik"}],"SiteSpecificCloseReasonIds":[13]}
Do NOT use Selection. It is horribly inefficient. Instead, you could use something as simple as: With WordRange .Collapse 0 'wdCollapseEnd .Text = "Severity: " & Sheets("CleanSheet").Cells(2, 2).Value & vbCr .Words.First.Font.Bold = True End With
Currently, I am working on a project with Vite + React and now I want to dockerize it. Actually, I am beginner to docker. So, I need guidance on how to build the docker image and run it. I tried once and it worked, but not as I supposed. Can anyone help me with following, - How to dockerize the react app with Vite? - How to run the webapp on local host when developing? - Hot Module Reload tool in Vite didn't work for me, how to fix it? I used following commands in cmd: `docker build .` and `docker run -p 5173:5173 0ac94edb8feb` And here is my dockerfile: ``` FROM node:18-alpine WORKDIR /app COPY package.json . RUN npm install COPY . . EXPOSE 5173 CMD ["npm", "run", "dev"] ``` Give me instructions to fix above issue.
Run Vite + React in docker with Hot Module Reload
|docker|vite|hot-module-replacement|
null
Basically, I am trying to remove special character from xml file. I have tried the below code. I have tested with regex tester. It's working fine. In the production machine, it is replacing string.Empty for = character which is valid. `using System;` `using System.Text.RegularExpressions;` `class Program` `{` `static void Main(string[] args)` `{` `string xmlString = "<root><name>John & = Doe</name></root>";` // Replace special characters with their XML entities string cleanedXml = Regex.Replace(xmlString, @"[^\u09\u0A\u0D\u20-\uD7FF\uE000-\uFFFD\u10000-\u10FFFF]", string.Empty); Console.WriteLine(cleanedXml); } `}` Culture : en-US in the prod machine. Please anyone help me on this why it's happening. What's problem in the regex expression? Why regex is replacing equal symbol on prod machine alone? I am using. Net framework 4.8 version. \`
Regex is working in local machine. But in the production machine, it is not working