instruction
stringlengths
0
30k
|c#|constraints|
null
I have an issue with node fs.unlink I have a function that writes files to disk storage extracts data from the these files then deletes the files ```js const parseShpFile = async ({ cpgFile, dbfFile, prjFile, qmdFile, shpFile, shxFile, }) => { // saving binary files to local machine const dbfPath = await saveBinaryToLocalMachine(dbfFile); const shpPath = await saveBinaryToLocalMachine(shpFile); //reading files from local machine using shapefile const shpParsedData = await shapefile .open(shpPath, dbfPath) .then((src) => src.read()) .then((data) => { return data; }) .then(async (data) => { // deleting from the local machine deleteFilesFromLocal([shpPath, dbfPath]); return data; }) .catch((e) => { console.log("Error", e); }); return shpParsedData; }; ``` the delete function is ```js const deleteFilesFromLocal = async (filePaths) => { for (const filePath of filePaths) { try { fs.unlinkSync(path.resolve(filePath)); } catch (e) { console.log("error in deleting file", filePath); } } }; ``` The issue is when I run this code the files are not removed from the desk until the server restarts or shutdowns. Before server restart or shutdown [![enter image description here][1]][1] After the server restarted. [![enter image description here][2]][2] [1]: https://i.stack.imgur.com/2shE3.png [2]: https://i.stack.imgur.com/GRxkJ.png
In Delphi, you can use the StringReplace function from the SysUtils unit to replace multiple spaces with a single space. However, StringReplace only works on one occurrence at a time. To remove all instances of multiple spaces without looping, you can use a regular expression with the TRegEx class from the System.RegularExpressions unit. Here's a simple way to do it in one line: uses System.RegularExpressions; // ... ResultString := TRegEx.Replace(InputString, '\s+', ' '); This line of code will replace all sequences of one or more whitespace characters (\s+) in InputString with a single space, and store the result in ResultString. Remember to add System.RegularExpressions to your uses clause to access the TRegEx class. Thank you for taking the time to view my post. I appreciate your attention and assistance!
Make the code in line 2 to: int i = 0.00 As java needs a value beforehand when you create the variable. I hope it works fine after that:)
{"Voters":[{"Id":14122,"DisplayName":"Charles Duffy"},{"Id":4154375,"DisplayName":"pjh"},{"Id":9952196,"DisplayName":"Shawn"}]}
I'm trying to insert a cylinder in the MCNP 6 code. I believe I defined the surfaces and planes correctly. What could be wrong? Surfaces: 520 cz 435 1 5020 px 435 6020 px 450 Cells: 81 5 -1.2250E-3 (-520 5020 -6020) 99 5 -1.2250E-3 -3552 1050 -110 (110:-1050:-33:33:29:-35:36) (110:-1050:-30:34:-35:36) (110:-109:-29:30:-35:36) (109:-1050:-29:30:31:-35) (109:-1050:-29:30:-32:36) (110:-1050:-33:29:-35:36) (520:-5020:6020) What could be wrong?
This question is incomplete. We need to know what you use for styling in order to give you more guidance. If you use css for it, you can have a look at the focus pseudo-class. It is generally triggered, when the user clicks or taps on an element or selects it with the keyboard's Tab key. [:focus][1] <!-- begin snippet: js hide: false console: true babel: false --> <!-- language: lang-css --> label { display: block; margin-top: 1em; } input:focus { background-color: lightblue; } select:focus { background-color: ivory; } <!-- language: lang-html --> <form> <p>Which flavor would you like to order?</p> <label>Full Name: <input name="firstName" type="text" /></label> <label >Flavor: <select name="flavor"> <option>Cherry</option> <option>Green Tea</option> <option>Moose Tracks</option> <option>Mint Chip</option> </select> </label> </form> <!-- end snippet --> [1]: https://developer.mozilla.org/en-US/docs/Web/CSS/:focus
There are two different concepts for filtering: 1. hybrid search https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-knn-query.html#knn-query-in-hybrid-search https://opster.com/guides/elasticsearch/operations/elasticsearch-hybrid-search/#Hybrid-search-with-dense-models 2. kNN filtering Hybrid search is combining knn search and lexical search. kNN filtering is 1. `filter` inside of the kNN query (which is pre-filtering) 2. `filter` all other filters found in the Query DSL tree (which is post-filtering) There are two ways to filter documents that match a kNN query [pre-filters and post-filters][1]: 1. pre-filtering – filter is applied during the approximate kNN search to ensure that `k` matching documents are returned. 2. post-filtering – filter is applied after the approximate kNN search completes, which results in fewer than `k` results, even when there are enough matching documents. Yes, the first approach can be slow and the second approach can has low recall. You can increase the speed by decreasing the `num_candidates` value and you can tune the search relevancy by increasing the `num_candidates`. It's a trade-off between the search speed and relevancy. --- \* pre-filtering kNN search (48 hits) POST image-index/_search { "knn": { "filter": {...} } } \* post-filtering kNN search (24 hits) POST collection-with-embeddings/_search { "query": { "bool": { "must": {"knn": {...}}, "filter": {...} } } } \* hybrid search (124 hits) POST collection-with-embeddings/_search { "query": {...}, "knn": {...} } Note: for result hits `k` and `num_candidates` and `size` set to `100`. [1]: https://www.elastic.co/guide/en/elasticsearch/reference/current/query-dsl-knn-query.html#knn-query-filtering
Flutter bloc: state does not change after changing new event
{"Voters":[{"Id":328193,"DisplayName":"David"},{"Id":1974224,"DisplayName":"Cristik"},{"Id":17562044,"DisplayName":"Sunderam Dubey"}],"SiteSpecificCloseReasonIds":[13]}
- In Desktop (The emulator turns on automatically) [npm start video](https://youtu.be/uUhNKguiao4) [terminal(?) image](https://i.stack.imgur.com/k913N.png) [emulator image](https://i.stack.imgur.com/GY4MG.png) - On the laptop After turning on the emulator can activate the React-Native Which program is the terminal image among the images? (Powershell X, Azure X, cmd X, ...) I want to use it like a desktop - case of me * What went wrong: Execution failed for task ':app:installDebug'. > com.android.builder.testing.api.DeviceException: No connected devices!
I'm a beginner in using selenium-cucumber, I was trying to automate a web application i have the page objects where i used findelements to get all the elements that is where i'm getting the Null pointer exception I was having similar issue before as well any leads on this is much appreciated This is my first question let me know if any more info is required ***Feature file:*** Feature: I want to select product on the page Scenario: Given user is on landing page When user enters username and password and click clickSignIn |username|abcd@gmail.com| |password|Hinata@12| And user hovers on the category and the product then selects required item |category|Women | |product |tops | |item |Hoodies & Sweatshirts| And user exists the browser. ***Homepage class:*** i have multiple options when i hover on them it will show more options to choose. ``` public HomePage(WebDriver driver) { this.driver = driver; PageFactory.initElements(driver, this); } ``` ``` public void productCategories(String category) { try { int size = optionsProduct.size(); for (int i = 0; i < size; i++) { String actualText = optionsProduct.get(i).getText(); String ExpectedText = category; if (actualText.equalsIgnoreCase(ExpectedText)) { Actions actions = new Actions(driver); WebElement categoryName = driver.findElement(By.xpath("//li[contains(@class,'level0')]/a/span[2]")); actions.moveToElement(categoryName).perform(); System.out.println("===Moved to the Element"+ExpectedText); } } } catch (Exception e) { e.printStackTrace(); } } ``` ***Step defs:*** ``` public class ProductTests { WebDriver driver; HomePage hp; @When("user hovers on the category and the product then selects required item") public void user_hovers_on_the_category_and_the_product_then_selects_required_item(DataTable dataTable) { hp = new HomePage(driver); Map<String, String> formdata = dataTable.asMap(); String category = formdata.get("category"); String product = formdata.get("product"); String item = formdata.get("item"); System.out.println("Category is"+category+"product is"+product+"item is"+item); hp.productCategories(category); hp.womensOptions(product); hp.womensSelection(item); } } ``` ***Error:*** java.lang.NullPointerException: Cannot invoke "org.openqa.selenium.SearchContext.findElements(org.openqa.selenium.By)" because "this.searchContext" is null
Node fs.unlink does not delete the files immediatly
|javascript|node.js|backend|node.js-fs|
I am looping through the records in the dataframe and need to convert each row to separate nested JSON ``` from pprint import pprint pprint(pd.to_dict()) ``` {'id':{0: 'A'}, 'col1':{0: 'B'}, 'address_id':{0: ['123','ABC']}, 'address_1':{0: ['Street 123','Street ABC']}, 'address_2':{0: ['Road 123','Road ABC']}, 'city':{0: ['Dallas','Houston']}, 'state':{0: ['Texas','Texas']}, 'addition_details':{0: ['XYZ','LMP']}, } The expected JSON format for reach record is below, I need help to convert to desired output: ``` { 'id':'A', 'col1':'B', 'address':[ {'address_id':'123', 'address_1': 'Street 123', 'address_2': 'Road 123', 'city': 'Dallas', 'state': 'Texas' }, {'address_id':'ABC', 'address_1': 'Street ABC', 'address_2': 'Road ABC', 'city': 'Houston', 'state': 'Texas' } ], 'criteria':[ {'addition_details':'XYZ'}, {'addition_details':'LMP'}, ] } ``` I tried to combine address field: ``` json_output=(pd.groupby(['id','col1']) .apply(lambda x: x[['address_id','address_1','address_2','city','state']].to_dist('list')) .reset_index(name='address').to_json(orient='records')) print(json.dumps(json.loads(json_output),index=2, sort_keys=True)) ``` I am not getting the desired output: [ { "id":"A", "col1":"B", "address":{ "address_id":[ [ '123', 'ABC' ]], "address_1":[ [ 'Street 123', 'Street ABC' ]], "address_2":[ [ 'Road 123', 'Road ABC' ]], ....
Python convert Pandas to nested JSON
|json|python-3.x|pandas|
The embedding layer is defined with `input_dim=vocab_size`, but I don't see the definition of `vocab_size` in the code snippet you provided. Try this: ```python def build_model(hp): model = keras.Sequential() model.add(Embedding( input_dim=vocab_size, # Make sure vocab_size is defined output_dim=EMBEDDING_DIM, weights=[embedding_matrix], input_length=MAX_SEQUENCE_LENGTH, trainable=False, input_shape=(MAX_SEQUENCE_LENGTH,) # Add input_shape parameter )) # Rest of your code remains unchanged... ``` Also make sure to replace `MAX_SEQUENCE_LENGTH` and provide a valid value for `vocab_size`. After making these changes, try running the hyperparameter tuning process again. Good luck.
Suppose I have colmap camera poses, is it possible and how to obtain a new view of input image `I` (planar object) from a different viewpoint/camera pose using those poses? Colmap camera poses has following data: ``` extr = cam_extrinsics[key] intr = cam_intrinsics[extr.camera_id] height = intr.height width = intr.width uid = intr.id R = np.array(qvec2rotmat(extr.qvec)) T = np.array(extr.tvec) if intr.model=="SIMPLE_PINHOLE": focal_length_x = intr.params[0] FovY = focal2fov(focal_length_x, height) FovX = focal2fov(focal_length_x, width) fx = fy = intr.params[0] cx = intr.params[1] cy = intr.params[2] elif intr.model=="PINHOLE": focal_length_x = intr.params[0] focal_length_y = intr.params[1] FovY = focal2fov(focal_length_y, height) FovX = focal2fov(focal_length_x, width) fx = intr.params[0] fy = intr.params[1] cx = intr.params[2] cy = intr.params[3] ``` ``` class DummyCamera: def __init__(self, uid, R, T, FoVx, FoVy, K, image_width, image_height): self.uid = uid self.R = R self.T = T self.FoVx = FoVx self.FoVy = FoVy self.K = K self.image_width = image_width self.image_height = image_height self.projection_matrix = getProjectionMatrix(znear=0.01, zfar=100.0, fovX=FoVx, fovY=FoVy).transpose(0,1).cuda() self.world_view_transform = torch.tensor(getWorld2View2(R, T, np.array([0,0,0]), 1.0)).transpose(0, 1).cuda() self.full_proj_transform = (self.world_view_transform.unsqueeze(0).bmm(self.projection_matrix.unsqueeze(0))).squeeze(0) self.camera_center = self.world_view_transform.inverse()[3, :3] ``` Colmap camera poses are computed on different flat object, size of images used in this computation is different from size of image `I` going from this: ![input image](https://i.stack.imgur.com/SyQ5q.jpg) to this after transformation using colmap pose: ![expected image](https://i.stack.imgur.com/b6k8V.jpg)
Yes, you can do this to a limited degree with gmail. Gmail allows you to define aliases for your account, and you can use those as from addresses in addition to the address you use for sign-in. In gmail, click the settings icon, and go to the "Accounts and import" tab. Click the "Add another email address" link and you'll get this pop-up: [![Adding an alias in gmail][1]][1] Enter your details and you'll have a new address that you can use as your from address. In your PHPMailer script you'll then be able to do exactly what you're doing in your script, having different addresses in `Username` and `From`. Note that this doesn't mean that you can use arbitrary addresses as you still have to define all aliases within your account first. If this is on a contact form, don't try to use the submitter's address as the from address; that's what reply-to is for, as [the example contact form provided with PHPMailer](https://github.com/PHPMailer/PHPMailer/blob/master/examples/contactform.phps) shows. Minor aside: `$mail->SMTPSecure = "TLS";` should be `$mail->SMTPSecure = "tls";`. [1]: https://i.stack.imgur.com/Oyy0M.png
i am getting below error while trying to start my java application. i configured java 17 in intellij and in environment variable. So just wanted to know, what is the possible reason of this error. Execution failed for task ':DemoApplication.main()'. > Process 'command 'C:\Program Files\Java\jdk-17\bin\java.exe'' finished with non-zero exit value 1 Try: > Run with --stacktrace option to get the stack trace. > Run with --info or --debug option to get more log output. > Run with --scan to get full insights. > Get more help at https://help.gradle.org. Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0. You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins. For more on this, please refer to https://docs.gradle.org/8.7/userguide/command_line_interface.html#sec:command_line_warnings in the Gradle documentation. BUILD FAILED in 3s 3 actionable tasks: 2 executed, 1 up-to-date
Process 'command 'C:\Program Files\Java\jdk-17\bin\java.exe'' finished with non-zero exit value 1
|java|spring-boot|gradle|intellij-idea|java-17|
{"Voters":[{"Id":476,"DisplayName":"deceze"}]}
I’m working on developing a Teams tab app in Angular. I’m stuck at the authentication process. To summarize the problem, the Angular app itself is working fine and the authentication using Entra is working fine in the web app. I tried using loginPopup and loginRedirect from MsalService on the web app and that works without a problem. In the Teams app instead, I’m initializing the app in the app.component.ts file using `app.initialize()`. I’m using `authentication.authenticate()` from @microsoft/teams-js. I'm using @azure/msal-angular (3.0.12), @azure/msal-browser (3.9.0) and @microsoft/teams-js (2.20.0). ``` authentication.authenticate({       url: window.location.origin + "/auth-start",       width: 600,       height: 535     })       .then((result) => {         console.log("Login succeeded: " + result);       })       .catch((reason) => {         console.log("Login failed: " + reason);       }); ``` Here's auth-start ``` ngOnInit(): void {     this.msalService.handleRedirectObservable().subscribe();     app.getContext().then(async (context) => {       this.loginRedirect(context.user?.loginHint);     });   }   loginRedirect(loginHint?: string) {       let req = { ...this.msalGuardConfig.authRequest } as RedirectRequest;       req.loginHint = loginHint;       req.redirectUri = window.location.origin + `/auth-end`;       this.msalService.loginRedirect(req);   } ``` Here’s auth-end: ```   ngOnInit(): void {       app.getContext().then(async (context) => {         await this.msalInstance.initialize();         await this.msalInstance.handleRedirectPromise()           .then((tokenResponse) => {             if (tokenResponse !== null) {               authentication.notifySuccess(JSON.stringify(tokenResponse));             } else {               authentication.notifyFailure("Get empty response.");             }           })           .catch((error) => {             authentication.notifyFailure(JSON.stringify(error));           });       });   } ``` After the authentication process, the code reaches authentication.notifySuccess, it returns the correct tokenResponse from auth-end and the popup closes as expected. Then the problem starts. After the popup closes, the main app is supposed to authenticate but it doesn’t do anything. I tried authenticating it manually using `msalService.instance.setActiveAccount()` but with no success. Here’s my app configuration which is authenticating correctly for the website but not the Teams app: ``` export function MSALInstanceFactory(): IPublicClientApplication { return new PublicClientApplication({ auth: { clientId: environment.msalConfig.auth.clientId, authority: environment.msalConfig.auth.authority, redirectUri: '/', postLogoutRedirectUri: '/', navigateToLoginRequestUrl: false }, cache: { cacheLocation: BrowserCacheLocation.SessionStorage }, system: { allowNativeBroker: false, // Disables WAM Broker loggerOptions: { loggerCallback, logLevel: LogLevel.Info, piiLoggingEnabled: false } } }); } export function MSALInterceptorConfigFactory(): MsalInterceptorConfiguration { const protectedResourceMap = new Map<string, Array<string>>([ [environment.graphConfig.uri, environment.graphConfig.scopes], [environment.apiUrl, environment.apiScopes] ]); return { interactionType: InteractionType.Redirect, protectedResourceMap }; } export function MSALGuardConfigFactory(): MsalGuardConfiguration { return { interactionType: InteractionType.Redirect, authRequest: { scopes: [...environment.graphConfig.scopes] }, loginFailedRoute: '/login-failed' }; } export const appConfig: ApplicationConfig = { providers: [ provideRouter(routes), provideClientHydration(), provideAnimationsAsync(), provideHttpClient(withInterceptors([errorInterceptor]), withInterceptorsFromDi()), { provide: HTTP_INTERCEPTORS, useClass: MsalInterceptor, multi: true }, { provide: MSAL_INSTANCE, useFactory: MSALInstanceFactory }, { provide: MSAL_GUARD_CONFIG, useFactory: MSALGuardConfigFactory }, { provide: MSAL_INTERCEPTOR_CONFIG, useFactory: MSALInterceptorConfigFactory }, MsalService, MsalGuard, MsalBroadcastService, { provide: MAT_FORM_FIELD_DEFAULT_OPTIONS, useValue: { appearance: 'outline' } }, provideNativeDateAdapter(), { provide: MAT_DATE_LOCALE, useValue: 'en-GB' } ] }; ``` In my testing, I’ve found that the popup itself gets authenticated as it shows the component guarded by MsalGuard when the authentication process is complete, but after it is closed, the main app stays unauthenticated.
How to authenticate a Teams tab app built in Angular using Microsoft Entra
|angular|microsoft-teams|microsoft-teams-js|microsoft-entra-id|
null
I am writing a request handler in a telegram bot. I am having difficulty processing the waiting for pressing the inline button, can you tell me if this can be implemented? I have a ticket monitoring start handler, get them in json, then process each ticket in the list. ``` class MonitoringStatus(StatesGroup): monitoring_active = State() monitoring_pending = State() waiting_for_ticket_action = State() ``` ``` def get_ticket_keyboard(): builder = InlineKeyboardBuilder() builder.add( InlineKeyboardButton( text="assign", callback_data="assign"), InlineKeyboardButton( text="resolve", callback_data="resolve"), ) return builder.as_markup() ``` ``` @router.message(None or MonitoringStatus.monitoring_pending, F.text == 'Start Monitoring') async def start_monitoring(message: Message, state: FSMContext): await state.set_state(MonitoringStatus.monitoring_active) await state.update_data(is_monitoring_active=True) await asyncio.sleep(3) await message.answer('Monitoring started') while True: is_monitoring_active = data.get('is_monitoring_active', False) if not is_monitoring_active: break tickets = await fetch_tickets_from_file() for ticket in tickets: await message.answer(f'Ticket: {ticket["ticket_number"]}\n' f'Reporter: {ticket["reporter"]}\n' f'Description: {ticket["description"]}', reply_markup=get_ticket_keyboard()) await MonitoringStatus.waiting_for_ticket_action.set() await asyncio.sleep(10) ``` And I get an error AttributeError: 'State' object has no attribute 'set'. If I don't use the set() function, all requests from tickets instantly leave messages in telegram, but I need to process each request sequentially.
What you are suggesting is called "Command Guidance" but there is an easier, and better way. The way that real missiles generally do it (Not all are alike) is using a system called Proportional Navigation. This means the missile "turns" in the same direction as the line-of-sight (LOS) between the missile and the target is turning, at a turn rate "proportional" to the LOS rate... This will do what you are asking for as when the LOS rate is zero, you are on collision course. You can calculate the LOS rate by just comparing the slopes of the line between missile and target from one second to the next. If that slope is not changing, you are on collision course. if it is changing, calculate the change and turn the missile by a proportionate angular rate... you can use any metrics that represent missile and target position. For example, if you use a proportionality constant of 2, and the LOS is moving to the right at 2 deg/sec, turn the missile to the right at 4 deg/sec. LOS to the left at 6 deg/sec, missile to the left at 12 deg/sec... In 3-d problem is identical except the "Change in LOS Rate", (and resultant missile turn rate) is itself a vector, i.e., it has not only a magnitude, but a direction (Do I turn the missile left, right or up or down or 30 deg above horizontal to the right, etc??... Imagine, as a missile pilot, where you would "set the wings" to apply the lift... Radar guided missiles, which "know" the rate of closure. adjust the proportionality constant based on closure (the higher the closure the faster the missile attempts to turn), so that the missile will turn more aggressively in high closure scenarios, (when the time of flight is lower), and less aggressively in low closure (tail chases) when it needs to conserve energy. Other missiles (like Sidewinders), which do not know the closure, use a constant pre-determined proportionality value). FWIW, Vietnam era AIM-9 sidewinders used a proportionality constant of 4.
This should fix your problem if by 'disappear' you meant the paragraph to disappear, but not the button, as referred to in your code above. Please check the code below. I hope it helps you. const paragraph = document.getElementById("p1Text"); const button = document.getElementById("button"); button.addEventListener("click",() => { if(paragraph.style.display === "none" || paragraph.style.display ==="") { paragraph.style.display = "block"; } else { paragraph.style.display = "none"; } });
I'm having an application on Symfony 6.3. I've created a Service, but I've always the error "Class "App\Service\DeclarationService" does not exist". I don't understand where is the mistake. DeclarationController : namespace App\Controller; use App\Service\DeclarationService; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; use Symfony\Component\Routing\Annotation\Route; class DeclarationController extends AbstractController { #[Route('/', name: 'app_declaration')] public function index(DeclarationService $declarationService): Response { $annees = $declarationService->createYearsArray(); return $this->render('declaration/index.html.twig', [ 'annees' => $annees, ]); } } DeclarationService : namespace App\Service; class DeclarationService { public function createYearsArray(): array { $dateArray = []; for ($i=0; $i <= 4; $i++) { $dateArray[] = date('Y', strtotime('-'.$i.' years')); } sort($dateArray); return $dateArray; } } services.yaml : parameters: domain_name: '%env(DOMAIN_NAME)%' services: # default configuration for services in *this* file _defaults: autowire: true # Automatically injects dependencies in your services. autoconfigure: true # Automatically registers your services as commands, event subscribers, etc. bind: $domainName: '%domain_name%' # makes classes in src/ available to be used as services # this creates a service per class whose id is the fully-qualified class name App\: resource: '../src/' exclude: - '../src/DependencyInjection/' - '../src/Entity/' - '../src/Kernel.php' Any suggestion is welcomed.
Getting NullPointerException when trying to use FindElements to read all elements
|java|selenium-webdriver|nullpointerexception|webdriver|cucumber|
null
{"Voters":[{"Id":147356,"DisplayName":"larsks"},{"Id":1974224,"DisplayName":"Cristik"},{"Id":17562044,"DisplayName":"Sunderam Dubey"}],"SiteSpecificCloseReasonIds":[13]}
{"Voters":[{"Id":8496462,"DisplayName":"GuiFalourd"},{"Id":1974224,"DisplayName":"Cristik"},{"Id":6463558,"DisplayName":"Lin Du"}]}
# hardhat shows the below after running npx npx hardhat init sh: 1: hardhat: Permission denied # I tried removing and installing the latest versions of node.js and still received the permission error after trying. Any assistance with setting up hardhat on WSL would be appreciated.
Hardhat permission denied
|node.js|npx|hardhat|
null
{"Voters":[{"Id":328193,"DisplayName":"David"},{"Id":1974224,"DisplayName":"Cristik"},{"Id":17562044,"DisplayName":"Sunderam Dubey"}],"SiteSpecificCloseReasonIds":[13]}
{"Voters":[{"Id":1191247,"DisplayName":"user1191247"},{"Id":1974224,"DisplayName":"Cristik"},{"Id":6463558,"DisplayName":"Lin Du"}]}
{"Voters":[{"Id":18309290,"DisplayName":"user18309290"},{"Id":1974224,"DisplayName":"Cristik"},{"Id":6463558,"DisplayName":"Lin Du"}],"SiteSpecificCloseReasonIds":[13]}
{"Voters":[{"Id":14853083,"DisplayName":"Tangentially Perpendicular"},{"Id":1974224,"DisplayName":"Cristik"},{"Id":17562044,"DisplayName":"Sunderam Dubey"}],"SiteSpecificCloseReasonIds":[18]}
hello on my server clang 11.0.1 version is installed but my project is compiled with clang14, when I write the command " pkg install clang14 " I get an error like clang14 not found. please help me solve this problem, thank you. [enter image description here](https://i.stack.imgur.com/n6Vq0.png) I tried to download clang14 from llvm web page but I couldn't install it :(
How can I switch from clang11 to clang14 on freebsd?
|c++|clang|clang++|freebsd|pkg|
null
I am working on a C++ project with qml files. I have documented C++ files using doxygen but in the same project, I'm also having many .qml files. For documenting qml files, I instlaled doxyqml. My requirement is C++ files and qml file should be documented separately. Issue I'm facing is, this project is having all C++ and qml files with same name like Login.cpp, Login.qml, DatabaseHandler.cpp, DatabaseHandler.qml, likewise all the .cpp and .qml files are having same name. So when I'm trying to document, whichever files having same names, both the C++ and qml content are documented in single class Login, DatabaseHandler, etc. But I need to document C++ class as separate class and qml class as separate class although they have same name. Can anyone help me how to resolve this?
Symfony 6.3 Class "App\Service\DeclarationService" does not exist
|php|symfony|
{"Voters":[{"Id":-1,"DisplayName":"Community"}]}
Hi I am trying to update a database table rows with the same row ID using PHP for loop but it only updates all the rows in the database table with the last iteration data when i ECHO the update query it shows the correct update code in each iteration below i have included the code and necessary screenshots PHP ForLoop code ``` if (!empty($_POST['cycleStartDate']) && !empty($_POST['mainSystemLink']) && !empty($_POST['paymentMethod'])) { $invoice_stat = 'no'; // Assuming you have the initial payment date // If payment method is monthly, add 1 month to the current date for the next iteration if ($paymentMethod == 'monthly') { $description = $_POST['mainSystemLink']; // Assuming the description is the same for all iterations $amount = $_POST['payment']; // Assuming the amount is the same for all iterations $aId = $_POST['AutoId']; // Assuming the AutoId is the same for all iterations $cycleStartDate = $_POST['cycleStartDate']; for ($i = 0; $i < 12; $i++) { // Construct the query $query = "UPDATE `hosting_payment` SET `payment_date` = '$cycleStartDate', `description`='$main_sys_link', `amount`='$payment', `payment_method`='$paymentMethod' WHERE `project_id`='$proj_id'"; // Execute the query $result = mysqli_query($con, $query); // Update paymentDate for the next iteration $cycleStartDate = date('Y-m-d', strtotime($cycleStartDate . ' +1 month')); echo $query; } } ``` update query echo output ``` 59Record updated successfullyUPDATE `hosting_payment` SET `payment_date` = '2024-01-05', `description`='www.dasisprinters.com1' , `amount`='30000', `payment_method`='monthly' WHERE `project_id`='59'UPDATE `hosting_payment` SET `payment_date` = '2024-02-05', `description`='www.dasisprinters.com1' , `amount`='30000', `payment_method`='monthly' WHERE `project_id`='59'UPDATE `hosting_payment` SET `payment_date` = '2024-03-05', `description`='www.dasisprinters.com1' , `amount`='30000', `payment_method`='monthly' WHERE `project_id`='59'UPDATE `hosting_payment` SET `payment_date` = '2024-04-05', `description`='www.dasisprinters.com1' , `amount`='30000', `payment_method`='monthly' WHERE `project_id`='59'UPDATE `hosting_payment` SET `payment_date` = '2024-05-05', `description`='www.dasisprinters.com1' , `amount`='30000', `payment_method`='monthly' WHERE `project_id`='59'UPDATE `hosting_payment` SET `payment_date` = '2024-06-05', `description`='www.dasisprinters.com1' , `amount`='30000', `payment_method`='monthly' WHERE `project_id`='59'UPDATE `hosting_payment` SET `payment_date` = '2024-07-05', `description`='www.dasisprinters.com1' , `amount`='30000', `payment_method`='monthly' WHERE `project_id`='59'UPDATE `hosting_payment` SET `payment_date` = '2024-08-05', `description`='www.dasisprinters.com1' , `amount`='30000', `payment_method`='monthly' WHERE `project_id`='59'UPDATE `hosting_payment` SET `payment_date` = '2024-09-05', `description`='www.dasisprinters.com1' , `amount`='30000', `payment_method`='monthly' WHERE `project_id`='59'UPDATE `hosting_payment` SET `payment_date` = '2024-10-05', `description`='www.dasisprinters.com1' , `amount`='30000', `payment_method`='monthly' WHERE `project_id`='59'UPDATE `hosting_payment` SET `payment_date` = '2024-11-05', `description`='www.dasisprinters.com1' , `amount`='30000', `payment_method`='monthly' WHERE `project_id`='59'UPDATE `hosting_payment` SET `payment_date` = '2024-12-05', `description`='www.dasisprinters.com1' , `amount`='30000', `payment_method`='monthly' WHERE `project_id`='59' ``` Database Screenshots [![enter image description here][1]][1] [1]: https://i.stack.imgur.com/rjgnb.png please can you guys check and let me know the necessary fixes THANKS FOR YOUR VALUABLE TIME
While running test classes using jest.spyOn my test is failing
|jestjs|salesforce|phpunit|ts-jest|tooling|
null
I want to hold backspace button for several seconds then release it, but it only clicks 1 once (deletes a single character) Latest version of both modules import pyautogui import time time.sleep(2) pyautogui.keyDown('backspace') time.sleep(5) pyautogui.keyUp('backspace') this is what I tried expecting it to hold backspace for 5 seconds, but it only deletes a single character
Pyautogui malfunctions?
|python-3.x|time|pyautogui|
null
you can use aggregation query for it. ```MONGODB db.collection.aggregate([ {$match:{source:'here'}, {$addFields:{count:1}}, {$group:{_id:'$date' ,totalDocuments:{$sum:"$count"}} } ]) ```
I have a vectorised def: def selection_update_weights(df): # Define the selections for 'Win' selections_win = ["W & O 2.5 (both untested)", "Win (untested) & O 2.5", "Win & O 2.5 (untested)", "W & O 2.5", "W & O 1.5 (both untested)", "Win (untested) & O 1.5", "Win & O 1.5 (untested)", "W & O 1.5", "W & U 4.5 (both untested)", "Win (untested) & U 4.5", "Win & U 4.5 (untested)", "W & U 4.5", "W (untested)", "W"] # Create a boolean mask for the condition for 'Win' mask_win = (df['selection_match'] == "no match") & \ (df['selection'].isin(selections_win)) & \ (df['result_match'] == "no match") & \ (df['result'] != 'draw') # Apply the condition and update the 'Win' column df.loc[mask_win, 'Win'] = df.loc[mask_win, 'predicted_score_difference'] + 0.02 # Define the selections for 'DNB' selections_DNB = ["DNB or O 2.5 (both untested)", "DNB (untested) or O 2.5", "DNB or O 2.5 (untested)", "DNB or O 2.5", "DNB or O 1.5 (both untested)", "DNB (untested) or O 1.5", "DNB or O 1.5 (untested)", "DNB or O 1.5", "DNB (untested)", "DNB"] # Create a boolean mask for the condition for 'DNB' mask_DNB = ((df['selection_match'] == 'no match') & \ (df['selection'].isin(selections_DNB)) & \ (df['result_match'] == 'no match') & \ (df['result'] != 'draw')) # Apply the condition and update the 'DNB' column df.loc[mask_DNB, 'DNB'] = df.loc[mask_DNB, 'predicted_score_difference'] + 0.02 # Define the selections for O 1.5' selections_O_1_5 = ["W & O 1.5 (both untested)", "Win (untested) & O 1.5", "Win & O 1.5 (untested)", "W & O 1.5", "DNB or O 1.5 (both untested)", "DNB (untested) or O 1.5", "DNB or O 1.5 (untested)", "DNB or O 1.5", "O 1.5 (untested)", "O 1.5"] # Create a boolean mask for the condition for 'O 1.5' mask_O_1_5 = ((df['selection_match'] == 'no match') & \ (df['selection'].isin(selections_O_1_5)) & \ (df['total_score'] < 2)) # Apply the condition and update the 'O 1.5' column df.loc[mask_O_1_5, 'O_1_5'] = df.loc[mask_O_1_5, 'predicted_total_score'] + 0.02 # Define the selections for O 2.5' selections_O_2_5 = ["W & O 2.5 (both untested)", "Win (untested) & O 2.5", "Win & O 2.5 (untested)", "W & O 2.5", "DNB or O 2.5 (both untested)", "DNB (untested) or O 2.5", "DNB or O 2.5 (untested)", "DNB or O 2.5", "O 2.5 (untested)", "O 2.5"] # Create a boolean mask for the condition for 'O 2.5' mask_O_2_5 = ((df['selection_match'] == 'no match') & \ (df['selection'].isin(selections_O_2_5)) & \ (df['total_score'] < 3)) # Apply the condition and update the 'O 2.5' column df.loc[mask_O_2_5, 'O_2_5'] = df.loc[mask_O_2_5, 'predicted_total_score'] + 0.02 # Define the selections for U 4.5' selections_U_4_5 = ["W & U 4.5 (both untested)", "Win (untested) & U 4.5", "Win & U 4.5 (untested)", "W & U 4.5", "U 4.5 (untested)", "U 4.5"] # Create a boolean mask for the condition for 'O 2.5' mask_U_4_5 = ((df['selection_match'] == 'no match') & \ (df['selection'].isin(selections_U_4_5)) & \ (df['total_score'] > 4)) # Apply the condition and update the 'O 2.5' column df.loc[mask_U_4_5, 'U_4_5'] = df.loc[mask_U_4_5, 'predicted_total_score'] - 0.02 return df and I apply it by: df = selection_update_weights(df) While I have a very large dataframe, This snippet **is where the weights dont get updated**. Weights are updated partially. And I am not sure why. df.head(): home_score away_score total_score score_difference predicted_total_score predicted_score_difference result predicted_result result_match Win DNB O_1_5 O_2_5 U_4_5 selection selection_match 44 3 3 6 0 8.748172 8.135116 draw home no match 1.1 0.7 2.0 3.000000 4.0 W & O 2.5 (both untested) no match 50 1 0 1 1 8.605350 7.932909 home home match 1.1 0.7 2.0 8.625350 4.0 W & O 1.5 (both untested) no match 57 1 1 2 0 7.510030 7.750101 draw home no match 1.1 0.7 2.0 7.530030 4.0 W & O 1.5 (both untested) no match 62 0 1 1 1 8.895045 7.710740 away away match 1.1 0.7 2.0 8.915045 4.0 W & O 1.5 (both untested) no match 85 1 0 1 1 8.099853 7.444815 home home match 1.1 0.7 2.0 8.119853 4.0 W & O 1.5 (both untested) no match so when i am applying it: df = selection_update_weights(df) I should ideally get home_score away_score total_score score_difference predicted_total_score predicted_score_difference result predicted_result result_match Win DNB O_1_5 O_2_5 U_4_5 selection selection_match 3 3 6 0 8.748172 8.135116 draw home no match 8.155116 0.7 2.0 3 4.0 W & O 2.5 (both untested) no match 1 0 1 1 8.605350 7.932909 home home match 1.100000 0.7 8.625350 8.625350 4.0 W & O 1.5 (both untested) no match 1 1 2 0 7.510030 7.750101 draw home no match 7.770101 0.7 2.0 7.530030 4.0 W & O 1.5 (both untested) no match 0 1 1 1 8.895045 7.710740 away away match 1.100000 0.7 8.915045 8.915045 4.0 W & O 1.5 (both untested) no match 1 0 1 1 8.099853 7.444815 home home match 1.100000 0.7 8.119853 8.119853 4.0 W & O 1.5 (both untested) no match However thats not happening and the original dataframe is unaffected. *Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum*
python: Vectorised function does not apply when all conditions are met
|python|pandas|dataframe|function|
Imagine site is `https://www.example.com` and it maps to `/var/www/example.com/public` I have a typical index.php router to feed any request within example.com through index.php: ```htaccess RewriteEngine On RewriteBase / RewriteRule ^index\.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] ``` Can I serve files in the `other` or `thing` directories from another location on the server (outside example.com's directory root), such as `/var/www/othersite.org/public/other/`? ```htaccess RewriteRule ^(other|thing)/?(.*) /var/www/othersite.org/public/$1/$2 [L] ``` I get a 'unable to process this request' error.
php / htaccess - serve files from another directory outside directoryroot?
|php|apache|.htaccess|
I get a 403 while using Cypress custom commands to login into a webpage I'm testing. If I log in manually, it doesn't returns any kind of error, but with Cypress I always get the same state: > "403 Forbiden > > Login Failed: Unable to find a valid CSRF token. Please try again. > > Request ID: f88dd507-22e4-4776-9113-d2e5fbc3f8ec" Gladly, there's a "Login" button at the page that allows me to continue: [403 error](https://i.stack.imgur.com/Q9JgA.png) So, I think I must create a test with any cookies used at the moment of the login to bypass this issue? Here's the test I'm doing: ``` Cypress.Commands.add('login', (email, password) => { cy.session([email, password], () => { cy.visit('baseURL') cy.get('[data-test="email"]').type(email); cy.get('.has-right-element').type(password) cy.get('button[type="submit"]').click() cy.get(':nth-child(2) > form > .button').click() // The "Login" button at the 403 error }) }) ``` Nothing out of the ordinary. I've also used another one to capture the cookies that are being used at the moment of the login: ``` Cypress.Commands.add('loginAndSaveCookies', (email, password) => { cy.visit('baseURL') cy.get('[data-test="email"]').type(email) cy.get('.has-right-element').type(password) cy.get('button[type="submit"]').click() cy.get(':nth-child(2) > form > .button').click() cy.getCookies().then((cookies) => { cy.writeFile('cypress/fixtures/cookies.json', cookies) }) }) ``` Here are the cookies that are being sent: ``` [ { "name": "_oauth2_proxy_csrf", "value": "sxvnE7akcD26gzrK2N8w3q0EENUsPIxBTPNbbI6QxvLBSSJ6ufkmSeOwST3vEkBqOt9R_O1-XGcSX7w0GynDLLoW6x4e5JEo6noGBBUEiUPNotwrRb5b9PE=|1710311225|AjqwRehQxbfOul4wQTmj2_F9C2NSdtgJZ3K5prAxEso=", "path": "/", "secure": true, "hostOnly": true, "httpOnly": true, "expiry": 1710312125, "domain": "webpage being tested", "sameSite": "lax" }, { "name": "_oauth2_proxy", "value": "8uThtxIW4Mkrw2KtjHvPXAMUKtqUeYeK4SHWm8CBuvFSg50UDx84-Iec26tJhlO0W40hbGV-nCLLL2ZyZb14YTce8XvV7-9CrzLriMeGFCcFve3ytzhYS5CpmjsSKcrMqq_35YvL8iHkU5YrhCj132e2EGt-X_HQY4y0Z46f9ch1Y1U6DZ7q_lefEhBoGCBqQiwGM0-EWJ0oVaCMpTVxObSZhAlegZWfYpWzrNJqgm0zlChADbobsnyLBn72Gi4_kO0gUa5eEdhCyhFysxC9yDH8XS3bUtmch7bRJ9vVU8ZjbshwWdISfyf1hyf02M2Sir53a0GJmFua_N9r9m6tzBJvSCza7YddBeBZ9sckd0iL9Ij51E_QIRl8MeFDUTWkw_uH2yrBWeWpa-OK54jlpkrTOAA0Apt1FZD_PljVAOc2ikzyXhaxD35VvRI6pORkhvErJ3pGqS25ufbWFrHG5TaQPnNmY9IyQZRR658mD4sLJ4OqQVWbAUX8tFhf-Td73RMFi5aMm8thjMj1bz8QAKcao2HbAvwV_KMNacVn487joQ6Q9ZnT-tQkqVOn95ED5nx08497qPtJ8Q9LacOyel1hVudFpTxUssJDEpgRUEWRJo4s_G2utiURi0zbQ56UT1aJrWZgwawMyBLcmACj7UU06MOaKW6HfQvHsmXilHdFIWIyiNe2aaPJ-Z9hngTXkDPdmXFSB2UMrNBuF0IoW9jgyooucHWRVB4bVtBmT0RCXrLtyLKMyplAuwNFUjUllDsM8D19eeAvQA-7QlwpD4EucLsy8Mfp6naYXT1aUSOFw7rlS_-nV_3o2p_Ph7CZ0Mf-yHz7oG3cbb0r7IqlnPIKP9_1hn_3ZpsM0zvhzeaUBj6M5FUZMeJIDd8kCL5s-ZXsuZFzPYcgFqK6q3T0OiJalYwEawesP_MJ-f0MNhPXWgIJJ3PV7NJp09NszVX6iZrdhVTBbdgaOVXKtWF_amwPD5oM0BfhzXPAjdRIDMSy-ohOi-0Y7c_xWdPE-kPWbdyF5Z88kTLA_BuDCLgA_k5NHfdi1Hq6io9Gtgu8UKHSMxpuORDGvCu2L38OQnIk_EPYEJ8BaaFDyMDjqdY-LwCuhRjf1p_d7p4Cx6sM9odq6PEtCXuj-d82PsNo9V_LSIOdW-0ZgEFdjaVr5W_qbqkyFJ3KK0e3jugwF9PS75rL2ms-h5gD3AGGHISZeh9h2yD61QKqyK2fnpPCZvif5RDLOfAupCIou-HEPhxc8uHCulpgtayx8_ybOW0IDwpc34yarJXsb3EXnu-5gdHpgyUH6OdknWgyTydYqxslRm0zRMn3naFiIBEV-szxYoUB-kiQd0Fl8LATwrdxK4XV6qPEnCGGO0Vq4jrpfk5CU9C2Ixx9N2KTtwfqnV0nT-h3qL_G3q83WwwbB8x501p6d8L-kmnQPPWHotqeiOnA3KNTbB3iLJS-UloK9K5dmtE2ko__KdbsFlmHvLTGOjS8BLbJLfE6HwPO7s2B_VlwhpHtpj1PFRTOn32S8kdJCkyW2Ti9O2kTcmtS-kG-_xCZE6WahCJYzJcNg-gok1XjZLuTffjq8O1d1J-isEkUMjlwGMbC5689g-200UJb0CXiXaHOkkh0CryBxR_Kgpw_OfCWja8eysdjDbdIULai821Hgg3W_6abibQNscpmzFwyVrpBvl1gpJZNbKBloNEabBu1gqWaTccTCv7nPk2sCkTIbqAwx3B_LP2Q71-R0yZJoGlQftptUnE15OzEVXLOKl-YlTn9zhtfpdtgO_JF0f-EUpty2cQ2cNJ5qbIliIJUOkTyQqP6_D6N2FIAgnaHkDX0kR9fZK6tgrQDIlUly_noM2s0-rvy7Dar6Fhn2AzbF9c5GzzSkGOPoK2dM6N0zZenIw7fXV2R-FSNv5_nz3KPiN3Rowm2_AWPCmo9xtQVjqQku0Yo29ic5q5sqkjGPdV04cq4eFen6olpxB6M1Sw1PIvMgZXOOUtEQOB3GB_x_VIe9LyAvHKYnVVPc5WQbaK_posY-Nr9nN8vT4mFqajdD4gVRLRD5dqt-I0DUOLHgco3sBONPQRvk-ansl1NGhOfm7AvU8jQ0PDWKtqpR1TXGy2yjfhmN0vkaHDb3LzjwJ2YLbfhMBjW3gfVao-7XQqmJzVWU1MHWynG1MFKYm8kLVeXHL6BbQxym8MuB67sXuUyGGigbnGI9W-jflvs6Zu7DWzqYbhtgp6Y71CUIRfKVrPfvaLn02GrAOZgqp_61MTeQ2D7DDlMrM9G9ctZy7jHzPiYkYc-T0py6-eEGBOdO3bCGmSBbPLWB3biz43CxRngB0byusBISQyMQSli87mo|1710311226|tzcI0q_ZL29dYQfhGq8eotRiaxyNO9qedY5wWbracdY=", "path": "/", "secure": true, "hostOnly": true, "httpOnly": true, "expiry": 1710916026, "domain": "webpage being tested", "sameSite": "lax" } ] ```
When loggin in with Cypress, I get a 403 error related to a CSRF token
|javascript|authentication|cookies|cypress|csrf-token|
null
You need to mark the fields with the `transient` keyword. It will cause the default serialization mechanism to skip the marked fields. ``` public class MyClass implements Serializable { private transient SampleClass sampleClass; private transient MyService myService; private transient OtherService otherService; } ``` You will also need a way to restore the services when you deserialize an object - via setters for example.
**No, the Telegram API does not allow you to directly access a user's camera. This is for security and privacy reasons.**
New to lua. On example i have multiple ``` local part1 = display.newImage("part1.png", 0, 0) part1:scale ( 0.5, 0.5) part1.isVisible = false ... local part10 = display.newImage("part10.png", 0, 0) part10:scale ( 0.5, 0.5) part10.isVisible = false ``` How can i optimize it using array and for do? Like execute multiple commands from one for-loop whem command only has different numbers? Im sure that this wont work but there should be a way to do what i want? ``` for i = 1, 10 do part[i]:scale ( 0.5, 0.5) part[i].isVisible = false ```
No labels on map using MapLibre GL JS angular
streamlit : The term 'streamlit' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again. At line:1 char:1 + streamlit run c:/Users/Zbook 15 G5/OneDrive/Desktop/main.py/streamlit ... + ~~~~~~~~~ + CategoryInfo : ObjectNotFound: (streamlit:String) [], CommandNotFoundException + FullyQualifiedErrorId : CommandNotFoundException C:\Users\Zbook 15 G5>cd C:\Users\Zbook 15 G5\OneDrive\Desktop C:\Users\Zbook 15 G5\OneDrive\Desktop>cd main.py C:\Users\Zbook 15 G5\OneDrive\Desktop\main.py>cd streamlitenv C:\Users\Zbook 15 G5\OneDrive\Desktop\main.py\streamlitenv>open main.py 'open' is not recognized as an internal or external command, operable program or batch file. C:\Users\Zbook 15 G5\OneDrive\Desktop\main.py\streamlitenv>streamlit run main.py 'streamlit' is not recognized as an internal or external command, operable program or batch file. C:\Users\Zbook 15 G5\OneDrive\Desktop\main.py\streamlitenv>streamlit run main.py 'streamlit' is not recognized as an internal or external command, operable program or batch file. C:\Users\Zbook 15 G5\OneDrive\Desktop\main.py\streamlitenv>streamlit run C:\Users\Zbook 15 G5\OneDrive\Desktop\main.py 'streamlit' is not recognized as an internal or external command, operable program or batch file. C:\Users\Zbook 15 G5\OneDrive\Desktop\main.py\streamlitenv>
path problem when i enter the streamlit run command in terminal
|python|path|streamlit|
null
I want to implement gestures detector in appBar. When user click image or name and it direct to another page. But it display error `Found this candidate, but the arguments don't match. GestureDetector({ ^^^^^^^^^^^^^^^ Try again after fixing the above error(s).` I was trying many things but I get only errors. I am new in all of that and I would appreciate some help. This my appBar code Widget build(BuildContext context) { return MaterialApp( home: Scaffold( appBar: AppBar( flexibleSpace: GestureDetector( onTap: (){ Navigator.pushNamed(context, LoginPage.routeName); }, title: Row( children: [ const CircleAvatar( radius: 20, backgroundImage: NetworkImage( 'https://i1.sndcdn.com/artworks-79AS3zNyDuB420uC-pKTA2w-t500x500.jpg'), ), const SizedBox( width: 10, ), Column( mainAxisSize: MainAxisSize.min, crossAxisAlignment: CrossAxisAlignment.start, children: [ const Text( 'Welcome Back!', style: TextStyle( fontSize: 13, fontWeight: FontWeight.w400, color: Colors.black87) ), Text('Guest', style: TextStyle( fontSize: 19, fontWeight: FontWeight.w600, color: Colors.black87 )), ], ), ], )), forceMaterialTransparency: true, ), body: Container( decoration: BoxDecoration( image: DecorationImage( image: AssetImage('assets/images/header_home.jpg'), fit: BoxFit.cover, ), ), child: SingleChildScrollView( padding: EdgeInsets.symmetric(vertical: 16), child: Column( children: [ filterField(), ], ), ), ), ), );
I have been working with Flutter and I have a doubt. I am trying to show overlay on top of my screen. That's why I am using [flutter_overlay_window][1] In its [example][2] code I found this void main() { WidgetsFlutterBinding.ensureInitialized(); runApp(const MyApp()); } @pragma("vm:entry-point") void overlayMain() { WidgetsFlutterBinding.ensureInitialized(); runApp( const MaterialApp( debugShowCheckedModeBanner: false, home: TrueCallerOverlay(), ), ); } `main` is the main `entrypoint` of dart VM's root isolate. But what about the overlayMain entry point? How does the dart code inside of this entry point gets executed? In a new isolate or the same isolate? Another question, will it be in the same flutter engine or different flutter engine. I know the meaning of `@pragma(vm:entry-point)` notation. These are additional readings I did: 1. [dart vm][3] 2. [dart executor][4] 3. [Flutter engine][5] 4. [Dart isolates][6] Please share any additional resources that I might have missed. [1]: https://pub.dev/packages/flutter_overlay_window [2]: https://github.com/Adora-Inc/flutter_overlay_window/blob/6bcbfadbc35a0cd2bb8be155afead14451c98d5d/example/lib/main.dart#L5 [3]: https://mrale.ph/dartvm/ [4]: https://api.flutter.dev/javadoc/io/flutter/embedding/engine/dart/DartExecutor.html [5]: https://api.flutter.dev/javadoc/io/flutter/embedding/engine/FlutterEngine.html [6]: https://github.com/flutter/engine/blob/main/runtime/dart_isolate.h#L63
Does dart code of a different `@pragma(vm:entry-point)` runs in a separate isolate?
|flutter|dart|dart-isolates|dart-vm|
If you are new to the Ada ecosystem I recommend downloading a version of the GNAT compiler from https://www.adacore.com/download Officially the recommended way nowadays is to use the Alire package manager. It’s also a user friendly way to get started if you are used to package managers.
Update: You can simply use `(name ='')` as order by clause which will return 1 if name is empty other wise 0. select * from comments order by (name ='') If you have `null` as well then you can use: select * from comments order by (NULLIF(name,'') is null) Here `NULLIF(name,'')` will convert empty string into null You can select rows without empty strings first without any order. Then you can select the rows with empty strings. You can combine both the results with `union all` Query: select * from comments where name <>'' union all select * from comments where name ='' Output: | name | |:-----| | Apple | | Orange | | Avocado | | Banana | | Cauliflower | | Broccoli | | Potato | | Cabbage | | | | | [fiddle](https://dbfiddle.uk/u75I0Nmw) Better approach would be to use conditional order clause like below: Query: select * from comments order by (case when name ='' then 1 else 0 end) Output: | name | |:-----| | Apple | | Orange | | Avocado | | Banana | | Cauliflower | | Broccoli | | Potato | | Cabbage | | | | | [fiddle](https://dbfiddle.uk/Be2Z1dQn)
<com.google.android.material.textfield.TextInputLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginStart="32dp" android:layout_marginTop="16sp" android:layout_marginEnd="32dp" app:boxStrokeColor="@color/blue"> <com.google.android.material.textfield.TextInputEditText android:layout_width="match_parent" android:layout_height="wrap_content" android:fontFamily="@font/quicksand_bold" android:hint="Full Name" android:textColor="@color/blue" android:textColorHint="@color/blue" /> </com.google.android.material.textfield.TextInputLayout> I used this for Edittext but I don't know how to use it for Textview I want like this [enter image description here][1] [1]: https://i.stack.imgur.com/gCKp4.png
Waiting for the inline button to be pressed from user in a loop from the aiogram 3.4
|aiogram|
Getting a error while loading a model(.h5) the error is below:- Traceback (most recent call last): File "C:\Ananconda\Lib\site-packages\keras\src\ops\operation.py", line 208, in from_config return cls(**config) ^^^^^^^^^^^^^ File "C:\Ananconda\Lib\site-packages\keras\src\layers\convolutional\depthwise_conv2d.py", line 118, in __init__ super().__init__( File "C:\Ananconda\Lib\site-packages\keras\src\layers\convolutional\base_depthwise_conv.py", line 106, in __init__ super().__init__( File "C:\Ananconda\Lib\site-packages\keras\src\layers\layer.py", line 263, in __init__ raise ValueError( ValueError: Unrecognized keyword arguments passed to DepthwiseConv2D: {'groups': 1} During handling of the above exception, another exception occurred: Traceback (most recent call last): File "f:\NanoPix--ISS\3.Teachable machine\Using_teachable.py", line 6, in <module> model = load_model("keras_model.h5") ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Ananconda\Lib\site-packages\keras\src\saving\saving_api.py", line 183, in load_model return legacy_h5_format.load_model_from_hdf5(filepath) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Ananconda\Lib\site-packages\keras\src\legacy\saving\legacy_h5_format.py", line 133, in load_model_from_hdf5 model = saving_utils.model_from_config( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Ananconda\Lib\site-packages\keras\src\legacy\saving\saving_utils.py", line 85, in model_from_config return serialization.deserialize_keras_object( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Ananconda\Lib\site-packages\keras\src\legacy\saving\serialization.py", line 495, in deserialize_keras_object deserialized_obj = cls.from_config( ^^^^^^^^^^^^^^^^ File "C:\Ananconda\Lib\site-packages\keras\src\models\sequential.py", line 326, in from_config layer = saving_utils.model_from_config( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Ananconda\Lib\site-packages\keras\src\legacy\saving\saving_utils.py", line 85, in model_from_config return serialization.deserialize_keras_object( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Ananconda\Lib\site-packages\keras\src\legacy\saving\serialization.py", line 495, in deserialize_keras_object deserialized_obj = cls.from_config( ^^^^^^^^^^^^^^^^ File "C:\Ananconda\Lib\site-packages\keras\src\models\sequential.py", line 326, in from_config layer = saving_utils.model_from_config( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Ananconda\Lib\site-packages\keras\src\legacy\saving\saving_utils.py", line 85, in model_from_config return serialization.deserialize_keras_object( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Ananconda\Lib\site-packages\keras\src\legacy\saving\serialization.py", line 495, in deserialize_keras_object deserialized_obj = cls.from_config( ^^^^^^^^^^^^^^^^ File "C:\Ananconda\Lib\site-packages\keras\src\models\model.py", line 528, in from_config return functional_from_config( ^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Ananconda\Lib\site-packages\keras\src\models\functional.py", line 509, in functional_from_config process_layer(layer_data) File "C:\Ananconda\Lib\site-packages\keras\src\models\functional.py", line 489, in process_layer layer = saving_utils.model_from_config( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Ananconda\Lib\site-packages\keras\src\legacy\saving\saving_utils.py", line 85, in model_from_config return serialization.deserialize_keras_object( ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Ananconda\Lib\site-packages\keras\src\legacy\saving\serialization.py", line 504, in deserialize_keras_object deserialized_obj = cls.from_config(cls_config) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Ananconda\Lib\site-packages\keras\src\ops\operation.py", line 210, in from_config raise TypeError( TypeError: Error when deserializing class 'DepthwiseConv2D' using config={'name': 'expanded_conv_depthwise', 'trainable': True, 'dtype': 'float32', 'kernel_size': [3, 3], 'strides': [1, 1], 'padding': 'same', 'data_format': 'channels_last', 'dilation_rate': [1, 1], 'groups': 1, 'activation': 'linear', 'use_bias': False, 'bias_initializer': {'class_name': 'Zeros', 'config': {}}, 'bias_regularizer': None, 'activity_regularizer': None, 'bias_constraint': None, 'depth_multiplier': 1, 'depthwise_initializer': {'class_name': 'VarianceScaling', 'config': {'scale': 1, 'mode': 'fan_avg', 'distribution': 'uniform', 'seed': None}}, 'depthwise_regularizer': None, 'depthwise_constraint': None}. Exception encountered: Unrecognized keyword arguments passed to DepthwiseConv2D: {'groups': 1} ``` from keras.models import load_model from PIL import Image, ImageOps import numpy as np # Load the model model = load_model("keras_model.h5") # Load the labels with open("labels.txt", "r") as file: class_names = [line.strip() for line in file.readlines()] # Load and preprocess the image image_path = "data//images2//img ("+str(1)+").jpg" image = Image.open(image_path).convert("RGB") size = (224, 224) image = ImageOps.fit(image, size, Image.ANTIALIAS) image_array = np.asarray(image) normalized_image_array = (image_array.astype(np.float32) / 127.5) - 1 data = np.ndarray(shape=(1, 224, 224, 3), dtype=np.float32) data[0] = normalized_image_array # Make a prediction prediction = model.predict(data) index = np.argmax(prediction) class_name = class_names[index] confidence_score = prediction[0][index] # Print prediction and confidence score print("Class:", class_name, "Confidence Score:", confidence_score) ``` This is my python code and u i am using the following versions: [versions used](https://i.stack.imgur.com/fJmpL.png)
Unable to load the teachable machine model
|tensorflow|machine-learning|
null
looking for help in Prolog
|prolog|prolog-findall|
I have a Flask + SQLAlchemy + Marshmallow REST API with a MS SQL Server database. The tables are all system-temporal tables with [hidden row effective/expiration dates](https://learn.microsoft.com/en-us/sql/relational-databases/tables/temporal-tables?view=sql-server-ver16#hide-the-period-columns). I'm trying to fetch relationship data as of historical points in time. Below is a basic example: ``` class Policyholder(db.Model): __tablename__ = 'policyholder' policyholder_id = db.Column(db.Integer, primary_key=True) ssn = db.Column(db.String(9), index=True, unique=True, nullable=False) last_name = db.Column(db.String(100)) first_name = db.Column(db.String(100)) is_married = db.Column(db.Boolean) autos = db.relationship("Auto", uselist=True) class Auto(db.Model): __tablename__ = 'auto' auto_id = db.Column(db.Integer, primary_key=True) policyholder_id = db.Column(db.ForeignKey('policyholder.policyholder_id'), nullable=False) make = db.Column(db.String(100)) model = db.Column(db.String(100)) color = db.Column(db.String(100)) ``` In this example, the policyholder's names and `is_married` flag can change over time, and the car's color can change over time. The SQL Server's system-temporal tables correctly track any updates. In SQL Server, I can fetch the version of the data at points in time with the `FOR SYSTEM_TIME AS OF 'YYYY-MM-DD HH:MM:SS'` [syntax](https://learn.microsoft.com/en-us/sql/relational-databases/tables/querying-data-in-a-system-versioned-temporal-table?view=sql-server-ver16). I can use the `with_hint` syntax (suggested [here](https://github.com/sqlalchemy/sqlalchemy/issues/4797)) with SQLAlchemy ORM queries. **Question:** What's the best way to integrate temporal queries (with or without `with_hint`) and relationships? For example: ``` # this gives the correct version of policyholder 123456789 policyholder = db.session.query(Policyholder).with_hint(Policyholder, "FOR SYSTEM_TIME AS OF '2020-01-01 00:00:00'").filter_by(ssn="123456789").one() # this is the current version of autos (with current colors) # I want to see the colors as of 1/1/2020 autos = policyholder.autos ``` It's especially tricky when I serialize with Marshmallow because I've observed the schema emitting queries for relationships, even if the relationship's records are already in the identity map.
I have a firebase project. I am calling an external api via cloud function in the hope the api key (stored in env variable) will be less discoverable. While I have managed to get the following code working in the emulator, it doesn't work after deployment. ``` const {onRequest} = require("firebase-functions/v2/https"); const fetch = require("node-fetch"); const makeRequest = async (req, res) => { const apiKey = process.env.KEY1; const apiUrl = `[externalAPIurl]&key=${apiKey}`; try { const response = await fetch(apiUrl); const data = await response.json(); res.set("Content-Type", "application/json"); res.status(200).send(JSON.stringify(data)); } catch (error) { console.error("Error:", error); res.status(500).send("Internal Server Error"); } }; exports.helloWorld = onRequest(makeRequest); ``` Postman tells me that it's a lack of authentication being passed in the header (error 403). I have struggled to adapt existing code (Google samples/turtorials, and community-provided excerpts). For example: 1. The following excludes req, res parameters and isn't obviously amenable to calling an external api (url) https://cloud.google.com/functions/docs/samples/functions-bearer-token?hl=en 2. The following documents how one might create authenticated functions: https://stackoverflow.com/questions/57589339/how-to-invoke-authenticated-functions-on-gcp-cloud-functions But the linked documentation suggests the approach is for development purposes (only?): https://cloud.google.com/functions/docs/securing/authenticating For context, the plan is to anonymously authenticate all users of the website. If anyone can point me in the right direction, that would be sweet.
how to add gesture in appbar
|flutter|dart|