instruction
stringlengths
0
30k
I have a problem with Excel customized ribbon. The file I'm using has a customized ribbon and I need to edit/remove it but I can't find it in the ''Main Tabs'' available, but still I do not have the option to remove/edit it. Any clues on this? [Excel customized ribbon](https://i.stack.imgur.com/aH2cZ.png) I tried using "Customize the Ribbon" options to remove it, but the button name (CEAF) dose not appear between the ''Main Tabs'' available. Also, I tried to use the ''Quick access Toolbar'', this time the customized ribbon name appeared (Upadacitinib CEA Tab) in the commands and this specific button (CEAF) also appeared, but still I don not have the option to remove/edit it. [Quick access Toolbar](https://i.stack.imgur.com/tQGzU.jpg) Thanks.
Removing a Button from Customized Excel Ribbon
|excel|ribbon|
null
I ran into a problem when I decided to make an edge server for microservices, but I ran into the problem that my microservice cannot register in Eureka, what could be wrong? ``` apiVersion: v1 kind: ConfigMap metadata: name: configmap data: foodcataloguedb_url: jdbc:postgresql://35.228.167.123:5432/foodcataloguedb restaurantdb_url: jdbc:postgresql://35.228.167.123:5432/restaurantdb userdb_url: jdbc:postgresql://35.228.167.123:5432/userdb EUREKA_CLIENT_SERVICEURL_DEFAULTZONE: "http://eureka:8761/eureka/" GATEWAY_APPLICATION_NAME: gateway ``` ``` apiVersion: apps/v1 kind: Deployment metadata: name: gateway labels: app: gateway spec: replicas: 1 selector: matchLabels: app: gateway template: metadata: labels: app: gateway spec: containers: - name: gateway image: kirsing123/gateway:v1.4 imagePullPolicy: Always ports: - containerPort: 8072 env: - name: SPRING_APPLICATION_NAME valueFrom: configMapKeyRef: name: configmap key: GATEWAY_APPLICATION_NAME - name: EUREKA_CLIENT_SERVICEURL_DEFAULTZONE valueFrom: configMapKeyRef: name: configmap key: EUREKA_CLIENT_SERVICEURL_DEFAULTZONE --- apiVersion: v1 kind: Service metadata: name: gateway spec: selector: app: gateway type: LoadBalancer ports: - protocol: TCP port: 8072 targetPort: 8072 ``` [Errors](https://i.stack.imgur.com/dElHe.png) [Eureka Dashboard](https://i.stack.imgur.com/uqnY8.png) I changed dependencies and turned the @EnableDiscoveryClient annotation on and off, to no avail
Programmatic connection to open WiFi network fails intermittently on Android 9
|java|android|wifi|wifimanager|android-9.0-pie|
Thank you for your feedback. I have already found and checked this information. I am already fulfilling your suggestion. However, your feedback is already helping to narrow down the error further. [My extract from AndroidManifest.xml][1] [1]: https://i.stack.imgur.com/hB8xk.png
|c++|qt|widget|physics|qwidget|
I encountered a warning during the compilation of my Angular application and discovered that it was caused by the 'outputHashing' configuration in the 'angular.json' file. In the development build configuration, removing the 'outputHashing=all' setting resolved the warning for me. After making this change, the warning no longer appeared during compilation.[enter image description here][1] [1]: https://i.stack.imgur.com/vzTRE.png
I've set up my \_app.js and store.js in what seems to be the expected format. This is my first attempt as using both so if I'm missing something obvious, please let me know. store.js: ``` import { configureStore } from '@reduxjs/toolkit'; import { createWrapper } from 'next-redux-wrapper'; import authReducer from '../store/slices/authSlice'; import searchReducer from '../store/slices/searchSlice'; const makeStore = () => { console.log('config store: ', configureStore({ reducer: { auth, search } })); return configureStore({ reducer: { auth: authReducer, search: searchReducer, }, }); } export const wrapper = createWrapper(makeStore, { debug: process.env.NODE_ENV === 'development' }); ``` app.js: ``` import { Provider } from 'react-redux'; import { wrapper } from '../store/store'; function MyApp({ Component, pageProps }) { console.log('wrapper: ', wrapper); return ( <Provider store={wrapper}> <Component {...pageProps} /> </Provider> ); } export default MyApp; ``` The console.log of my wrapper is: ``` wrapper: { getServerSideProps: [Function: getServerSideProps], getStaticProps: [Function: getStaticProps], getInitialAppProps: [Function: getInitialAppProps], getInitialPageProps: [Function: getInitialPageProps], withRedux: [Function: withRedux], useWrappedStore: [Function: useWrappedStore] } ``` The reason I've done all this is because I was originally getting a legacy error when using withRedux so it said I had to use the createWrapper option. I've tried to look up on here and on ChatGPT and Gemini and nothing seems to explain why I'm getting TypeError: store.getState is not a function. It also looks like makeStore is never getting called because the console.log in the function never logs.
Using Redux and Next.js and getting "store.getState is not a function"
|reactjs|react-redux|next-redux-wrapper|
null
I assume your Kafka properties are like this ```properties exampe.kafka.deserializer.mapper =com.example.consumer.model.Example ``` ```java public class DeserializerU<T> implements Deserializer<T> { private Class<T> type; @Override public void configure(Map map, boolean bln) { this.type = (Class) map.get("example.kafka.deserializer.mapper"); } @Override public void close() { } @Override public T deserialize(String string, byte[] bytes) { ObjectMapper mapper = new ObjectMapper(); T object = null; try { object = mapper.readValue(bytes, type); } catch (Exception e) { e.printStackTrace(); } return object; } } ```
The rules of Conway's Game of Life aren't working in my Javascript version. What am I doing wrong?
|javascript|arrays|cellular-automata|
null
try adding one more line under mongoose.connect curly braces:- mongoose.connect("monogodb://localhost....",{ useNewUrlParser: true, useUnifiedTopology: true, useCreateIndex: true }) .then(() => { console.log('successfully connected'); }) .catch((e) => { console.log('not connected'); }) you can check the error in console if not connected by replacing "not connected" with 'e'
null
It's been 2 years but hope this helps, at least, it worked for me. If you have the country boundaries GeoJSON (Multipolygon Feature). You may use @turf import { featureEach, difference, buffer } from '@turf/turf'; const getInverseFeature = (featureCollection, distance) => { // Create a bounding box for the entire world let invertedPolygon; // Loop through each feature in the FeatureCollection featureEach(featureCollection, (feature) => { // Buffer the feature polygon slightly to ensure it covers the boundaries const bufferedFeature = buffer(feature, 40, { units: 'kilometers' }); //You may use distance instead of 40 km, I just hard coded the 40 km to show Sea Border lines of Country which was added by Openstreet map // Convert the buffered feature to a GeoJSON polygon const featurePolygon = bufferedFeature; // If invertedPolygon already exists, subtract the current feature polygon from it if (invertedPolygon) { invertedPolygon = difference(invertedPolygon, featurePolygon); } else { // Otherwise, initialize invertedPolygon with the first feature polygon invertedPolygon = featurePolygon; } }); // Subtract the inverted polygon from the world bounding box const worldPolygon = { type: 'Polygon', coordinates: [ [ [-180, -90], [180, -90], [180, 90], [-180, 90], [-180, -90], ], ], }; return difference(worldPolygon, invertedPolygon); }; With the help of function you can get inverse feature and (In React I used the GeoJSON component) <GeoJSON data={outterBounds} pathOptions={{ color: mapChange ? '#163a4a' : '#aad3df', // weight: 2.5, lineCap: 'round', fill: true, fillOpacity: 0.98, }} /> But this is important to know, you shouldn't use the function in Frontend, because it is a very slow function and will freeze the brower. To use the inverse feature you may use one of the following options. 1- Generate Inverse Feature in Backend and return the result from backend to frontend (By the way, the FeatureCollection at function is the Feature Collection of the Country Coastline (Borderlines of the country)) 2- You may use it at frontend just once, console log the Reverse Feature to DevTools console, copy the object and create a country outter bounds constant and import it to the file which you will generate the map and use GeoJSON. 3- Use the second option, add copied object to DB and fetch it from DB (again you will get the data from Backend but this time you do not need to use the above function calculation again and again. Result from the above (I used 2nd option by the way) : [enter image description here][1] [1]: https://i.stack.imgur.com/mvpUF.png
I am trying to integrate VSCode `settings.json` into WebStorm. When I save files, VSCode automatically formats the code for me. How can I integrate this formatting into WebStorm? For example, here is a `settings.json` in VSCode: ```json { "eslint.validate": [ "javascript" ], "eslint.format.enable": true, "eslint.alwaysShowStatus": true, "editor.formatOnSave": false, "editor.tabSize": 2, "stylelint.validate": [ "scss", "css", "less" ], "css.validate": false, "scss.validate": false, "stylelint.config": null, "editor.codeActionsOnSave": { "source.fixAll.eslint": "explicit", "source.fixAll": "explicit" } } ```
How to integrate VSCode settings.json into WebStorm?
I'm new into flutter and I want to code a Flashcard App. But at the moment, I don't know how to continue coding. I'm stuck at adding a new flashcard and saving the learning set with the title and description and I literally don't find something similar on yt. What's the best way to solve this problem? And is it something with the list widget or am I wrong? In the Picture you see my Page. If you click on the plus icon, it should add a new flashcard with term and definition. And if you click on the button on the bottom, it should save the whole set and the title and the number of flashcards should be visible on the homepage then. The picture: ![1](https://i.stack.imgur.com/smV3u.png) Here is my code for this Page, and I also created a reusable TextFormField for the title and description of the flashcard-set: ``` class AddSetPage extends StatefulWidget { const AddSetPage({super.key}); @override State<AddSetPage> createState() => _AddSetPageState(); } class _AddSetPageState extends State<AddSetPage> { @override Widget build(BuildContext context) { return Scaffold( bottomNavigationBar: SizedBox( height: 100, child: const BottomAppBar( surfaceTintColor: AppPallete.transparentColor, child: Padding( padding: EdgeInsets.only(left:75.0, right: 75.0), child: CreateSetButton(), ), ), ), body: Container( height: MediaQuery.of(context).size.height, width: MediaQuery.of(context).size.width, child: SingleChildScrollView( child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ SizedBox( height: 50, ), IconButton( onPressed: (){}, icon: Icon(Icons.arrow_back_rounded, color: AppPallete.whiteColor,size: 30,) ), Padding( padding: const EdgeInsets.all(20.0), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ TitleField(text: 'Titel', fontSize: 24, fontWeight: FontWeight.w700, titleController: null,), SizedBox(height: 5,), DescriptionField(text: 'Beschreibung', descriptionController: null,), SizedBox(height: 5,), ],), ), Padding( padding: EdgeInsets.only(left: 10, right: 10), child: Column( children: [ KarteiKarte(), SizedBox(height: 10,), KarteiKarte(), SizedBox(height: 10,), IconButton( onPressed: (){}, icon: SvgPicture.asset('assets/svg/add.svg', width: 35, height: 35, color: AppPallete.whiteColor,) ), ], ) ), ], ), ), ), ); } } ``` And here is my reusable Flashcard widget: ``` class KarteiKarte extends StatelessWidget { final TextEditingController? definitionController; final TextEditingController? begriffController; const KarteiKarte({super.key, this.definitionController, this.begriffController}); @override Widget build(BuildContext context) { return Container( decoration: const BoxDecoration(color: AppPallete.primaryColor), child: Padding( padding: const EdgeInsets.only(left: 10, right: 10, bottom: 20, top: 10), child: Column( crossAxisAlignment: CrossAxisAlignment.start, children: [ TextFormField( controller: begriffController, decoration: const InputDecoration( focusedBorder: UnderlineInputBorder( borderSide: BorderSide(color: AppPallete.whiteColor, width: 2) ), enabledBorder: UnderlineInputBorder( borderSide: BorderSide(color: AppPallete.whiteColor, width: 2), ), ), style: const TextStyle(fontWeight: FontWeight.normal, fontSize: 16), maxLines: null, ), const SizedBox(height: 5,), const Text('Begriff', style: TextStyle(fontSize: 13, color: AppPallete.whiteColor),), const SizedBox(height: 5,), TextFormField( controller: definitionController, decoration: const InputDecoration( focusedBorder: UnderlineInputBorder( borderSide: BorderSide(color: AppPallete.whiteColor, width: 2) ), enabledBorder: UnderlineInputBorder( borderSide: BorderSide(color: AppPallete.whiteColor, width: 2), ), ), style: const TextStyle(fontWeight: FontWeight.normal, fontSize: 16), maxLines: null, ), const SizedBox(height: 5,), const Text('Definition', style: TextStyle(fontSize: 13, color: AppPallete.whiteColor),), ], ), ), ); } } ``` btw. I want to save the data local, so I was thinking of using the sqflite package? Can someone help me please or send a link to a yt video? Thank you! I tried nothing yet because I really don't know how to solve something like this and I'm generally new into coding
WASM cannot access regions outside of its allocated memory (of the host). That would defeat the entire point of sandboxing using WASM. You need to copy the data into WASM memory, then pass the address from there. ```rust use wasmer::{imports, Instance, Module, Store, Value}; fn main() { // Read the Wasm file let wasm_bytes = include_bytes!("../../target/wasm32-unknown-unknown/release/guest.wasm"); // Create a store let mut store = Store::default(); // let compiler = Cranelift::default(); // let mut store = Store::new(compiler); // Compile the module let module = Module::new(&store, wasm_bytes).unwrap(); // Create an import object with the host function let import_object = imports! {}; let instance = Instance::new(&mut store, &module, &import_object).unwrap(); let function = instance.exports.get_function("process_bytes").unwrap(); // Example byte array let byte_array: Vec<u8> = vec![0x48, 0x65, 0x6C, 0x6C, 0x6F]; let memory = instance.exports.get_memory("memory").unwrap(); let view = memory.view(&store); // Cannot be 0 because null is disallowed in Rust references. view.write(1, &byte_array).unwrap(); // Call the exported function with the byte array let result = function .call( &mut store, &[Value::I32(1), Value::I32(byte_array.len() as i32)], ) .unwrap(); // Check the result println!("Result: {:?}", result); } ``` If you don't know a free place in the memory, you can for example ask the guest to allocate X bytes using its allocator and return their address, then write there.
You passed a pointer to host memory to `process_bytes`. The WASM module instance gets its entirely separate block of memory, so when it tries to access that pointer, it's a pointer to nowhere. You'll have to copy the byte array to the instance's memory. Sorry, this is only a sketch of how to do that: 1. You'll somehow have to obtain a valid instance memory pointer on the host. One way of doing that is to export malloc (and call it): ```rust #[no_mangle] pub extern "C" fn alloc(len: u32) -> u32 { let layout = std::alloc::Layout::array<u8>(len.try_into().unwrap()).try_into().unwrap(); (std::alloc::alloc(layout) as usize).try_into().unwrap() } ``` 2. Write the data to instance memory: ``` memory.view(&store).write(pointer_from_alloc, &byte_array);` ``` 3. Call your function: ``` function.call(&mut store, &[Value::I32(pointer_from_allc), Value::I32(byte_array.len() as i32)]) 4. Dealloc ;) Of course, there's other ways of getting valid writable pointers, for example `Memory::grow`, call a host import from wasm with a pointer (that'd be what wasi's `fd_write` does), which can then call `process_bytes`, or just reserving a static array at a specific location.
May be a litte bit late but I would like what works for me: ``` import { FC, useState } from "react"; import { useRoles } from "../../hooks"; import Select, { SingleValue } from "react-select"; import { Option } from "../../types/types"; import { UseFormRegister } from "react-hook-form"; import { CreateUserDto } from "../../api"; type Props = { onSelect: (role: Option | null) => void; register: UseFormRegister<CreateUserDto>; }; export const RolesSelect: FC<Props> = ({ onSelect, register }) => { const { rolesOptions } = useRoles(); const [selectedRole, setSelectedRole] = useState<SingleValue<Option>>(); const onChange = (option: SingleValue<Option>) => { setSelectedRole(option); onSelect(option); }; return ( <Select {...register("roleId", { required: "El rol es requerido", })} name="roleId" options={rolesOptions} value={selectedRole} onChange={onChange} /> ); }; ``` And in my form ``` ... const { register, handleSubmit, control, formState: { errors }, } = useForm<UserForm>(); return <RolesSelect register={register} onSelect={(d) => { console.log(d); }} /> ```
For anyone finding this, I was trying to create a Devise user type that isn't authenticated by email and password. If you're in the same boat, remove the following from your model: `:validatable :database_authenticatable`. These two expect there to be an email and password to validate and authenticate against. Removing them ensures the checks related to either aren't used.
> Samples method Calling double number = 1.99; Console.WriteLine(string.Format("Amount: {0}", number)); Console.WriteLine(NumberTowords.NumberToWords(number.ToString(), "rupees", "paisa")); Console.WriteLine(NumberTowords.NumberToWords(number.ToString(), "dollers", "cent")); Console.WriteLine(string.Format("=========================================")); number = 99.99; Console.WriteLine(string.Format("Amount: {0}", number)); Console.WriteLine(NumberTowords.NumberToWords(number.ToString(), "rupees", "paisa")); Console.WriteLine(NumberTowords.NumberToWords(number.ToString(), "dollers", "cent")); > Class for containes related methods public static class NumberTowords { public static string NumberToWords(string doubleNumber, string mainAmountType, string decimalAmountType) { int beforeFloatingPoint = Convert.ToInt32(Convert.ToString(doubleNumber).Split('.')[0]); string beforeFloatingPointWord = string.Format("{0} {1}", NumberToWords(beforeFloatingPoint), (beforeFloatingPoint > 1 ? mainAmountType : mainAmountType.TrimEnd(mainAmountType.Last()))); int afterFloatingPoint = Convert.ToInt32(Convert.ToString(doubleNumber).Contains('.') ? Convert.ToString(doubleNumber).Split('.')[1] : "0"); string afterFloatingPointWord = string.Format("{0} {1} only.", SmallNumberToWord(afterFloatingPoint, ""), decimalAmountType); if (afterFloatingPoint > 0) { return string.Format("{0} and {1}", beforeFloatingPointWord, afterFloatingPointWord); } else { return string.Format("{0} only", beforeFloatingPointWord); } } private static string NumberToWords(int number) { if (number == 0) return "zero"; if (number < 0) return "minus " + NumberToWords(Math.Abs(number)); var words = ""; if (number / 1000000000 > 0) { words += NumberToWords(number / 1000000000) + " billion "; number %= 1000000000; } if (number / 1000000 > 0) { words += NumberToWords(number / 1000000) + " million "; number %= 1000000; } if (number / 1000 > 0) { words += NumberToWords(number / 1000) + " thousand "; number %= 1000; } if (number / 100 > 0) { words += NumberToWords(number / 100) + " hundred "; number %= 100; } words = SmallNumberToWord(number, words); return words; } private static string SmallNumberToWord(int number, string words) { if (number <= 0) return words; if (words != "") words += ""; var unitsMap = new[] { "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen" }; var tensMap = new[] { "zero", "ten", "twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety" }; if (number < 20) words += unitsMap[number]; else { words += tensMap[number / 10]; if ((number % 10) > 0) words += " " + unitsMap[number % 10]; } return words; } } > Sample Results [![enter image description here][1]][1] [1]: https://i.stack.imgur.com/sYCzn.png
When I clicked the button, the console printed `render` **once**. expect: Because of `StrictMode`, it should print `render` **twice** <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-html --> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8" /> <meta name="viewport" content="width=device-width, initial-scale=1.0" /> <title>Document</title> <script src="https://unpkg.com/react@17/umd/react.development.js" crossorigin ></script> <script src="https://unpkg.com/react-dom@17/umd/react-dom.development.js" crossorigin ></script> <script src="https://unpkg.com/babel-standalone@6/babel.min.js"></script> <script type="text/babel"> console.log(React.version, ReactDOM.version); class App extends React.Component { state = { count: 0, }; render() { console.log("render"); return ( <div> <button onClick={() => { this.setState({ count: this.state.count + 1, }); }} > click </button> <div>count {this.state.count}</div> </div> ); } } ReactDOM.render( <React.StrictMode> <App /> </React.StrictMode>, document.getElementById("root") ); </script> </head> <body> <div id="root"></div> </body> </html> <!-- end snippet --> If I change the version to 16, the console will print the render twice ``` https://unpkg.com/react@16/umd/react.development.js https://unpkg.com/react-dom@16/umd/react-dom.development.js ```
I had the same problem. this happened because of a NVM misconfiguration. follow these steps to fix. check `node -v` on WSL terminal. command wouldn't work. check installed node versions by `nvm ls`. see `default -> N/A`? this is the issue. bind a node version to default by `nvm alias default <node_version>` check `nvm ls` again to see if it's added. check `node -v` again. now it'll work(if not check on a new terminal window)
{"Voters":[{"Id":12957340,"DisplayName":"jared_mamrot"},{"Id":22180364,"DisplayName":"Jan"},{"Id":354577,"DisplayName":"Chris"}],"SiteSpecificCloseReasonIds":[18]}
I have this simple program: ```c++ #include <windows.h> #include <iostream> #include <stdint.h> int main() { WCHAR Filestring[MAX_PATH] = L"\0"; OPENFILENAMEW ofn = { 0 }; ofn.lStructSize = sizeof(ofn); ofn.lpstrFile = Filestring; ofn.nMaxFile = MAX_PATH; if (GetOpenFileNameW(&ofn)) { } return 0; } ``` This is my "simple reproducible example". When I run this in my Visual Studio, it crashes at `GetOpenFileNameW`. Why? I don't know. But when I run the application from the file path instead of debugging, it's fine and it opens the dialog like's it's supposed to. I realized it's an issue with my situation rather than the code, so I completely reinstalled windows! After, it worked fine when I tested it. But 5 hours later, I'm getting the same error. Here is my error: [![image][1]][1] [1]: https://i.stack.imgur.com/ahxC1.png Anyone know what to do? This code used to work, because I just grabbed it from an earlier project that just worked, until very recently for no reason.
SSIS package writes empty CSV file
|sql-server|ssis|
null
Follow these steps: 1. **Check Firebase Storage Rules**: Ensure that your Firebase Storage rules allow public access to the images. If the rules are set to deny public access, you won't be able to fetch the image URL without proper authentication. For testing purposes, you can set the rules to allow public read access: ```plaintext service firebase.storage { match /b/{bucket}/o { match /{allPaths=**} { allow read; allow write: if request.auth != null; } } } ``` 2. **Check Firebase Storage Path**: In your `getImageUrl` method, you have an empty string inside `ref().child("")`. This means you're not specifying the path to the image in Firebase Storage. Make sure to provide the correct path to the image. ```dart final ref = storage.ref().child("path/to/your/image.jpg"); ``` Replace `"path/to/your/image.jpg"` with the actual path to your image in Firebase Storage. 3. **Error Handling**: Wrap your code inside try-catch blocks to catch any potential errors during fetching the image URL. ```dart try { final ref = storage.ref().child("path/to/your/image.jpg"); final url = await ref.getDownloadURL(); setState(() { imageUrl = url; }); } catch (e) { print("Error fetching image URL: $e"); } ``` By adding error handling, you'll be able to see any errors that occur during the process, which can help in diagnosing the issue. 4. **Verify Image URL**: After obtaining the URL, print it to ensure that you're getting a valid URL. ```dart print("Image URL: $url"); ``` Check the printed URL in the console to ensure it's correct and accessible.
This looks like a bug to me. The animations involving rotation and offset are not respecting the animation duration and have a delay at the end. The delay is almost as long as the animation itself (and more noticeable if you give the animation a longer duration). As a workaround, you could use a `PhaseAnimator ` to chain the forwards and backwards animations together, instead of using `.repeatForever(autoreverses: true)`: ```swift struct ContentView: View { var body: some View { PhaseAnimator([false, true]) { isAnimating in ZStack { // content as before } .animation(.bouncy(duration: 0.5), value: flag) } .frame(width: 100, height: 100) .padding() } } ``` ![Animation](https://i.stack.imgur.com/6jLvM.gif)
I am having the below snippet in inventory.wxi file. I have BuildVersion = 10.7.5896.4556 (an example reference). I want to have the formatted string in FinalVersion as 10.58.9645.56 (don't want to have 7 after the first . character). Below snippet is not giving the desired output. Need your suggestions how can it be improved further? ``` <?xml version="1.0" encoding="utf-8"?> <Include xmlns="http://schemas.microsoft.com/wix/2006/wi"> <?define BuildVersion = "10.7.5896.4556"> ?> <?define TempVersion = $(var.BuildVersion) ?> <?define firstPart = $(var.TempVersion).Substring(0, $(var.TempVersion).IndexOf('.')) ?> <?define secondPart = $(var.TempVersion).Substring($(var.TempVersion).IndexOf('.') + 1, $(var.TempVersion).IndexOf('.', $(var.TempVersion).IndexOf('.') + 1) - $(var.TempVersion).IndexOf('.') - 1) ?> <?define thirdPart = $(var.TempVersion).Substring($(var.TempVersion).IndexOf('.', $(var.TempVersion).IndexOf('.') + 1) + 1, $(var.TempVersion).IndexOf('.', $(var.TempVersion).IndexOf('.', $(var.TempVersion).IndexOf('.') + 1) + 1) - $(var.TempVersion).IndexOf('.', $(var.TempVersion).IndexOf('.') + 1) - 1) ?> <?define fourthPart = $(var.TempVersion).Substring($(var.TempVersion).LastIndexOf('.') + 1) ?> <?define FinalVersion = $(var.firstPart) + '.' + $(var.thirdPart).Substring(0, 2) + '.' + $(var.thirdPart).Substring(2, 2) + $(var.fourthPart).Substring(0, 2) + '.' + $(var.fourthPart).Substring(2) ?> </Include> ```
The following: ``` interface IThing { virtual string A => "A"; } ``` Is the so called [default interface method][1] and virtual as far as I can see actually does nothing because: > The `virtual` modifier may be used on a function member that would otherwise be implicitly `virtual` I.e. it just an explicit declaration of the fact that **interface** method is virtual since the language team decided to not restrict such things. See also the [Virtual Modifier vs Sealed Modifier][2] part of the spec: > Decisions: Made in the LDM 2017-04-05: > - non-`virtual` should be explicitly expressed through `sealed` or `private`. > - `sealed` is the keyword to make interface instance members with bodies non-`virtual` > - We want to allow all modifiers in interfaces > - ... Note that default implemented `IThing.A` is not part of the `Thing`, hence you can't do `new Thing().A`, you need to cast to the interface first. If you want to override the `IThing.A` in the `Thing2` then you can implement the interface directly: ``` class Thing2: Thing, IThing { public string A => "!"; } Console.WriteLine(((IThing)new Thing()).A); // Prints "A" Console.WriteLine(((IThing)new Thing2()).A); // Prints "!" ``` Aother way would be declaring `public virtual string A` in the `Thing` so your current code for `Thing2` works: ``` class Thing: IThing { public virtual string A => "A"; } class Thing2: Thing { public override string A => "!"; } ``` To understand meaning of `sealed`/`virtual` identifiers you can create a second interface: ``` interface IThing { string A => "A"; } interface IThing2 : IThing { string IThing.A => "B"; } class Thing : IThing2 {} Console.WriteLine(((IThing)new Thing()).A); // Prints "B" ``` While if you declare `IThing.A` as `sealed` then `IThing2` will not compile. [1]: https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/proposals/csharp-8.0/default-interface-methods [2]: https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/proposals/csharp-8.0/default-interface-methods#virtual-modifier-vs-sealed-modifier
I'm working on a Unity project where I need to draw on each face of a cube independently. However, when I draw on one face, the changes are reflected on all six faces of the cube simultaneously. I've implemented a drawing functionality using a Drawer script. This script manages drawing points between the mouse clicks and interpolates them to create smooth lines. However, it seems that the interpolation logic is causing the drawn lines to appear on all faces of the cube. Here's the relevant part of my Drawer script: // Relevant code snippet from the Drawer script private void SetPixelsBetweenDrawPoints() { while (drawPoints.Count > 1) { Vector2Int startPos = drawPoints.Dequeue(); Vector2Int endPos = drawPoints.Peek(); InterpolateDrawPositions(startPos, endPos); } } IEnumerator DrawToCanvas() { while(true) { SetPixelsBetweenDrawPoints(); yield return new WaitForSeconds(drawInterval); } } void InterpolateDrawPositions(Vector2Int startPos, Vector2Int endPos) { int dx = endPos.x - startPos.x; int dy = endPos.y - startPos.y; float xinc, yinc, x, y; int steps = (Math.Abs(dx) > Math.Abs(dy)) ? Math.Abs(dx) : Math.Abs(dy); xinc = ((float)dx / steps) * interpolationPixelCount; yinc = ((float)dy / steps) * interpolationPixelCount; x = startPos.x; y = startPos.y; for(int k=0; k < steps; k += interpolationPixelCount) { canvasDrawOrEraseAt((int)Math.Round(x), (int)Math.Round(y)); x += xinc; y += yinc; } canvasDrawOrEraseAt(endPos.x, endPos.y); } void AddDrawPositions(Vector2Int newDrawPos) { drawPoints.Enqueue(newDrawPos); } I want to modify this script so that when I draw on one face of the cube, the changes are confined to that specific face only. How can I achieve this? Should I modify the interpolation logic or is there a better approach to handle drawing on individual faces of a cube? Any insights or suggestions would be greatly appreciated. Thank you!
I have this `Dropdown` Widget in a `Modal` and I cannot Change the Value in the Widget while I'm using `setState` and everytime I change the value, I should close the Modal and then the Value is Changed. this is my Code: var chosenRecentDay = 1; List<int> daysList = [for (var i = 1; i < 31; i++) i]; int defaultDropDownValue = 1; showModalBottomSheet( context: context, builder: (BuildContext context) { return SizedBox( height: 500.0, child: Center( child: Padding( padding: const EdgeInsets.symmetric( vertical: 20.0), child: Column( mainAxisAlignment: MainAxisAlignment.start, children: <Widget>[ SizedBox( width: 150.0, height: 45.0, child: Center( child: DropdownButton( value: defaultDropDownValue, menuMaxHeight: 250.0, icon: const Icon( Icons .arrow_drop_down_circle_rounded, color: Color(0xffF85E63), ), borderRadius: BorderRadius.circular( 30.0), alignment: Alignment.center, underline: Container( color: Colors.transparent), items: daysList.map< DropdownMenuItem< dynamic>>( (dynamic value) { var convertedList = value.toString(); return DropdownMenuItem< dynamic>( value: value, child: Row( mainAxisAlignment: MainAxisAlignment .start, children: <Widget>[ Padding( padding: const EdgeInsets .symmetric( horizontal: 5.0), child: Text( convertedList, style: const TextStyle( color: Color( 0xffF85E63), fontFamily: 'Lalezar', fontSize: 18.0, ), ), ), ], ), ); }).toList(), onChanged: (val) { setState(() { defaultDropDownValue = val!; chosenRecentDay = val; }); }, ), ), ), ], ), ), ), ); }, );
Dropdown Values not change in Flutter Modal
|android|flutter|widget|dropdown|setstate|
{"Voters":[{"Id":2320961,"DisplayName":"Nic3500"},{"Id":14732669,"DisplayName":"ray"},{"Id":354577,"DisplayName":"Chris"}],"SiteSpecificCloseReasonIds":[18]}
Im trying to use: df_pca_filt = df_pca[df_pca['cdf'].astype(float) > 0.975] But it doesn't work. I ran the program once and everything was fine. But then I ran it again, everything was exactly the same and it stopped filtering I tried: df_pca_filt = df_pca[df_pca['cdf'] > 0.975] df_pca_filt = df_pca[df_pca['cdf'].values > 0.975] But it gives me all the values for `df_pca['cdf']` from 0 to 1. Idk what happend I also tried using `conda upgrade pandas` in the prompt. The data type for `cdf` is `float64` This is my real data for `df['cdf']` (I know I have to remove some decimals to make it more optimal, but it doesn't matter, the code should work anyway): cdf 0 12.842872998255906 1 22.467100047566195 2 29.451403202790548 3 36.16616457903916 4 41.98509592516252 5 47.05882352941176 6 52.04534644046298 7 56.98430315522436 8 60.496273981290635 9 63.78626922467101 10 66.996987474235 11 70.19185032503569 12 73.28365308387508 13 75.89979387981609 14 78.46836847946727 15 80.91009988901222 16 82.82860313936897 17 84.57269700332965 18 86.1106706833677 19 87.45837957824641 20 88.52861899476774 21 89.5037260187094 22 90.43126684636121 23 91.3508799746314 24 92.24671000475665 25 92.95227524972256 26 93.65784049468847 27 94.30791184398291 28 94.95798319327734 29 95.48121135246555 30 96.00443951165374 31 96.43253527826228 32 96.82892024734426 33 97.13810052322819 34 97.39178690344065 35 97.63754558427146 36 97.87537656572066 37 98.11320754716984 38 98.34311082923738 39 98.57301411130493 40 98.77120659584591 41 98.93768828286034 42 99.10416996987476 43 99.24686855874427 44 99.38956714761377 45 99.52433803710164 46 99.61947042968133 47 99.69874742349771 48 99.77009671793246 49 99.83351831298557 50 99.88901220865706 51 99.92072300618362 52 99.95243380371018 53 99.96828920247346 54 99.9762169018551 55 99.98414460123674 56 99.99207230061837 57 100.00000000000003
When you construct a Font via `Font font = Font.loadFont(myFontInputStream, myFontSize);` And set it programmatically e.g. like this ```java public class MyFXController { @FXML TextField myTextField; private static Font loadFont(String resourcePath, double fontSize) { final URL fontURL = DefaultController.class.getResource(resourcePath); final Font font; try(final InputStream fontInputStream = fontURL.openStream()){ font = Font.loadFont(fontInputStream, fontSize); }catch (IOException e) { throw new RuntimeException("Couldn't load font", e); } return font; } @FXML public void initialize() { Font font = loadFont("/myfont.ttf"); //font located under src/main/resources/myfont.ttf and copied to the jar under myjar.jar:/myfont.ttf myTextField.setFont(font); } } ``` no fallbacks will be used and you will get the Tofu characters (square boxes) for unsupported codepoints.
Drawing on 3D object at Unity
|c#|unity-game-engine|unityscript|
null
Creating subclasses would probably work better in your case, as you have seen. Instead of creating a class factory function, define the common behaviour of all derived classes in the base class and make specifics depend on class variables defined by subclasses. In an example which is similar to yours, this could look like: ``` class UInt: size: int # to be defined by subclasses def __init__(self, value: int): if value >= 2 ** self.size: raise ValueError("Too big") self._value = value def __repr__(self): return f"{self.__class__.__name__}({self._value})" class UInt12(UInt): size = 12 an_example_number = UInt12(508) print(an_example_number) # UInt12(508) ```
|python|json|indexing|fastapi|
[enter image description here][1][2]According to the network diagram above, the connection from company A's pc0 to the server system including gmail and facebook is successful, but company B's pc6 and pc7 cannot ping the server system. I tried to give ip from dns but it didn't work. The system works normally, all devices are connected successfully, can send emails from the pc to the server [1]: https://i.stack.imgur.com/UfjQH.png [2]: https://i.stack.imgur.com/pz5eC.png
Let's guess I have class on server like ``` class MyData { String statusA; String statusB; String statusC; ... Something field20; boolean canDoX() { return statusA.equals('z') && statusB.equals('y') } } ``` It is mapping from DB entity. Now for optimization was created new class ``` class MyDataWithHalfOfFields { String statusA; String statusB; String statusC; ... Something field10; } ``` How should I replace ```canDoX``` so that it will be according to clean architecture? Lang is Java but not really matter **Update** Why it is optimization. Designer wants 2 pages in frontend 1. Group of objects with data from array of MyDataWithHalfOfFields 2. Page of MyData May be it won't be a big problem to get unnecessary fields for one object but for list it already more consuming
The following: ``` interface IThing { virtual string A => "A"; } ``` Is the so called [default interface method][1] and virtual as far as I can see actually does nothing because: > The `virtual` modifier may be used on a function member that would otherwise be implicitly `virtual` I.e. it just an explicit declaration of the fact that **interface** method is virtual since the language team decided to not restrict such things. See also the [Virtual Modifier vs Sealed Modifier][2] part of the spec: > Decisions: Made in the LDM 2017-04-05: > - non-`virtual` should be explicitly expressed through `sealed` or `private`. > - `sealed` is the keyword to make interface instance members with bodies non-`virtual` > - We want to allow all modifiers in interfaces > - ... Note that default implemented `IThing.A` is not part of the `Thing`, hence you can't do `new Thing().A`, you need to cast to the interface first. If you want to override the `IThing.A` in the `Thing2` then you can implement the interface directly: ``` class Thing2: Thing, IThing { public string A => "!"; } Console.WriteLine(((IThing)new Thing()).A); // Prints "A" Console.WriteLine(((IThing)new Thing2()).A); // Prints "!" ``` Aother way would be declaring `public virtual string A` in the `Thing` so your current code for `Thing2` works: ``` class Thing: IThing { public virtual string A => "A"; } class Thing2: Thing { public override string A => "!"; } ``` To understand meaning of `sealed`/`virtual` identifiers in itnerfaces you can create a second interface: ``` interface IThing { string A => "A"; } interface IThing2 : IThing { string IThing.A => "B"; } class Thing : IThing2 {} Console.WriteLine(((IThing)new Thing()).A); // Prints "B" ``` While if you declare `IThing.A` as `sealed` then `IThing2` will not compile. Also check out the https://stackoverflow.com/q/4470446/2501279 linked by [wohlstad][3] in the comments. [1]: https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/proposals/csharp-8.0/default-interface-methods [2]: https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/proposals/csharp-8.0/default-interface-methods#virtual-modifier-vs-sealed-modifier [3]: https://stackoverflow.com/users/18519921/wohlstad
Player freezes in position when swapped in for another player
null
_supabaseClient__WEBPACK_IMPORTED_MODULE_1__.supabase.auth.signIn is not a function
1. Add this line in rails_helper.rb file: ``` config.include Devise::Test::IntegrationHelpers, type: :request ``` The above line includes Devise's integration test helpers for RSpec request specs, allowing you to simulate user authentication in your tests. 2. Use Devise helper method sign ``` and add this method in your spec or rails_helper file def auth_headers(user) sign_in user { 'Authorization' => "Bearer #{user.auth_token}" } end ``` The `auth_headers` method signs in a user using Devise's `sign_in` helper method and returns a hash containing the user's authorization token in the 'Authorization' header, prefixed with the string 'Bearer '. This method can be used in API request specs to authenticate as a specific user. Now you can add `auth_headers(user)` in your spec headers to authenticate API requests. This will pass the user's authorization token in the 'Authorization' header of the request, allowing your application to authenticate the user and authorize access to protected resources.
{"Voters":[{"Id":4722345,"DisplayName":"JBallin"},{"Id":476,"DisplayName":"deceze"}],"SiteSpecificCloseReasonIds":[11]}
**Question Body:** I'm encountering a peculiar issue in my Laravel API setup. I have a resource controller for managing student data, including deletion. When I make a DELETE request to `http://127.0.0.1:8000/api/student/1` (for example, with `id=1`), the first request successfully deletes the student and returns a JSON response with a success message: ```json { "message": "Student deleted successfully" } ``` However, if I make another DELETE request immediately afterward with the same URL and ID, instead of receiving a similar success message, I get a 404 Not Found error with a rendered HTML response. ```html <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Not Found</title> <style> /* code css here */ </style> <link rel='stylesheet' type='text/css' property='stylesheet' href='//127.0.0.1:8000/_debugbar/assets/stylesheets?v=1697098252&theme=auto' data-turbolinks-eval='false' data-turbo-eval='false'> <script src='//127.0.0.1:8000/_debugbar/assets/javascript?v=1697098252' data-turbolinks-eval='false' data-turbo-eval='false'></script> <script data-turbo-eval="false"> jQuery.noConflict(true); </script> <script> //js code here </script> </head> <body class="antialiased"> <div class="relative flex items-top justify-center min-h-screen bg-gray-100 dark:bg-gray-900 sm:items-center sm:pt-0"> <div class="max-w-xl mx-auto sm:px-6 lg:px-8"> <div class="flex items-center pt-8 sm:justify-start sm:pt-0"> <div class="px-4 text-lg text-gray-500 border-r border-gray-400 tracking-wider"> 404 </div> <div class="ml-4 text-lg text-gray-500 uppercase tracking-wider"> Not Found </div> </div> </div> </div> <script type="text/javascript"> //js script code </script> </body> </html> ``` The code of the Controller function ```php // StudentController.php <?php use App\Models\Student; use App\Http\Controllers\Controller; use Illuminate\Support\Facades\Validator; class StudentController extends Controller { // ...other code public function destroy(Student $student) { try { $student->delete(); $student->person()->delete(); $student->guardian1()->delete(); $student->guardian2()->delete(); return response()->json(['message' => 'Student deleted successfully'], 200); } catch (\Illuminate\Database\Eloquent\ModelNotFoundException $notFoundException) { return response()->json(['error' => 'Student not found', 'exception' => $notFoundException->getMessage()], 404); } catch (\Exception $e) { return response()->json(['error' => 'An error occurred while deleting the student', 'exception' => $e->getMessage()], 500); } } } ``` the Code of the Api Route ```php // api.php <?php use Illuminate\Support\Facades\Route; Route::group(['middleware' => 'auth:api'], function(){ // ...other code Route::resource('student', App\Http\Controllers\StudentController::class); }); ``` **Additional Information:** - This behavior occurs consistently whenever I attempt to delete a student for the second time. - I've ensured that the appropriate routes are registered in `api.php`. - I'm using Laravel version 10.32.1 I expected that both DELETE requests would successfully return a JSON response with a message indicating successful deletion, or Error message of not exists element.
In ths some time,this program is useful.But it make exception as fllowing picture [enter image description here](https://i.stack.imgur.com/FYncJ.png) Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you Thank you
undetected_chromedriver urllib.error.URLError
|google-chrome|
null
As noted in the comments, an `awk` solution is simple. For example: ``` awk '!index($0,q) || ++c>n' n=3 q=please "$filename" ``` --- It is not very convenient to try to count with `sed`, although it is possible. Parameterising arguments is also complicated. Ignoring both those issues, here is a sed script to delete the first 3 occurrences of lines containing "please": ``` sed -n ' 1 { x s/^/.../ x } /please/ { x s/.// x t } p ' "$filename" ``` Applying either script to: ``` 1 leave this line alone 2 leave this line alone 1 please delete this line 3 leave this line alone 2 please delete this line 4 leave this line alone 5 leave this line alone 3 please delete this line 6 leave this line alone 4 please leave this line alone 7 leave this line alone ``` produces: ``` 1 leave this line alone 2 leave this line alone 3 leave this line alone 4 leave this line alone 5 leave this line alone 6 leave this line alone 4 please leave this line alone 7 leave this line alone ``` --- If you would prefer to enter a number rather than a long string of dots, you can do: ``` sed -n ' 1 { x :loop s/././3 t end s/^/ / t loop :end x } /please/ { x s/.// x t } p ' "$filename" ``` As "one-liner": ``` sed -n -e '1{x;:l' -e's/././3;te' -e's/^/ /;tl' -e:e -e'x;};/please/{x;s/.//;x;t' -e'};p' "$filename" ```
My code keeps working for a couple inputs and then ends citing a segmentation fault. I do not do any dynamic memory allocation. It's supposed to be a game of reversi (aka othello). The include lab8part1 contains the stdbool and declares some of the functions. ``` #include <stdio.h> #include <stdlib.h> #include "lab8part1.h" void printBoard(char board[][26], int n); bool positionInBounds(int n, int row, int col); bool checkLegalInDirection(char board[][26], int n, int row, int col, char colour, int deltaRow, int deltaCol); bool validMove(char board[][26], int n, int row, int col, char colour); bool computerMove(char board[][26], int n, char colour, char row, char col); bool UserMove(char board[][26], int n, char colour, char row, char col); int checkBestMoves(char board[][26], int n, int row, int col, char colour, int deltaRow, int deltaCol); bool checkifmove(char board[][26], int n, char color); int main(void) { char board[26][26], color, row, col; printf("Enter the board dimension: "); int n; scanf(" %d", &n); int start = n / 2; for (int m = 0; m < n; m++) { for (int j = 0; j < n; j++) { if ((m == start - 1 && j == start - 1) || (m == start && j == start)) { board[m][j] = 'W'; } else if ((m == start - 1 && j == start) || (m == start && j == start - 1)) { board[m][j] = 'B'; } else { board[m][j] = 'U'; } } } printf("Computer plays (B/W): "); scanf(" %c", &color); char color1; if (color == 'B') { color1 = 'W'; } else { color1 = 'B'; } printBoard(board, n); printf("\n"); char turn = 'B'; bool validmove = true; while ((checkifmove(board, n, color) == true) || (checkifmove(board, n, color1) == true)) { validmove = true; if (turn == color) { validmove = computerMove(board, n, color, row, col); } else { UserMove(board, n, color1, row, col); } if (validmove == false) { break; } if (turn == 'W') { turn = 'B'; } else { turn = 'W'; } } int whitwin = 0; int blacwin = 0; for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { if (board[i][j] == 'W') { whitwin += 1; } else { blacwin += 1; } } } if (whitwin > blacwin) { printf("W player wins."); } else if (whitwin < blacwin) { printf("B player wins."); } else { printf("Draw."); } return 0; } bool computerMove(char board[][26], int n, char colour, char row, char col) { int movesrow[100] = { 0 }; int movescol[100] = { 0 }; int count = 0; for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { if (board[i][j] == 'U') { if (checkLegalInDirection(board, n, i, j, colour, -1, -1)) { movesrow[count] = i; movescol[count] = j; } if (checkLegalInDirection(board, n, i, j, colour, -1, 0)) { movesrow[count] = i; movescol[count] = j; } if (checkLegalInDirection(board, n, i, j, colour, -1, 1)) { movesrow[count] = i; movescol[count] = j; } if (checkLegalInDirection(board, n, i, j, colour, 0, -1)) { movesrow[count] = i; movescol[count] = j; } if (checkLegalInDirection(board, n, i, j, colour, 0, 1)) { movesrow[count] = i; movescol[count] = j; } if (checkLegalInDirection(board, n, i, j, colour, 1, -1)) { movesrow[count] = i; movescol[count] = j; } if (checkLegalInDirection(board, n, i, j, colour, 1, 0)) { movesrow[count] = i; movescol[count] = j; } if (checkLegalInDirection(board, n, i, j, colour, 1, 1)) { movesrow[count] = i; movescol[count] = j; } } } count += 1; } int bestMoves[600] = { 0 }; int tracker = 0; int tot = 0; for (int i = 0; i < count; i++) { if (tot != 0) { tracker += 1; } tot = 0; for (int j = 0; j < count; j++) { tot += checkBestMoves(board, n, movesrow[i], movescol[i], colour, -1, -1); if (tot != 0) { bestMoves[tracker] = tot; } } if (tot != 0) { tracker += 1; } tot = 0; for (int j = 0; j < count; j++) { tot += checkBestMoves(board, n, movesrow[i], movescol[i], colour, -1, 0); if (tot != 0) { bestMoves[tracker] = tot; } } if (tot != 0) { tracker += 1; } tot = 0; for (int j = 0; j < count; j++) { tot += checkBestMoves(board, n, movesrow[i], movescol[i], colour, -1, 1); if (tot != 0) { bestMoves[tracker] = tot; } } if (tot != 0) { tracker += 1; } tot = 0; for (int j = 0; j < count; j++) { tot += checkBestMoves(board, n, movesrow[i], movescol[i], colour, 0, -1); if (tot != 0) { bestMoves[tracker] = tot; } } if (tot != 0) { tracker += 1; } tot = 0; for (int j = 0; j < count; j++) { tot += checkBestMoves(board, n, movesrow[i], movescol[i], colour, 0, 1); if (tot != 0) { bestMoves[tracker] = tot; } } if (tot != 0) { tracker += 1; } tot = 0; for (int j = 0; j < count; j++) { tot += checkBestMoves(board, n, movesrow[i], movescol[i], colour, 1, -1); if (tot != 0) { bestMoves[tracker] = tot; } } if (tot != 0) { tracker += 1; } tot = 0; for (int j = 0; j < count; j++) { tot += checkBestMoves(board, n, movesrow[i], movescol[i], colour, 1, 0); if (tot != 0) { bestMoves[tracker] = tot; } } if (tot != 0) { tracker += 1; } tot = 0; for (int j = 0; j < count; j++) { tot += checkBestMoves(board, n, movesrow[i], movescol[i], colour, 1, 1); if (tot != 0) { bestMoves[tracker] = tot; } } } // if computer runs out of moves if (bestMoves[0] == 0) { printf("%c player has no valid move.", colour); return false; } int counter = 0; int bigNum = bestMoves[0]; int duplicates[tracker]; for (int i = 1; i < tracker; i++) { if (bestMoves[i] > bigNum) { bigNum = bestMoves[i]; duplicates[0] = i; counter = 1; } else if (bestMoves[i] == bigNum) { duplicates[counter] = i; counter++; } } int rowtemp = 0, coltemp = 0; for (int i = 0; i < counter; i++) { for (int j = 0; j < n; j++) { if ((movesrow[duplicates[i]] < movesrow[duplicates[i + j]]) && movescol[duplicates[i]] < movescol[duplicates[i + j]]) { rowtemp = movesrow[duplicates[i]]; coltemp = movescol[duplicates[i]]; } else { rowtemp = movesrow[duplicates[i + j]]; coltemp = movescol[duplicates[i + j]]; } } } row = rowtemp; col = coltemp; if (validMove(board, n, (row), (col), colour)) { board[row][col] = colour; printf("\nComputer places %c at %c%c\n", colour, (row + 'a'), (col + 'a')); printBoard(board, n); return true; } else { return false; } } bool UserMove(char board[][26], int n, char colour, char row, char col) { int movesrow[100] = { 0 }; int movescol[100] = { 0 }; int count = 0; for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { if (board[i][j] == 'U') { if (checkLegalInDirection(board, n, i, j, colour, -1, -1)) { movesrow[count] = i; movescol[count] = j; } if (checkLegalInDirection(board, n, i, j, colour, -1, 0)) { movesrow[count] = i; movescol[count] = j; } if (checkLegalInDirection(board, n, i, j, colour, -1, 1)) { movesrow[count] = i; movescol[count] = j; } if (checkLegalInDirection(board, n, i, j, colour, 0, -1)) { movesrow[count] = i; movescol[count] = j; } if (checkLegalInDirection(board, n, i, j, colour, 0, 1)) { movesrow[count] = i; movescol[count] = j; } if (checkLegalInDirection(board, n, i, j, colour, 1, -1)) { movesrow[count] = i; movescol[count] = j; } if (checkLegalInDirection(board, n, i, j, colour, 1, 0)) { movesrow[count] = i; movescol[count] = j; } if (checkLegalInDirection(board, n, i, j, colour, 1, 1)) { movesrow[count] = i; movescol[count] = j; } } } count += 1; } int bestMoves[100] = { 0 }; int tracker = 0; int tot = 0; for (int i = 0; i < count; i++) { if (tot != 0) { tracker += 1; } tot = 0; for (int j = 0; j < count; j++) { tot += checkBestMoves(board, n, movesrow[i], movescol[i], colour, -1, -1); if (tot != 0) { bestMoves[tracker] = tot; } } if (tot != 0) { tracker += 1; } tot = 0; for (int j = 0; j < count; j++) { tot += checkBestMoves(board, n, movesrow[i], movescol[i], colour, -1, 0); if (tot != 0) { bestMoves[tracker] = tot; } } if (tot != 0) { tracker += 1; } tot = 0; for (int j = 0; j < count; j++) { tot += checkBestMoves(board, n, movesrow[i], movescol[i], colour, -1, 1); if (tot != 0) { bestMoves[tracker] = tot; } } if (tot != 0) { tracker += 1; } tot = 0; for (int j = 0; j < count; j++) { tot += checkBestMoves(board, n, movesrow[i], movescol[i], colour, 0, -1); if (tot != 0) { bestMoves[tracker] = tot; } } if (tot != 0) { tracker += 1; } tot = 0; for (int j = 0; j < count; j++) { tot += checkBestMoves(board, n, movesrow[i], movescol[i], colour, 0, 1); if (tot != 0) { bestMoves[tracker] = tot; } } if (tot != 0) { tracker += 1; } tot = 0; for (int j = 0; j < count; j++) { tot += checkBestMoves(board, n, movesrow[i], movescol[i], colour, 1, -1); if (tot != 0) { bestMoves[tracker] = tot; } } if (tot != 0) { tracker += 1; } tot = 0; for (int j = 0; j < count; j++) { tot += checkBestMoves(board, n, movesrow[i], movescol[i], colour, 1, 0); if (tot != 0) { bestMoves[tracker] = tot; } } if (tot != 0) { tracker += 1; } tot = 0; for (int j = 0; j < count; j++) { tot += checkBestMoves(board, n, movesrow[i], movescol[i], colour, 1, 1); if (tot != 0) { bestMoves[tracker] = tot; } } } // if player runs out of moves if (bestMoves[0] == 0) { printf("%c player has no valid move.", colour); return false; } printf("\nEnter a move for colour %c (RowCol): ", colour); scanf(" %c%c", &row, &col); if (validMove(board, n, (row - 'a'), (col - 'a'), colour)) { board[row - 'a'][col - 'a'] = colour; printBoard(board, n); } } bool validMove(char board[][26], int n, int row, int col, char colour) { int score = 0; if (checkLegalInDirection(board, n, row, col, colour, -1, -1)) { score++; int i = 1; while (board[row + (i * -1)][col + (i * -1)] != colour) { board[row + (i * -1)][col + (i * -1)] = colour; i++; } } if (checkLegalInDirection(board, n, row, col, colour, -1, 0)) { score++; int i = 1; while (board[row + (i * -1)][col + (i * 0)] != colour) { board[row + (i * -1)][col + (i * 0)] = colour; i++; } } if (checkLegalInDirection(board, n, row, col, colour, -1, 1)) { score++; int i = 1; while (board[row + (i * -1)][col + (i * 1)] != colour) { board[row + (i * -1)][col + (i * 1)] = colour; i++; } } if (checkLegalInDirection(board, n, row, col, colour, 0, -1)) { score++; int i = 1; while (board[row + (i * 0)][col + (i * -1)] != colour) { board[row + (i * 0)][col + (i * -1)] = colour; i++; } } if (checkLegalInDirection(board, n, row, col, colour, 0, 1)) { score++; int i = 1; while (board[row + (i * 0)][col + (i * 1)] != colour) { board[row + (i * 0)][col + (i * 1)] = colour; i++; } } if (checkLegalInDirection(board, n, row, col, colour, 1, -1)) { score++; int i = 1; while (board[row + (i * 1)][col + (i * -1)] != colour) { board[row + (i * 1)][col + (i * -1)] = colour; i++; } } if (checkLegalInDirection(board, n, row, col, colour, 1, 0)) { score++; int i = 1; while (board[row + (i * 1)][col + (i * 0)] != colour) { board[row + (i * 1)][col + (i * 0)] = colour; i++; } } if (checkLegalInDirection(board, n, row, col, colour, 1, 1)) { score++; int i = 1; while (board[row + (i * 1)][col + (i * 1)] != colour) { board[row + (i * 1)][col + (i * 1)] = colour; i++; } } if (score > 0) { return true; } else { return false; } } void printBoard(char board[][26], int n) { printf(" "); for (int i = 0; i < n; i++) { printf("%c", 'a' + i); } for (int m = 0; m < n; m++) { printf("\n%c ", 'a' + m); for (int j = 0; j < n; j++) { printf("%c", board[m][j]); } } } bool positionInBounds(int n, int row, int col) { if (row >= 0 && row < n && col >= 0 && col < n) { return true; } else { return false; } } bool checkLegalInDirection(char board[][26], int n, int row, int col, char colour, int deltaRow, int deltaCol) { if (positionInBounds(n, row, col) == false) { return false; } if (board[row][col] != 'U') { return false; } row += deltaRow; col += deltaCol; if (positionInBounds(n, row, col) == false) { return false; } if (board[row][col] == colour || board[row][col] == 'U') { return false; } while ((positionInBounds(n, row, col)) == true) { if (board[row][col] == colour) { return true; } if (board[row][col] == 'U') { return false; } row += deltaRow; col += deltaCol; } return false; } int checkBestMoves(char board[][26], int n, int row, int col, char colour, int deltaRow, int deltaCol) { int tiles = 0; if (positionInBounds(n, row, col) == false) { return false; } if (board[row][col] != 'U') { return false; } row += deltaRow; col += deltaCol; if (positionInBounds(n, row, col) == false) { return false; } if (board[row][col] == colour || board[row][col] == 'U') { return false; } while ((positionInBounds(n, row, col)) == true) { if (board[row][col] == colour) { return tiles; } if (board[row][col] == 'U') { return false; } tiles += 1; row += deltaRow; col += deltaCol; } return false; } bool checkifmove(char board[][26], int n, char color) { for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { if (board[i][j] == 'U') { if (checkLegalInDirection(board, n, i, j, color, -1, -1) || checkLegalInDirection(board, n, i, j, color, -1, 0) || checkLegalInDirection(board, n, i, j, color, -1, 1) || checkLegalInDirection(board, n, i, j, color, 0, -1) || checkLegalInDirection(board, n, i, j, color, 0, 1) || checkLegalInDirection(board, n, i, j, color, 1, -1) || checkLegalInDirection(board, n, i, j, color, 1, 0) || checkLegalInDirection(board, n, i, j, color, 1, 1)) { return true; } } } } return false; } ``` I have messed with shortening and expanding the array sizes but nothing seems to be working. I also tried using malloc but encountered the same problem.
Your container's ID contains a space and they're illegal. <div id="Sign-In TempUI" Get rid of it. Also... document.addEventListener('DOMContentLoaded', Why are you in such a hurry? Use LOAD... document.addEventListener('load',
I had something in my mind to spice up the code that draw the pixels on the screen about what if I can make a condition that change the ***variable*** (dl register/data stack) value by 1, 2 and 5, then make the code to increase/decrease value by ***variable***. add dx, dl ; something like that, the assembler gave me an error: incorrect/illegal combination of opcodes and operands Here's the full code, modified by me (OG code from the [video](https://youtu.be/HmoSg5p-AXc?si=Q9T06AqFtxSH1kn8)): bits 16 org 0x7c00 start: cli push 0x0A000 pop es xor di, di xor ax, ax mov ax, 0x13 int 0x10 jmp payload payload: add dl, 1 cmp dl, 3 jg condition mov ah, 0x0c add al, 1 mov bh, 0x00 add cx, 1 add dx, [dl] ; from reference, the assembler said: invalid 16-bit effective address int 0x10 jmp payload condition: mov dl, 0 jmp payload times 510 - ($-$$) db 0 dw 0xaa55 Waiting for your answers and feedback. P.S. For those who are confused, I'll rephrase the code part I want to add in a C syntax *(may be some inaccuracies, you can always fix me)*: byte reg1; byte reg2 = 1; int main() { reg1 += &reg2; if (reg2 == 1) { reg2 = 2; } else if (reg2 == 2) { reg2 = 5; } else if (reg2 == 5) { reg2 = 1; }; return 0; } **As for my config: I compile the code into .img (floppy disk) file.** I tried to figure out what's wrong and fixed the question to be more understandable. I asked my question because I want to follow the DRY (Don't Repeat Yourself) coding principle to reduce the CPU overhead if there's no use to apply the dl register, then I could use the other unit that can hold the value compatible with DX, otherwise, give me a verdict if that's possible or not. Thank you.
{"Voters":[{"Id":642706,"DisplayName":"Basil Bourque"},{"Id":4216641,"DisplayName":"Turing85"},{"Id":5389127,"DisplayName":"Gaël J"}],"SiteSpecificCloseReasonIds":[19]}
I have imported 1000 sample rows from various tables in a SQL server (lets call it SQLSever1). I have imported the rows into the second SQL Server(SQLServer2). When I execute the following query on SQLServer2 I get no results, however when I execute the same query on SQLServer1 I get the expected results. This is because I haven't imported all the rows from SQLServer1 to SQLServer2. The problem is that I can't import all the data from SQLServer1 to SQLServer2 because some tables contain over 3 million rows. Therefore, can someone let me know if there is a way to find out exactly data is required from the tables in SQLServer1 to get a result from SQLServer 2? Basically, I need to import only those rows into SQL Server 2, that will produce the same result in SQL Server 1. I believe I would need to do apply somekind of DISTINCT clause or a LEFT / RIGHT JOIN to determine the rows/fiels/data that is present in SQL Server 1 that is not present in SQL Server 2, but I'm not sure. The tables look like the following: [![enter image description here][1]][1] [1]: https://i.stack.imgur.com/zjRrR.png Sample code is as follows: CREATE TABLE #tmpTable ( MakeName nvarchar(100), ModelName nvarchar(150), Cost money) INSERT #tmpTable VALUES (N'Ferrari',N'Testarossa',52000.00), (N'Ferrari',N'355',176000.00), (N'Porsche',N'911',15600.00), (N'Porsche',N'924',9200.00), (N'Porsche',N'944',15960.00), (N'Ferrari',N'Testarossa',176000.00), (N'Aston Martin',N'DB4',23600.00), (N'Aston Martin',N'DB5',39600.00) Any thoughts The code is as follows: SELECT Make.MakeName, Model.ModelName, Stock.Cost FROM Data.Stock INNER JOIN Data.Model ON Model.ModelID = Stock.ModelID INNER JOIN Data.Make ON Make.MakeID = Model.MakeID
To me it looks like you are not waiting for every single character to be sent out. You are just updating the uartData on every clock cycle without checking the uartRdy signal. So I assume the TX_SEND_WAIT state you commented out would be actually what you need. In that state (or create a second one) you just have to check if you're at the end of the string or if there are more characters to send.
{"OriginalQuestionIds":[30794235],"Voters":[{"Id":442760,"DisplayName":"cafce25","BindingReason":{"GoldTagBadge":"rust"}}]}
If you're writing something that does "the same thing, with just one thing changing at each step", that's a loop. You don't use separate `if` statements. Not even "when you're lazy": being lazy is an _excellent_ property to have when you're a programmer, because it means you want to do as little work as possible. Of course, in this case that means "why am I even doing this, [`npm install marked`](https://www.npmjs.com/package/marked), oh look I'm done", but even if you insist on implementing a markdown parser yourself (sometimes, just writing code to see if you can is all the justification you need) you don't use a sequence of `if` statements, it takes more time to write, and takes more time to maintain/update. However, even if you _do_ use `if` statements, resolve them either such that you handle "the largest thing first", to ensure there's no fall-through, _or_ with if-else statements, so there's no fall-though. (And based on your question about whether to use a switch: why stop there? Why not just use a mapping object with `#` sequences as keys instead so the lookup runs in O(1)?) However, you don't need any of this, because what you're really doing is simple text matching, so you can use the best tool in the toolset for that: you can trivially get both the `#` sequence and "remaining text" with a dead simple regex, and then generate the replacement HTML using the captured data: <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-js --> function markdownToHTML(doc) { return convertMultiLineMD(convertInlineMD(doc.split(`\n`))).join(`\n`); } function convertInlineMD(lines) { return lines.map((line) => { // convert headings line = line.replace( // two capture groups for the markup, and the heading, /^(#+)\s+(.+)/, // and we extract the first group's length immediately (_, { length: h }, text) => `<h${h}>${text.trim()}</h${h}>` ); // then convert bold, then italic, then... etc. etc. return line; }); } function convertMultiLineMD(lines) { // convert tables, etc. etc. return lines; } // And a simple test based on what you indicated: const docs = [`## he#llo\nthere\n# yooo`, `# he#llo\nthere\n## yooo`]; docs.forEach((doc, i) => console.log(`[doc ${i + 1}]\n`, markdownToHTML(doc))); <!-- end snippet --> However, this is also a naive approach to writing a transpiler, and will have dismal runtime performance compared to writing a DFA based on the markdown grammar (the "markup language specification" grammar, i.e. the rules that say which tokens can follow which other tokens), where you run through your document by tracking what kind of token we're dealing with, and convert on the fly as we pass token terminations. That's wildly beyond the scope of this answer, but worth digging into if you're doing this just to see if you can do it: anyone can write code "that works" but is extremely inefficient, so that's not an exercise that's going to improve your skill as a programmer.
null
A simple fix could be using `x_compat=True` when plotting from pandas: ``` df.plot(y=["A"], lw = 0.2, ax = plt.gca(), legend=None, x_compat=True) ``` Output: [![enter image description here][1]][1] [1]: https://i.stack.imgur.com/ZsOOC.png
I'm writing a bash script to execute a python program with different values of parameters 'H' and 'K'. What I would like to happen is that only one instance of 'program.py' runs at a time and subsequent jobs are not started until the previous one finishes. Here's what I tried - ``` #!/bin/bash H="1 10 100" K="0.01 0.1" for H_val in ${H} do for K_val in ${K} do { nohup python program.py $H_val $K_val; } & done done ``` However, this just loops over all the parameter values without waiting for any one job to finish. Conversely, if I modify the above slightly by taking off the ampersand, I can run each job individually - but not in the background. Any ideas on how to proceed?
Run Jobs Sequentially, in the Background, in Bash
|linux|bash|
null
I am trying to pull data using urllib and tableau_api_lib to create PDFs based off of filtered data of a view within Tableau. I have THAT part working, but I need help with looping through the list of IDs to then create a dictionary (that is needed to create the PDF), then off of those parameters, create output that changes the PDF name as the same as the ID in the test_loop. I can make it work with just one record (without the loop). ``` test_loop = ['202','475','78','20','10'] for item in test_loop: tableau_filter_value = parse.quote(item) pdf_params = { "pdf_orientation":"orientation=Landscape", "pdf_layout":"type=A4", "filter_vendor": f"vf_{tableau_filter_field}={tableau_filter_value}", } for params in pdf_params: with open('output{test}.pdf'.format(test=params),'wb') as file: file.write(conn.query_view_pdf(view_id = pdf_view_id, parameter_dict=params).content) ``` Basically, the PDF should be named as output202.pdf and should have the data associated with it from the pdf_params dict above. So the output, I am expecting 5 different pdfs with this list. I am somewhat new to python, so anything helps! AttributeError: 'str' object has no attribute 'keys' ++++ tableau_filter_field is defined before this code.
I'm encountering some issues while installing Laravel 11. For more details, please refer to this photo (https://i.stack.imgur.com/KCAHW.png).I've attempted various solutions to resolve the problem, including modifying the php.ini file, but I am still looking for a successful solution. I'm trying to set up my first project with Laravel 11, and my goal is to complete the installation. > Failed to download laravel/framework from dist: curl error 28 while > downloading
Download failure of Laravel framework due to curl error 28
Laravel API DELETE Requests of Resource Controller and Getting 404 Not Found Error (for Second time Delete)
|laravel|http-status-code-404|laravel-routing|laravel-10|laravel-resource|
null
In kotlin i use this: private fun isConnected(): Boolean { val connectivityManager = applicationContext.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager val network = connectivityManager.activeNetwork val capabilities = connectivityManager.getNetworkCapabilities(network) return (capabilities != null && capabilities.hasTransport(NetworkCapabilities.TRANSPORT_WIFI) && capabilities.hasTransport(NetworkCapabilities.TRANSPORT_ETHERNET) && capabilities.hasTransport(NetworkCapabilities.TRANSPORT_CELLULAR) && capabilities.hasCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET)) }
I used the Glance API in Jetpack Compose to make a homescreen widget. However, when used, the button fills up the whole widget. Did as mentioned in this documentation - https://developer.android.com/develop/ui/compose/glance/create-app-widget implementation ("androidx.glance:glance:1.0.0") implementation ("androidx.glance:glance-appwidget:1.0.0") Dependency versions added Tried the exact thing given in the documentation above [Expected](https://i.stack.imgur.com/Aue6w.png) [Result](https://i.stack.imgur.com/yhBQj.png) ``` @Composable private fun MyContent() { Column( modifier = GlanceModifier.fillMaxSize(), verticalAlignment = Alignment.Top, horizontalAlignment = Alignment.CenterHorizontally ) { Text(text = "hello", modifier = GlanceModifier.padding(12.dp)) Row(horizontalAlignment = Alignment.CenterHorizontally) { Button( text = "A", onClick = actionStartActivity<MainActivity>() ) Button( text = "B", onClick = actionStartActivity<MainActivity>() ) } } } ``` Exact code
Made a widget with glance API in Jetpack Compose. Button filling the whole widget
|android|kotlin|android-jetpack-compose|android-appwidget|glance-appwidget|
null
Here I just need to look up three tables first need to get all subjects from the subject table according to classid and boardid then from the content table we need to get all topic and content details and group them by topicid(please look into expecting output). then each topic details should contain child details which we will get from edchildrevisioncompleteschemas table #lookup code const { stageid, subjectid, boardid, scholarshipid, childid } = req.params; edcontentmaster .aggregate([ { $match: { stageid: stageid, subjectid: subjectid, boardid: boardid, // scholarshipid: scholarshipid, }, }, { $addFields: { convertedField: { $cond: { if: { $eq: ["$slcontent", ""] }, then: "$slcontent", else: { $toInt: "$slcontent" }, }, }, }, }, { $sort: { slcontent: 1, }, }, { $lookup: { from: "edchildrevisioncompleteschemas", let: { childid: childid, subjectid:subjectid,topicid:"$topicid" }, pipeline: [ { $match: { $expr: { $and: [ { $eq: [ "$childid", "$$childid" ] }, { $in: [ "$$subjectid", "$subjectDetails.subjectid" ] }, { $in: [ "$$topicid", { $reduce: { input: "$subjectDetails", initialValue: [], in: { $concatArrays: [ "$$value", "$$this.topicDetails.topicid" ] } } } ] } ] } } }, { $project: { _id: 1, childid: 1 } } ], as: "studenttopic", }, }, { $group: { _id: "$topic", topicimage: { $first: "$topicimage" }, topicid: { $first: "$topicid" }, sltopic: { $first: "$sltopic" }, studenttopic: { $first: "$studenttopic" }, reviewquestionsets: { $push: { id: "$_id", sub: "$sub", topic: "$topic", contentset: "$contentset", stage: "$stage", timeDuration: "$timeDuration", contentid: "$contentid", studentdata: "$studentdata", subjectIamge: "$subjectIamge", topicImage: "$topicImage", contentImage: "$contentImage", isPremium: "$isPremium", }, }, }, }, { $project: { _id: 0, topic: "$_id", topicimage: 1, topicid: 1, sltopic: 1, studenttopic:1, contentid: "$contentid", reviewquestionsets: 1, }, }, ]) .sort({ sltopic: 1 }) .collation({ locale: "en_US", numericOrdering: true, }) from the above query I am getting appropriate data for a single subject, but I need all subjects from subject table and each subject should have the same format data that i getting for a single subject, ex-mongoplayground.net/p/LoxSBI3jZL- current output- [ { "reviewquestionsets": [ { "contentid": "NVOOKADA1690811843420STD-5EnglishThe Monkey from RigerLesson - 1", "contentset": "Lesson - 1", "id": ObjectId("64ccd53792362c7639d3da5f"), "stage": "STD-5", "timeDuration": "15", "topic": "The Monkey from Riger" }, { "contentid": "NVOOKADA1690811843420STD-5EnglishThe Monkey from RigerLesson - 3", "contentset": "Lesson - 3", "id": ObjectId("64ccf5ca92362c7639d3f145"), "isPremium": true, "stage": "STD-5", "timeDuration": "5", "topic": "The Monkey from Riger" } ], "sltopic": "1", "studenttopic": [ { "_id": ObjectId("659580293aaddf7594689d18"), "childid": "WELL1703316202984" } ], "topic": "The Monkey from Riger", "topicid": "1691144002706", "topicimage": "" } ] expected output- [ { "_id": "64cc9a2656738e9f1507f521", "subjectid": "1691130406151", "subject": "English", "subjectImage": "https://wkresources.s3.ap-south- 1.amazonaws.com/1691761437925_644750345.png", "stageid": "5", "stage": "STD-5", "boardid": "1", "boardname": "BSE", "scholarshipid": "NVOOKADA1690811843420", "scholarshipname": "Adarsh", "createon": "2023-08-04T06:26:46.154Z", "updatedon": "2023-08-14T13:07:16.256Z", "__v": 0, "slsubject": "1", "topicDetails": { "reviewquestionsets": [ { "contentid": "NVOOKADA1690811843420STD-5EnglishThe Monkey from RigerLesson - 1", "contentset": "Lesson - 1", "id": "64ccd53792362c7639d3da5f", "stage": "STD-5", "timeDuration": "15", "topic": "The Monkey from Riger" }, { "contentid": "NVOOKADA1690811843420STD-5EnglishThe Monkey from RigerLesson - 3", "contentset": "Lesson - 3", "id": "64ccf5ca92362c7639d3f145", "isPremium": true, "stage": "STD-5", "timeDuration": "5", "topic": "The Monkey from Riger" } ], "sltopic": "1", "studenttopic": [ { "_id": "659580293aaddf7594689d18", "childid": "WELL1703316202984" } ], "topic": "The Monkey from Riger", "topicid": "1691144002706", "topicimage": "" } } ]
|node.js|mongodb|mongoose|mongodb-query|aggregation-framework|
`` from keras.models import Sequential from keras.layers.core import Dense, Flatten from keras.layers.convolutional import Conv2D, MaxPooling2D ` ` ModuleNotFoundError Traceback (most recent call last) <ipython-input-35-e0ce7722f83a> in <cell line: 2>() 1 from keras.models import Sequential ----> 2 from keras.layers.core import Dense, Flatten 3 from keras.layers.convolutional import Conv2D, MaxPooling2D ModuleNotFoundError: No module named 'keras.layers.core' --------------------------------------------------------------------------- NOTE: If your import is failing due to a missing package, you can manually install dependencies using either !pip or !apt. To view examples of installing some common dependencies, click the "Open Examples" button below. use Chat GPT the answer is The error indicates that the module keras.layers.core cannot be found, suggesting an issue with the Keras installation or compatibility. As of Keras version 2.7.0 (the latest stable version as of my last update), the module organization has changed, and keras.layers.core is no longer used. Instead, core layers like Dense and Flatten are directly available under keras.layers.
I created custom theme by [theming system guide][1], but don't know how to use new theme in my project. I am not using mvc, mvvm. In my project i connect extjs files in this way: <link rel="stylesheet" type="text/css" href="http://localhost/ext-6.0.0/build/classic/theme-neptune/resources/theme-neptune-all.css"> <script type="text/javascript" src="http://localhost/ext-6.0.0/build/ext-all.js"></script> <script type="text/javascript" src="http://localhost/ext-6.0.0/build/classic/theme-neptune/theme-neptune.js"></script> How can i add my new theme to project? After command 'sencha pakcage build' i get an error: [![sencha pakcage build error][3]][3] [1]: https://docs.sencha.com/extjs/5.1.0/guides/core_concepts/theming.html [3]: http://i.stack.imgur.com/QVTk0.png
null
I created custom theme by [theming system guide][1], but don't know how to use new theme in my project. I am not using mvc, mvvm. In my project i connect extjs files in this way: <link rel="stylesheet" type="text/css" href="http://localhost/ext-6.0.0/build/classic/theme-neptune/resources/theme-neptune-all.css"> <script type="text/javascript" src="http://localhost/ext-6.0.0/build/ext-all.js"></script> <script type="text/javascript" src="http://localhost/ext-6.0.0/build/classic/theme-neptune/theme-neptune.js"></script> How can i add my new theme to project? After command 'sencha pakcage build' i get an error: [![sencha pakcage build error][3]][3] [1]: https://docs.sencha.com/extjs/5.0.0/guides/core_concepts/theming.html [3]: https://i.stack.imgur.com/QVTk0.png
I'm developing a mobile application in React Native. The application has the `<TextInput/>` for entering SMS codes: ```js const [pinCode, setPinCode] = useState(''); const pinCodeRef = useRef(); // crutch so that the user's keyboard opens automatically useEffect(() => { const timeout = setTimeout(() => { pinCodeRef.current.focus(); }, 400); return () => clearTimeout(timeout); }, []); ... <TextInput placeholder="Enter pin-cpde" placeholderTextColor={commonStyles.colors.label} value={pinCode} onChangeText={val => setPinCode(val)} maxLength={6} ref={pinCodeRef} keyboardType="number-pad" autoComplete="sms-otp" textContentType="oneTimeCode" /> ``` I use properties `keyboardType="number-pad" autoComplete="sms-otp" textContentType="oneTimeCode"` to have the keyboard prompt the user for an SMS code. **The problem is that 6-digit codes on IOS are not prompted, while 4-digit codes work correctly. On Android everything works correctly.** About app: ``` System: OS: macOS 13.4 CPU: (8) arm64 Apple M1 Pro Memory: 141.94 MB / 16.00 GB Shell: 5.9 - /bin/zsh Binaries: Node: 16.18.0 - ~/.nvm/versions/node/v16.18.0/bin/node Yarn: 1.22.19 - /opt/homebrew/bin/yarn npm: 8.19.2 - ~/.nvm/versions/node/v16.18.0/bin/npm Watchman: Not Found Managers: CocoaPods: 1.11.2 - /Users/alexander/.rvm/rubies/ruby-2.7.4/bin/pod SDKs: iOS SDK: Platforms: DriverKit 22.2, iOS 16.2, macOS 13.1, tvOS 16.1, watchOS 9.1 Android SDK: Not Found IDEs: Android Studio: 2022.2 AI-222.4459.24.2221.10121639 Xcode: 14.2/14C18 - /usr/bin/xcodebuild Languages: Java: 11.0.16.1 - /usr/bin/javac npmPackages: @react-native-community/cli: Not Found react: 17.0.2 => 17.0.2 react-native: 0.67.4 => 0.67.4 react-native-macos: Not Found npmGlobalPackages: *react-native*: Not Found ``` Libraries (for example `react-native-otp-auto-fill`) did not cope with the code hint (on IOS and ob Android). Only the properties mentioned above helped me.
I'm developing a project on Raspberry Pi Pico W and I'm trying to setup a custom Wi-Fi Manager using [AsyncWebServer_RP2040W library](https://github.com/khoih-prog/AsyncWebServer_RP2040W) and [AsyncTCP_RP2040W](https://github.com/khoih-prog/AsyncTCP_RP2040W) on [Arduino Pico](https://arduino-pico.readthedocs.io/en/latest/index.html). The code for the async server are bellow: ```cpp #include <Arduino.h> #include "AsyncTCP_RP2040W.h" #include "AsyncWebServer_RP2040W.h" #include <WiFi.h> #include <LittleFS.h> // Wi-Fi Manager definitions const char *WIFI_USER = "WIFI_MANAGER"; const uint8_t WIFI_CHANNEL = 6; const uint8_t WIFI_PORT = 80; // Read File from LittleFS String readFile(fs::FS &fs, const char * path) { Serial.printf("Reading file: %s\r\n", path); File file = fs.open(path, "r"); if(!file || file.isDirectory()) { Serial.println("- failed to open file"); return String(); } String fileContent; while(file.available()) { fileContent = file.readStringUntil('\n'); break; } return fileContent; } // Write file to LittleFS void writeFile(fs::FS &fs, const char * path, const char * message) { Serial.printf("Writing file: %s\r\n", path); File file = fs.open(path, "w"); if(!file) { Serial.println("- failed to write file"); return; } if(file.print(message)) { Serial.println("- writed file"); } else { Serial.println("- failed to write file"); } } void setup() { // Init serial, LittleFS and ON LED Serial.begin(115200); pinMode(LED_BUILTIN, OUTPUT); digitalWrite(LED_BUILTIN, HIGH); LittleFS.begin(); // Load values saved in LittleFS ssid = readFile(LittleFS, ssidPath); pass = readFile(LittleFS, passPath); Serial.println(ssid); Serial.println(pass); if(ssid == "") { AsyncWebServer server(WIFI_PORT); // Connect to Wi-Fi network with SSID and password Serial.println("Beggining AP..."); WiFi.softAP(WIFI_USER, NULL, WIFI_CHANNEL); IPAddress IP = WiFi.softAPIP(); Serial.print("AP IP: "); Serial.println(IP); // Web Server Root URL server.on("/", HTTP_GET, [](AsyncWebServerRequest *request){ request->send(LittleFS, "/index.html", "text/html"); }); server.serveStatic("/", LittleFS, "/"); server.on("/", HTTP_POST, [](AsyncWebServerRequest *request) { int params = request->params(); for(int i=0;i<params;i++) { AsyncWebParameter* p = request->getParam(i); if(p->isPost()) { // HTTP POST ssid value if (p->name() == PARAM_INPUT_1) { ssid = p->value().c_str(); Serial.print("SSID: "); Serial.println(ssid); // Write file to save value writeFile(LittleFS, ssidPath, ssid.c_str()); } // HTTP POST pass value if (p->name() == PARAM_INPUT_2) { pass = p->value().c_str(); Serial.print("Password: "); Serial.println(pass); // Write file to save value writeFile(LittleFS, passPath, pass.c_str()); } } } request->send(200, "text/plain", "Finished. The device will restart"); vTaskDelay(pdMS_TO_TICKS(3000)); rp2040.reboot(); // restart device }); server.begin(); } } ``` The software needs to detect if there are a connection avaliable and if aren't, it opens an AP and set up a HTML page where the user can send the parameters for the Wi-Fi network and these params are saved in a .txt file using LittleFS, so the system reboots and on the next boot, it can read the file with the Wi-Fi credentials and connect to network. The code compiles and uploads to the Pico, but when I connect to the AP and type the IP in the browser, it gives a ERR_CONNECTION_REFUSED error. I tried to change various parameters without success, and earlier versions of the code opened the page, but now doesn't open at any cost. Can someone give a hint?
It's because in `GetAllProducts`, type `T` is not decided yet. So it is impossible to assign `[]models.Products` to `T`. You can assign `models.Products` to `T` if `T` is decided, like this. ```golang db := DbConnection[Products]{} var re []Products re, _ = db.GetAll() fmt.Println(re) ``` I reproduce your problem using this entire code. You can find the same error `GetAllProducts()` but in the main code, it works. ```golang package main import "fmt" type DbOperations[T any] interface { GetAll() ([]T, error) } type DbConnection[T any] struct { field []T } func (db *DbConnection[T]) GetAll() ([]T, error) { return db.field, nil } type Products struct{} func (db *DbConnection[T]) GetAllProducts() { var re []Products re, _ = db.GetAll() } func main() { db := DbConnection[Products]{} var re []Products re, _ = db.GetAll() fmt.Println(re) } ```