instruction
stringlengths
0
30k
Why is userData an empty array even after fetching and awaiting the data?
I'm brand new to JavaScript, so bear with me! I have a webpage that has a scrollable div element. I've been trying to find a solution that adds the following functionality: A user scrolls down the page. Once the scrollable div element reaches the center of the viewport, scrolling input is switched from the page to the div - freezing the page scroll with the div vertically centered. Once the div element reaches the end of its scrollable content, scroll input is returned to the overall page and the user can scroll past the div element. Ideally, this mechanic would work when page scrolling down to or up to the scrollable div element. I've been pulling my hair out trying to get this to work! This is what I have so far: ``` <script> window.addEventListener('DOMContentLoaded', function() { const scrolldiv1 = document.getElementById('scrolldiv1'); const content = scrolldiv1.querySelector('.content'); let isDivScrolling = false; function handleScroll() { const viewportHeight = window.innerHeight; const divTop = scrolldiv1.getBoundingClientRect().top; const divBottom = scrolldiv1.getBoundingClientRect().bottom; const divHeight = scrolldiv1.clientHeight; const contentHeight = content.clientHeight; if (divTop < viewportHeight / 2 && divBottom > viewportHeight / 2 + divHeight) { isDivScrolling = true; } else { isDivScrolling = false; } if (isDivScrolling) { document.body.style.overflow = 'hidden'; scrolldiv1.style.overflowY = 'scroll'; if (scrolldiv1.scrollTop + divHeight >= contentHeight) { scrolldiv1.style.overflowY = 'hidden'; document.body.style.overflow = 'auto'; isDivScrolling = false; } } else { scrolldiv1.style.overflowY = 'hidden'; document.body.style.overflow = 'auto'; } } window.addEventListener('scroll', handleScroll); }); </script> <style> .scroll-div { overflow:hidden; overflow-y: scroll; height: 400px; -ms-overflow-style: none; scrollbar-width: none; } .scroll-div::-webkit-scrollbar { display: none; } .content { height: 2706px; } </style> <div class="scroll-div" id="scrolldiv1"> <div class="content"> <img src="image1" alt="" class="img-responsive thumbnail" width="100%"> <br> <br> <br> <img src="image2" alt="" class="img-responsive thumbnail" width="100%"> <br> <br> <br> <img src="image3" alt="" class="img-responsive thumbnail" width="100%"> <br> <br> <br> <img src="image4" alt="" class="img-responsive thumbnail" width="100%"> <br> <br> <br> <img src="image5" alt="" class="img-responsive thumbnail" width="100%"> <br> <br> <br> <img src="image6" width="100%" class="img-responsive thumbnail"> </div> </div> ``` For some reason, it refuses to detect when the scrollable div is centered and does not transfer control of scrolling.
It sounds like you're letting KNIME have more RAM than your machine can offer, which may be what's causing your computer to freeze. You mentioned adjusting Xmx setting, have you tried dialing it down, not just up? Have you been able to run your workflow on a different machine, or has someone else been able to run the workflow? It's possible there is a something in the workflow that is causing you to eat up too much memory. If you share your workflow, that might help determine if there is a problem with it. I also came across this interesting post in the KNIME forum, I wonder if it might help? https://forum.knime.com/t/best-memory-optimization-practices/32775
|nlp|large-language-model|
I have a json like [ { "url": "https://drive.google.com/file/d/1tO-qVknlH0PLK9CblQsyd568ZiptdKff/view?usp=share_link", "title": "&#8211; Flexibility" }, { "url": "https://drive.google.com/open?id=11_sR8X13lmPcvlT3POfMW3044f3wZdra", "title": "&#8211; Pronouns" } ] I got it using `curl -Lfs "https://motivatedsisters.com/2019/07/08/arabic-review-sr-rahat-basit/" | rg -o '<li>.*?href="(.*?)".*?</a> (.*?)<\/li>' -r '{"url": "$1", "title": "$2"}' | jq -s '.'`. I have a command in my machine named `unescape_html`, a python scipt to unescape the html (replace &#8211; with appropriate character). How can I apply this function on each of the titles using `jq`. For example: I want to run: unescape_html "&#8211; Flexibility" unescape_html "&#8211; Pronouns" The expected output is: [ { "url": "https://drive.google.com/file/d/1tO-qVknlH0PLK9CblQsyd568ZiptdKff/view?usp=share_link", "title": "– Flexibility" }, { "url": "https://drive.google.com/open?id=11_sR8X13lmPcvlT3POfMW3044f3wZdra", "title": "– Pronouns" } ] **Update 1:** If `jq` doesn't have that feature, then i am also fine that the command is applied on `rg`. I mean, can i run `unescape_html` on `$2` on the line: rg -o '<li>.*?href="(.*?)".*?</a> (.*?)<\/li>' -r '{"url": "$1", "title": "$2"}' Any other bash approach to solve this problem is also fine. The point is, i need to run `unescape_html` on `title`, so that i get the expected output. **Update 2:** The following command: curl -Lfs "https://motivatedsisters.com/2019/07/08/arabic-review-sr-rahat-basit/" | rg -o '<li>.*?href="(.*?)".*?</a> (.*?)<\/li>' -r '{"url": "$1", "title": "$2"}' | jq -s '.' | jq 'map(.title |= @sh "unescape_html \(.)")' gives: [ { "url": "https://drive.google.com/file/d/1tO-qVknlH0PLK9CblQsyd568ZiptdKff/view?usp=share_link", "title": "unescape_html '&#8211; Flexibility'" }, { "url": "https://drive.google.com/open?id=11_sR8X13lmPcvlT3POfMW3044f3wZdra", "title": "unescape_html '&#8211; Pronouns'" } ] Just not evaluating the commands. The following command works: curl -Lfs "https://motivatedsisters.com/2019/07/08/arabic-review-sr-rahat-basit/" | rg -o '<li>.*?href="(.*?)".*?</a> (.*?)<\/li>' -r '{"url": "$1", "title": "$2"}' | jq -s '.' | jq 'map(.title |= sub("&#8211;"; "–"))' But it only works for `&#8211;`. It will not work for other reserved characters. **Update 3:** The following command: curl -Lfs "https://motivatedsisters.com/2019/07/08/arabic-review-sr-rahat-basit/" | rg -o '<li>.*?href="(.*?)".*?</a> (.*?)<\/li>' -r '{"url": "$1", "title": "$2"}' | jq -s '.' | jq -r '.[] | "unescape_html \(.title | @sh)"' | bash is giving: – Flexibility – Pronouns So, it is applying the bash function. Now I need to format is so that the urls are come with the title in json format. **Update 4:** So, the command that is working is: curl -Lfs "https://motivatedsisters.com/2019/07/08/arabic-review-sr-rahat-basit/" | rg -o '<li>.*?href="(.*?)".*?</a> (.*?)<\/li>' -r 'echo $1 $(unescape_html "$2")' | bash | rg -o '(https?://\S+)\s(.*)' -r 'echo $1 $(unescape_html "$2")' -r '{"url": "$1", "title": "$2"}' | jq -s '.' I am still looking for a better solution.
I figured out I don't really need my viewmodels to be lifecycle aware and I want to replace them with just plane kotlin classes to handle the ui logic, my problem is hilt; since it will only allow me to inject fields into android components like activities or services. Now, I don't want to inject my plane class viewmodels into the activity as this will make them servive when my composables leave the composition. Is there any work around to achieve that using hilt? Should I just implement my own dependency injection? I heard of another di library called koin, could it help? One thing I thought about is injecting the repository in the main activity then pass it to the composables so the can use it to create their instances of the viewmodel but this seems like it's gonna break the separation of concerns rule.
I am using Firestore to fetch data based on a filter that utilizes the 'array-contains-any' operator. Here is the code I am using to fetch the data - ``` const fV = this.getFV(this.selectedButton); return qnaCollectionRef .where('qS', 'array-contains-any' , fV) .onSnapshot((querySnapshot) => { ``` here is the code for getFv ``` getFV(qF: QF): number[] { debugger; switch (qF) { case QF.All: return [1,2]; case QF.O: return [1]; case QF.A: return [2]; default: throw new Error('Unsupported filter option'); } } ``` Assume that my firestore db contains data like ``` for [1,2] - [abc, dce, efg, hij] for [1] - [abc, dce] for [2] - [efg, hij] ``` Now I have a button which changes this fV to [1,2], [1], [2] which gets called in below query ``` .where('qS', 'array-contains-any' , fV) ``` The issue I'm facing is that regardless of the filter values I pass in fVs, the query always returns data from the fv [1,2]. However, when I modify the query and hardcode the operand to [1] or [2], it correctly returns the desired data from [1] or [2]. ``` .where('qS', 'array-contains-any', [2]) ```
null
You can also use `ri` from within `irb`. I'd recommend the [wirble gem][1] as an easy way to set this up. [1]: https://github.com/pablotron/wirble
I don't know if you're using it but You could use `custom_exception_handler` to transform any exceptions raised to the format you provide. Here is an example: def custom_exception_handler(exc, context): response = exception_handler(exc, context) if response is not None: response.data["timestamp"] = datetime.now().isoformat() response.data["error_type"] = exc.__class__.__name__ response.data["path"] = context["request"].path return response Using it this is what it produced: { "detail": "Authentication credentials were not provided.", "timestamp": "2024-03-29T20:09:02.228370", "error_type": "NotAuthenticated", "path": "/tools/" } P.S: It also can take the detail as the exception raised from `validate` in serializers. Here are the docs: [custom_execption_handler][1] [1]: https://www.django-rest-framework.org/api-guide/exceptions/#custom-exception-handling
I found these in the MacOS symbols: `▾` and `▴` Not sure if they will look proper on all devices though.
If you using REACT+typeScript on Front, by convention, you need use REACT_APP in your name variable, like this. ``` REACT_APP_NAMEOFVARIABLE = "Name of Variable" ``` And to use, u will use normaly. You can creates a variable or do a direct acces, like this: ``` const variableName = process.env.REACT_APP_NAMEOFVARIABLE console.log(variableNAme) ``` Or like this (direct way) ``` <a> ${process.env.REACT_APP_NAMEOFVARIABLE}</a>
For the versions of the plugin that supports SMSS 2014 ,and SSMS 16-18, PoorMan's T-SQL Formatter requires the Visual Studio 2015 Isolated Shell installed in order to work. It can be downloaded from [here][1]. After installing it, the option will be made available. [![The formatter is now enabled.][2]][2] [1]: https://visualstudio.microsoft.com/vs/older-downloads/isolated-shell/ [2]: https://i.stack.imgur.com/u8NY6.png
check dictionary is user exists
|python-3.x|
I should say first that I have found and read most (if not all) of the questions with the same error message. So far, none of lead to a solution. Most seemed to be aimed at IIS hosted apps. And the ones that are Azure hosted are old and just don't have solutions, or have dead links to old articles that no longer exist. The error is sporadic. And, the error is happening only in Prod. We are not able to reproduce in QA or in Dev or in Local. The errors began immediately after pushing a release that contained an upgrade from .NET Framework 4.7 to .NET Framework 4.8. (No other changes in this release). So, obviously, there is some difference between QA and Prod, but so far we can't track it down. Some of the other posts on this same error have indicated that it's a permissions issue. We have checked the permissions on everything we can think of, and they are the same between the QA and Prod. That being said, our Azure guy is (as I type) doing his best to compare everything he can think of between QA and Prod to find any differences. Our method is generating a bar code. The error is on this line: graphic.DrawString(string.Format("*{0}*", Code), newFont, black, point); Here is the entire method: *(Please note that we are aware that some of this code can be cleaned up with newer versions of C#. We're working on that!)* public static byte[] BarcodeImageGenerator(string Code) { byte[] BarCode; int Height; // = 50 int Width;// = 100 Code = Code.ToUpper(); PrivateFontCollection customfont = new PrivateFontCollection(); customfont.AddFontFile(string.Format("{0}{1}", HttpRuntime.AppDomainAppPath, "fonts\\FRE3OF9X.TTF")); Font newFont = new Font(customfont.Families[0], 60, FontStyle.Regular); SizeF stringSize = Graphics.FromImage(new Bitmap(1, 1)).MeasureString(Code, newFont); Width = (int)stringSize.Width + 50; Height = (int)stringSize.Height; Bitmap objBitmap = new Bitmap(Width, Height); using (Graphics graphic = Graphics.FromImage(objBitmap)) { PointF point = new PointF(2f, 2f); SolidBrush black = new SolidBrush(Color.Black); SolidBrush white = new SolidBrush(Color.White); graphic.FillRectangle(white, 0, 0, objBitmap.Width, objBitmap.Height); graphic.DrawString(string.Format("*{0}*", Code), newFont, black, point); } using (MemoryStream Mmst = new MemoryStream()) { objBitmap.Save(Mmst, ImageFormat.Jpeg); BarCode = Mmst.GetBuffer(); return BarCode; } } Here are the first few lines of the stack trace: > System.Runtime.InteropServices.ExternalException (0x80004005): A > generic error occurred in GDI+. at > System.Drawing.Graphics.CheckErrorStatus(Int32 status) at > System.Drawing.Graphics.DrawString(String s, Font font, Brush brush, > RectangleF layoutRectangle, StringFormat format) at > System.Drawing.Graphics.DrawString(String s, Font font, Brush brush, > PointF point)
Azur Hosted Web App: A generic error occurred in GDI+
|c#|.net|azure|system.graphics|
Inject a class into a composable function using hilt
|android|android-jetpack-compose|android-viewmodel|dagger-hilt|clean-architecture|
null
There is no such command in vanilla `cargo` (well, there's `cargo install` but that's for dependencies), but since `cargo` supports [third-party subcommands](https://github.com/rust-lang/cargo/wiki/Third-party-cargo-subcommands) there is an answer: the [`cargo-update` crate](https://crates.io/crates/cargo-update). Install as usual with ``` cargo install cargo-update ``` then use ``` cargo install-update -a ``` to update all installed packages, for more usage information and examples see the [`cargo install-update` manpage](https://rawcdn.githack.com/nabijaczleweli/cargo-update/man/cargo-install-update-config.1.html). <sub>Disclaimer: am author</sub>
In C# I have a class like this public class BClass { public int Ndx { get; set; } public string Title { get; set; } } This is then used within this class public class AClass { public int Ndx { get; set; } public string Author { get; set; } public BClass[] Titles { get; set; } } Now when I populate author I do not know how many titles they have until run time so the number of instances of AClass.Titles there will be, so my question is how do I initialise this everytime please? Thanks in advance
How do I initialiase a class within a class
|c#|class|initialization|
I am using NestJS and the solution for me was to add ` "typeRoots": [],` in `tsconfig.json`. I solved it accidentally and don't know why this works.
I am trying to get the total students who have enrolled in a particular course, with a course id, in this month only. The table structure is same as what remains in most of the Moodle databases. I dont want the total of students of all time, I just want to get them in this month. The code can be something related to those provided on this page: https://stackoverflow.com/questions/22161606/sql-query-for-courses-enrolment-on-moodle The above link provides similar codes but does not include the **date** part which I want. You can suggest me any other way also like using external webservices on moodle if this function exists there.
I am creating an endpoint in charge of verifying that the "pages" table verifies that all the records work by checking with axios to verify that the link field works correctly or at least a status of 200. The problem with my code is that the application freezes with the first record and does not advance, also if a record contains a link that does not work the loop ends with the axios error and does not advance with the other links. If the page does not work, I delete it from the database Code for (var i = 0; i < pages.length; i++) { var page = pages[i]; var name = page.name; var link = page.link; console.log("TEST WITH " + name); try { const response = await axios.get(link, {timeout: 2000}); console.log(response.status); console.log("OK"); } catch (error) { console.log("FAIL"); // I need link for delete in database /* const result = await conn.query("DELETE FROM pages WHERE link = ?", [ link, ]); */ } } I am using the latest version of NextJS How could I achieve my goal?
{"Voters":[{"Id":446594,"DisplayName":"DarkBee"},{"Id":2802040,"DisplayName":"Paulie_D"},{"Id":272109,"DisplayName":"David Makogon"}]}
|typescript|nestjs|typeorm|
Has anyone experienced issues when running a command like this in SSMS?: ``` SELECT STRING_AGG(JSON_ARRAY(COL1, COL2, COL3 NULL ON NULL), ', ') FROM {schema}.{table} ``` In my case this closes the connection to SQL Server with error: > Msg 109, Level 20, State 0, Line 42 A transport-level error has > occurred when receiving results from the server. (provider: Shared > Memory Provider, error: 0 - The pipe has been ended.) SSMS 19.3 Microsoft SQL Server 2022 Express Edition (64-bit) Windows Server 2016 Datacenter 10.0 To work around this issue I split this activity into 2 steps: 1. Create a temp table with rows created by JSON_ARRAY 2. Combine all rows into array of arrays with STRING_AGG
|r|dplyr|sparklyr|
|excel|vba|outlook|
I am having issues with a query which includes BEGINSWITH (or CONTAINS for that matter). I am trying to follow the example as found in the Mongo Db documentation: This query to find instances of the \<Pantry\> model is not filtering the way it should. (all of this is in the viewModel) This is the query: ``` val searchResults = realm .query<Pantry>("itemName BEGINSWITH $0", searchText.value) .find() .asFlow() .map { results -> results.list.toList() } .stateIn( viewModelScope, SharingStarted.WhileSubscribed(), emptyList() ) ``` `searchText` is a String with a search pattern input by the user to find instances of the Pantry model. This done by use of a TextField. 'realm' is defined like this: private val realm = `MyApp.realm`. MyApp is : ``` class MyApp: Application() { companion object { lateinit var realm: Realm } override fun onCreate() { super.onCreate() realm = Realm.open( configuration = RealmConfiguration.create( schema = setOf( Pantry::class, Department::class, Market::class, ) ) ) } } ``` I implemented this function to see what was happening; if the query was doing anything or not: ``` suspend fun checkSearchResults(){ searchResults.collect { results -> if (results.isEmpty()) { Log.d("Search", "No search results found") } else { // Loop through or access items in results for (item in results) { Log.d("Search", "Found item: ${item.itemName}") } } } } ``` This is the log as the user inputs characters: ``` The value of searchText: h D Found item: bananas D Found item: clorox D Found item: garbanzos D Found item: ham D Found item: laundry detergent, pods D Found item: milk D Found item: olives D Found item: pastries D Found item: salmon D Found item: water, sparkling D The value of searchText: ha D Found item: bananas D Found item: clorox D Found item: garbanzos D Found item: ham D Found item: laundry detergent, pods D Found item: milk D Found item: olives D Found item: pastries D Found item: salmon D Found item: water, sparkling D The value of searchText: ham D Found item: bananas D Found item: clorox D Found item: garbanzos D Found item: ham D Found item: laundry detergent, pods D Found item: milk D Found item: olives D Found item: pastries D Found item: salmon D Found item: water, sparkling ``` which is the entire database. ``` ``` So, from the log its evident that the query is ignoring the filter and all instances are included. Can anyone point out where I am failing? I think I'm following the documentation pretty closely. UPDATE: if I use a query like this: `.query<Pantry>("itemName = $0", searchText.value)` and using a known `itemName`, the result is an empty list.
I have a question regarding web scraping on multiple layers of a website. For instance, I have a website about US elections having 2 layers. Layer 1: state information: include 50 states. Once I click each state on the table, I will jump into the Layer 2. Layer 2: city information in each state Once I click each city on the table, I will get the city mayor election result. My purpose is to scrape all city mayor election data. Do you have any advice on how to scrape this multilayer webpage in Python? There are limited resources online of scraping multilayer webpage. If you can provide any code examples, much appreciated! My expected output: | City | Name | Number of Votes | -------- | -------- |--------------- | City A | Tom | X | City B | Jerry | y ... ... ......
Web Scrapping on Multiple Layers of a Website
|python|web|screen-scraping|
null
When I render a gfm report from Quarto and push to github, the gfm report displays a massive amount of html above the great_tables table. How can I prevent this? [![enter image description here][1]][1] ~~~ --- title: 'HTML junk' author: 'Joseph Powers' date: 2024-03-14 format: gfm --- ```{python} import numpy as np import pandas as pd from great_tables import GT ``` ```{python} N = int(5e3) TRIALS = int(1) df = pd.DataFrame( { "A": np.random.binomial(TRIALS, 0.65, N), "B": np.random.binomial(TRIALS, 0.65, N), "C": np.random.binomial(TRIALS, 0.65, N), "D": np.random.binomial(TRIALS, 0.67, N) } ) ``` ## No html, but an ugly table ... ```{python} print(df.head().to_markdown()) ``` ## great_tables ```{python} GT(df.head()) ``` ~~~ [1]: https://i.stack.imgur.com/PUvPX.png
How to prevent html code appearing above python great_tables in quarto gfm reports?
|python|quarto|
The training process has stopped
My answer is on the basis of "a user should be able to have a view_page permission for one project instance, and don't have it for another instance." So basically you will have to catch "first user visit == first model instance", you can create "FirstVisit" model which will catch and save each first instance using `url`, `user.id` and `page.id`, then you check if it exists. # model class Project(models.Model): pass class Page(models.Model): project = models.ForeignKey(Project) class FirstVisit(models.Model): url = models.URLField() user = models.ForeignKey(User) page = models.ForeignKey(Page) #views.py def my_view(request): if not FisrtVisit.objects.filter(user=request.user.id, url=request.path, page=request.page.id).exists(): # first time visit == first instance #your code... FisrtVisit(user=request.user, url=request.path, page=request.page.id).save() based on this [solution][1] I suggest to use device (computer or Smartphone) Mac Address instead of url using [getmac][2] for maximum first visit check [1]: https://stackoverflow.com/questions/15699947/how-to-check-if-the-user-is-visiting-the-page-for-the-first-time [2]: https://pypi.org/project/getmac/
Check list of pages with axios
|next.js|axios|
When you want to return from an activity to it's caller/invoker then you should not start the activity to be returned to, you should **`finish`** the activity. So instead of:- back.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(ForgetPasswordPage.this, LoginPage.class); startActivity(intent); } }); You would use:- back.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { Intent intent = new Intent(ForgetPasswordPage.this, LoginPage.class); finish(); } });
You're using Modules, so your main.ts should be like import { platformBrowser } from '@angular/platform-browser'; import { AppModule } from './app.module'; import 'zone.js'; //see that you "bootstrap a module" using platformBrowser platformBrowser().bootstrapModule(AppModule) .catch((err:any) => console.error(err)); See a [stackblitz][1] with your code You only boostrap a component if the component is "standalone", in this case is when you use bootstrapApplication(AppComponent, { providers: [ ...]}); [1]: https://stackblitz.com/edit/stackblitz-starters-h8qdwg?file=src%2Fmain.ts,src%2Findex.html,src%2Fhome.component.ts
**Here is another way you can understand how debouncing works, here the state will be set 5 mili seconds late after the user stop typing.** import React, { useState, useEffect } from 'react'; const DebouncedInput = () => { const [inputValue, setInputValue] = useState(''); const [debouncedValue, setDebouncedValue] = useState(''); useEffect(() => { const delayDebounceFn = setTimeout(() => { setDebouncedValue(inputValue); }, 500); return () => clearTimeout(delayDebounceFn); }, [inputValue]); const handleChange = (e) => { setInputValue(e.target.value); }; return ( <div> <input type="text" value={inputValue} onChange={handleChange} placeholder="Type something..." /> <p>Debounced value: {debouncedValue}</p> </div> ); }; export default DebouncedInput;
I was able to make the view appears in a single animation by inserting hidden `UITextField` behind SwiftUI's `TextField` or `SecureField` and calling `becomeFirstRespoder` when the UITextField is initialized, like this: ```swift class FirstResponderField: UITextField { init() { super.init(frame: .zero) becomeFirstResponder() } required init?(coder: NSCoder) { fatalError("init(coder:) has not been implemented") } } struct FirstResponderFieldView: UIViewRepresentable { func makeUIView(context: Context) -> FirstResponderField { return FirstResponderField() } func updateUIView(_ uiView: FirstResponderField, context: Context) {} } struct MyView: View { @FocusState var isFocused: Bool var body: some View { ZStack { FirstResponderFieldView() // this makes the keyboard to appear with a single animation .frame(width: 0, height: 0) .opacity(0) TextField("Email", text: $text) .focused($isFocused) } .onAppear { isFocused = true // After the view appears, you want to focus to actual SwiftUI view. } } } ``` I created a small library called `focusOnAppear` to achieve this using a view modifier like this: https://github.com/naan/FocusOnAppear ```swift TextField("text", text: $text) .focusOnAppear() ```
|entity-framework-core|linq2db|
How can I write the logic to this function which should be able to do 2 things. ``` get_data <- function(database, table=NULL, query=NULL){ rlang::check_required( x = database ) if(is.null(query) & !is.null(table)){ # check whether code is piped %>% | |> query <- dbplyr::sql_render("piped code") } return(query) } ``` Accept SQL Query ``` get_data( database = "uspto", query = "select * from applications where id = 1" ) ``` Recognize that Query is NULL and Table is not NULL so perform some check or pass through to piped code. ``` get_data( database = "uspto", table = "applications" ) %>% filter(id == 1) %>% collect() ``` For more context this function will be interacting with an API that accepts SQL as input. There will be a network / microservice layer between the client and the API. So I probably need to do something like below to create a dummy connection which I can then use `dbplyr::sql_render` to get a query string. ``` con <- memdb_frame( database, .name = table )
Write custom lazy evaluation function like dbplyr to get SQL
|r|dplyr|tidyverse|dbplyr|
Python Code: <pre> <code> ` from Crypto.Random import get_random_bytes from Crypto.Cipher import AES from Crypto.Util.Padding import pad import base64 def encrypt_string(input_string, key_base64, str_iv): try: key = key_base64.encode('utf-8') if str_iv: iv = base64.b64decode(str_iv) else: iv = get_random_bytes(16) cipher = AES.new(key, AES.MODE_CBC, iv) padded_data = pad(input_string.encode(), AES.block_size) cipher_data = cipher.encrypt(padded_data) combined_data = iv + cipher_data return base64.b64encode(combined_data).decode() except Exception as e: print(e) if __name__ == "__main__": key = "1bd393e7a457f9023d9ba95fffb5a2e1" iv = "1oTOhV9xGyu1mppmWZWa5w==" input_string = "AAAAAAA" encrypted_data = encrypt_string(input_string, key, iv) print("Encrypted string:", encrypted_data)` </pre></code> OUTPUT : Encrypted string: 1oTOhV9xGyu1mppmWZWa5+kzveiTRzRH+gRVHx+7Ad0= PHP code: <pre> <code> ` <?php function encrypt_string($input_string, $key_base64, $str_iv) { try { $key = base64_decode($key_base64); if ($str_iv) { $iv = base64_decode($str_iv); } else { $iv = openssl_random_pseudo_bytes(16); } $ciphertext = openssl_encrypt($input_string, 'aes-256-cbc', $key, OPENSSL_RAW_DATA, $iv); $combined_data = $iv . $ciphertext; return base64_encode($combined_data); } catch (Exception $e) { echo $e->getMessage(); } } $key = "1bd393e7a457f9023d9ba95fffb5a2e1"; $iv = "1oTOhV9xGyu1mppmWZWa5w=="; $input_string = "AAAAAAA"; $encrypted_data = encrypt_string($input_string, $key, $iv); echo "Encrypted string: " . $encrypted_data . "\n"; ?>` </pre> </code> OUTPUT: Encrypted string: 1oTOhV9xGyu1mppmWZWa53Nc8rxWTultBWLvWitUICQ= Please,Does anyone know how to make the output of these two codes the same?
how i can move element of dynamic vector in argument of function push_back for dynamic vector. Probably, i’ve said something and it isn’t right. Sorry, but i don't know English so good… `vector<int> *ans = new vector<int>(); vector<int> *x = new vector<int>(); ans->push_back(x[i]);`
How i can move element of dynamic vector in argument of function push_back for dynamic vector
|c#|c++|arrays|windows|vector|
null
I think i made a mistake either while defining or initializing the xml serializer... But i can't figure it out. Another try was use "Microsoft.AspNetCore.Mvc.Formatters.Xml.Extensions" to explicitly define the XmlSerializer but it does not work .. ``` [ApiExplorerSettings(IgnoreApi = false)] [Produces("application/xml")] [Consumes("application/xml")] public async Task<IActionResult> Propfind([FromXmlBody(XmlSerializerType = XmlSerializerType.XmlSerializer)]PropFindRequest propFindRequest,[FromHeader] int Depth) { throw new NotImplementedException(); } ```
c# Xml ModelBinding - Webapi .Net8 - Required Field not found
|c#|asp.net-web-api|
null
{"Voters":[{"Id":21305238,"DisplayName":"InSync"},{"Id":3832970,"DisplayName":"Wiktor Stribiżew"},{"Id":546871,"DisplayName":"AdrianHHH"}],"SiteSpecificCloseReasonIds":[11]}
I am not sure what is wrong. I have a basic understanding of git, but I am not an expert. In my remote branch, I have a file that has a bunch of changes, etc in it. In my local branch, this file is completely empty. When I open up github, and the file, I notice it has something like this, so I believe something is out of sync: <<<<<<< HEAD:my_repo/category_1/run_daily_jobs/summary_daily_job.kjb <xloc>1328</xloc> <yloc>80</yloc> ======= <xloc>1280</xloc> <yloc>128</yloc> >>>>>>> 44abcxyzbunchofvalues:my_repo/summary_daily_job.kjb any suggestions? I am not sure what to do.
Git Not In Sync with Local Branch
|git|github|
Okay so basically the date format is dd-mm-yyyy (it's the format here in Portugal) , and the hour is hh:mm, and my code is this: ``` #include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> struct DateTime { int day, month, year, hour, minute; }; // Function to convert date and time to minutes since midnight int minutes_since_midnight(struct DateTime dt) { return dt.hour * 60 + dt.minute; } // Function to calculate time difference int calculate_time_difference(char date_in[], char time_in[], char date_out[], char time_out[]) { struct DateTime dt1, dt2; sscanf(date_in, "%d-%d-%d", &dt1.day, &dt1.month, &dt1.year); sscanf(time_in, "%d:%d", &dt1.hour, &dt1.minute); sscanf(date_out, "%d-%d-%d", &dt2.day, &dt2.month, &dt2.year); sscanf(time_out, "%d:%d", &dt2.hour, &dt2.minute); // Convert date and time to minutes since midnight int minutes1 = minutes_since_midnight(dt1); int minutes2 = minutes_since_midnight(dt2); // Calculate total difference in minutes int time_difference = abs(minutes2 - minutes1); // Calculate day difference in minutes int day_difference = dt2.day - dt1.day; // If the date of departure is before the date of arrival, adjust the day difference if (day_difference < 0) { // Add a full day of minutes day_difference += 1; // Add the remaining hours of the departure day time_difference += (24 - dt1.hour) * 60 + (60 - dt1.minute); // Add the hours of the arrival day time_difference += dt2.hour * 60 + dt2.minute; } else { // If the date of departure is after the date of arrival, just add the remaining minutes time_difference += day_difference * 24 * 60; } return time_difference; } int main() { int time_diff = calculate_time_difference("01-01-2024", "19:05", "02-01-2024", "9:05"); printf("Time difference->%i\n", time_diff); return 0; } ``` And as you can probably tell by the example I let in the main function, in this case where **input 1= "01-01-2024", "19:05"** and **input 2= "02-01-2024", "9:05"** the time difference in minutes **should be 840** (14 hours *60 minutes), but the code when I run it says : **Time difference->2040** . How can I fix this??
|reactjs|asynchronous|async-await|
null
It can _almost_ be done easily in bash, with [the `declare` builtin](https://www.gnu.org/software/bash/manual/bash.html#index-declare): ```sh IFS=, declare -a "filenames=({${param_1[*]}}_{${param_2[*]}}_{${param_3[*]}})" declare -p filenames ``` ```sh declare -a filenames=([0]="coke_nugget_{cheesecake}" [1]="coke_pizza_{cheesecake}" [2]="coke_burger_{cheesecake}" [3]="icetea_nugget_{cheesecake}" [4]="icetea_pizza_{cheesecake}" [5]="icetea_burger_{cheesecake}") ``` [Brace expansion](https://www.gnu.org/software/bash/manual/bash.html#Brace-Expansion) only works with strings if there's a comma.
null
I have a wsdl file which has reference to multiple xsd files in nested folder system . I want to parse it and show on the ui with react js library I tried few libraries with node but it hits actual backend and doesn't give parsed evelope
How do I render wsdl with xsd extensions in react js with the information like operation method sample request and sample response
|javascript|reactjs|node.js|soap|wsdl|
null
Turns out, that `flex-direction:column` also affects `::before`s (and `::after`s). Remove that, and... Well, now there isn't a space between the `::before` and the element now. This can be fixed by adding a no-break space `\00a0` at the end of the `::before`'s `content`. Here's the correct code: ```css /* ... */ .checkout>div { /* ... */ flex-direction: row; /* ... */ } /* ... */ .checkout .foods-count::before { content: 'Count:\00a0' } .checkout .total-price::before { content: 'Price:\00a0' } .checkout :is(.foods-count, .total-price)::before { display: inline; color: gray; } ``` The `:is(` is just a shorthand for both of the `::before`s. And here's the full snippet: <!-- begin snippet: js hide: true console: true babel: false --> <!-- language: lang-css --> .container { display: flex; flex-wrap: wrap; align-items: flex-start; margin: 1.5rem; } ul { display: flex; flex-direction: column; flex: 3 0; justify-content: space-evenly; border: 1px solid #ffbbbb; border-radius: 1rem; list-style-type: none; margin: .5rem; padding: 0; } ul li { display: flex; justify-content: space-around; align-items: center; flex-wrap: wrap; border-bottom: 1px solid #e4e4e4; } ul li:last-child { border: none; } ul li img { width: 5rem; height: 5rem; border-radius: 100rem; object-fit: cover; } ul li div { padding: 5px; } ul li div:not(:first-child) { flex-basis: 18%; } ul li select { width: 3rem; outline: none; border: none; border-bottom: 1px solid lightgrey; font-weight: 100; } ul .remove-button { border-radius: 1rem; border: none; padding: .5rem; color: var(--primary-color); opacity: .7; outline: none; } ul .remove-button:hover { opacity: 1; cursor: pointer; } .checkout { display: flex; flex-direction: column; justify-content: space-between; align-items: center; flex: 1 3; height: 20rem; border: 1px solid #ffbbbb; border-radius: 1rem; padding: .5rem; margin: .5rem; } .checkout>div { font-size: 1.4rem; margin: 1rem; flex: 3; display: flex; flex-direction: row; justify-content: center; align-items: flex-start; } .checkout .foods-count { margin-bottom: 1.5rem; } .checkout .foods-count::before { content: 'Count:\00a0 ' } .checkout .total-price::before { content: 'Price:\00a0 ' } .checkout :is(.foods-count, .total-price)::before { display: inline; color: gray; } <!-- language: lang-html --> <div class="container"> <ul> <li *ngFor="let cartItem of cart.items"> <div> <img [src]="cartItem.food.imageUrl" [alt]="cartItem.food.name" /> </div> <div> <a [routerLink]="['/food/', cartItem.food.id]"> {{ cartItem.food.name }} </a> </div> <div> <select #quantitySelect (change)="changeQuantity(cartItem, quantitySelect.value)"> <option>1</option> <option>2</option> <option>3</option> <option>4</option> <option>5</option> </select> </div> <div> {{ cartItem.price | currency }} </div> <div> <button class="remove-button" (click)="removeFromCart(cartItem)"> Remove </button> </div> </li> </ul> <div class="checkout"> <div class="foods-count"> 2 </div> <div class="total-price"> $4 </div> </div> </div> <!-- end snippet -->
I am following a guide to fetch payment details before creating an intent. https://docs.stripe.com/payments/accept-a-payment-deferred?platform=react-native&type=payment&integration=paymentsheet#react-native-setup I can't seem to find a way to save payment methods. I have two types of users. Users that make subscriptions and users that make one-time payments. Both use an initial payment intent. Subscription user payments aren't saved since `setupFutureUsage='OffSession` is required for an intent configuration. Regular payment intents aren't saving the card with any 'setupFutureUsage' enum or lack thereof. ---------- Here is my initPaymentSheet(): const { error } = await initPaymentSheet({ customerId: customer, customerEphemeralKeySecret: ephemeralKeySecret, merchantDisplayName: 'Parket', intentConfiguration: { mode: { amount: checkoutData.totalInCents, currencyCode: 'USD', }, captureMethod: 'Manual', confirmHandler: (paymentMethod, shouldSavePaymentMethod, intentCreationCallback) => handleCheckout({ checkoutData, paymentMethod, shouldSavePaymentMethod, intentCreationCallback }), }, }) ---------- # Create a payment intent based on the configuration of initPaymentSheet() # Attach customer_id which provides a payment methods to PaymentIntent Object (PI) | https://docs.stripe.com/payments/paymentintents/lifecycle # Add metadata, used by our Stripe Listener uses identify linked document def HandleCreatePaymentIntent(customer_id, total_in_cents, metadata): payment_intent = stripe.PaymentIntent.create( amount=total_in_cents, currency='usd', customer=customer_id, capture_method='manual', metadata=metadata, setup_future_usage="on_session", automatic_payment_methods={"enabled": True}, ) # Return { payment_intent.client_secret } to the client : intentCreationCallback() confirms it on client-side # Set { payment_intent.id } in created booking return payment_intent.client_secret, payment_intent.id ---------- I verified the Customer and Ephemeral Key I am passing to the payment sheet.
AES-256-CBC encryption returning different result in Python and PHP , HELPPP
|python|php|encryption|aes|
null
i have 2 dynamic lists & 2 maps **2 List** List<dynamic> superDeepList1 = [ [ { 'name': 'Alice', 'age': 30, 'height': 5.8, 'isStudent': false, 'friends': ['Bob', 'Carol', 'David'], 'address': { 'street': '123 Main St', 'city': 'Wonderland', 'zipcode': '12345' } }, { 'name': 'Bob', 'age': 25, 'height': 6.1, 'isStudent': true, 'friends': ['Alice', 'Carol'], 'address': { 'street': '456 Elm St', 'city': 'Dreamville', 'zipcode': '54321' } }, 'This is a string item' ], [ { 'name': 'Carol', 'age': 28, 'height': 5.5, 'isStudent': true, 'friends': ['Alice', 'Bob', 'David'], 'address': { 'street': '789 Oak St', 'city': 'Fantasia', 'zipcode': '67890' } }, { 'name': 'David', 'age': 32, 'height': 5.9, 'isStudent': false, 'friends': ['Alice', 'Carol'], 'address': { 'street': '321 Pine St', 'city': 'Neverland', 'zipcode': '09876' } }, 'Another string item' ] ]; List<dynamic> superDeepList2 = [ [ { 'name': 'Alfdsfe', 'age': 36, 'height': 5.8, 'isStudent': false, 'friends': ['Bob', 'Carol', 'David'], 'address': { 'street': '123 Main St', 'city': 'Wonderland', 'zipcode': '12345' } }, { 'name': 'Bob', 'age': 25, 'height': 6.1, 'isStudent': true, 'friends': ['Alice', 'Carol'], 'address': { 'street': '456 Elm St', 'city': 'Dreamville', 'zipcode': '54321' } }, 'This is a string item' ], [ { 'name': 'Carol', 'age': 28, 'height': 5.5, 'isStudent': true, 'friends': ['Alice', 'Bob', 'David'], 'address': { 'street': '789 Oak St', 'city': 'Fantasia', 'zipcode': '67890' } }, { 'name': 'David', 'age': 32, 'height': 5.9, 'isStudent': false, 'friends': ['Alice', 'Carol'], 'address': { 'street': '321 Pine St', 'city': 'Neverland', 'zipcode': '09876' } }, 'Another string item' ] ]; **2 Map** Map<String, dynamic> superDeepMap1 = { 'outerKey1': { 'innerKey1': { 'nestedKey1': 'value1', 'nestedKey2': 'value2', 'nestedKey3': { 'deepNestedKey1': 'deepValue1', 'deepNestedKey2': 'deepValue2' } }, 'innerKey2': { 'nestedKey4': 'value4', 'nestedKey5': 'value5' } }, 'outerKey2': { 'innerKey3': { 'nestedKey6': 'value6', 'nestedKey7': 'value7' }, 'innerKey4': { 'nestedKey8': 'value8', 'nestedKey9': 'value9' } } }; Map<String, dynamic> superDeepMap2 = { 'outerKey1': { 'innerKey1': { 'nestedKey1': 'value1', 'nestedKey2': 'value2', 'nestedKey3': { 'deepNestedKey1': 'deepValue1', 'deepNestedKey2': 'deepValue2' } }, 'innerKey2': { 'nestedKey4': 'value4', 'nestedKey5': 'value5' } }, 'outerKey2': { 'innerKey3': { 'nestedKey6': 'value6', 'nestedKey7': 'value7' }, 'innerKey4': { 'nestedKey8': 'value8', 'nestedKey9': 'value9' } } }; How to chick if `superDeepList1` == superDeepList2 in length and content exactly . and the same question with Maps . best way i find so far is following https://pub.dev/packages/collection bool listsEqual = const DeepCollectionEquality().equals(superDeepList1,superDeepList2); but is there short code without using external package ?
|javascript|php|wordpress|download|
I am building a Python stored procedure that will execute a lengthy process and return a result. To improve performance, the handler code will be decorated with `functools.cache` to cache results. The following code is a minimal example that demonstrates the problem: ``` create or replace function get_key(which varchar) returns varchar language python runtime_version = '3.11' packages = ('snowflake-snowpark-python') handler = 'get_key' AS $$ import functools @functools.cache def get_key(which): if which == 'PN': return 'toomanysecrets' else: return '' $$; select get_key('PN'); ``` Error is > Python Interpreter Error: > AttributeError: 'functools._lru_cache_wrapper' object has no attribute > '\_\_code\_\_' in function GET_KEY with handler get_key
Problem decorating Python stored procedure handler with @functools.cache
|snowflake-cloud-data-platform|
null
{"Voters":[{"Id":3636601,"DisplayName":"Jens"},{"Id":214525,"DisplayName":"f1sh"},{"Id":522444,"DisplayName":"Hovercraft Full Of Eels"}]}
If you want to execute a command remotely, you'd typically use [ssh](https://linux.die.net/man/1/ssh). You don't need to do any socket programming to use ssh. If you can use ssh, then you should. You shouldn't reinvent the wheel. And using ssh is far more secure! It sounds like this is a class assignment. You need to write a socket "listener" that executes some remote command and returns the command's output. If so, you probably want your socket to call [popen()](https://linux.die.net/man/3/popen). Here's a simple "popen()" example: > https://c-for-dummies.com/blog/?p=1418 > > #include <stdio.h> > > int main() > { > FILE *p; > int ch; > > p = popen("ver","r"); /* DOS */ > /* p = popen("uname","r"); /* Unix */ > if( p == NULL) > { > puts("Unable to open process"); > return(1); > } > while( (ch=fgetc(p)) != EOF) > putchar(ch); > pclose(p); > > return(0); > } To clarify the usual meanings of "server" and "client": * **Server**: waits for commands, executes them, returns a response. * **Client**: sends a command to the server, waits for the server's response. You absolutely don't need to programmatically "open a terminal" for any of this. Addendum --- Regarding the requirements for the class assignment: > This project consists of a server (victim - debian) and a client (attacker - kali). the server is a program running in a loop and listening on an port. It receives messages across the network from the client. Each message must correspond to a system command to be executed. Each message must correspond to a system command to be executed. Once executed, the server sends a message to the client with the result of the executed command. Easy peasy. You're almost there: * You'll need to modify your server to [listen()](https://man7.org/linux/man-pages/man2/listen.2.html), then [accept()](https://man7.org/linux/man-pages/man2/accept.2.html) new requests, and handle them in a loop. * Your server could use [popen()](https://man7.org/linux/man-pages/man3/popen.3.html) to execute the requested command, and write the results back to the client. Forget about "opening a terminal". * Your client is sending OK. Now you need modify it to read the results back from the server. Here's some example code: https://www.thegeekstuff.com/2011/12/c-socket-programming/ (there are many, many examples on Google) You might also be interested in [Beej's Guide to Network Programming](https://beej.us/guide/bgnet/)
I would suggest transforming `slice_pairs` into a sequence of mutable slices first, then use all these slices in parallel. Subdividing a whole slice into multiple independent sub-slices (from the borrow-checker's point of view) can be done with [`slice::split_at_mut()`](https://doc.rust-lang.org/std/primitive.slice.html#method.split_at_mut). Of course, the indices in `slice_pairs` must be ordered and must not overlap, for these sub-slices to be correct. Note that I tried to use `.map().collect()`, instead of an explicit loop with `.push()`, in order to build the sequence of slices, but I failed... The compiler said that the `FnMut` closure in `.map()` could not return a reference; may be someone could fix my code... ```rust use rayon::prelude::*; fn main() { let mut data = vec![1, 2, 3, 4, 5, 6, 7, 8, 9, 10]; let slice_pairs = vec![(0, 3), (4, 7), (8, 10)]; // build a sequence of mutable slices let mut slices = Vec::with_capacity(slice_pairs.len()); let mut remaining = data.as_mut_slice(); let mut idx = 0; for (start, end) in slice_pairs { let (_skip, tail) = remaining.split_at_mut(start - idx); let (sl, tail) = tail.split_at_mut(end - start); remaining = tail; idx = end; slices.push(sl); } println!("slices: {:?}", slices); // parallel usage of the mutable slices slices.into_par_iter().for_each(|sl| { for elem in sl.iter_mut() { *elem *= 2; } }); println!("data: {:?}", data); } /* slices: [[1, 2, 3], [5, 6, 7], [9, 10]] data: [2, 4, 6, 4, 10, 12, 14, 8, 18, 20] */ ```
I'm developing a .NET 6 application that allows the user to configure the integration with an external LDAP, possibly using SSL. I'm trying to setup a container image to distribute the application but I'm having trouble with allowing the user to inject custom certificates inside the running container without using volumes and without root privileges. As of now I was able to achieve the expect result using volumes and root privileges: 1. The user needs to map a volume to the `/usr/local/share/ca-certificates` containing the certificates 2. before running the application the container runs `update-ca-certificates` Is it possible to allow the user to inject/provide custom certificates without using volumes (env vars maybe?) and removing root privileges in the container? I'm also open to solutions that may imply code development on the .NET application, but from my uderstanding the .NET LDAP implementation simply lets the underlying native library handle the certificate validation. [Source][1] [1]: https://github.com/dotnet/runtime/issues/63759#issuecomment-1074349308
Allow for injection of custom certificates inside rootless docker container with .NET application
|asp.net|linux|docker|ssl|
I don't think you need to do this in Pandas. You can create a class that tracks the current section and bumps it by 1, or appends a subsection, or truncates and increments, based on the paragraph type. Here is an example: ```python class SectionCreator: def __init__(self): self.section = [0] def __call__(self, paragraph_type: str): depth = int(paragraph_type.replace('Heading', '')) section = self.section[:depth] if depth == len(section) + 1: section.append(1) elif depth > len(section) + 1: raise ValueError(f'Heading depth increased from {len(section)} to {depth}') else: section[depth - 1] += 1 self.section = section return '.'.join(map(str, self.section)) ``` To use it, instantiate the object and pass in the paragraph types one at at time. ```python headings = ['Heading1', 'Heading2', 'Heading2', 'Heading2', 'Heading3', 'Heading3', 'Heading1', 'Heading2', 'Heading2', 'Heading2', 'Heading3', 'Heading3', 'Heading3', 'Heading1', 'Heading1', 'Heading2', 'Heading3', 'Heading2', 'Heading2', 'Heading2', 'Heading1', 'Heading2', 'Heading2', 'Heading2', 'Heading3', 'Heading3', 'Heading3', 'Heading3', 'Heading3', 'Heading2', 'Heading2', 'Heading1', 'Heading2', 'Heading3', 'Heading2', 'Heading2', 'Heading2', 'Heading2', 'Heading2', 'Heading3', 'Heading3', 'Heading3', 'Heading2', 'Heading2', 'Heading2', 'Heading3', 'Heading4', 'Heading4', 'Heading3'] sc = SectionCreator() for h in headings: print(sc(h)) ``` The printed output is: ``` 1 1.1 1.2 1.3 1.3.1 1.3.2 2 2.1 2.2 2.3 2.3.1 2.3.2 2.3.3 3 4 4.1 4.1.1 4.2 4.3 4.4 5 5.1 5.2 5.3 5.3.1 5.3.2 5.3.3 5.3.4 5.3.5 5.4 5.5 6 6.1 6.1.1 6.2 6.3 6.4 6.5 6.6 6.6.1 6.6.2 6.6.3 6.7 6.8 6.9 6.9.1 6.9.1.1 6.9.1.2 6.9.2 ``` I added a exception for the case where a paragraph type jumps up by more than 1 level of depth. So going from a 2 to a 4 will raise an exception. ``` sc = SectionCreator() sc('Heading1') # -> "1" sc('Heading2') # -> "1.1" sc('Heading4') # raises: ValueError: Heading depth increased from 2 to 4 ```
MongoDB is a NoSQL DB and by design you should only be querying a single row by ID, and all aggregations are meant to be separately. E.g. during write time. [$concat](https://www.mongodb.com/docs/manual/reference/operator/aggregation/concat/) will not really work for you since it aggregates values within a single row. I think in your case it's very simple to get all the results and then concatenate at the client side. E.g. JavaScript / NodeJS: ```javascript function concatKeys(input) { return (input || []).map(({key}) => key).join("|") } ```
It's a strange array structure, but based on your description this should work: const arr = [ Object.entries(jsonobject) .map(entry => entry.join(':')) .join(', ') ];
I am trying to convert a Jsonobj that i fetched using async/await into an array, i have been doing it like this: ``` const apiurl = 'https://api.wheretheiss.at/v1/satellites/25544'; async function getArray(){ var arr= []; const response = await fetch(apiurl); const jsonobject = await response.json(); for(var i in jsonobject){ arr.push(i, jsonobject[i]); } console.log(arr); } ``` I am trying to make an object inside an array for every marker that is saved on my json, right now the json contains one marker, with the coordinates of the ISS. The code gives me an array of length 26 looking like this: ['name','iss','lat','45'....], but i would like an array of length 1 looking like this: ['name:iss, Lat:45, Lng:32'], the array should contain 1 element for every marker that im saving in my json.
I recently had to change my SSD drive. I got my Flutter android apps from backup and now I've created new update for one of my apps, but when I tried to install this update, I got 'App not installed as package conflicts with an existing package' error. The fix is simple, just uninstall existing app and install new one, right? Unfortunately, this app holds a lot of data locally in app's folder and users would lose everything if they uninstall the app. I read that now my app has different signature, something like that. Is there any way to repair the signature of my app, so the phone would see the updated APK as the same app that is already installed and not as another app with the same name? I tried uninstalling the app and then installing the updated one and it worked of course, but I can't allow users to lose their data, so I need another solution without uninstalling the old version.
Flutter apk installation package conflict
|android|flutter|installation|apk|
null